advpack/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-02-23 09:10:58 +01:00 committed by Alexandre Julliard
parent 339f4a3a70
commit 488505360e
4 changed files with 93 additions and 94 deletions

View File

@ -1,4 +1,3 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = advpack.dll
IMPORTS = cabinet advapi32 advpack

View File

@ -99,28 +99,28 @@ static void version_test(void)
major = minor = 0;
hr = pGetVersionFromFile("kernel32.dll", &major, &minor, FALSE);
ok (hr == S_OK, "GetVersionFromFileEx(kernel32.dll) failed, returned "
"0x%08x\n", hr);
trace("kernel32.dll Language ID: 0x%08x, Codepage ID: 0x%08x\n",
"0x%08lx\n", hr);
trace("kernel32.dll Language ID: 0x%08lx, Codepage ID: 0x%08lx\n",
major, minor);
major = minor = 0;
hr = pGetVersionFromFile("kernel32.dll", &major, &minor, TRUE);
ok (hr == S_OK, "GetVersionFromFileEx(kernel32.dll) failed, returned "
"0x%08x\n", hr);
"0x%08lx\n", hr);
trace("kernel32.dll version: %d.%d.%d.%d\n", HIWORD(major), LOWORD(major),
HIWORD(minor), LOWORD(minor));
major = minor = 0;
hr = pGetVersionFromFile("advpack.dll", &major, &minor, FALSE);
ok (hr == S_OK, "GetVersionFromFileEx(advpack.dll) failed, returned "
"0x%08x\n", hr);
trace("advpack.dll Language ID: 0x%08x, Codepage ID: 0x%08x\n",
"0x%08lx\n", hr);
trace("advpack.dll Language ID: 0x%08lx, Codepage ID: 0x%08lx\n",
major, minor);
major = minor = 0;
hr = pGetVersionFromFile("advpack.dll", &major, &minor, TRUE);
ok (hr == S_OK, "GetVersionFromFileEx(advpack.dll) failed, returned "
"0x%08x\n", hr);
"0x%08lx\n", hr);
trace("advpack.dll version: %d.%d.%d.%d\n", HIWORD(major), LOWORD(major),
HIWORD(minor), LOWORD(minor));
}
@ -278,7 +278,7 @@ static void translateinfstring_test(void)
}
ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", (UINT)hr);
ok(!strcmp(buffer, TEST_STRING2), "Expected %s, got %s\n", TEST_STRING2, buffer);
ok(dwSize == 25, "Expected size 25, got %d\n", dwSize);
ok(dwSize == 25, "Expected size 25, got %ld\n", dwSize);
buffer[0] = 0;
/* try other nonexistent section */
@ -304,7 +304,7 @@ static void translateinfstring_test(void)
if(hr == ERROR_SUCCESS)
{
ok(!strcmp(buffer, APP_PATH), "Expected '%s', got '%s'\n", APP_PATH, buffer);
ok(dwSize == APP_PATH_LEN, "Expected size %d, got %d\n", APP_PATH_LEN, dwSize);
ok(dwSize == APP_PATH_LEN, "Expected size %ld, got %ld\n", APP_PATH_LEN, dwSize);
}
buffer[0] = 0;
@ -315,7 +315,7 @@ static void translateinfstring_test(void)
todo_wine
{
ok(!strcmp(buffer, TEST_STRING2), "Expected %s, got %s\n", TEST_STRING2, buffer);
ok(dwSize == 25, "Expected size 25, got %d\n", dwSize);
ok(dwSize == 25, "Expected size 25, got %ld\n", dwSize);
}
DeleteFileA("c:\\a.inf");
@ -342,31 +342,31 @@ static void translateinfstringex_test(void)
/* try a NULL filename */
hr = pOpenINFEngine(NULL, "Options.NTx86", 0, &hinf, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
/* try an empty filename */
hr = pOpenINFEngine("", "Options.NTx86", 0, &hinf, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) /* NT+ */ ||
hr == HRESULT_FROM_WIN32(E_UNEXPECTED) /* 9x */,
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND or E_UNEXPECTED), got %08x\n", hr);
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND or E_UNEXPECTED), got %08lx\n", hr);
/* try a NULL hinf */
hr = pOpenINFEngine(inf_file, "Options.NTx86", 0, NULL, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
/* open the INF without the Install section specified */
hr = pOpenINFEngine(inf_file, NULL, 0, &hinf, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
/* try a NULL hinf */
hr = pTranslateInfStringEx(NULL, inf_file, "Options.NTx86", "InstallDir",
buffer, size, &size, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
/* try a NULL filename */
hr = pTranslateInfStringEx(hinf, NULL, "Options.NTx86", "InstallDir",
buffer, size, &size, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
/* try an empty filename */
memset(buffer, 'a', 25);
@ -374,32 +374,32 @@ static void translateinfstringex_test(void)
size = MAX_PATH;
hr = pTranslateInfStringEx(hinf, "", "Options.NTx86", "InstallDir",
buffer, size, &size, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
todo_wine
{
ok(!strcmp(buffer, TEST_STRING2), "Expected %s, got %s\n", TEST_STRING2, buffer);
ok(size == 25, "Expected size 25, got %d\n", size);
ok(size == 25, "Expected size 25, got %ld\n", size);
}
/* try a NULL translate section */
hr = pTranslateInfStringEx(hinf, inf_file, NULL, "InstallDir",
buffer, size, &size, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
/* try an empty translate section */
hr = pTranslateInfStringEx(hinf, inf_file, "", "InstallDir",
buffer, size, &size, NULL);
ok(hr == SPAPI_E_LINE_NOT_FOUND, "Expected SPAPI_E_LINE_NOT_FOUND, got %08x\n", hr);
ok(hr == SPAPI_E_LINE_NOT_FOUND, "Expected SPAPI_E_LINE_NOT_FOUND, got %08lx\n", hr);
/* try a NULL translate key */
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", NULL,
buffer, size, &size, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
/* try an empty translate key */
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "",
buffer, size, &size, NULL);
ok(hr == SPAPI_E_LINE_NOT_FOUND, "Expected SPAPI_E_LINE_NOT_FOUND, got %08x\n", hr);
ok(hr == SPAPI_E_LINE_NOT_FOUND, "Expected SPAPI_E_LINE_NOT_FOUND, got %08lx\n", hr);
/* successfully translate the string */
memset(buffer, 'a', 25);
@ -407,20 +407,20 @@ static void translateinfstringex_test(void)
size = MAX_PATH;
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "InstallDir",
buffer, size, &size, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
todo_wine
{
ok(!strcmp(buffer, TEST_STRING2), "Expected %s, got %s\n", TEST_STRING2, buffer);
ok(size == 25, "Expected size 25, got %d\n", size);
ok(size == 25, "Expected size 25, got %ld\n", size);
}
/* try a NULL hinf */
hr = pCloseINFEngine(NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08lx\n", hr);
/* successfully close the hinf */
hr = pCloseINFEngine(hinf);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
/* open the inf with the install section */
hr = pOpenINFEngine(inf_file, "section", 0, &hinf, NULL);
@ -430,7 +430,7 @@ static void translateinfstringex_test(void)
DeleteFileA(inf_file);
return;
}
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
/* translate the string with the install section specified */
memset(buffer, 'a', APP_PATH_LEN);
@ -438,9 +438,9 @@ static void translateinfstringex_test(void)
size = MAX_PATH;
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "InstallDir",
buffer, size, &size, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!strcmp(buffer, APP_PATH), "Expected %s, got %s\n", APP_PATH, buffer);
ok(size == APP_PATH_LEN, "Expected size %d, got %d\n", APP_PATH_LEN, size);
ok(size == APP_PATH_LEN, "Expected size %ld, got %ld\n", APP_PATH_LEN, size);
/* Single quote test (Note size includes null on return from call) */
memset(buffer, 'a', APP_PATH_LEN);
@ -448,10 +448,10 @@ static void translateinfstringex_test(void)
size = MAX_PATH;
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "Result1",
buffer, size, &size, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpiA(buffer, PROG_FILES_ROOT),
"Expected %s, got %s\n", PROG_FILES_ROOT, buffer);
ok(size == strlen(PROG_FILES_ROOT)+1, "Expected size %d, got %d\n",
ok(size == strlen(PROG_FILES_ROOT)+1, "Expected size %d, got %ld\n",
lstrlenA(PROG_FILES_ROOT)+1, size);
memset(buffer, 'a', APP_PATH_LEN);
@ -459,10 +459,10 @@ static void translateinfstringex_test(void)
size = MAX_PATH;
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "Result2",
buffer, size, &size, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpiA(buffer, PROG_FILES_ROOT),
"Expected %s, got %s\n", PROG_FILES_ROOT, buffer);
ok(size == strlen(PROG_FILES_ROOT)+1, "Expected size %d, got %d\n",
ok(size == strlen(PROG_FILES_ROOT)+1, "Expected size %d, got %ld\n",
lstrlenA(PROG_FILES_ROOT)+1, size);
{
@ -475,16 +475,16 @@ static void translateinfstringex_test(void)
size = MAX_PATH;
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "Result3",
buffer, size, &size, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpiA(buffer, drive),
"Expected %s, got %s\n", drive, buffer);
ok(size == strlen(drive)+1, "Expected size %d, got %d\n",
ok(size == strlen(drive)+1, "Expected size %d, got %ld\n",
lstrlenA(drive)+1, size);
}
/* close the INF again */
hr = pCloseINFEngine(hinf);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
DeleteFileA(inf_file);
@ -525,7 +525,7 @@ static void translateinfstringex_test(void)
/* open the inf with the install section */
hr = pOpenINFEngine(inf_file, "section", 0, &hinf, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
/* Single quote test (Note size includes null on return from call) */
memset(buffer, 'a', APP_PATH_LEN);
@ -533,15 +533,15 @@ static void translateinfstringex_test(void)
size = MAX_PATH;
hr = pTranslateInfStringEx(hinf, inf_file, "Options.NTx86", "Result2",
buffer, size, &size, NULL);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(!lstrcmpiA(buffer, PROG_FILES_ROOT),
"Expected %s, got %s\n", PROG_FILES_ROOT, buffer);
ok(size == strlen(PROG_FILES_ROOT)+1, "Expected size %d, got %d\n",
ok(size == strlen(PROG_FILES_ROOT)+1, "Expected size %d, got %ld\n",
lstrlenA(PROG_FILES_ROOT)+1, size);
/* close the INF again */
hr = pCloseINFEngine(hinf);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
DeleteFileA(inf_file);
}
@ -588,14 +588,14 @@ static void setperusersecvalues_test(void)
/* This crashes on systems with IE7 */
hr = pSetPerUserSecValues(NULL);
todo_wine
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(!OPEN_GUID_KEY(), "Expected guid key to not exist\n");
}
/* at the very least, szGUID must be valid */
peruser.szGUID[0] = '\0';
hr = pSetPerUserSecValues(&peruser);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(!OPEN_GUID_KEY(), "Expected guid key to not exist\n");
/* set initial values */
@ -606,7 +606,7 @@ static void setperusersecvalues_test(void)
skip("SetPerUserSecValues is broken\n");
return;
}
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(OPEN_GUID_KEY(), "Expected guid key to exist\n");
ok(check_reg_str(guid, NULL, "displayname"), "Expected displayname\n");
ok(check_reg_str(guid, "ComponentID", "compid"), "Expected compid\n");
@ -623,7 +623,7 @@ static void setperusersecvalues_test(void)
/* raise the version, but bRollback is FALSE, so vals not saved */
lstrcpyA(peruser.szVersion, "2,1,1,1");
hr = pSetPerUserSecValues(&peruser);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(check_reg_str(guid, NULL, "displayname"), "Expected displayname\n");
ok(check_reg_str(guid, "ComponentID", "compid"), "Expected compid\n");
ok(check_reg_str(guid, "Locale", "locale"), "Expected locale\n");
@ -640,7 +640,7 @@ static void setperusersecvalues_test(void)
peruser.bRollback = TRUE;
lstrcpyA(peruser.szVersion, "3,1,1,1");
hr = pSetPerUserSecValues(&peruser);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(check_reg_str(guid, NULL, "displayname"), "Expected displayname\n");
ok(check_reg_str(guid, "ComponentID", "compid"), "Expected compid\n");
ok(check_reg_str(guid, "Locale", "locale"), "Expected locale\n");

View File

@ -111,7 +111,7 @@ static void test_AddDelBackupEntry(void)
/* try a NULL file list */
res = pAddDelBackupEntry(NULL, "backup", "basename", AADBE_ADD_ENTRY);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
ok(!DeleteFileA(path), "Expected path to not exist\n");
lstrcpyA(path, CURR_DIR);
@ -119,7 +119,7 @@ static void test_AddDelBackupEntry(void)
/* try an empty base name */
res = pAddDelBackupEntry("one\0two\0three\0", "backup", "", AADBE_ADD_ENTRY);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
ok(!DeleteFileA(path), "Expected path to not exist\n");
lstrcpyA(path, CURR_DIR);
@ -127,14 +127,14 @@ static void test_AddDelBackupEntry(void)
/* try an invalid flag */
res = pAddDelBackupEntry("one\0two\0three\0", NULL, "basename", 0);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
ok(!DeleteFileA(path), "Expected path to not exist\n");
lstrcpyA(path, "c:\\basename.INI");
/* create the INF file */
res = pAddDelBackupEntry("one\0two\0three\0", "c:\\", "basename", AADBE_ADD_ENTRY);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
if (GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES)
{
ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
@ -149,14 +149,14 @@ static void test_AddDelBackupEntry(void)
/* try to create the INI file in a nonexistent directory */
RemoveDirectoryA("backup");
res = pAddDelBackupEntry("one\0two\0three\0", "backup", "basename", AADBE_ADD_ENTRY);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
ok(!check_ini_file_attr(path), "Expected ini file to not be hidden\n");
ok(!DeleteFileA(path), "Expected path to not exist\n");
/* try an existent, relative backup directory */
CreateDirectoryA("backup", NULL);
res = pAddDelBackupEntry("one\0two\0three\0", "backup", "basename", AADBE_ADD_ENTRY);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
ok(check_ini_file_attr(path), "Expected ini file to be hidden\n");
ok(DeleteFileA(path), "Expected path to exist\n");
RemoveDirectoryA("backup");
@ -166,13 +166,13 @@ static void test_AddDelBackupEntry(void)
/* try a NULL backup dir, INI is created in the windows directory */
res = pAddDelBackupEntry("one\0two\0three\0", NULL, "basename", AADBE_ADD_ENTRY);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
/* remove the entries with AADBE_DEL_ENTRY */
SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL);
res = pAddDelBackupEntry("one\0three\0", NULL, "basename", AADBE_DEL_ENTRY);
SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL);
ok(res == S_OK, "Expected S_OK, got %d\n", res);
ok(res == S_OK, "Expected S_OK, got %ld\n", res);
ret = DeleteFileA(path);
ok(ret == TRUE ||
broken(ret == FALSE), /* win98 */
@ -395,19 +395,19 @@ static void test_ExtractFiles(void)
/* try NULL cab file */
hr = pExtractFiles(NULL, destFolder, 0, NULL, NULL, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");
/* try NULL destination */
hr = pExtractFiles("extract.cab", NULL, 0, NULL, NULL, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
ok(!RemoveDirectoryA("dest"), "Expected dest to not exist\n");
/* extract all files in the cab to nonexistent destination directory */
hr = pExtractFiles("extract.cab", destFolder, 0, NULL, NULL, 0);
ok(hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND) ||
hr == E_FAIL, /* win95 */
"Expected %08x or %08x, got %08x\n", E_FAIL,
"Expected %08lx or %08lx, got %08lx\n", E_FAIL,
HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), hr);
ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
@ -417,7 +417,7 @@ static void test_ExtractFiles(void)
/* extract all files in the cab to the destination directory */
CreateDirectoryA("dest", NULL);
hr = pExtractFiles("extract.cab", destFolder, 0, NULL, NULL, 0);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
@ -426,7 +426,7 @@ static void test_ExtractFiles(void)
/* extract all files to a relative destination directory */
hr = pExtractFiles("extract.cab", "dest", 0, NULL, NULL, 0);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
ok(DeleteFileA("dest\\b.txt"), "Expected dest\\b.txt to exist\n");
ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
@ -435,7 +435,7 @@ static void test_ExtractFiles(void)
/* only extract two of the files from the cab */
hr = pExtractFiles("extract.cab", "dest", 0, "a.txt:testdir\\c.txt", NULL, 0);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
@ -444,7 +444,7 @@ static void test_ExtractFiles(void)
/* use valid chars before and after file list */
hr = pExtractFiles("extract.cab", "dest", 0, " :\t: a.txt:testdir\\c.txt \t:", NULL, 0);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
@ -453,27 +453,27 @@ static void test_ExtractFiles(void)
/* use invalid chars before and after file list */
hr = pExtractFiles("extract.cab", "dest", 0, " +-\\ a.txt:testdir\\c.txt a_:", NULL, 0);
ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
ok(hr == E_FAIL, "Expected E_FAIL, got %ld\n", hr);
ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
/* try an empty file list */
hr = pExtractFiles("extract.cab", "dest", 0, "", NULL, 0);
ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
ok(hr == E_FAIL, "Expected E_FAIL, got %ld\n", hr);
ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
/* try a nonexistent file in the file list */
hr = pExtractFiles("extract.cab", "dest", 0, "a.txt:idontexist:testdir\\c.txt", NULL, 0);
ok(hr == E_FAIL, "Expected E_FAIL, got %d\n", hr);
ok(hr == E_FAIL, "Expected E_FAIL, got %ld\n", hr);
ok(!DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to not exist\n");
ok(!DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to not exist\n");
ok(!RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to not exist\n");
if(pExtractFilesW) {
hr = pExtractFilesW(L"extract.cab", L"dest", 0, L"a.txt:testdir\\c.txt", NULL, 0);
ok(hr == S_OK, "Expected S_OK, got %08x\n", hr);
ok(hr == S_OK, "Expected S_OK, got %08lx\n", hr);
ok(DeleteFileA("dest\\a.txt"), "Expected dest\\a.txt to exist\n");
ok(DeleteFileA("dest\\testdir\\c.txt"), "Expected dest\\testdir\\c.txt to exist\n");
ok(RemoveDirectoryA("dest\\testdir"), "Expected dest\\testdir to exist\n");
@ -507,22 +507,22 @@ static void test_AdvInstallFile(void)
/* try invalid source directory */
hr = pAdvInstallFile(NULL, NULL, "source.txt", destFolder, "destination.txt", 0, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
/* try invalid source file */
hr = pAdvInstallFile(NULL, CURR_DIR, NULL, destFolder, "destination.txt", 0, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
/* try invalid destination directory */
hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", NULL, "destination.txt", 0, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
ok(!DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to not exist\n");
/* try copying to nonexistent destination directory */
hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder, "destination.txt", 0, 0);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
/* native windows screws up if the source file doesn't exist */
@ -531,7 +531,7 @@ static void test_AdvInstallFile(void)
createTestFile("dest\\destination.txt");
hr = pAdvInstallFile(NULL, CURR_DIR, "source.txt", destFolder,
"destination.txt", AIF_NOOVERWRITE | AIF_QUIET, 0);
ok(hr == S_OK, "Expected S_OK, got %d\n", hr);
ok(hr == S_OK, "Expected S_OK, got %ld\n", hr);
ok(DeleteFileA("dest\\destination.txt"), "Expected dest\\destination.txt to exist\n");
ok(RemoveDirectoryA("dest"), "Expected dest to exist\n");

View File

@ -84,17 +84,17 @@ static void test_RunSetupCommand(void)
/* try an invalid cmd name */
hr = pRunSetupCommand(NULL, NULL, "Install", "Dir", "Title", NULL, 0, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
/* try an invalid directory */
hr = pRunSetupCommand(NULL, "winver.exe", "Install", NULL, "Title", NULL, 0, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
/* try to run a nonexistent exe */
hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "idontexist.exe", "Install", systemdir, "Title", &hexe, 0, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %d\n", hr);
"Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld\n", hr);
ok(hexe == NULL, "Expected hexe to be NULL\n");
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
@ -102,21 +102,21 @@ static void test_RunSetupCommand(void)
hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "winver.exe", "Install", "non\\existent\\directory", "Title", &hexe, 0, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY),
"Expected HRESULT_FROM_WIN32(ERROR_DIRECTORY), got %d\n", hr);
"Expected HRESULT_FROM_WIN32(ERROR_DIRECTORY), got %ld\n", hr);
ok(hexe == NULL, "Expected hexe to be NULL\n");
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
/* try to run an exe with the RSC_FLAG_INF flag */
hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "winver.exe", "Install", systemdir, "Title", &hexe, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(is_spapi_err(hr), "Expected a setupapi error, got %d\n", hr);
ok(is_spapi_err(hr), "Expected a setupapi error, got %ld\n", hr);
ok(hexe == (HANDLE)0xdeadbeef, "Expected hexe to be 0xdeadbeef\n");
ok(!TerminateProcess(hexe, 0), "Expected TerminateProcess to fail\n");
/* run winver.exe */
hexe = (HANDLE)0xdeadbeef;
hr = pRunSetupCommand(NULL, "winver.exe", "Install", systemdir, "Title", &hexe, 0, NULL);
ok(hr == S_ASYNCHRONOUS, "Expected S_ASYNCHRONOUS, got %d\n", hr);
ok(hr == S_ASYNCHRONOUS, "Expected S_ASYNCHRONOUS, got %ld\n", hr);
ok(hexe != NULL, "Expected hexe to be non-NULL\n");
ok(TerminateProcess(hexe, 0), "Expected TerminateProcess to succeed\n");
@ -129,42 +129,42 @@ static void test_RunSetupCommand(void)
lstrcpyA(dir, CURR_DIR);
lstrcatA(dir, "\\one");
hr = pRunSetupCommand(NULL, path, "DefaultInstall", dir, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", hr);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", hr);
/* try a full path to the INF, NULL working dir */
hr = pRunSetupCommand(NULL, path, "DefaultInstall", NULL, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %d\n", hr);
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld\n", hr);
/* try a full path to the INF, empty working dir */
hr = pRunSetupCommand(NULL, path, "DefaultInstall", "", "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", hr);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", hr);
/* try a relative path to the INF, with working dir provided */
hr = pRunSetupCommand(NULL, "one\\test.inf", "DefaultInstall", dir, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", hr);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", hr);
/* try a relative path to the INF, NULL working dir */
hr = pRunSetupCommand(NULL, "one\\test.inf", "DefaultInstall", NULL, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %d\n", hr);
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld\n", hr);
/* try a relative path to the INF, empty working dir */
hr = pRunSetupCommand(NULL, "one\\test.inf", "DefaultInstall", "", "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", hr);
ok(hr == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n", hr);
/* try only the INF filename, with working dir provided */
hr = pRunSetupCommand(NULL, "test.inf", "DefaultInstall", dir, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %d\n", hr);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld\n", hr);
/* try only the INF filename, NULL working dir */
hr = pRunSetupCommand(NULL, "test.inf", "DefaultInstall", NULL, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %d\n", hr);
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld\n", hr);
/* try only the INF filename, empty working dir */
hr = pRunSetupCommand(NULL, "test.inf", "DefaultInstall", "", "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %d\n", hr);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld\n", hr);
DeleteFileA("one\\test.inf");
RemoveDirectoryA("one");
@ -173,16 +173,16 @@ static void test_RunSetupCommand(void)
/* try INF file in the current directory, working directory provided */
hr = pRunSetupCommand(NULL, "test.inf", "DefaultInstall", CURR_DIR, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %d\n", hr);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld\n", hr);
/* try INF file in the current directory, NULL working directory */
hr = pRunSetupCommand(NULL, "test.inf", "DefaultInstall", NULL, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %d\n", hr);
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %ld\n", hr);
/* try INF file in the current directory, empty working directory */
hr = pRunSetupCommand(NULL, "test.inf", "DefaultInstall", CURR_DIR, "Title", NULL, RSC_FLAG_INF | RSC_FLAG_QUIET, NULL);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %d\n", hr);
ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "Expected HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), got %ld\n", hr);
}
static void test_LaunchINFSection(void)
@ -199,7 +199,7 @@ static void test_LaunchINFSection(void)
{
/* try an invalid cmdline */
hr = pLaunchINFSection(NULL, NULL, NULL, 0);
ok(hr == 1, "Expected 1, got %d\n", hr);
ok(hr == 1, "Expected 1, got %ld\n", hr);
}
CreateDirectoryA("one", NULL);
@ -210,7 +210,7 @@ static void test_LaunchINFSection(void)
lstrcatA(cmdline, "\\");
lstrcatA(cmdline, "one\\test.inf,DefaultInstall,,4");
hr = pLaunchINFSection(NULL, NULL, cmdline, 0);
ok(hr == 0, "Expected 0, got %d\n", hr);
ok(hr == 0, "Expected 0, got %ld\n", hr);
DeleteFileA("one\\test.inf");
RemoveDirectoryA("one");
@ -219,10 +219,10 @@ static void test_LaunchINFSection(void)
/* try just the INF filename */
hr = pLaunchINFSection(NULL, NULL, file, 0);
ok(hr == 0, "Expected 0, got %d\n", hr);
ok(hr == 0, "Expected 0, got %ld\n", hr);
hr = pLaunchINFSection(NULL, NULL, file2, 0);
ok(hr == 0, "Expected 0, got %d\n", hr);
ok(hr == 0, "Expected 0, got %ld\n", hr);
DeleteFileA("test.inf");
}
@ -239,14 +239,14 @@ static void test_LaunchINFSectionEx(void)
lstrcatA(cmdline, "\\");
lstrcatA(cmdline, "test.inf,DefaultInstall,c:imacab.cab,4");
hr = pLaunchINFSectionEx(NULL, NULL, cmdline, 0);
ok(hr == 0, "Expected 0, got %d\n", hr);
ok(hr == 0, "Expected 0, got %ld\n", hr);
/* try quoting the parameters */
lstrcpyA(cmdline, "\"");
lstrcatA(cmdline, CURR_DIR);
lstrcatA(cmdline, "\\test.inf\",\"DefaultInstall\",\"c:,imacab.cab\",\"4\"");
hr = pLaunchINFSectionEx(NULL, NULL, cmdline, 0);
ok(hr == 0, "Expected 0, got %d\n", hr);
ok(hr == 0, "Expected 0, got %ld\n", hr);
/* The 'No UI' flag seems to have no effect whatsoever on Windows.
* So only do this test in interactive mode.
@ -256,7 +256,7 @@ static void test_LaunchINFSectionEx(void)
/* try an invalid CAB filename with a relative INF name */
lstrcpyA(cmdline, "test.inf,DefaultInstall,c:imacab.cab,4");
hr = pLaunchINFSectionEx(NULL, NULL, cmdline, 0);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %d\n", hr);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %ld\n", hr);
}
DeleteFileA("test.inf");