Commit 191bc054 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shlwapi: Partially implement SHRegCreateUSKeyW.

parent ff9ae10b
...@@ -235,12 +235,49 @@ LONG WINAPI SHRegCreateUSKeyA(LPCSTR pszPath, REGSAM samDesired, HUSKEY hRelativ ...@@ -235,12 +235,49 @@ LONG WINAPI SHRegCreateUSKeyA(LPCSTR pszPath, REGSAM samDesired, HUSKEY hRelativ
* *
* See SHRegCreateUSKeyA. * See SHRegCreateUSKeyA.
*/ */
LONG WINAPI SHRegCreateUSKeyW(LPCWSTR pszPath, REGSAM samDesired, HUSKEY hRelativeUSKey, LONG WINAPI SHRegCreateUSKeyW(LPCWSTR path, REGSAM samDesired, HUSKEY relative_key,
PHUSKEY phNewUSKey, DWORD dwFlags) PHUSKEY new_uskey, DWORD flags)
{ {
FIXME("(%s, 0x%08x, %p, %p, 0x%08x) stub\n", debugstr_w(pszPath), samDesired, LONG ret = ERROR_CALL_NOT_IMPLEMENTED;
hRelativeUSKey, phNewUSKey, dwFlags); SHUSKEY *ret_key;
return ERROR_SUCCESS;
TRACE("(%s, 0x%08x, %p, %p, 0x%08x)\n", debugstr_w(path), samDesired,
relative_key, new_uskey, flags);
if (!new_uskey) return ERROR_INVALID_PARAMETER;
*new_uskey = NULL;
if (flags & ~SHREGSET_FORCE_HKCU)
{
FIXME("unsupported flags 0x%08x\n", flags);
return ERROR_SUCCESS;
}
ret_key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ret_key));
lstrcpynW(ret_key->lpszPath, path, sizeof(ret_key->lpszPath)/sizeof(WCHAR));
if (relative_key)
{
ret_key->HKCUstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(relative_key, REG_HKCU));
ret_key->HKLMstart = SHRegDuplicateHKey(REG_GetHKEYFromHUSKEY(relative_key, REG_HKLM));
}
else
{
ret_key->HKCUstart = HKEY_CURRENT_USER;
ret_key->HKLMstart = HKEY_LOCAL_MACHINE;
}
if (flags & SHREGSET_FORCE_HKCU)
{
ret = RegCreateKeyExW(ret_key->HKCUstart, path, 0, NULL, 0, samDesired, NULL, &ret_key->HKCUkey, NULL);
if (ret == ERROR_SUCCESS)
*new_uskey = ret_key;
else
HeapFree(GetProcessHeap(), 0, ret_key);
}
return ret;
} }
/************************************************************************* /*************************************************************************
......
...@@ -33,12 +33,11 @@ ...@@ -33,12 +33,11 @@
#define REG_CURRENT_VERSION "Software\\Microsoft\\Windows\\CurrentVersion\\explorer" #define REG_CURRENT_VERSION "Software\\Microsoft\\Windows\\CurrentVersion\\explorer"
static HMODULE hshlwapi; static HMODULE hshlwapi;
typedef DWORD (WINAPI *SHCopyKeyA_func)(HKEY,LPCSTR,HKEY,DWORD);
static SHCopyKeyA_func pSHCopyKeyA; static DWORD (WINAPI *pSHCopyKeyA)(HKEY,LPCSTR,HKEY,DWORD);
typedef DWORD (WINAPI *SHRegGetPathA_func)(HKEY,LPCSTR,LPCSTR,LPSTR,DWORD); static DWORD (WINAPI *pSHRegGetPathA)(HKEY,LPCSTR,LPCSTR,LPSTR,DWORD);
static SHRegGetPathA_func pSHRegGetPathA; static LSTATUS (WINAPI *pSHRegGetValueA)(HKEY,LPCSTR,LPCSTR,SRRF,LPDWORD,LPVOID,LPDWORD);
typedef LSTATUS (WINAPI *SHRegGetValueA_func)(HKEY,LPCSTR,LPCSTR,SRRF,LPDWORD,LPVOID,LPDWORD); static LSTATUS (WINAPI *pSHRegCreateUSKeyW)(LPCWSTR,REGSAM,HUSKEY,PHUSKEY,DWORD);
static SHRegGetValueA_func pSHRegGetValueA;
static char sTestpath1[] = "%LONGSYSTEMVAR%\\subdir1"; static char sTestpath1[] = "%LONGSYSTEMVAR%\\subdir1";
static char sTestpath2[] = "%FOO%\\subdir1"; static char sTestpath2[] = "%FOO%\\subdir1";
...@@ -444,28 +443,47 @@ static void test_SHDeleteKey(void) ...@@ -444,28 +443,47 @@ static void test_SHDeleteKey(void)
ok( 0, "Could not set up SHDeleteKey test\n"); ok( 0, "Could not set up SHDeleteKey test\n");
} }
static void test_SHRegCreateUSKeyW(void)
{
static const WCHAR subkeyW[] = {'s','u','b','k','e','y',0};
LONG ret;
if (!pSHRegCreateUSKeyW)
{
win_skip("SHRegCreateUSKeyW not available\n");
return;
}
ret = pSHRegCreateUSKeyW(subkeyW, KEY_ALL_ACCESS, NULL, NULL, SHREGSET_FORCE_HKCU);
ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
}
START_TEST(shreg) START_TEST(shreg)
{ {
HKEY hkey = create_test_entries(); HKEY hkey = create_test_entries();
if (!hkey) return; if (!hkey) return;
hshlwapi = GetModuleHandleA("shlwapi.dll"); hshlwapi = GetModuleHandleA("shlwapi.dll");
/* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */ /* SHCreateStreamOnFileEx was introduced in shlwapi v6.0 */
if(!GetProcAddress(hshlwapi, "SHCreateStreamOnFileEx")){ if(!GetProcAddress(hshlwapi, "SHCreateStreamOnFileEx")){
win_skip("Too old shlwapi version\n"); win_skip("Too old shlwapi version\n");
return; return;
} }
pSHCopyKeyA = (void*)GetProcAddress(hshlwapi,"SHCopyKeyA");
pSHRegGetPathA = (void*)GetProcAddress(hshlwapi,"SHRegGetPathA");
pSHRegGetValueA = (void*)GetProcAddress(hshlwapi,"SHRegGetValueA");
pSHRegCreateUSKeyW = (void*)GetProcAddress(hshlwapi, "SHRegCreateUSKeyW");
test_SHGetValue();
test_SHRegGetValue();
test_SHQueryValueEx();
test_SHGetRegPath();
test_SHCopyKey();
test_SHDeleteKey();
test_SHRegCreateUSKeyW();
pSHCopyKeyA=(SHCopyKeyA_func)GetProcAddress(hshlwapi,"SHCopyKeyA"); delete_key( hkey, "Software\\Wine", "Test" );
pSHRegGetPathA=(SHRegGetPathA_func)GetProcAddress(hshlwapi,"SHRegGetPathA");
pSHRegGetValueA=(SHRegGetValueA_func)GetProcAddress(hshlwapi,"SHRegGetValueA");
test_SHGetValue();
test_SHRegGetValue();
test_SHQueryValueEx();
test_SHGetRegPath();
test_SHCopyKey();
test_SHDeleteKey();
delete_key( hkey, "Software\\Wine", "Test" );
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment