shlwapi/tests: Fix some test failures on Vista.

This commit is contained in:
Paul Vriens 2008-12-17 10:46:49 +01:00 committed by Alexandre Julliard
parent 579b8649a1
commit 05988f4fbc
1 changed files with 12 additions and 9 deletions

View File

@ -31,7 +31,7 @@
/* Keys used for testing */ /* Keys used for testing */
#define REG_TEST_KEY "Software\\Wine\\Test" #define REG_TEST_KEY "Software\\Wine\\Test"
#define REG_CURRENT_VERSION "Software\\Microsoft\\Windows\\CurrentVersion" #define REG_CURRENT_VERSION "Software\\Microsoft\\Windows\\CurrentVersion\\explorer"
static HMODULE hshlwapi; static HMODULE hshlwapi;
typedef DWORD (WINAPI *SHCopyKeyA_func)(HKEY,LPCSTR,HKEY,DWORD); typedef DWORD (WINAPI *SHCopyKeyA_func)(HKEY,LPCSTR,HKEY,DWORD);
@ -284,6 +284,12 @@ static void test_SHCopyKey(void)
HKEY hKeySrc, hKeyDst; HKEY hKeySrc, hKeyDst;
DWORD dwRet; DWORD dwRet;
if (!pSHCopyKeyA)
{
win_skip("SHCopyKeyA is not available\n");
return;
}
/* Delete existing destination sub keys */ /* Delete existing destination sub keys */
hKeyDst = NULL; hKeyDst = NULL;
if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst) && hKeyDst) if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst) && hKeyDst)
@ -305,22 +311,19 @@ static void test_SHCopyKey(void)
if (dwRet || !hKeySrc) if (dwRet || !hKeySrc)
{ {
ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet); ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet);
RegCloseKey(hKeyDst);
return; return;
} }
dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
if (pSHCopyKeyA) ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet);
{
dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet);
}
RegCloseKey(hKeySrc); RegCloseKey(hKeySrc);
RegCloseKey(hKeyDst); RegCloseKey(hKeyDst);
/* Check we copied the sub keys, i.e. something that's on every windows system (including Wine) */ /* Check we copied the sub keys, i.e. something that's on every windows system (including Wine) */
hKeyDst = NULL; hKeyDst = NULL;
dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Setup", &hKeyDst); dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Shell Folders", &hKeyDst);
if (dwRet || !hKeyDst) if (dwRet || !hKeyDst)
{ {
ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet); ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet);
@ -328,7 +331,7 @@ static void test_SHCopyKey(void)
} }
/* And the we copied the values too */ /* And the we copied the values too */
ok(!SHQueryValueExA(hKeyDst, "BootDir", NULL, NULL, NULL, NULL), "SHQueryValueExA failed\n"); ok(!SHQueryValueExA(hKeyDst, "Common AppData", NULL, NULL, NULL, NULL), "SHQueryValueExA failed\n");
RegCloseKey(hKeyDst); RegCloseKey(hKeyDst);
} }