[PATCH 1/5] shlwapi: Forward SHDeleteEmptyKey() to shcore.

Nikolay Sivov nsivov at codeweavers.com
Mon Dec 3 23:02:48 CST 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/shcore/shcore.spec   |  4 +--
 dlls/shlwapi/reg.c        | 68 ---------------------------------------
 dlls/shlwapi/shlwapi.spec |  4 +--
 3 files changed, 4 insertions(+), 72 deletions(-)

diff --git a/dlls/shcore/shcore.spec b/dlls/shcore/shcore.spec
index 6ad1297989..4c2717948d 100644
--- a/dlls/shcore/shcore.spec
+++ b/dlls/shcore/shcore.spec
@@ -40,8 +40,8 @@
 @ stdcall SHCreateThread(ptr ptr long ptr)
 @ stdcall SHCreateThreadRef(ptr ptr)
 @ stub SHCreateThreadWithHandle
-@ stdcall SHDeleteEmptyKeyA(long ptr)
-@ stdcall SHDeleteEmptyKeyW(long ptr)
+@ stdcall SHDeleteEmptyKeyA(long str)
+@ stdcall SHDeleteEmptyKeyW(long wstr)
 @ stdcall SHDeleteKeyA(long str)
 @ stdcall SHDeleteKeyW(long wstr)
 @ stdcall SHDeleteValueA(long str str)
diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c
index 163351995c..370161df12 100644
--- a/dlls/shlwapi/reg.c
+++ b/dlls/shlwapi/reg.c
@@ -1590,74 +1590,6 @@ DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey)
   return dwRet;
 }
 
-/*************************************************************************
- * SHDeleteEmptyKeyA   [SHLWAPI.@]
- *
- * Delete a registry key with no sub keys.
- *
- * PARAMS
- *   hKey       [I] Handle to registry key
- *   lpszSubKey [I] Name of sub key to delete
- *
- * RETURNS
- *   Success: ERROR_SUCCESS. The key is deleted.
- *   Failure: If the key is not empty, returns ERROR_KEY_HAS_CHILDREN. Otherwise
- *            returns an error code from RegOpenKeyExA(), RegQueryInfoKeyA() or
- *            RegDeleteKeyA().
- */
-DWORD WINAPI SHDeleteEmptyKeyA(HKEY hKey, LPCSTR lpszSubKey)
-{
-  DWORD dwRet, dwKeyCount = 0;
-  HKEY hSubKey = 0;
-
-  TRACE("(hkey=%p,%s)\n", hKey, debugstr_a(lpszSubKey));
-
-  dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
-  if(!dwRet)
-  {
-    dwRet = RegQueryInfoKeyA(hSubKey, NULL, NULL, NULL, &dwKeyCount,
-                             NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-    RegCloseKey(hSubKey);
-    if(!dwRet)
-    {
-      if (!dwKeyCount)
-        dwRet = RegDeleteKeyA(hKey, lpszSubKey);
-      else
-        dwRet = ERROR_KEY_HAS_CHILDREN;
-    }
-  }
-  return dwRet;
-}
-
-/*************************************************************************
- * SHDeleteEmptyKeyW   [SHLWAPI.@]
- *
- * See SHDeleteEmptyKeyA.
- */
-DWORD WINAPI SHDeleteEmptyKeyW(HKEY hKey, LPCWSTR lpszSubKey)
-{
-  DWORD dwRet, dwKeyCount = 0;
-  HKEY hSubKey = 0;
-
-  TRACE("(hkey=%p, %s)\n", hKey, debugstr_w(lpszSubKey));
-
-  dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey);
-  if(!dwRet)
-  {
-    dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, &dwKeyCount,
-                             NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-    RegCloseKey(hSubKey);
-    if(!dwRet)
-    {
-      if (!dwKeyCount)
-        dwRet = RegDeleteKeyW(hKey, lpszSubKey);
-      else
-        dwRet = ERROR_KEY_HAS_CHILDREN;
-    }
-  }
-  return dwRet;
-}
-
 /*************************************************************************
  * SHDeleteOrphanKeyA   [SHLWAPI.@]
  *
diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec
index 30c34cb988..a51088dba8 100644
--- a/dlls/shlwapi/shlwapi.spec
+++ b/dlls/shlwapi/shlwapi.spec
@@ -688,8 +688,8 @@
 @ stdcall SHCreateStreamOnFileW(wstr long ptr) shcore.SHCreateStreamOnFileW
 @ stdcall SHCreateStreamWrapper(ptr ptr long ptr)
 @ stdcall SHCreateThreadRef(ptr ptr) shcore.SHCreateThreadRef
-@ stdcall SHDeleteEmptyKeyA(long ptr)
-@ stdcall SHDeleteEmptyKeyW(long ptr)
+@ stdcall SHDeleteEmptyKeyA(long str) shcore.SHDeleteEmptyKeyA
+@ stdcall SHDeleteEmptyKeyW(long wstr) shcore.SHDeleteEmptyKeyW
 @ stdcall SHDeleteKeyA(long str)
 @ stdcall SHDeleteKeyW(long wstr)
 @ stdcall SHDeleteOrphanKeyA(long str)
-- 
2.19.2




More information about the wine-devel mailing list