Module: wine Branch: master Commit: a88f66d1556a9b721f818af7d5e0fdcc6a08f54d URL: https://source.winehq.org/git/wine.git/?a=commit;h=a88f66d1556a9b721f818af7d...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Thu Nov 29 12:06:13 2018 +0300
shcore: Add SHRegDuplicateHKey().
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/shcore/main.c | 12 ++++++++++++ dlls/shcore/shcore.spec | 2 +- dlls/shcore/tests/Makefile.in | 1 + dlls/shcore/tests/shcore.c | 20 ++++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c index 1228c9d..96ba7d7 100644 --- a/dlls/shcore/main.c +++ b/dlls/shcore/main.c @@ -1751,3 +1751,15 @@ DWORD WINAPI SHAnsiToUnicode(const char *src, WCHAR *dest, int dest_len)
return ret; } + +/************************************************************************* + * SHRegDuplicateHKey [SHCORE.@] + */ +HKEY WINAPI SHRegDuplicateHKey(HKEY hKey) +{ + HKEY newKey = 0; + + RegOpenKeyExW(hKey, 0, 0, MAXIMUM_ALLOWED, &newKey); + TRACE("new key is %p\n", newKey); + return newKey; +} diff --git a/dlls/shcore/shcore.spec b/dlls/shcore/shcore.spec index bd2bf12..c7a8744 100644 --- a/dlls/shcore/shcore.spec +++ b/dlls/shcore/shcore.spec @@ -61,7 +61,7 @@ @ stdcall SHQueryInfoKeyW(long ptr ptr ptr ptr) shlwapi.SHQueryInfoKeyW @ stdcall SHQueryValueExA(long str ptr ptr ptr ptr) shlwapi.SHQueryValueExA @ stdcall SHQueryValueExW(long wstr ptr ptr ptr ptr) shlwapi.SHQueryValueExW -@ stdcall SHRegDuplicateHKey(long) shlwapi.SHRegDuplicateHKey +@ stdcall SHRegDuplicateHKey(long) @ stdcall SHRegGetIntW(ptr wstr long) shlwapi.SHRegGetIntW @ stdcall SHRegGetPathA(long str str ptr long) shlwapi.SHRegGetPathA @ stdcall SHRegGetPathW(long wstr wstr ptr long) shlwapi.SHRegGetPathW diff --git a/dlls/shcore/tests/Makefile.in b/dlls/shcore/tests/Makefile.in index 0ea769a..4f537fa 100644 --- a/dlls/shcore/tests/Makefile.in +++ b/dlls/shcore/tests/Makefile.in @@ -1,4 +1,5 @@ TESTDLL = shcore.dll +IMPORTS = advapi32
C_SRCS = \ shcore.c diff --git a/dlls/shcore/tests/shcore.c b/dlls/shcore/tests/shcore.c index f788afd..0945e12 100644 --- a/dlls/shcore/tests/shcore.c +++ b/dlls/shcore/tests/shcore.c @@ -33,6 +33,7 @@ static int (WINAPI *pSHUnicodeToAnsi)(const WCHAR *, char *, int); static int (WINAPI *pSHAnsiToUnicode)(const char *, WCHAR *, int); static int (WINAPI *pSHAnsiToAnsi)(const char *, char *, int); static int (WINAPI *pSHUnicodeToUnicode)(const WCHAR *, WCHAR *, int); +static HKEY (WINAPI *pSHRegDuplicateHKey)(HKEY);
static void init(HMODULE hshcore) { @@ -43,6 +44,7 @@ static void init(HMODULE hshcore) X(SHAnsiToUnicode); X(SHAnsiToAnsi); X(SHUnicodeToUnicode); + X(SHRegDuplicateHKey); #undef X }
@@ -300,6 +302,23 @@ static void test_SHUnicodeToUnicode(void) ok(buff[5] == 'f', "Unexpected buffer contents.\n"); }
+static void test_SHRegDuplicateHKey(void) +{ + HKEY hkey, hkey2; + DWORD ret; + + ret = RegCreateKeyA(HKEY_CURRENT_USER, "Software\Wine\Test", &hkey); + ok(!ret, "Failed to create test key, ret %d.\n", ret); + + hkey2 = pSHRegDuplicateHKey(hkey); + ok(hkey2 != NULL && hkey2 != hkey, "Unexpected duplicate key.\n"); + + RegCloseKey(hkey2); + RegCloseKey(hkey); + + RegDeleteKeyA(HKEY_CURRENT_USER, "Software\Wine\Test"); +} + START_TEST(shcore) { HMODULE hshcore = LoadLibraryA("shcore.dll"); @@ -317,4 +336,5 @@ START_TEST(shcore) test_SHAnsiToUnicode(); test_SHAnsiToAnsi(); test_SHUnicodeToUnicode(); + test_SHRegDuplicateHKey(); }