From 684fbf413be8f041481be40ecf07e24cc9cf10e3 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 12 May 2020 22:41:10 +0300 Subject: [PATCH] shlwapi: Forward SHSetValue() to shcore.dll. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- .../api-ms-win-downlevel-shlwapi-l2-1-0.spec | 2 +- dlls/shlwapi/reg.c | 73 ------------------- dlls/shlwapi/shlwapi.spec | 4 +- 3 files changed, 3 insertions(+), 76 deletions(-) diff --git a/dlls/api-ms-win-downlevel-shlwapi-l2-1-0/api-ms-win-downlevel-shlwapi-l2-1-0.spec b/dlls/api-ms-win-downlevel-shlwapi-l2-1-0/api-ms-win-downlevel-shlwapi-l2-1-0.spec index 21fbbb00ab9..11c33f8949c 100644 --- a/dlls/api-ms-win-downlevel-shlwapi-l2-1-0/api-ms-win-downlevel-shlwapi-l2-1-0.spec +++ b/dlls/api-ms-win-downlevel-shlwapi-l2-1-0/api-ms-win-downlevel-shlwapi-l2-1-0.spec @@ -49,7 +49,7 @@ @ stdcall SHRegSetPathW(long wstr wstr wstr long) shlwapi.SHRegSetPathW @ stdcall SHReleaseThreadRef() shlwapi.SHReleaseThreadRef @ stdcall SHSetThreadRef(ptr) shlwapi.SHSetThreadRef -@ stdcall SHSetValueA(long str str long ptr long) shlwapi.SHSetValueA +@ stdcall SHSetValueA(long str str long ptr long) shlwapi.SHSetValueA @ stdcall SHSetValueW(long wstr wstr long ptr long) shlwapi.SHSetValueW @ stdcall SHStrDupW(wstr ptr) shlwapi.SHStrDupW @ stdcall SHUnicodeToAnsi(wstr ptr ptr) shlwapi.SHUnicodeToAnsi diff --git a/dlls/shlwapi/reg.c b/dlls/shlwapi/reg.c index 0c982384b36..78188e8fcb8 100644 --- a/dlls/shlwapi/reg.c +++ b/dlls/shlwapi/reg.c @@ -47,79 +47,6 @@ static const WCHAR szExtensionW[] = { 'E', 'x', 't','e','n','s','i','o','n','\0' INT WINAPI SHStringFromGUIDW(REFGUID,LPWSTR,INT); HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID,LPCWSTR,BOOL,BOOL,PHKEY); -/************************************************************************* - * SHSetValueA [SHLWAPI.@] - * - * Set a value in the registry. - * - * PARAMS - * hKey [I] Handle to registry key - * lpszSubKey [I] Name of sub key under hKey - * lpszValue [I] Name of value to set - * dwType [I] Type of the value - * pvData [I] Data of the value - * cbData [I] Size of the value - * - * RETURNS - * Success: ERROR_SUCCESS. The value is set with the data given. - * Failure: An error code from RegCreateKeyExA() or RegSetValueExA() - * - * NOTES - * If lpszSubKey does not exist, it is created before the value is set. If - * lpszSubKey is NULL or an empty string, then the value is added directly - * to hKey instead. - */ -DWORD WINAPI SHSetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, - DWORD dwType, LPCVOID pvData, DWORD cbData) -{ - DWORD dwRet = ERROR_SUCCESS, dwDummy; - HKEY hSubKey; - - TRACE("(hkey=%p,%s,%s,%d,%p,%d)\n", hKey, debugstr_a(lpszSubKey), - debugstr_a(lpszValue), dwType, pvData, cbData); - - if (lpszSubKey && *lpszSubKey) - dwRet = RegCreateKeyExA(hKey, lpszSubKey, 0, NULL, - 0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy); - else - hSubKey = hKey; - if (!dwRet) - { - dwRet = RegSetValueExA(hSubKey, lpszValue, 0, dwType, pvData, cbData); - if (hSubKey != hKey) - RegCloseKey(hSubKey); - } - return dwRet; -} - -/************************************************************************* - * SHSetValueW [SHLWAPI.@] - * - * See SHSetValueA. - */ -DWORD WINAPI SHSetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, - DWORD dwType, LPCVOID pvData, DWORD cbData) -{ - DWORD dwRet = ERROR_SUCCESS, dwDummy; - HKEY hSubKey; - - TRACE("(hkey=%p,%s,%s,%d,%p,%d)\n", hKey, debugstr_w(lpszSubKey), - debugstr_w(lpszValue), dwType, pvData, cbData); - - if (lpszSubKey && *lpszSubKey) - dwRet = RegCreateKeyExW(hKey, lpszSubKey, 0, NULL, - 0, KEY_SET_VALUE, NULL, &hSubKey, &dwDummy); - else - hSubKey = hKey; - if (!dwRet) - { - dwRet = RegSetValueExW(hSubKey, lpszValue, 0, dwType, pvData, cbData); - if (hSubKey != hKey) - RegCloseKey(hSubKey); - } - return dwRet; -} - /************************************************************************* * SHQueryValueExA [SHLWAPI.@] * diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index de25ed58c11..ed7810c676a 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -748,8 +748,8 @@ @ stdcall SHRegisterValidateTemplate(wstr long) @ stdcall SHReleaseThreadRef() shcore.SHReleaseThreadRef @ stdcall SHSetThreadRef(ptr) shcore.SHSetThreadRef -@ stdcall SHSetValueA (long str str long ptr long) -@ stdcall SHSetValueW (long wstr wstr long ptr long) +@ stdcall -import SHSetValueA(long str str long ptr long) +@ stdcall -import SHSetValueW(long wstr wstr long ptr long) @ stdcall SHSkipJunction(ptr ptr) @ stdcall SHStrDupA (str ptr) @ stdcall SHStrDupW (wstr ptr)