shlwapi: Invoke RegGetValue on SHRegGetValue call.
This commit is contained in:
parent
dfe535226a
commit
17736b90e7
|
@ -1137,68 +1137,6 @@ DWORD WINAPI SHGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue,
|
|||
return dwRet;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHRegGetValueA [SHLWAPI.@]
|
||||
*
|
||||
* Get a value from the registry.
|
||||
*
|
||||
* PARAMS
|
||||
* hKey [I] Handle to registry key
|
||||
* lpszSubKey [I] Name of sub key containing value to get
|
||||
* lpszValue [I] Name of value to get
|
||||
* srrf [I] Flags for restricting returned data
|
||||
* pwType [O] Pointer to the values type
|
||||
* pvData [O] Pointer to the values data
|
||||
* pcbData [O] Pointer to the values size
|
||||
*
|
||||
* RETURNS
|
||||
* Success: ERROR_SUCCESS. Output parameters contain the details read.
|
||||
* Failure: An error code from RegOpenKeyExA() or SHQueryValueExA().
|
||||
*/
|
||||
LSTATUS WINAPI SHRegGetValueA(HKEY hKey, LPCSTR lpszSubKey, LPCSTR lpszValue, SRRF srrfFlags,
|
||||
LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
|
||||
{
|
||||
DWORD dwRet = 0;
|
||||
HKEY hSubKey = 0;
|
||||
|
||||
TRACE("(hkey=%p,%s,%s,%p,%p,%p)\n", hKey, debugstr_a(lpszSubKey),
|
||||
debugstr_a(lpszValue), pwType, pvData, pcbData);
|
||||
FIXME("Semi-Stub: Find meaning and implement handling of SRFF Flags 0x%08x\n", srrfFlags);
|
||||
|
||||
dwRet = RegOpenKeyExA(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
|
||||
if (! dwRet)
|
||||
{
|
||||
/* SHQueryValueEx expands Environment strings */
|
||||
dwRet = SHQueryValueExA(hSubKey, lpszValue, 0, pwType, pvData, pcbData);
|
||||
RegCloseKey(hSubKey);
|
||||
}
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHReg GetRegValueW [SHLWAPI.@]
|
||||
*
|
||||
* See SHGetValueA.
|
||||
*/
|
||||
LSTATUS WINAPI SHRegGetValueW(HKEY hKey, LPCWSTR lpszSubKey, LPCWSTR lpszValue, SRRF srrfFlags,
|
||||
LPDWORD pwType, LPVOID pvData, LPDWORD pcbData)
|
||||
{
|
||||
DWORD dwRet = 0;
|
||||
HKEY hSubKey = 0;
|
||||
|
||||
TRACE("(hkey=%p,%s,%s,0x%08x, %p,%p,%p)\n", hKey, debugstr_w(lpszSubKey),
|
||||
debugstr_w(lpszValue), srrfFlags,pwType, pvData, pcbData);
|
||||
FIXME("Semi-Stub: Find meaning and implement handling of SRFF Flags 0x%08x\n", srrfFlags);
|
||||
|
||||
dwRet = RegOpenKeyExW(hKey, lpszSubKey, 0, KEY_QUERY_VALUE, &hSubKey);
|
||||
if (! dwRet)
|
||||
{
|
||||
dwRet = SHQueryValueExW(hSubKey, lpszValue, 0, pwType, pvData, pcbData);
|
||||
RegCloseKey(hSubKey);
|
||||
}
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHGetValueW [SHLWAPI.@]
|
||||
*
|
||||
|
|
|
@ -725,8 +725,8 @@
|
|||
@ stdcall SHRegGetPathW(long wstr wstr ptr long)
|
||||
@ stdcall SHRegGetUSValueA ( str str ptr ptr ptr long ptr long )
|
||||
@ stdcall SHRegGetUSValueW ( wstr wstr ptr ptr ptr long ptr long )
|
||||
@ stdcall SHRegGetValueA ( long str str long ptr ptr ptr )
|
||||
@ stdcall SHRegGetValueW ( long wstr wstr long ptr ptr ptr )
|
||||
@ stdcall SHRegGetValueA ( long str str long ptr ptr ptr ) advapi32.RegGetValueA
|
||||
@ stdcall SHRegGetValueW ( long wstr wstr long ptr ptr ptr ) advapi32.RegGetValueW
|
||||
@ stdcall SHRegOpenUSKeyA ( str long long long long )
|
||||
@ stdcall SHRegOpenUSKeyW ( wstr long long long long )
|
||||
@ stdcall SHRegQueryInfoUSKeyA ( long ptr ptr ptr ptr long )
|
||||
|
|
|
@ -38,6 +38,8 @@ typedef DWORD (WINAPI *SHCopyKeyA_func)(HKEY,LPCSTR,HKEY,DWORD);
|
|||
static SHCopyKeyA_func pSHCopyKeyA;
|
||||
typedef DWORD (WINAPI *SHRegGetPathA_func)(HKEY,LPCSTR,LPCSTR,LPSTR,DWORD);
|
||||
static SHRegGetPathA_func pSHRegGetPathA;
|
||||
typedef LSTATUS (WINAPI *SHRegGetValueA_func)(HKEY,LPCSTR,LPCSTR,SRRF,LPDWORD,LPVOID,LPDWORD);
|
||||
static SHRegGetValueA_func pSHRegGetValueA;
|
||||
|
||||
static char sTestpath1[] = "%LONGSYSTEMVAR%\\subdir1";
|
||||
static char sTestpath2[] = "%FOO%\\subdir1";
|
||||
|
@ -138,6 +140,44 @@ static void test_SHGetValue(void)
|
|||
ok( REG_SZ == dwType , "Expected REG_SZ, got (%u)\n", dwType);
|
||||
}
|
||||
|
||||
static void test_SHRegGetValue(void)
|
||||
{
|
||||
LSTATUS ret;
|
||||
DWORD size, type;
|
||||
char data[MAX_PATH];
|
||||
|
||||
if(!pSHRegGetValueA)
|
||||
return;
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_EXPAND_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(!strcmp(data, sExpTestpath1), "data = %s, expected %s\n", data, sExpTestpath1);
|
||||
ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_DWORD, &type, data, &size);
|
||||
ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_EXPAND_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_SZ, &type, data, &size);
|
||||
ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
ok(!strcmp(data, sTestpath1), "data = %s, expected %s\n", data, sTestpath1);
|
||||
ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type);
|
||||
|
||||
size = MAX_PATH;
|
||||
ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_QWORD, &type, data, &size);
|
||||
ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret);
|
||||
}
|
||||
|
||||
static void test_SHGetRegPath(void)
|
||||
{
|
||||
char buf[MAX_PATH];
|
||||
|
@ -414,7 +454,9 @@ START_TEST(shreg)
|
|||
hshlwapi = GetModuleHandleA("shlwapi.dll");
|
||||
pSHCopyKeyA=(SHCopyKeyA_func)GetProcAddress(hshlwapi,"SHCopyKeyA");
|
||||
pSHRegGetPathA=(SHRegGetPathA_func)GetProcAddress(hshlwapi,"SHRegGetPathA");
|
||||
pSHRegGetValueA=(SHRegGetValueA_func)GetProcAddress(hshlwapi,"SHRegGetValueA");
|
||||
test_SHGetValue();
|
||||
test_SHRegGetValue();
|
||||
test_SHQUeryValueEx();
|
||||
test_SHGetRegPath();
|
||||
test_SHCopyKey();
|
||||
|
|
Loading…
Reference in New Issue