msi: Common Files is translated to current language.

This commit is contained in:
Marcus Meissner 2007-10-16 21:41:39 +02:00 committed by Alexandre Julliard
parent 9684c9fee6
commit 6f865b9497
1 changed files with 24 additions and 5 deletions

View File

@ -42,6 +42,7 @@ static const char *msifile2 = "winetest2.msi";
static const char *mstfile = "winetest.mst"; static const char *mstfile = "winetest.mst";
static CHAR CURR_DIR[MAX_PATH]; static CHAR CURR_DIR[MAX_PATH];
static CHAR PROG_FILES_DIR[MAX_PATH]; static CHAR PROG_FILES_DIR[MAX_PATH];
static CHAR COMMON_FILES_DIR[MAX_PATH];
/* msi database data */ /* msi database data */
@ -995,10 +996,10 @@ static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files)
ok(res, "Failed to destroy the cabinet\n"); ok(res, "Failed to destroy the cabinet\n");
} }
static BOOL get_program_files_dir(LPSTR buf) static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2)
{ {
HKEY hkey; HKEY hkey;
DWORD type = REG_EXPAND_SZ, size; DWORD type, size;
if (RegOpenKey(HKEY_LOCAL_MACHINE, if (RegOpenKey(HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion", &hkey)) "Software\\Microsoft\\Windows\\CurrentVersion", &hkey))
@ -1008,6 +1009,10 @@ static BOOL get_program_files_dir(LPSTR buf)
if (RegQueryValueEx(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) if (RegQueryValueEx(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size))
return FALSE; return FALSE;
size = MAX_PATH;
if (RegQueryValueEx(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size))
return FALSE;
RegCloseKey(hkey); RegCloseKey(hkey);
return TRUE; return TRUE;
} }
@ -1064,6 +1069,20 @@ static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
return RemoveDirectoryA(path); return RemoveDirectoryA(path);
} }
static BOOL delete_cf(const CHAR *rel_path, BOOL is_file)
{
CHAR path[MAX_PATH];
lstrcpyA(path, COMMON_FILES_DIR);
lstrcatA(path, "\\");
lstrcatA(path, rel_path);
if (is_file)
return DeleteFileA(path);
else
return RemoveDirectoryA(path);
}
static void delete_test_files(void) static void delete_test_files(void)
{ {
DeleteFileA("msitest.msi"); DeleteFileA("msitest.msi");
@ -1620,8 +1639,8 @@ static void test_setdirproperty(void)
r = MsiInstallProductA(msifile, NULL); r = MsiInstallProductA(msifile, NULL);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r);
ok(delete_pf("Common Files\\msitest\\maximus", TRUE), "File not installed\n"); ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n");
ok(delete_pf("Common Files\\msitest", FALSE), "File not installed\n"); ok(delete_cf("msitest", FALSE), "File not installed\n");
/* Delete the files in the temp (current) folder */ /* Delete the files in the temp (current) folder */
DeleteFile(msifile); DeleteFile(msifile);
@ -2889,7 +2908,7 @@ START_TEST(install)
if(len && (CURR_DIR[len - 1] == '\\')) if(len && (CURR_DIR[len - 1] == '\\'))
CURR_DIR[len - 1] = 0; CURR_DIR[len - 1] = 0;
get_program_files_dir(PROG_FILES_DIR); get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR);
test_MsiInstallProduct(); test_MsiInstallProduct();
test_MsiSetComponentState(); test_MsiSetComponentState();