From: Paul Gofman pgofman@codeweavers.com
--- dlls/msi/action.c | 3 +-- dlls/msi/assembly.c | 3 +-- dlls/msi/custom.c | 2 +- dlls/msi/msi_main.c | 3 +++ dlls/msi/msipriv.h | 2 ++ dlls/msi/package.c | 4 ++-- 6 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/msi/action.c b/dlls/msi/action.c index f9b43692ab3..f750b875d6b 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -5210,12 +5210,11 @@ static UINT ACTION_InstallFinalize(MSIPACKAGE *package)
UINT ACTION_ForceReboot(MSIPACKAGE *package) { - WCHAR buffer[256], sysdir[MAX_PATH], squashed_pc[SQUASHED_GUID_SIZE]; + WCHAR buffer[256], squashed_pc[SQUASHED_GUID_SIZE]; HKEY hkey;
squash_guid( package->ProductCode, squashed_pc );
- GetSystemDirectoryW(sysdir, ARRAY_SIZE(sysdir)); RegCreateKeyW(HKEY_LOCAL_MACHINE, L"Software\Microsoft\Windows\CurrentVersion\RunOnce", &hkey); swprintf(buffer, ARRAY_SIZE(buffer), L"%s\MsiExec.exe /@ "%s"", sysdir, squashed_pc);
diff --git a/dlls/msi/assembly.c b/dlls/msi/assembly.c index 47e8071502c..6613bf3bf96 100644 --- a/dlls/msi/assembly.c +++ b/dlls/msi/assembly.c @@ -34,9 +34,8 @@ static void load_fusion_dlls( MSIPACKAGE *package ) { HRESULT (WINAPI *pLoadLibraryShim)( const WCHAR *, const WCHAR *, void *, HMODULE * ); WCHAR path[MAX_PATH]; - DWORD len = GetSystemDirectoryW( path, MAX_PATH );
- lstrcpyW( path + len, L"\mscoree.dll" ); + lstrcpyW( path + sysdir_len, L"\mscoree.dll" ); if (!package->hmscoree && !(package->hmscoree = LoadLibraryW( path ))) return; if (!(pLoadLibraryShim = (void *)GetProcAddress( package->hmscoree, "LoadLibraryShim" ))) { diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index 12a7c3c3676..54e1897a2c5 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -612,7 +612,7 @@ static DWORD custom_start_server(MSIPACKAGE *package, DWORD arch) if ((sizeof(void *) == 8 || is_wow64) && arch == SCS_32BIT_BINARY) GetSystemWow64DirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\msiexec.exe")); else - GetSystemDirectoryW(path, MAX_PATH - ARRAY_SIZE(L"\msiexec.exe")); + wcscpy(path, sysdir); lstrcatW(path, L"\msiexec.exe"); swprintf(cmdline, ARRAY_SIZE(cmdline), L"%s -Embedding %d", path, GetCurrentProcessId());
diff --git a/dlls/msi/msi_main.c b/dlls/msi/msi_main.c index a2b6b6a0503..32b4f9ad45d 100644 --- a/dlls/msi/msi_main.c +++ b/dlls/msi/msi_main.c @@ -50,6 +50,8 @@ LPVOID gUIContextRecord = NULL; WCHAR *gszLogFile = NULL; HINSTANCE msi_hInstance;
+WCHAR sysdir[MAX_PATH]; +SIZE_T sysdir_len;
/* * Dll lifetime tracking declaration @@ -75,6 +77,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) msi_hInstance = hinstDLL; DisableThreadLibraryCalls(hinstDLL); IsWow64Process( GetCurrentProcess(), &is_wow64 ); + sysdir_len = GetSystemDirectoryW( sysdir, ARRAY_SIZE(sysdir) ); break; case DLL_PROCESS_DETACH: if (lpvReserved) break; diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index aebfc85ab76..bd8f6ec7a48 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -43,6 +43,8 @@
static const BOOL is_64bit = sizeof(void *) > sizeof(int); extern BOOL is_wow64; +extern WCHAR sysdir[MAX_PATH]; +extern SIZE_T sysdir_len;
#define MSI_DATASIZEMASK 0x00ff #define MSITYPE_VALID 0x0100 diff --git a/dlls/msi/package.c b/dlls/msi/package.c index b8966a0df90..969441f8827 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -777,7 +777,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) msi_set_property( package->db, L"Intel", bufstr, len ); if (sys_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL) { - GetSystemDirectoryW( pth, MAX_PATH ); + wcscpy( pth, sysdir ); PathAddBackslashW( pth ); msi_set_property( package->db, L"SystemFolder", pth, -1 );
@@ -798,7 +798,7 @@ static VOID set_installer_properties(MSIPACKAGE *package) msi_set_property( package->db, L"Msix64", bufstr, -1 ); msi_set_property( package->db, L"VersionNT64", verstr, -1 );
- GetSystemDirectoryW( pth, MAX_PATH ); + wcscpy( pth, sysdir ); PathAddBackslashW( pth ); msi_set_property( package->db, L"System64Folder", pth, -1 );