Author: akhaldi
Date: Mon Nov 16 21:53:56 2015
New Revision: 69903
URL:
http://svn.reactos.org/svn/reactos?rev=69903&view=rev
Log:
[ADVAPI32_VISTA] Introduce this module to hold Vista+ exports that we need to provide.
CORE-10536
Added:
trunk/reactos/dll/win32/advapi32_vista/
trunk/reactos/dll/win32/advapi32_vista/CMakeLists.txt (with props)
trunk/reactos/dll/win32/advapi32_vista/DllMain.c (with props)
trunk/reactos/dll/win32/advapi32_vista/RegDeleteTree.c (with props)
trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.h (with props)
trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.spec (with props)
Modified:
trunk/reactos/dll/win32/CMakeLists.txt
Modified: trunk/reactos/dll/win32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/CMakeLists.txt?r…
==============================================================================
--- trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/CMakeLists.txt [iso-8859-1] Mon Nov 16 21:53:56 2015
@@ -4,6 +4,7 @@
add_subdirectory(activeds)
add_subdirectory(actxprxy)
add_subdirectory(advapi32)
+add_subdirectory(advapi32_vista)
add_subdirectory(advpack)
add_subdirectory(atl)
add_subdirectory(atl100)
Added: trunk/reactos/dll/win32/advapi32_vista/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32_vista/C…
==============================================================================
--- trunk/reactos/dll/win32/advapi32_vista/CMakeLists.txt (added)
+++ trunk/reactos/dll/win32/advapi32_vista/CMakeLists.txt [iso-8859-1] Mon Nov 16 21:53:56
2015
@@ -0,0 +1,17 @@
+
+remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
+add_definitions(-D_WIN32_WINNT=0x600 -DWINVER=0x600)
+
+add_definitions(-D_ADVAPI32_)
+spec2def(advapi32_vista.dll advapi32_vista.spec ADD_IMPORTLIB)
+
+list(APPEND SOURCE
+ DllMain.c
+ RegDeleteTree.c
+ ${CMAKE_CURRENT_BINARY_DIR}/advapi32_vista.def)
+
+add_library(advapi32_vista SHARED ${SOURCE})
+set_module_type(advapi32_vista win32dll ENTRYPOINT DllMain 12)
+add_importlibs(advapi32_vista advapi32 kernel32 ntdll)
+add_dependencies(advapi32_vista psdk)
+add_cd_file(TARGET advapi32_vista DESTINATION reactos/system32 FOR all)
Propchange: trunk/reactos/dll/win32/advapi32_vista/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/advapi32_vista/DllMain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32_vista/D…
==============================================================================
--- trunk/reactos/dll/win32/advapi32_vista/DllMain.c (added)
+++ trunk/reactos/dll/win32/advapi32_vista/DllMain.c [iso-8859-1] Mon Nov 16 21:53:56
2015
@@ -0,0 +1,14 @@
+
+#include "advapi32_vista.h"
+
+BOOL
+WINAPI
+DllMain(HANDLE hDll,
+ DWORD dwReason,
+ LPVOID lpReserved)
+{
+ /* For now, there isn't much to do */
+ if (dwReason == DLL_PROCESS_ATTACH)
+ DisableThreadLibraryCalls(hDll);
+ return TRUE;
+}
Propchange: trunk/reactos/dll/win32/advapi32_vista/DllMain.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/advapi32_vista/RegDeleteTree.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32_vista/R…
==============================================================================
--- trunk/reactos/dll/win32/advapi32_vista/RegDeleteTree.c (added)
+++ trunk/reactos/dll/win32/advapi32_vista/RegDeleteTree.c [iso-8859-1] Mon Nov 16
21:53:56 2015
@@ -0,0 +1,102 @@
+
+#include "advapi32_vista.h"
+
+/* heap allocation helpers */
+static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
+static inline void *heap_alloc( size_t len )
+{
+ return HeapAlloc( GetProcessHeap(), 0, len );
+}
+
+static inline BOOL heap_free( void *mem )
+{
+ return HeapFree( GetProcessHeap(), 0, mem );
+}
+
+/* Taken from Wine advapi32/registry.c */
+
+/******************************************************************************
+ * RegDeleteTreeW [ADVAPI32.@]
+ *
+ */
+LSTATUS WINAPI RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey)
+{
+ LONG ret;
+ DWORD dwMaxSubkeyLen, dwMaxValueLen;
+ DWORD dwMaxLen, dwSize;
+ WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf;
+ HKEY hSubKey = hKey;
+
+ if(lpszSubKey)
+ {
+ ret = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
+ if (ret) return ret;
+ }
+
+ /* Get highest length for keys, values */
+ ret = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL,
+ &dwMaxSubkeyLen, NULL, NULL, &dwMaxValueLen, NULL, NULL, NULL);
+ if (ret) goto cleanup;
+
+ dwMaxSubkeyLen++;
+ dwMaxValueLen++;
+ dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
+ if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
+ {
+ /* Name too big: alloc a buffer for it */
+ if (!(lpszName = heap_alloc( dwMaxLen*sizeof(WCHAR))))
+ {
+ ret = ERROR_NOT_ENOUGH_MEMORY;
+ goto cleanup;
+ }
+ }
+
+
+ /* Recursively delete all the subkeys */
+ while (TRUE)
+ {
+ dwSize = dwMaxLen;
+ if (RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL,
+ NULL, NULL, NULL)) break;
+
+ ret = RegDeleteTreeW(hSubKey, lpszName);
+ if (ret) goto cleanup;
+ }
+
+ if (lpszSubKey)
+ ret = RegDeleteKeyW(hKey, lpszSubKey);
+ else
+ while (TRUE)
+ {
+ dwSize = dwMaxLen;
+ if (RegEnumValueW(hKey, 0, lpszName, &dwSize,
+ NULL, NULL, NULL, NULL)) break;
+
+ ret = RegDeleteValueW(hKey, lpszName);
+ if (ret) goto cleanup;
+ }
+
+cleanup:
+ /* Free buffer if allocated */
+ if (lpszName != szNameBuf)
+ heap_free( lpszName);
+ if(lpszSubKey)
+ RegCloseKey(hSubKey);
+ return ret;
+}
+
+/******************************************************************************
+ * RegDeleteTreeA [ADVAPI32.@]
+ *
+ */
+LSTATUS WINAPI RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey)
+{
+ LONG ret;
+ UNICODE_STRING lpszSubKeyW;
+
+ if (lpszSubKey) RtlCreateUnicodeStringFromAsciiz( &lpszSubKeyW, lpszSubKey);
+ else lpszSubKeyW.Buffer = NULL;
+ ret = RegDeleteTreeW( hKey, lpszSubKeyW.Buffer);
+ RtlFreeUnicodeString( &lpszSubKeyW );
+ return ret;
+}
Propchange: trunk/reactos/dll/win32/advapi32_vista/RegDeleteTree.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32_vista/a…
==============================================================================
--- trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.h (added)
+++ trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.h [iso-8859-1] Mon Nov 16
21:53:56 2015
@@ -0,0 +1,12 @@
+
+#pragma once
+
+/* PSDK/NDK Headers */
+#define WIN32_NO_STATUS
+#include <windef.h>
+#include <winbase.h>
+#include <winreg.h>
+
+#include <ndk/rtlfuncs.h>
+
+/* EOF */
Propchange: trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32_vista/a…
==============================================================================
--- trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.spec (added)
+++ trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.spec [iso-8859-1] Mon Nov 16
21:53:56 2015
@@ -0,0 +1,3 @@
+
+@ stdcall RegDeleteTreeA(long str)
+@ stdcall RegDeleteTreeW(long wstr)
Propchange: trunk/reactos/dll/win32/advapi32_vista/advapi32_vista.spec
------------------------------------------------------------------------------
svn:eol-style = native