More verbosity of errors.

This commit is contained in:
Paul Vriens 2005-02-03 19:38:58 +00:00 committed by Alexandre Julliard
parent bbc081e834
commit 89330709b7
1 changed files with 32 additions and 15 deletions

View File

@ -94,7 +94,10 @@ static HKEY create_test_entries(void)
sExpLen2 = ExpandEnvironmentStringsA(sTestpath2, sExpTestpath2, sizeof(sExpTestpath2)); sExpLen2 = ExpandEnvironmentStringsA(sTestpath2, sExpTestpath2, sizeof(sExpTestpath2));
ok(sExpLen1 > 0, "Couldn't expand %s\n", sTestpath1); ok(sExpLen1 > 0, "Couldn't expand %s\n", sTestpath1);
trace("sExplen1 = (%d)\n", sExpLen1);
ok(sExpLen2 > 0, "Couldn't expand %s\n", sTestpath2); ok(sExpLen2 > 0, "Couldn't expand %s\n", sTestpath2);
trace("sExplen2 = (%d)\n", sExpLen2);
return hKey; return hKey;
} }
@ -268,6 +271,7 @@ static void test_SHQUeryValueEx(void)
static void test_SHCopyKey(void) static void test_SHCopyKey(void)
{ {
HKEY hKeySrc, hKeyDst; HKEY hKeySrc, hKeyDst;
DWORD dwRet;
/* Delete existing destination sub keys */ /* Delete existing destination sub keys */
hKeyDst = NULL; hKeyDst = NULL;
@ -278,31 +282,37 @@ static void test_SHCopyKey(void)
} }
hKeyDst = NULL; hKeyDst = NULL;
if (RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst) || !hKeyDst) dwRet = RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst);
if (dwRet || !hKeyDst)
{ {
ok(0, "didn't open dest\n"); ok( 0, "Destination couldn't be created, RegCreateKeyA returned (%lu)\n", dwRet);
return; return;
} }
hKeySrc = NULL; hKeySrc = NULL;
if (RegOpenKeyA(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, &hKeySrc) || !hKeySrc) dwRet = RegOpenKeyA(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, &hKeySrc);
if (dwRet || !hKeySrc)
{ {
ok(0, "didn't open source\n"); ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%lu)\n", dwRet);
return; return;
} }
if (pSHCopyKeyA) if (pSHCopyKeyA)
ok (!(*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0), "failed copy\n"); {
dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0);
ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%lu)\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;
if (RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Setup", &hKeyDst) || !hKeyDst) dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Setup", &hKeyDst);
if (dwRet || !hKeyDst)
{ {
ok(0, "didn't open copy\n"); ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%lu)\n", dwRet);
return; return;
} }
@ -314,17 +324,20 @@ static void test_SHCopyKey(void)
static void test_SHDeleteKey() static void test_SHDeleteKey()
{ {
HKEY hKeyTest; HKEY hKeyTest, hKeyS;
int sysfail=1; DWORD dwRet;
int sysfail = 1;
if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY, &hKeyTest)) if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY, &hKeyTest))
{ {
HKEY hKeyS;
if (!RegCreateKey(hKeyTest, "ODBC", &hKeyS)) if (!RegCreateKey(hKeyTest, "ODBC", &hKeyS))
{ {
HKEY hKeyO; HKEY hKeyO;
if (!RegCreateKey(hKeyS, "ODBC.INI", &hKeyO)) if (!RegCreateKey(hKeyS, "ODBC.INI", &hKeyO))
{ {
RegCloseKey (hKeyO); RegCloseKey (hKeyO);
if (!RegCreateKey(hKeyS, "ODBCINST.INI", &hKeyO)) if (!RegCreateKey(hKeyS, "ODBCINST.INI", &hKeyO))
{ {
RegCloseKey (hKeyO); RegCloseKey (hKeyO);
@ -335,17 +348,21 @@ static void test_SHDeleteKey()
} }
RegCloseKey (hKeyTest); RegCloseKey (hKeyTest);
} }
if (!sysfail) if (!sysfail)
{ {
HKEY hKeyS;
DWORD dwRet; dwRet = SHDeleteKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC");
ok (!SHDeleteKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC"), "SHDeleteKey failed\n"); ok ( ERROR_SUCCESS == dwRet, "SHDeleteKey failed, ret=(%lu)\n", dwRet);
ok ((dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC", &hKeyS)) == ERROR_FILE_NOT_FOUND, "SHDeleteKey did not delete\n");
dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\ODBC", &hKeyS);
ok ( ERROR_FILE_NOT_FOUND == dwRet, "SHDeleteKey did not delete\n");
if (dwRet == ERROR_SUCCESS) if (dwRet == ERROR_SUCCESS)
RegCloseKey (hKeyS); RegCloseKey (hKeyS);
} }
else else
ok (0, "Could not set up SHDeleteKey test\n"); ok( 0, "Could not set up SHDeleteKey test\n");
} }
START_TEST(shreg) START_TEST(shreg)