shcore: Add SHRegDuplicateHKey().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-11-29 12:06:13 +03:00 committed by Alexandre Julliard
parent d7a4556111
commit a88f66d155
4 changed files with 34 additions and 1 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -1,4 +1,5 @@
TESTDLL = shcore.dll
IMPORTS = advapi32
C_SRCS = \
shcore.c

View File

@ -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();
}