Module: wine Branch: master Commit: 5f42d67dc5453a47e0c62fc43d7120e8ed9b0db7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=5f42d67dc5453a47e0c62fc43...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Dec 4 08:02:49 2018 +0300
shlwapi: Forward SHDeleteKey() to shcore.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/shlwapi/reg.c | 77 ----------------------------------------------- dlls/shlwapi/shlwapi.spec | 4 +-- 2 files changed, 2 insertions(+), 79 deletions(-)
diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c index 370161d..5faad4a 100644 --- a/dlls/shlwapi/reg.c +++ b/dlls/shlwapi/reg.c @@ -1514,83 +1514,6 @@ DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue, }
/************************************************************************* - * SHDeleteKeyA [SHLWAPI.@] - * - * Delete a registry key and any sub keys/values present - * - * This function forwards to the unicode version directly, to avoid - * handling subkeys that are not representable in ASCII. - * - * PARAMS - * hKey [I] Handle to registry key - * lpszSubKey [I] Name of sub key to delete - * - * RETURNS - * Success: ERROR_SUCCESS. The key is deleted. - * Failure: An error code from RegOpenKeyExA(), RegQueryInfoKeyA(), - * RegEnumKeyExA() or RegDeleteKeyA(). - */ -DWORD WINAPI SHDeleteKeyA(HKEY hKey, LPCSTR lpszSubKey) -{ - WCHAR subkeyW[MAX_PATH]; - - MultiByteToWideChar (CP_ACP, 0, lpszSubKey, -1, subkeyW, ARRAY_SIZE(subkeyW)); - return SHDeleteKeyW(hKey, subkeyW); -} - -/************************************************************************* - * SHDeleteKeyW [SHLWAPI.@] - * - * See SHDeleteKeyA. - */ -DWORD WINAPI SHDeleteKeyW(HKEY hKey, LPCWSTR lpszSubKey) -{ - DWORD dwRet, dwMaxSubkeyLen = 0, dwSize; - WCHAR szNameBuf[MAX_PATH], *lpszName = szNameBuf; - HKEY hSubKey = 0; - - TRACE("(hkey=%p,%s)\n", hKey, debugstr_w(lpszSubKey)); - - dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_READ, &hSubKey); - if(!dwRet) - { - /* Find the maximum subkey length so that we can allocate a buffer */ - dwRet = RegQueryInfoKeyW(hSubKey, NULL, NULL, NULL, NULL, - &dwMaxSubkeyLen, NULL, NULL, NULL, NULL, NULL, NULL); - if(!dwRet) - { - dwMaxSubkeyLen++; - if (dwMaxSubkeyLen > ARRAY_SIZE(szNameBuf)) - /* Name too big: alloc a buffer for it */ - lpszName = HeapAlloc(GetProcessHeap(), 0, dwMaxSubkeyLen*sizeof(WCHAR)); - - if(!lpszName) - dwRet = ERROR_NOT_ENOUGH_MEMORY; - else - { - while (dwRet == ERROR_SUCCESS) - { - dwSize = dwMaxSubkeyLen; - dwRet = RegEnumKeyExW(hSubKey, 0, lpszName, &dwSize, NULL, NULL, NULL, NULL); - if (dwRet == ERROR_SUCCESS || dwRet == ERROR_MORE_DATA) - dwRet = SHDeleteKeyW(hSubKey, lpszName); - } - if (dwRet == ERROR_NO_MORE_ITEMS) - dwRet = ERROR_SUCCESS; - - if (lpszName != szNameBuf) - HeapFree(GetProcessHeap(), 0, lpszName); /* Free buffer if allocated */ - } - } - - RegCloseKey(hSubKey); - if(!dwRet) - dwRet = RegDeleteKeyW(hKey, lpszSubKey); - } - return dwRet; -} - -/************************************************************************* * SHDeleteOrphanKeyA [SHLWAPI.@] * * Delete a registry key with no sub keys or values. diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index a51088d..f8ffd36 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -690,8 +690,8 @@ @ stdcall SHCreateThreadRef(ptr ptr) shcore.SHCreateThreadRef @ stdcall SHDeleteEmptyKeyA(long str) shcore.SHDeleteEmptyKeyA @ stdcall SHDeleteEmptyKeyW(long wstr) shcore.SHDeleteEmptyKeyW -@ stdcall SHDeleteKeyA(long str) -@ stdcall SHDeleteKeyW(long wstr) +@ stdcall SHDeleteKeyA(long str) shcore.SHDeleteKeyA +@ stdcall SHDeleteKeyW(long wstr) shcore.SHDeleteKeyW @ stdcall SHDeleteOrphanKeyA(long str) @ stdcall SHDeleteOrphanKeyW(long wstr) @ stdcall SHDeleteValueA(long str str)