setupapi/tests: Clean up and expand tests for SetupCopyOEMInf().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b9735fc69e
commit
097e224af7
|
@ -45,27 +45,19 @@ static CHAR CURR_DIR[MAX_PATH];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static BOOL (WINAPI *pSetupGetFileCompressionInfoExA)(PCSTR, PSTR, DWORD, PDWORD, PDWORD, PDWORD, PUINT);
|
static BOOL (WINAPI *pSetupGetFileCompressionInfoExA)(PCSTR, PSTR, DWORD, PDWORD, PDWORD, PDWORD, PUINT);
|
||||||
static BOOL (WINAPI *pSetupCopyOEMInfA)(PCSTR, PCSTR, DWORD, DWORD, PSTR, DWORD, PDWORD, PSTR *);
|
|
||||||
static BOOL (WINAPI *pSetupQueryInfOriginalFileInformationA)(PSP_INF_INFORMATION, UINT, PSP_ALTPLATFORM_INFO, PSP_ORIGINAL_FILE_INFO_A);
|
static BOOL (WINAPI *pSetupQueryInfOriginalFileInformationA)(PSP_INF_INFORMATION, UINT, PSP_ALTPLATFORM_INFO, PSP_ORIGINAL_FILE_INFO_A);
|
||||||
static BOOL (WINAPI *pSetupUninstallOEMInfA)(PCSTR, DWORD, PVOID);
|
|
||||||
|
|
||||||
static void create_inf_file(LPCSTR filename)
|
static void create_file(const char *name, const char *data)
|
||||||
{
|
{
|
||||||
DWORD dwNumberOfBytesWritten;
|
HANDLE file;
|
||||||
HANDLE hf = CreateFileA(filename, GENERIC_WRITE, 0, NULL,
|
DWORD size;
|
||||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
BOOL ret;
|
||||||
|
|
||||||
static const char data[] =
|
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
|
||||||
"[Version]\n"
|
ok(file != INVALID_HANDLE_VALUE, "Failed to create %s, error %u.\n", name, GetLastError());
|
||||||
"Signature=\"$Chicago$\"\n"
|
ret = WriteFile(file, data, strlen(data), &size, NULL);
|
||||||
"AdvancedINF=2.5\n"
|
ok(ret && size == strlen(data), "Failed to write %s, error %u.\n", name, GetLastError());
|
||||||
"[DefaultInstall]\n"
|
CloseHandle(file);
|
||||||
"RegisterOCXs=RegisterOCXsSection\n"
|
|
||||||
"[RegisterOCXsSection]\n"
|
|
||||||
"%%11%%\\ole32.dll\n";
|
|
||||||
|
|
||||||
WriteFile(hf, data, sizeof(data) - 1, &dwNumberOfBytesWritten, NULL);
|
|
||||||
CloseHandle(hf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_temp_filename(LPSTR path)
|
static void get_temp_filename(LPSTR path)
|
||||||
|
@ -84,19 +76,13 @@ static BOOL file_exists(LPSTR path)
|
||||||
return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
|
return GetFileAttributesA(path) != INVALID_FILE_ATTRIBUTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL check_format(LPSTR path, LPSTR inf)
|
static BOOL is_in_inf_dir(const char *path)
|
||||||
{
|
{
|
||||||
CHAR check[MAX_PATH];
|
char expect[MAX_PATH];
|
||||||
BOOL res;
|
|
||||||
|
|
||||||
static const CHAR format[] = "\\INF\\oem";
|
GetWindowsDirectoryA(expect, sizeof(expect));
|
||||||
|
strcat(expect, "\\inf\\");
|
||||||
GetWindowsDirectoryA(check, MAX_PATH);
|
return !strncasecmp(path, expect, strrchr(path, '\\') - path);
|
||||||
strcat(check, format);
|
|
||||||
res = CompareStringA(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, check, -1, path, strlen(check)) == CSTR_EQUAL &&
|
|
||||||
path[strlen(check)] != '\\';
|
|
||||||
|
|
||||||
return (!inf) ? res : res && (inf == path + strlen(check) - 3);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_original_file_name(LPCSTR original, LPCSTR dest)
|
static void test_original_file_name(LPCSTR original, LPCSTR dest)
|
||||||
|
@ -143,32 +129,39 @@ static void test_original_file_name(LPCSTR original, LPCSTR dest)
|
||||||
|
|
||||||
static void test_SetupCopyOEMInf(void)
|
static void test_SetupCopyOEMInf(void)
|
||||||
{
|
{
|
||||||
CHAR toolong[MAX_PATH * 2];
|
char path[MAX_PATH * 2], dest[MAX_PATH], tmpfile[MAX_PATH], orig_dest[MAX_PATH];
|
||||||
CHAR path[MAX_PATH], dest[MAX_PATH];
|
char *filepart, pnf[MAX_PATH];
|
||||||
CHAR tmpfile[MAX_PATH], dest_save[MAX_PATH];
|
|
||||||
LPSTR inf = NULL;
|
|
||||||
DWORD size;
|
DWORD size;
|
||||||
BOOL res;
|
BOOL res;
|
||||||
|
|
||||||
|
static const char inf_data1[] =
|
||||||
|
"[Version]\n"
|
||||||
|
"Signature=\"$Chicago$\"\n"
|
||||||
|
"; This is a WINE test INF file\n";
|
||||||
|
|
||||||
|
static const char inf_data2[] =
|
||||||
|
"[Version]\n"
|
||||||
|
"Signature=\"$Chicago$\"\n"
|
||||||
|
"; This is another WINE test INF file\n";
|
||||||
|
|
||||||
/* try NULL SourceInfFileName */
|
/* try NULL SourceInfFileName */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(NULL, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(NULL, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
ok(GetLastError() == ERROR_INVALID_PARAMETER,
|
||||||
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
"Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
|
||||||
|
|
||||||
/* try empty SourceInfFileName */
|
/* try empty SourceInfFileName */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA("", NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA("", NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
|
||||||
GetLastError() == ERROR_BAD_PATHNAME || /* Win98 */
|
|
||||||
GetLastError() == ERROR_INVALID_PARAMETER, /* Vista, W2K8 */
|
GetLastError() == ERROR_INVALID_PARAMETER, /* Vista, W2K8 */
|
||||||
"Unexpected error : %d\n", GetLastError());
|
"Unexpected error : %d\n", GetLastError());
|
||||||
|
|
||||||
/* try a relative nonexistent SourceInfFileName */
|
/* try a relative nonexistent SourceInfFileName */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA("nonexistent", NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA("nonexistent", NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||||
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
@ -177,30 +170,18 @@ static void test_SetupCopyOEMInf(void)
|
||||||
strcpy(path, CURR_DIR);
|
strcpy(path, CURR_DIR);
|
||||||
strcat(path, "\\nonexistent");
|
strcat(path, "\\nonexistent");
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(path, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||||
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
|
|
||||||
/* try a long SourceInfFileName */
|
|
||||||
memset(toolong, 'a', MAX_PATH * 2);
|
|
||||||
toolong[MAX_PATH * 2 - 1] = '\0';
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = pSetupCopyOEMInfA(toolong, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
|
|
||||||
GetLastError() == ERROR_FILENAME_EXCED_RANGE, /* Win98 */
|
|
||||||
"Expected ERROR_FILE_NOT_FOUND or ERROR_FILENAME_EXCED_RANGE, got %d\n", GetLastError());
|
|
||||||
|
|
||||||
get_temp_filename(tmpfile);
|
get_temp_filename(tmpfile);
|
||||||
create_inf_file(tmpfile);
|
create_file(tmpfile, inf_data1);
|
||||||
|
|
||||||
/* try a relative SourceInfFileName */
|
/* try a relative SourceInfFileName */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(tmpfile, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(tmpfile, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
||||||
ok(res == FALSE ||
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
broken(res == TRUE), /* Win98 */
|
|
||||||
"Expected FALSE, got %d\n", res);
|
|
||||||
if (GetLastError() == ERROR_WRONG_INF_TYPE || GetLastError() == ERROR_UNSUPPORTED_TYPE /* Win7 */)
|
if (GetLastError() == ERROR_WRONG_INF_TYPE || GetLastError() == ERROR_UNSUPPORTED_TYPE /* Win7 */)
|
||||||
{
|
{
|
||||||
/* FIXME:
|
/* FIXME:
|
||||||
|
@ -212,152 +193,169 @@ static void test_SetupCopyOEMInf(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND ||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
broken(GetLastError() == ERROR_SUCCESS), /* Win98 */
|
|
||||||
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
|
||||||
ok(file_exists(tmpfile), "Expected tmpfile to exist\n");
|
ok(file_exists(tmpfile), "Expected tmpfile to exist\n");
|
||||||
|
|
||||||
/* try SP_COPY_REPLACEONLY, dest does not exist */
|
/* try SP_COPY_REPLACEONLY, dest does not exist */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, NULL, 0, NULL, NULL);
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND,
|
||||||
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
"Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
|
||||||
ok(file_exists(tmpfile), "Expected source inf to exist\n");
|
ok(file_exists(tmpfile), "Expected source inf to exist\n");
|
||||||
|
|
||||||
/* try an absolute SourceInfFileName, without DestinationInfFileName */
|
/* Test a successful call. */
|
||||||
strcpy(path, CURR_DIR);
|
strcpy(path, CURR_DIR);
|
||||||
strcat(path, "\\");
|
strcat(path, "\\");
|
||||||
strcat(path, tmpfile);
|
strcat(path, tmpfile);
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
|
||||||
if (!res && GetLastError() == ERROR_ACCESS_DENIED)
|
if (!res && GetLastError() == ERROR_ACCESS_DENIED)
|
||||||
{
|
{
|
||||||
skip("SetupCopyOEMInfA() failed on insufficient permissions\n");
|
skip("SetupCopyOEMInfA() failed on insufficient permissions\n");
|
||||||
|
DeleteFileA(tmpfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
ok(file_exists(path), "Expected source inf to exist\n");
|
ok(file_exists(path), "Expected source inf to exist.\n");
|
||||||
|
ok(file_exists(dest), "Expected dest file to exist.\n");
|
||||||
|
ok(is_in_inf_dir(dest), "Got unexpected path '%s'.\n", dest);
|
||||||
|
strcpy(orig_dest, dest);
|
||||||
|
|
||||||
|
/* Existing INF files are checked for a match. */
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
|
||||||
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
|
ok(file_exists(path), "Expected source inf to exist.\n");
|
||||||
|
ok(file_exists(dest), "Expected dest file to exist.\n");
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
|
||||||
|
|
||||||
/* try SP_COPY_REPLACEONLY, dest exists */
|
/* try SP_COPY_REPLACEONLY, dest exists */
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_REPLACEONLY, dest, sizeof(dest), NULL, NULL);
|
||||||
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
ok(file_exists(path), "Expected source inf to exist\n");
|
ok(file_exists(path), "Expected source inf to exist.\n");
|
||||||
|
ok(file_exists(dest), "Expected dest file to exist.\n");
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
|
||||||
|
|
||||||
/* try SP_COPY_NOOVERWRITE */
|
strcpy(dest, "aaa");
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_NOOVERWRITE, dest, sizeof(dest), NULL, NULL);
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_FILE_EXISTS,
|
ok(GetLastError() == ERROR_FILE_EXISTS,
|
||||||
"Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
|
"Expected ERROR_FILE_EXISTS, got %d\n", GetLastError());
|
||||||
|
todo_wine
|
||||||
|
ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
|
||||||
|
|
||||||
/* get the DestinationInfFileName */
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, NULL, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, NULL, 0, NULL, NULL);
|
||||||
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
ok(strlen(dest) != 0, "Expected a non-zero length string\n");
|
ok(file_exists(path), "Expected source inf to exist.\n");
|
||||||
ok(file_exists(dest), "Expected destination inf to exist\n");
|
ok(file_exists(orig_dest), "Expected dest file to exist.\n");
|
||||||
ok(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
|
|
||||||
ok(file_exists(path), "Expected source inf to exist\n");
|
|
||||||
|
|
||||||
strcpy(dest_save, dest);
|
|
||||||
DeleteFileA(dest_save);
|
|
||||||
|
|
||||||
/* get the DestinationInfFileName, DestinationInfFileNameSize is too small
|
|
||||||
* - inf is still copied
|
|
||||||
*/
|
|
||||||
strcpy(dest, "aaa");
|
strcpy(dest, "aaa");
|
||||||
size = 0;
|
size = 0;
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, 5, &size, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, 5, &size, NULL);
|
||||||
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
ok(res == FALSE, "Expected FALSE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER,
|
||||||
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
|
"Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError());
|
||||||
ok(file_exists(path), "Expected source inf to exist\n");
|
ok(file_exists(path), "Expected source inf to exist\n");
|
||||||
ok(file_exists(dest_save), "Expected dest inf to exist\n");
|
ok(file_exists(orig_dest), "Expected dest inf to exist\n");
|
||||||
ok(!strcmp(dest, "aaa"), "Expected dest to be unchanged\n");
|
ok(!strcmp(dest, "aaa"), "Expected dest to be unchanged\n");
|
||||||
ok(size == strlen(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
|
todo_wine
|
||||||
|
ok(size == strlen(orig_dest) + 1, "Expected size %d, got %d.\n", strlen(orig_dest) + 1, size);
|
||||||
|
|
||||||
/* get the DestinationInfFileName and DestinationInfFileNameSize */
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), &size, NULL);
|
||||||
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
ok(lstrlenA(dest) + 1 == size, "Expected sizes to match, got (%d, %d)\n", lstrlenA(dest), size);
|
todo_wine
|
||||||
ok(file_exists(dest), "Expected destination inf to exist\n");
|
ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
|
||||||
ok(check_format(dest, NULL), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
|
ok(size == strlen(dest) + 1, "Expected size %d, got %d.\n", strlen(dest) + 1, size);
|
||||||
ok(file_exists(path), "Expected source inf to exist\n");
|
|
||||||
ok(size == lstrlenA(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
|
|
||||||
|
|
||||||
test_original_file_name(strrchr(path, '\\') + 1, dest);
|
test_original_file_name(strrchr(path, '\\') + 1, dest);
|
||||||
|
|
||||||
/* get the DestinationInfFileName, DestinationInfFileNameSize, and DestinationInfFileNameComponent */
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, MAX_PATH, &size, &inf);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, &filepart);
|
||||||
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
ok(lstrlenA(dest) + 1 == size, "Expected sizes to match, got (%d, %d)\n", lstrlenA(dest), size);
|
todo_wine
|
||||||
ok(file_exists(dest), "Expected destination inf to exist\n");
|
ok(!strcmp(orig_dest, dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
|
||||||
ok((inf && inf[0] != 0) ||
|
ok(filepart == strrchr(dest, '\\') + 1, "Got unexpected file part %s.\n", filepart);
|
||||||
broken(!inf), /* Win98 */
|
|
||||||
"Expected inf to point to the filename\n");
|
|
||||||
ok(check_format(dest, inf), "Expected %%windir%%\\inf\\OEMx.inf, got %s\n", dest);
|
|
||||||
ok(file_exists(path), "Expected source inf to exist\n");
|
|
||||||
ok(size == lstrlenA(dest_save) + 1, "Expected size to be lstrlen(dest_save) + 1\n");
|
|
||||||
|
|
||||||
/* try SP_COPY_DELETESOURCE */
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
res = pSetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_DELETESOURCE, NULL, 0, NULL, NULL);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, SP_COPY_DELETESOURCE, NULL, 0, NULL, NULL);
|
||||||
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
ok(!file_exists(path), "Expected source inf to not exist\n");
|
ok(!file_exists(path), "Expected source inf to not exist\n");
|
||||||
|
|
||||||
if (pSetupUninstallOEMInfA)
|
strcpy(pnf, dest);
|
||||||
{
|
*(strrchr(pnf, '.') + 1) = 'p';
|
||||||
char pnf[MAX_PATH];
|
|
||||||
char *pnffile;
|
|
||||||
char *destfile = strrchr(dest, '\\') + 1;
|
|
||||||
|
|
||||||
strcpy(pnf, dest);
|
res = SetupUninstallOEMInfA(strrchr(dest, '\\') + 1, 0, NULL);
|
||||||
*(strrchr(pnf, '.') + 1) = 'p';
|
ok(res, "Failed to uninstall '%s', error %u.\n", dest, GetLastError());
|
||||||
pnffile = strrchr(pnf, '\\') + 1;
|
todo_wine ok(!file_exists(dest), "Expected inf '%s' to not exist\n", dest);
|
||||||
|
DeleteFileA(dest);
|
||||||
|
ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
create_file(tmpfile, inf_data1);
|
||||||
res = pSetupUninstallOEMInfA(destfile, 0, NULL);
|
SetLastError(0xdeadbeef);
|
||||||
if(!res)
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
|
||||||
res = pSetupUninstallOEMInfA(pnffile, 0, NULL);
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
ok(res, "Failed to uninstall '%s'/'%s' : %d\n", destfile,
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
pnffile, GetLastError());
|
ok(is_in_inf_dir(dest), "Got unexpected path '%s'.\n", dest);
|
||||||
todo_wine ok(!file_exists(dest), "Expected inf '%s' to not exist\n", dest);
|
strcpy(orig_dest, dest);
|
||||||
if(file_exists(dest))
|
|
||||||
{
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = DeleteFileA(dest);
|
|
||||||
ok(res, "Failed to delete file '%s' : %d\n", dest, GetLastError());
|
|
||||||
}
|
|
||||||
ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
|
|
||||||
if(file_exists(pnf))
|
|
||||||
{
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = DeleteFileA(pnf);
|
|
||||||
ok(res, "Failed to delete file '%s' : %d\n", pnf, GetLastError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Win9x/WinMe */
|
|
||||||
SetLastError(0xdeadbeef);
|
|
||||||
res = DeleteFileA(dest);
|
|
||||||
ok(res, "Failed to delete file '%s' : %d\n", dest, GetLastError());
|
|
||||||
|
|
||||||
/* On WinMe we also need to remove the .pnf file */
|
create_file(tmpfile, inf_data2);
|
||||||
*(strrchr(dest, '.') + 1) = 'p';
|
SetLastError(0xdeadbeef);
|
||||||
DeleteFileA(dest);
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
|
||||||
}
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
|
ok(is_in_inf_dir(dest), "Got unexpected path '%s'.\n", dest);
|
||||||
|
ok(strcmp(dest, orig_dest), "Expected INF files to be copied to differnet paths.\n");
|
||||||
|
|
||||||
|
res = SetupUninstallOEMInfA(strrchr(dest, '\\') + 1, 0, NULL);
|
||||||
|
ok(res, "Failed to uninstall '%s', error %u.\n", dest, GetLastError());
|
||||||
|
todo_wine ok(!file_exists(dest), "Expected inf '%s' to not exist\n", dest);
|
||||||
|
DeleteFileA(dest);
|
||||||
|
strcpy(pnf, dest);
|
||||||
|
*(strrchr(pnf, '.') + 1) = 'p';
|
||||||
|
ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
|
||||||
|
|
||||||
|
res = SetupUninstallOEMInfA(strrchr(orig_dest, '\\') + 1, 0, NULL);
|
||||||
|
ok(res, "Failed to uninstall '%s', error %u.\n", orig_dest, GetLastError());
|
||||||
|
todo_wine ok(!file_exists(orig_dest), "Expected inf '%s' to not exist\n", dest);
|
||||||
|
DeleteFileA(orig_dest);
|
||||||
|
strcpy(pnf, dest);
|
||||||
|
*(strrchr(pnf, '.') + 1) = 'p';
|
||||||
|
ok(!file_exists(pnf), "Expected pnf '%s' to not exist\n", pnf);
|
||||||
|
|
||||||
|
GetWindowsDirectoryA(orig_dest, sizeof(orig_dest));
|
||||||
|
strcat(orig_dest, "\\inf\\");
|
||||||
|
strcat(orig_dest, tmpfile);
|
||||||
|
res = CopyFileA(tmpfile, orig_dest, TRUE);
|
||||||
|
todo_wine
|
||||||
|
ok(res, "Failed to copy file, error %u.\n", GetLastError());
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
res = SetupCopyOEMInfA(path, NULL, SPOST_NONE, 0, dest, sizeof(dest), NULL, NULL);
|
||||||
|
ok(res == TRUE, "Expected TRUE, got %d\n", res);
|
||||||
|
ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError());
|
||||||
|
todo_wine
|
||||||
|
ok(!strcasecmp(dest, orig_dest), "Expected '%s', got '%s'.\n", orig_dest, dest);
|
||||||
|
|
||||||
|
/* Since it wasn't actually installed, SetupUninstallOEMInf would fail here. */
|
||||||
|
res = DeleteFileA(dest);
|
||||||
|
ok(res, "Failed to delete '%s', error %u.\n", tmpfile, GetLastError());
|
||||||
|
|
||||||
|
res = DeleteFileA(tmpfile);
|
||||||
|
ok(res, "Failed to delete '%s', error %u.\n", tmpfile, GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void create_source_file(LPSTR filename, const BYTE *data, DWORD size)
|
static void create_source_file(LPSTR filename, const BYTE *data, DWORD size)
|
||||||
|
@ -716,12 +714,12 @@ static void test_SetupUninstallOEMInf(void)
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = pSetupUninstallOEMInfA(NULL, 0, NULL);
|
ret = SetupUninstallOEMInfA(NULL, 0, NULL);
|
||||||
ok(!ret, "Expected failure\n");
|
ok(!ret, "Expected failure\n");
|
||||||
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = pSetupUninstallOEMInfA("", 0, NULL);
|
ret = SetupUninstallOEMInfA("", 0, NULL);
|
||||||
todo_wine
|
todo_wine
|
||||||
{
|
{
|
||||||
ok(!ret, "Expected failure\n");
|
ok(!ret, "Expected failure\n");
|
||||||
|
@ -729,7 +727,7 @@ static void test_SetupUninstallOEMInf(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = pSetupUninstallOEMInfA("nonexistent.inf", 0, NULL);
|
ret = SetupUninstallOEMInfA("nonexistent.inf", 0, NULL);
|
||||||
todo_wine
|
todo_wine
|
||||||
{
|
{
|
||||||
ok(!ret, "Expected failure\n");
|
ok(!ret, "Expected failure\n");
|
||||||
|
@ -835,17 +833,11 @@ START_TEST(misc)
|
||||||
HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
|
HMODULE hsetupapi = GetModuleHandleA("setupapi.dll");
|
||||||
|
|
||||||
pSetupGetFileCompressionInfoExA = (void*)GetProcAddress(hsetupapi, "SetupGetFileCompressionInfoExA");
|
pSetupGetFileCompressionInfoExA = (void*)GetProcAddress(hsetupapi, "SetupGetFileCompressionInfoExA");
|
||||||
pSetupCopyOEMInfA = (void*)GetProcAddress(hsetupapi, "SetupCopyOEMInfA");
|
|
||||||
pSetupQueryInfOriginalFileInformationA = (void*)GetProcAddress(hsetupapi, "SetupQueryInfOriginalFileInformationA");
|
pSetupQueryInfOriginalFileInformationA = (void*)GetProcAddress(hsetupapi, "SetupQueryInfOriginalFileInformationA");
|
||||||
pSetupUninstallOEMInfA = (void*)GetProcAddress(hsetupapi, "SetupUninstallOEMInfA");
|
|
||||||
|
|
||||||
GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
|
GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
|
||||||
|
|
||||||
if (pSetupCopyOEMInfA)
|
test_SetupCopyOEMInf();
|
||||||
test_SetupCopyOEMInf();
|
|
||||||
else
|
|
||||||
win_skip("SetupCopyOEMInfA is not available\n");
|
|
||||||
|
|
||||||
test_SetupGetFileCompressionInfo();
|
test_SetupGetFileCompressionInfo();
|
||||||
|
|
||||||
if (pSetupGetFileCompressionInfoExA)
|
if (pSetupGetFileCompressionInfoExA)
|
||||||
|
@ -854,14 +846,8 @@ START_TEST(misc)
|
||||||
win_skip("SetupGetFileCompressionInfoExA is not available\n");
|
win_skip("SetupGetFileCompressionInfoExA is not available\n");
|
||||||
|
|
||||||
test_SetupDecompressOrCopyFile();
|
test_SetupDecompressOrCopyFile();
|
||||||
|
test_SetupUninstallOEMInf();
|
||||||
if (pSetupUninstallOEMInfA)
|
|
||||||
test_SetupUninstallOEMInf();
|
|
||||||
else
|
|
||||||
win_skip("SetupUninstallOEMInfA is not available\n");
|
|
||||||
|
|
||||||
test_defaultcallback();
|
test_defaultcallback();
|
||||||
|
|
||||||
test_SetupLogError();
|
test_SetupLogError();
|
||||||
test_CM_Get_Version();
|
test_CM_Get_Version();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue