Commit 6a6a2185 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Set the file contents of the file hash test file explicitly.

parent e1002889
...@@ -557,7 +557,7 @@ static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tV ...@@ -557,7 +557,7 @@ static const CHAR mc_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\tV
static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n" static const CHAR mc_file_hash_dat[] = "File_\tOptions\tHashPart1\tHashPart2\tHashPart3\tHashPart4\n"
"s72\ti2\ti4\ti4\ti4\ti4\n" "s72\ti2\ti4\ti4\ti4\ti4\n"
"MsiFileHash\tFile_\n" "MsiFileHash\tFile_\n"
"caesar\t0\t1477005400\t-2141257985\t284379198\t21485139"; "caesar\t0\t850433704\t-241429251\t675791761\t-1221108824";
typedef struct _msi_table typedef struct _msi_table
{ {
...@@ -1100,24 +1100,26 @@ static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2) ...@@ -1100,24 +1100,26 @@ static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
return TRUE; return TRUE;
} }
static void create_file(const CHAR *name, DWORD size) static void create_file_data(LPCSTR name, LPCSTR data, DWORD size)
{ {
HANDLE file; HANDLE file;
DWORD written, left; DWORD written;
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name); ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
WriteFile(file, name, strlen(name), &written, NULL); WriteFile(file, data, strlen(data), &written, NULL);
WriteFile(file, "\n", strlen("\n"), &written, NULL);
left = size - lstrlen(name) - 1; if (size)
{
SetFilePointer(file, size, NULL, FILE_BEGIN);
SetEndOfFile(file);
}
SetFilePointer(file, left, NULL, FILE_CURRENT);
SetEndOfFile(file);
CloseHandle(file); CloseHandle(file);
} }
#define create_file(name, size) create_file_data(name, name, size)
static void create_test_files(void) static void create_test_files(void)
{ {
CreateDirectoryA("msitest", NULL); CreateDirectoryA("msitest", NULL);
...@@ -3286,7 +3288,7 @@ static void test_adminprops(void) ...@@ -3286,7 +3288,7 @@ static void test_adminprops(void)
RemoveDirectory("msitest"); RemoveDirectory("msitest");
} }
static void create_pf(LPCSTR file, BOOL is_file) static void create_pf_data(LPCSTR file, LPCSTR data, BOOL is_file)
{ {
CHAR path[MAX_PATH]; CHAR path[MAX_PATH];
...@@ -3295,11 +3297,13 @@ static void create_pf(LPCSTR file, BOOL is_file) ...@@ -3295,11 +3297,13 @@ static void create_pf(LPCSTR file, BOOL is_file)
lstrcatA(path, file); lstrcatA(path, file);
if (is_file) if (is_file)
create_file(path, 500); create_file_data(path, data, 500);
else else
CreateDirectoryA(path, NULL); CreateDirectoryA(path, NULL);
} }
#define create_pf(file, is_file) create_pf_data(file, file, is_file)
static void test_removefiles(void) static void test_removefiles(void)
{ {
UINT r; UINT r;
...@@ -3533,7 +3537,7 @@ static void test_missingcab(void) ...@@ -3533,7 +3537,7 @@ static void test_missingcab(void)
create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0"); create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
create_pf("msitest", FALSE); create_pf("msitest", FALSE);
create_pf("msitest\\caesar", TRUE); create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
r = MsiInstallProductA(msifile, NULL); r = MsiInstallProductA(msifile, NULL);
todo_wine todo_wine
...@@ -3547,7 +3551,7 @@ static void test_missingcab(void) ...@@ -3547,7 +3551,7 @@ static void test_missingcab(void)
ok(delete_pf("msitest", FALSE), "File not installed\n"); ok(delete_pf("msitest", FALSE), "File not installed\n");
create_pf("msitest", FALSE); create_pf("msitest", FALSE);
create_pf("msitest\\caesar", TRUE); create_pf_data("msitest\\caesar", "abcdefgh", TRUE);
create_pf("msitest\\gaius", TRUE); create_pf("msitest\\gaius", TRUE);
r = MsiInstallProductA(msifile, "GAIUS=1"); r = MsiInstallProductA(msifile, "GAIUS=1");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment