msi: Fix several test failures.

This commit is contained in:
James Hawkins 2008-10-24 07:15:01 -05:00 committed by Alexandre Julliard
parent acfc915914
commit cd4b952863
1 changed files with 106 additions and 55 deletions

View File

@ -854,7 +854,7 @@ typedef struct _tagVS_VERSIONINFO
#define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1)) #define roundoffs(a, b, r) (((BYTE *)(b) - (BYTE *)(a) + ((r) - 1)) & ~((r) - 1))
#define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r)) #define roundpos(a, b, r) (((BYTE *)(a)) + roundoffs(a, b, r))
static void create_file_with_version(const CHAR *name, LONG ms, LONG ls) static BOOL create_file_with_version(const CHAR *name, LONG ms, LONG ls)
{ {
VS_VERSIONINFO *pVerInfo; VS_VERSIONINFO *pVerInfo;
VS_FIXEDFILEINFO *pFixedInfo; VS_FIXEDFILEINFO *pFixedInfo;
@ -862,6 +862,7 @@ static void create_file_with_version(const CHAR *name, LONG ms, LONG ls)
CHAR path[MAX_PATH]; CHAR path[MAX_PATH];
DWORD handle, size; DWORD handle, size;
HANDLE resource; HANDLE resource;
BOOL ret = FALSE;
GetSystemDirectory(path, MAX_PATH); GetSystemDirectory(path, MAX_PATH);
lstrcatA(path, "\\kernel32.dll"); lstrcatA(path, "\\kernel32.dll");
@ -886,12 +887,18 @@ static void create_file_with_version(const CHAR *name, LONG ms, LONG ls)
if (!resource) if (!resource)
goto done; goto done;
UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), if (!UpdateResource(resource, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO),
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size); MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), buffer, size))
EndUpdateResource(resource, FALSE); goto done;
if (!EndUpdateResource(resource, FALSE))
goto done;
ret = TRUE;
done: done:
HeapFree(GetProcessHeap(), 0, buffer); HeapFree(GetProcessHeap(), 0, buffer);
return ret;
} }
static void test_createpackage(void) static void test_createpackage(void)
@ -6146,6 +6153,7 @@ static void test_appsearch_reglocator(void)
CHAR prop[MAX_PATH]; CHAR prop[MAX_PATH];
DWORD binary[2]; DWORD binary[2];
DWORD size, val; DWORD size, val;
BOOL space, version;
HKEY hklm, classes; HKEY hklm, classes;
HKEY hkcu, users; HKEY hkcu, users;
LPCSTR str; LPCSTR str;
@ -6153,6 +6161,12 @@ static void test_appsearch_reglocator(void)
LONG res; LONG res;
UINT r; UINT r;
version = TRUE;
if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
version = FALSE;
DeleteFileA("test.dll");
res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes); res = RegCreateKeyA(HKEY_CLASSES_ROOT, "Software\\Wine", &classes);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -6167,12 +6181,18 @@ static void test_appsearch_reglocator(void)
(const BYTE *)"regszdata", 10); (const BYTE *)"regszdata", 10);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
users = 0;
res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users); res = RegCreateKeyA(HKEY_USERS, "S-1-5-18\\Software\\Wine", &users);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS ||
broken(res == ERROR_INVALID_PARAMETER),
"Expected ERROR_SUCCESS, got %d\n", res);
res = RegSetValueExA(users, "Value1", 0, REG_SZ, if (res == ERROR_SUCCESS)
(const BYTE *)"regszdata", 10); {
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); res = RegSetValueExA(users, "Value1", 0, REG_SZ,
(const BYTE *)"regszdata", 10);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
}
res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm); res = RegCreateKeyA(HKEY_LOCAL_MACHINE, "Software\\Wine", &hklm);
ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res);
@ -6258,6 +6278,7 @@ static void test_appsearch_reglocator(void)
res = RegSetValueExA(hklm, "value16", 0, REG_SZ, res = RegSetValueExA(hklm, "value16", 0, REG_SZ,
(const BYTE *)path, lstrlenA(path) + 1); (const BYTE *)path, lstrlenA(path) + 1);
space = (strchr(CURR_DIR, ' ')) ? TRUE : FALSE;
sprintf(path, "%s\\FileName1 -option", CURR_DIR); sprintf(path, "%s\\FileName1 -option", CURR_DIR);
res = RegSetValueExA(hklm, "value17", 0, REG_SZ, res = RegSetValueExA(hklm, "value17", 0, REG_SZ,
(const BYTE *)path, lstrlenA(path) + 1); (const BYTE *)path, lstrlenA(path) + 1);
@ -6656,11 +6677,14 @@ static void test_appsearch_reglocator(void)
ok(!lstrcmpA(prop, "regszdata"), ok(!lstrcmpA(prop, "regszdata"),
"Expected \"regszdata\", got \"%s\"\n", prop); "Expected \"regszdata\", got \"%s\"\n", prop);
size = MAX_PATH; if (users)
r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size); {
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); size = MAX_PATH;
ok(!lstrcmpA(prop, "regszdata"), r = MsiGetPropertyA(hpkg, "SIGPROP17", prop, &size);
"Expected \"regszdata\", got \"%s\"\n", prop); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, "regszdata"),
"Expected \"regszdata\", got \"%s\"\n", prop);
}
size = MAX_PATH; size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP18", prop, &size);
@ -6678,22 +6702,25 @@ static void test_appsearch_reglocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop); ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
size = MAX_PATH; if (version)
sprintf(path, "%s\\FileName3.dll", CURR_DIR); {
r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size); size = MAX_PATH;
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); sprintf(path, "%s\\FileName3.dll", CURR_DIR);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); r = MsiGetPropertyA(hpkg, "SIGPROP21", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
size = MAX_PATH; size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP22", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop); ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
size = MAX_PATH; size = MAX_PATH;
sprintf(path, "%s\\FileName5.dll", CURR_DIR); sprintf(path, "%s\\FileName5.dll", CURR_DIR);
r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP23", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
}
size = MAX_PATH; size = MAX_PATH;
lstrcpyA(path, CURR_DIR); lstrcpyA(path, CURR_DIR);
@ -6731,9 +6758,13 @@ static void test_appsearch_reglocator(void)
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
size = MAX_PATH; size = MAX_PATH;
sprintf(path, "%s\\FileName1", CURR_DIR);
r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP30", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop); if (space)
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
else
todo_wine ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
RegSetValueA(hklm, NULL, REG_SZ, "", 0); RegSetValueA(hklm, NULL, REG_SZ, "", 0);
RegDeleteValueA(hklm, "Value1"); RegDeleteValueA(hklm, "Value1");
@ -6792,11 +6823,18 @@ static void test_appsearch_inilocator(void)
MSIHANDLE hpkg, hdb; MSIHANDLE hpkg, hdb;
CHAR path[MAX_PATH]; CHAR path[MAX_PATH];
CHAR prop[MAX_PATH]; CHAR prop[MAX_PATH];
BOOL version;
LPCSTR str; LPCSTR str;
LPSTR ptr; LPSTR ptr;
DWORD size; DWORD size;
UINT r; UINT r;
version = TRUE;
if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
version = FALSE;
DeleteFileA("test.dll");
WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini"); WritePrivateProfileStringA("Section", "Key", "keydata,field2", "IniFile.ini");
create_test_file("FileName1"); create_test_file("FileName1");
@ -7001,22 +7039,25 @@ static void test_appsearch_inilocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop); ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
size = MAX_PATH; if (version)
sprintf(path, "%s\\FileName2.dll", CURR_DIR); {
r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size); size = MAX_PATH;
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); sprintf(path, "%s\\FileName2.dll", CURR_DIR);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
size = MAX_PATH; size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP11", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop); ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
size = MAX_PATH; size = MAX_PATH;
sprintf(path, "%s\\FileName4.dll", CURR_DIR); sprintf(path, "%s\\FileName4.dll", CURR_DIR);
r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP12", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
}
delete_win_ini("IniFile.ini"); delete_win_ini("IniFile.ini");
DeleteFileA("FileName1"); DeleteFileA("FileName1");
@ -7032,10 +7073,17 @@ static void test_appsearch_drlocator(void)
MSIHANDLE hpkg, hdb; MSIHANDLE hpkg, hdb;
CHAR path[MAX_PATH]; CHAR path[MAX_PATH];
CHAR prop[MAX_PATH]; CHAR prop[MAX_PATH];
BOOL version;
LPCSTR str; LPCSTR str;
DWORD size; DWORD size;
UINT r; UINT r;
version = TRUE;
if (!create_file_with_version("test.dll", MAKELONG(2, 1), MAKELONG(4, 3)))
version = FALSE;
DeleteFileA("test.dll");
create_test_file("FileName1"); create_test_file("FileName1");
CreateDirectoryA("one", NULL); CreateDirectoryA("one", NULL);
CreateDirectoryA("one\\two", NULL); CreateDirectoryA("one\\two", NULL);
@ -7216,21 +7264,24 @@ static void test_appsearch_drlocator(void)
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
size = MAX_PATH; if (version)
sprintf(path, "%s\\FileName3.dll", CURR_DIR); {
r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size); size = MAX_PATH;
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); sprintf(path, "%s\\FileName3.dll", CURR_DIR);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop); r = MsiGetPropertyA(hpkg, "SIGPROP8", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, path), "Expected \"%s\", got \"%s\"\n", path, prop);
size = MAX_PATH; size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP9", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop); ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
size = MAX_PATH; size = MAX_PATH;
r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size); r = MsiGetPropertyA(hpkg, "SIGPROP10", prop, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop); ok(!lstrcmpA(prop, ""), "Expected \"\", got \"%s\"\n", prop);
}
DeleteFileA("FileName1"); DeleteFileA("FileName1");
DeleteFileA("FileName3.dll"); DeleteFileA("FileName3.dll");