(original) (raw)

--- old/make/installer/bundles/windows/ishield/wrapper/common/WrapperUtils.cpp Thu Sep 15 08:03:16 2011 +++ new/make/installer/bundles/windows/ishield/wrapper/common/WrapperUtils.cpp Thu Sep 15 08:03:15 2011 @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "UserProfile.h" #include "WrapperUtils.h" @@ -24,7 +25,13 @@ const int MOZILLA = 1; const int FIREFOX = 2; +#ifdef UNICODE +#define REG_WI_LOCATION_KEY L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer" +#define INSTALLER_LOCATION_STRING L"InstallerLocation" +#else #define REG_WI_LOCATION_KEY "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer" +#define INSTALLER_LOCATION_STRING "InstallerLocation" +#endif #define REG_JAVASOFTAU_KEY "SOFTWARE\\JavaSoft\\Auto Update" #define REG_JAVASOFT_KEY "SOFTWARE\\JavaSoft" @@ -208,7 +215,7 @@ else { if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, REG_WI_LOCATION_KEY, 0, KEY_READ, &hKey) == ERROR_SUCCESS) { - if (RegQueryValueEx(hKey, "InstallerLocation", NULL, &dwType, + if (RegQueryValueExA(hKey, INSTALLER_LOCATION_STRING, NULL, &dwType, (LPBYTE)lpszWIPath, &dwSize) == ERROR_SUCCESS) { bRet=TRUE; } @@ -1382,3 +1389,44 @@ } + +// finds s2 within s1 +TCHAR* substring(TCHAR *s1, TCHAR *s2) +{ +#ifdef UNICODE + return wcsstr(s1, s2); +#else + return strstr(s1, s2); +#endif +}; + +// Replaces s1 with s2 in source. +// Stores a copy of source in prev. +// s1 and s2 must have the same lenght otherwise function does nothig. +// Returns a pointer to source. +TCHAR* simple_replace(TCHAR *source, TCHAR *prev, TCHAR *s1, TCHAR *s2) +{ +#ifdef UNICODE + wcscpy(prev, source); +#else + strcpy(prev, source); +#endif + return simple_replace(source, s1, s2); +} + +// Replaces s1 with s2 in source. +// s1 and s2 must have the same lenght otherwise function does nothig. +// Returns a pointer to source. +TCHAR* simple_replace(TCHAR *source, TCHAR *s1, TCHAR *s2) +{ + TCHAR *p1; +#ifdef UNICODE + if( wcslen(s1) == wcslen(s2) && (p1 = wcsstr(source, s1)) != NULL ) + wcsncpy(p1,s2,wcslen(s2)); +#else + if( strlen(s1) == strlen(s2) && (p1 = strstr(source, s1)) != NULL ) + strncpy (p1,s2,strlen(s2)); +#endif + return source; +} + --- old/make/installer/bundles/windows/ishield/wrapper/common/WrapperUtils.h Thu Sep 15 08:03:22 2011 +++ new/make/installer/bundles/windows/ishield/wrapper/common/WrapperUtils.h Thu Sep 15 08:03:21 2011 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ @@ -82,6 +82,9 @@ BOOL IsSPInstalled(LPTSTR lpszSPName); UINT SetupJavaSoftSubKey(LPCTSTR lpcszRegKey); void DeleteJavaSoftSubKey(LPCTSTR lpcszRegKey); +TCHAR* substring(TCHAR *s1, TCHAR *s2); +TCHAR* simple_replace(TCHAR *source, TCHAR *prev, TCHAR *s1, TCHAR *s2); +TCHAR* simple_replace(TCHAR *source, TCHAR *s1, TCHAR *s2); #define LANGID_ENGLISH 1033 #define LANGID_CHINESE_SIMPLIFIED 2052 --- old/make/installer/bundles/windows/ishield/wrapper/wrapper.jre/wrapper.cpp Thu Sep 15 08:03:27 2011 +++ new/make/installer/bundles/windows/ishield/wrapper/wrapper.jre/wrapper.cpp Thu Sep 15 08:03:26 2011 @@ -37,6 +37,14 @@ #define BUFFER_SIZE 1024 #define ERROR_PROXY_AUTH_REQ HRESULT_FROM_WIN32(0x210) +#ifdef UNICODE +#define SYSWOW64 L"SysWOW64" +#define SYSTEM32 L"system32" +#else +#define SYSWOW64 "SysWOW64" +#define SYSTEM32 "system32" +#endif + #define SPONSOR_CMDLINE_OPTION "SPWEB=" #ifdef SPONSOR BOOL bSponsors = TRUE; @@ -530,6 +538,7 @@ TCHAR command[BUFFER_SIZE] = {NULL}; TCHAR szExecutableName[MAX_PATH] = {NULL}; TCHAR szExecutableNameCommand[BUFFER_SIZE] = {NULL}; + TCHAR szExecutableName_c[MAX_PATH] = {NULL}; TCHAR szCabName[MAX_PATH] = {NULL}; int iReturn = 1; BOOL bSilentInstall = FALSE; @@ -748,6 +757,20 @@ if (strstr(command, "/qn") == 0) { lstrcat(command, " /qn"); } + } + + //fix 7014194 + //If msiexec.exe location contains "Syswow64" then it means that this + //Java installer wrapper is a 32 bit application running under 64 bit Windows. + //For 32bit applications running under 64 bit Windows all attempts to access System32 directory + //should be mapped by WOW64 (Windows 32 On Windows 64) emulator to Syswow64 directory. + //For some reason System32->Syswow64 conversion/mapping doesn't take place for msiexec.exe + //(neither for 32bit version Syswow64/msiexec.exe nor for 64 bit version System32/msiexec.exe). + // + //The fix below replaces "System32" string with "Syswow64" string in a path to *.msi files + //being passed to msiexec.exe + if(substring(szPath, SYSWOW64)!=NULL){ + simple_replace(szExecutableName, szExecutableName_c, SYSTEM32, SYSWOW64); } //Set registry keys to be used by Download Initated & complete pings posting --- old/make/installer/bundles/windows/ishield/wrapper/wrapper.jdk/wrapper.cpp Thu Sep 15 08:03:33 2011 +++ new/make/installer/bundles/windows/ishield/wrapper/wrapper.jdk/wrapper.cpp Thu Sep 15 08:03:31 2011 @@ -32,6 +32,14 @@ #define JDK_CABEXTRACT_WAIT_EVENT "SunJDKCabExtractWaitEvent" +#ifdef UNICODE +#define SYSWOW64 L"SysWOW64" +#define SYSTEM32 L"system32" +#else +#define SYSWOW64 "SysWOW64" +#define SYSTEM32 "system32" +#endif + //Call this in wrapper.cpp main function. //If return value is NULL, then it failed to create event. //You might want to handle the error and exit @@ -194,6 +202,7 @@ gLangid = DetectLocale(); TCHAR command[BUFFER_SIZE]; TCHAR szExecutableName[MAX_PATH], szExecutableNameCommand[BUFFER_SIZE]; + TCHAR szExecutableName_c[MAX_PATH]; command[0] = NULL; int iReturn = 1; BOOL bSilentInstall = FALSE; @@ -266,6 +275,20 @@ lstrcat(command, " ADDLOCAL=PublicjreFeature,ToolsFeature"); } } + + //fix 7014194 + //If msiexec.exe location contains "Syswow64" then it means that this + //Java installer wrapper is a 32 bit application running under 64 bit Windows. + //For 32bit applications running under 64 bit Windows all attempts to access System32 directory + //should be mapped by WOW64 (Windows 32 On Windows 64) emulator to Syswow64 directory. + //For some reason System32->Syswow64 conversion/mapping doesn't take place for msiexec.exe + //(neither for 32bit version Syswow64/msiexec.exe nor for 64 bit version System32/msiexec.exe). + // + //The fix below replaces "System32" string with "Syswow64" string in a path to *.msi files + //being passed to msiexec.exe + if(substring(szPath, SYSWOW64)!=NULL){ + simple_replace(szExecutableName, szExecutableName_c, SYSTEM32, SYSWOW64); + } if (gLangid == LANGID_ENGLISH) wsprintf(szExecutableNameCommand, "\"%s\" /i \"%s\" %s WRAPPER=1",