From 3476f08bd757969b083e626b2f3cafd96ee7f0a9 Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Wed, 22 Dec 1999 20:19:34 +0000 Subject: [PATCH] This fixes bugs #16350, 17631, 20259, 21575. Installer registers in the Windows registry where mozilla.exe gets installed to. Installer is aware of the previous mozilla.exe installation location and offers it as the default destination location. Installer now is able to show a Readme.txt in the SetupType dialog. Eliminated most of the "Netscape" and replaced it with "Mozilla" a=chofmann r=sgehani git-svn-id: svn://10.0.0.236/trunk@56408 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpinstall/packager/windows/config.it | 43 ++-- mozilla/xpinstall/packager/windows/core.jst | 42 +++- mozilla/xpinstall/packager/windows/makeall.pl | 3 +- mozilla/xpinstall/packager/windows/makejs.pl | 23 +- .../xpinstall/wizard/windows/setup/dialogs.c | 7 + .../xpinstall/wizard/windows/setup/extra.c | 214 +++++++++++++++--- .../xpinstall/wizard/windows/setup/extra.h | 5 +- .../xpinstall/wizard/windows/setup/ifuncns.c | 38 ++-- .../xpinstall/wizard/windows/setup/setup.h | 2 + .../wizard/windows/setuprsc/setuprsc.h | 6 +- .../wizard/windows/setuprsc/setuprsc.rc | 5 +- 11 files changed, 306 insertions(+), 82 deletions(-) diff --git a/mozilla/xpinstall/packager/windows/config.it b/mozilla/xpinstall/packager/windows/config.it index dfc08e4eb38..a5db4a3180e 100644 --- a/mozilla/xpinstall/packager/windows/config.it +++ b/mozilla/xpinstall/packager/windows/config.it @@ -7,7 +7,7 @@ ; values. Run Mode=Normal -Product Name=Netscape Seamonkey +Product Name=Mozilla Seamonkey ; Destination Path values: ; PROGRAMFILESDIR @@ -45,7 +45,7 @@ Path=[PROGRAMFILESDIR]\Netscape\Seamonkey ; MEDIAPATH ; CONFIGPATH (supported only under Windows95 and Windows98) ; DEVICEPATH -Program Folder Name=Netscape Seamonkey +Program Folder Name=Mozilla Seamonkey Program Folder Path=[COMMON_PROGRAMS] ; Default Setup Type values: @@ -55,10 +55,25 @@ Program Folder Path=[COMMON_PROGRAMS] ; Setup Type 3 - fourth radio button (usually the Custom option) Default Setup Type=Setup Type 0 -Setup Title0=Netscape Seamonkey Setup +Setup Title0=Mozilla Seamonkey Setup Setup Title1=Build $Version$ Setup Title2= +; HKey: valid decryptable setup keys are [Mozilla Seamonkey CurrentVersion] +; and [Mozilla Seamonkey CurrentVersion]. +; Decrypt HKey: there are times when '[' and ']' are valid part of windows registry key names. +; Contains Filename: tells setup that the path contains filename needed to be removed before +; using it as a path. +; Verify Existance: FILE or PATH +; +[Locate Previous Product Path0] +HRoot=HKEY_LOCAL_MACHINE +HKey=[Netscape Seamonkey CurrentVersion]\Main +Name=Install Directory +Decrypt HKey=TRUE +Contains Filename=FALSE +Verify Existance= + [Dialog Welcome] Show Dialog=TRUE Title=Welcome @@ -77,6 +92,8 @@ Message1= Show Dialog=TRUE Title=Setup Type Message0=Click the type of Setup you prefer, then click Next. +Readme Filename=readme.txt +Readme App=notepad.exe ; at least one Setup Type needs to be set, and up to 4 can be ; set (Setup Type0, Setup Type1, Setup Type2, Setup Type3). @@ -131,24 +148,24 @@ Message0= [Dialog Windows Integration] Show Dialog=FALSE Title=Windows Integration -Message0=Check the Netscape Preference options you would like Setup to perform. -Message1=These settings allow you to set default Internet preferences for browsing and searching. They affect browsers installed on your machine, including Netscape Communicator and Microsoft Internet Explorer. +Message0=Check the Mozilla Preference options you would like Setup to perform. +Message1=These settings allow you to set default Internet preferences for browsing and searching. They affect browsers installed on your machine, including Mozilla Communicator and Microsoft Internet Explorer. ; Only a maximum of 4 "Windows Integration-Item"s are allowded. Each Item ; shows up as a checkbox in the Windows Integration dialog. [Windows Integration-Item0] CheckBoxState=FALSE -Description=Make Netscape Communicator my default Internet browser +Description=Make Mozilla Communicator my default Internet browser Archive= [Windows Integration-Item1] CheckBoxState=FALSE -Description=Make Netscape Netcenter my home page +Description=Make Mozilla Netcenter my home page Archive= [Windows Integration-Item2] CheckBoxState=FALSE -Description=Use Netscape Netcenter to search the Web +Description=Use Mozilla Netcenter to search the Web Archive= [Dialog Program Folder] @@ -193,7 +210,7 @@ exe_param= ; Components dialog) for installation. ; There is no limit to the number of components to install. [Component0] -Description Short=Netscape Seamonkey +Description Short=Mozilla Seamonkey Description Long=Browser software for the internet Archive=core.xpi $InstallSize$:core @@ -216,7 +233,7 @@ Archive=mail.xpi $InstallSize$:mail $InstallSizeSystem$ $InstallSizeArchive$:mail.xpi -;Dependency0=Netscape Seamonkey +;Dependency0=Mozilla Seamonkey ; Attributes can be the following values: ; SELECTED - the component is selected to be installed by default. ; INVISIBLE - the component is not shown in the Select Components dialog. @@ -303,7 +320,7 @@ Message=Preparing SmartUpdate, please wait... ;Delete FileX sections [Delete File0] Timing=post download -Destination=[COMMON_PROGRAMS]\Netscape Seamonkey\Netscape AppRunner.lnk +Destination=[COMMON_PROGRAMS]\Mozilla Seamonkey\Mozilla AppRunner.lnk ;Remove DirectoryX sections ;[Remove Directory0] @@ -353,7 +370,7 @@ Program Folder=[Default Folder] File=[SETUP PATH]\mozilla.exe Arguments= Working Dir=[SETUP PATH] -Description=Netscape Mozilla +Description=Mozilla Seamonkey Icon Path=[SETUP PATH]\mozilla.exe Icon Id=0 @@ -361,7 +378,7 @@ Icon Id=0 ;File=[SETUP PATH]\bin\viewer.exe ;Arguments= ;Working Dir=[SETUP PATH] -;Description=Netscape Viewer +;Description=Mozilla Viewer ;Icon Path=[SETUP PATH]\bin\viewer.exe ;Icon Id=0 diff --git a/mozilla/xpinstall/packager/windows/core.jst b/mozilla/xpinstall/packager/windows/core.jst index 7ba8b376d56..2485f748e06 100644 --- a/mozilla/xpinstall/packager/windows/core.jst +++ b/mozilla/xpinstall/packager/windows/core.jst @@ -1,3 +1,41 @@ +function updateWinReg() +{ + //Notes: + // can't use a double backslash before subkey - Windows already puts it in. + // subkeys have to exist before values can be put in. + var winreg = getWinRegistry(); + var subkey; //the name of the subkey you are poking around in + var valname; // the name of the value you want to look at + var value; //the data in the value you want to look at. + + if(winreg != null) + { + winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE); + subkey = "SOFTWARE\\Netscape\\Netscape Seamonkey"; + winreg.createKey(subkey,""); + valname = "CurrentVersion"; + value = "$UserAgent$"; + err = winreg.setValueString(subkey, valname, value); + + subkey = "SOFTWARE\\Netscape\\Netscape Seamonkey\\$UserAgent$\\Main"; + winreg.createKey(subkey,""); + valname = "Install Directory"; + value = communicatorFolder; + err = winreg.setValueString(subkey, valname, value); + + // set the App Paths key here + subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\mozilla.exe"; + winreg.createKey(subkey,""); + valname = ""; + value = communicatorFolder + "\\mozilla.exe"; + err = winreg.setValueString(subkey, valname, value); + + valname = "Path"; + value = communicatorFolder; + err = winreg.setValueString(subkey, valname, value); + } +} + // main var srDest; var err; @@ -7,7 +45,7 @@ var fileComponentRegStr; var fileComponentReg; srDest = $SpaceRequired$:bin; -err = startInstall("Mozilla Seamonkey", "", "$Version$"); +err = startInstall("Netscape Seamonkey", "", "$Version$"); logComment("startInstall: " + err); communicatorFolder = getFolder("Communicator"); @@ -41,6 +79,8 @@ if(verifyDiskSpace(communicatorFolder, srDest) == true) err = fileDelete(fileComponentReg); logComment("fileDelete() returned: " + err); + updateWinReg(); + err = finalizeInstall(); logComment("finalizeInstall() returned: " + err); } diff --git a/mozilla/xpinstall/packager/windows/makeall.pl b/mozilla/xpinstall/packager/windows/makeall.pl index 6bbee46eb3b..5f66a32312d 100644 --- a/mozilla/xpinstall/packager/windows/makeall.pl +++ b/mozilla/xpinstall/packager/windows/makeall.pl @@ -50,6 +50,7 @@ $inStagePath = $ARGV[2]; $inDistPath = $ARGV[3]; $seiFileNameGeneric = "nsinstall.exe"; $seiFileNameSpecific = "mozilla-win32-installer.exe"; +$userAgent = "5.0b1 (en)"; # Check for existance of staging path if(!(-e "$inStagePath")) @@ -112,7 +113,7 @@ sub MakeJsFile my($componentName) = @_; # Make .js file - if(system("perl makejs.pl $componentName.jst $inDefaultVersion $inStagePath\\$componentName") != 0) + if(system("perl makejs.pl $componentName.jst $inDefaultVersion \"$userAgent\" $inStagePath\\$componentName") != 0) { exit(1); } diff --git a/mozilla/xpinstall/packager/windows/makejs.pl b/mozilla/xpinstall/packager/windows/makejs.pl index 5dc30031981..746937936b4 100644 --- a/mozilla/xpinstall/packager/windows/makejs.pl +++ b/mozilla/xpinstall/packager/windows/makejs.pl @@ -27,24 +27,26 @@ # in the format of $Variable$ and replace it with the appropriate # value(s). # -# Input: .jst file - which is a .js template -# default version - a julian date in the form of: -# major.minor.release.yydoy -# ie: 5.0.0.99256 -# staging path - path to where the components are staged at +# Input: .jst file - which is a .js template +# default version - a julian date in the form of: +# major.minor.release.yydoy +# ie: 5.0.0.99256 +# user agent - user agent of product +# component staging path - path to where the components are staged at # # ie: perl makejs.pl core.jst 5.0.0.99256 # # Make sure there are at least two arguments -if($#ARGV < 2) +if($#ARGV < 3) { - die "usage: $0 <.jst file> + die "usage: $0 <.jst file> .jst file : .js template input file default version : default julian base version number to use in the form of: major.minor.release.yydoy ie: 5.0.0.99256 + user agent : user agent of product (5.0b1 [en]) component staging path : path to where this component is staged at ie: z:\\stage\\windows\\32bit\\en\\5.0\\core \n"; @@ -52,7 +54,8 @@ if($#ARGV < 2) $inJstFile = $ARGV[0]; $inVersion = $ARGV[1]; -$inStagePath = $ARGV[2]; +$inUserAgent = $ARGV[2]; +$inStagePath = $ARGV[3]; # Get the name of the file replacing the .jst extension with a .js extension @inJstFileSplit = split(/\./,$inJstFile); @@ -78,6 +81,10 @@ while($line = ) { $line =~ s/\$Version\$/$inVersion/i; } + elsif($line =~ /\$UserAgent\$/i) + { + $line =~ s/\$UserAgent\$/$inUserAgent/i; + } elsif($line =~ /\$SpaceRequired\$/i) # For each line read, search and replace $InstallSize$ with the calculated size { $spaceRequired = 0; diff --git a/mozilla/xpinstall/wizard/windows/setup/dialogs.c b/mozilla/xpinstall/wizard/windows/setup/dialogs.c index 02a245ed1c0..97c4cdd3b3a 100644 --- a/mozilla/xpinstall/wizard/windows/setup/dialogs.c +++ b/mozilla/xpinstall/wizard/windows/setup/dialogs.c @@ -527,6 +527,13 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara DlgSequenceNext(); break; + case IDC_README: + if(*diSetupType.szReadmeApp == '\0') + WinSpawn(diSetupType.szReadmeFilename, NULL, szSetupDir, SW_SHOWNORMAL, FALSE); + else + WinSpawn(diSetupType.szReadmeApp, diSetupType.szReadmeFilename, szSetupDir, SW_SHOWNORMAL, FALSE); + break; + case ID_WIZNEXT: GetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szTempSetupPath, MAX_PATH); lstrcpy(sgProduct.szPath, szTempSetupPath); diff --git a/mozilla/xpinstall/wizard/windows/setup/extra.c b/mozilla/xpinstall/wizard/windows/setup/extra.c index 9e94ab0f577..35a5c52728c 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extra.c +++ b/mozilla/xpinstall/wizard/windows/setup/extra.c @@ -603,7 +603,7 @@ HRESULT RetrieveArchives() any jar files needed to be downloaded */ if(FileExists(szFileIdiGetArchives)) { - DecriptString(szBuf, siSDObject.szCoreDir); + DecryptString(szBuf, siSDObject.szCoreDir); lstrcpy(siSDObject.szCoreDir, szBuf); WritePrivateProfileString("Netscape Install", "core_file", siSDObject.szCoreFile, szFileIdiGetArchives); @@ -926,6 +926,10 @@ HRESULT InitDlgSetupType(diST *diDialog) return(1); if((diDialog->szMessage0 = NS_GlobalAlloc(MAX_BUF)) == NULL) return(1); + if((diDialog->szReadmeFilename = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); + if((diDialog->szReadmeApp = NS_GlobalAlloc(MAX_BUF)) == NULL) + return(1); diDialog->stSetupType0.dwItems = 0; diDialog->stSetupType1.dwItems = 0; @@ -959,6 +963,8 @@ void DeInitDlgSetupType(diST *diDialog) FreeMemory(&(diDialog->szTitle)); FreeMemory(&(diDialog->szMessage0)); + FreeMemory(&(diDialog->szReadmeFilename)); + FreeMemory(&(diDialog->szReadmeApp)); FreeMemory(&(diDialog->stSetupType0.szDescriptionShort)); FreeMemory(&(diDialog->stSetupType0.szDescriptionLong)); FreeMemory(&(diDialog->stSetupType1.szDescriptionShort)); @@ -1978,7 +1984,7 @@ void InitSiComponents(char *szFileIni) /* get commandline parameter for component */ GetPrivateProfileString(szComponentItem, "Parameter", "", szBuf, MAX_BUF, szFileIni); - DecriptString(siCTemp->szParameter, szBuf); + DecryptString(siCTemp->szParameter, szBuf); /* get install size required in destination for component. Sould be in Kilobytes */ GetPrivateProfileString(szComponentItem, "Install Size", "", szBuf, MAX_BUF, szFileIni); @@ -2305,18 +2311,23 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) GetPrivateProfileString("General", "Product Name", "", sgProduct.szProductName, MAX_BUF, szFileIniConfig); /* get main install path */ - GetPrivateProfileString("General", "Path", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(sgProduct.szPath, szBuf); + if(LocatePreviousPath(sgProduct.szPath, MAX_PATH) == FALSE) + { + GetPrivateProfileString("General", "Path", "", szBuf, MAX_BUF, szFileIniConfig); + DecryptString(sgProduct.szPath, szBuf); + } + RemoveBackSlash(sgProduct.szPath); + /* make a copy of sgProduct.szPath to be used in the Setup Type dialog */ lstrcpy(szTempSetupPath, sgProduct.szPath); /* get main program folder path */ GetPrivateProfileString("General", "Program Folder Path", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(sgProduct.szProgramFolderPath, szBuf); + DecryptString(sgProduct.szProgramFolderPath, szBuf); /* get main program folder name */ GetPrivateProfileString("General", "Program Folder Name", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(sgProduct.szProgramFolderName, szBuf); + DecryptString(sgProduct.szProgramFolderName, szBuf); /* get setup title strings */ GetPrivateProfileString("General", "Setup Title0", "", sgProduct.szSetupTitle0, MAX_BUF, szFileIniConfig); @@ -2324,26 +2335,28 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) GetPrivateProfileString("General", "Setup Title2", "", sgProduct.szSetupTitle2, MAX_BUF, szFileIniConfig); /* Welcome dialog */ - GetPrivateProfileString("Dialog Welcome", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Welcome", "Title", "", diWelcome.szTitle, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Welcome", "Message0", "", diWelcome.szMessage0, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Welcome", "Message1", "", diWelcome.szMessage1, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Welcome", "Message2", "", diWelcome.szMessage2, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Welcome", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Welcome", "Title", "", diWelcome.szTitle, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Welcome", "Message0", "", diWelcome.szMessage0, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Welcome", "Message1", "", diWelcome.szMessage1, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Welcome", "Message2", "", diWelcome.szMessage2, MAX_BUF, szFileIniConfig); if(lstrcmpi(szShowDialog, "TRUE") == 0) diWelcome.bShowDialog = TRUE; /* License dialog */ - GetPrivateProfileString("Dialog License", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog License", "Title", "", diLicense.szTitle, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog License", "License File", "", diLicense.szLicenseFilename, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog License", "Message0", "", diLicense.szMessage0, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog License", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog License", "Title", "", diLicense.szTitle, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog License", "License File", "", diLicense.szLicenseFilename, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog License", "Message0", "", diLicense.szMessage0, MAX_BUF, szFileIniConfig); if(lstrcmpi(szShowDialog, "TRUE") == 0) diLicense.bShowDialog = TRUE; /* Setup Type dialog */ - GetPrivateProfileString("Dialog Setup Type", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Setup Type", "Title", "", diSetupType.szTitle, MAX_BUF, szFileIniConfig); - GetPrivateProfileString("Dialog Setup Type", "Message0", "", diSetupType.szMessage0, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Setup Type", "Show Dialog", "", szShowDialog, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Setup Type", "Title", "", diSetupType.szTitle, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Setup Type", "Message0", "", diSetupType.szMessage0, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Setup Type", "Readme Filename", "", diSetupType.szReadmeFilename, MAX_BUF, szFileIniConfig); + GetPrivateProfileString("Dialog Setup Type", "Readme App", "", diSetupType.szReadmeApp, MAX_BUF, szFileIniConfig); if(lstrcmpi(szShowDialog, "TRUE") == 0) diSetupType.bShowDialog = TRUE; @@ -2532,9 +2545,9 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) GetPrivateProfileString("SmartDownload-Execution", "exe_param", "", siSDObject.szExeParam, MAX_BUF, szFileIniConfig); GetPrivateProfileString("Core", "Source", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(siCFCoreFile.szSource, szBuf); + DecryptString(siCFCoreFile.szSource, szBuf); GetPrivateProfileString("Core", "Destination", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(siCFCoreFile.szDestination, szBuf); + DecryptString(siCFCoreFile.szDestination, szBuf); GetPrivateProfileString("Core", "Message", "", siCFCoreFile.szMessage, MAX_BUF, szFileIniConfig); GetPrivateProfileString("Core", "Cleanup", "", szBuf, MAX_BUF, szFileIniConfig); if(lstrcmpi(szBuf, "FALSE") == 0) @@ -2554,6 +2567,118 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) return(0); } +BOOL LocatePreviousPath(LPSTR szPath, DWORD dwPathSize) +{ + DWORD dwIndex; + char szIndex[MAX_BUF]; + char szSection[MAX_BUF]; + char szHKey[MAX_BUF]; + char szHRoot[MAX_BUF]; + char szName[MAX_BUF]; + char szVerifyExistance[MAX_BUF]; + char szBuf[MAX_BUF]; + BOOL bDecryptKey; + BOOL bContainsFilename; + BOOL bReturn; + HKEY hkeyRoot; + + bReturn = FALSE; + dwIndex = 0; + itoa(dwIndex, szIndex, 10); + lstrcpy(szSection, "Locate Previous Product Path"); + lstrcat(szSection, szIndex); + GetPrivateProfileString(szSection, "HKey", "", szHKey, MAX_BUF, szFileIniConfig); + while(*szHKey != '\0') + { + bReturn = FALSE; + ZeroMemory(szPath, dwPathSize); + + GetPrivateProfileString(szSection, "HRoot", "", szHRoot, MAX_BUF, szFileIniConfig); + GetPrivateProfileString(szSection, "Name", "", szName, MAX_BUF, szFileIniConfig); + GetPrivateProfileString(szSection, "Verify Existance", "", szVerifyExistance, MAX_BUF, szFileIniConfig); + GetPrivateProfileString(szSection, "Decrypt HKey", "", szBuf, MAX_BUF, szFileIniConfig); + if(lstrcmpi(szBuf, "FALSE") == 0) + bDecryptKey = FALSE; + else + bDecryptKey = TRUE; + + GetPrivateProfileString(szSection, "Contains Filename", "", szBuf, MAX_BUF, szFileIniConfig); + if(lstrcmpi(szBuf, "FALSE") == 0) + bContainsFilename = FALSE; + else + bContainsFilename = TRUE; + + if(lstrcmpi(szHRoot, "HKEY_CLASSES_ROOT") == 0) + hkeyRoot = HKEY_CLASSES_ROOT; + else if(lstrcmpi(szHRoot, "HKEY_CURRENT_CONFIG") == 0) + hkeyRoot = HKEY_CURRENT_CONFIG; + else if(lstrcmpi(szHRoot, "HKEY_CURRENT_USER") == 0) + hkeyRoot = HKEY_CURRENT_USER; + else if(lstrcmpi(szHRoot, "HKEY_LOCAL_MACHINE") == 0) + hkeyRoot = HKEY_LOCAL_MACHINE; + else if(lstrcmpi(szHRoot, "HKEY_USERS") == 0) + hkeyRoot = HKEY_USERS; + + if(bDecryptKey == TRUE) + { + DecryptString(szBuf, szHKey); + lstrcpy(szHKey, szBuf); + } + + GetWinReg(hkeyRoot, szHKey, szName, szBuf, sizeof(szBuf)); + if(*szBuf != '\0') + { + if(lstrcmpi(szVerifyExistance, "FILE") == 0) + { + if(FileExists(szBuf)) + { + if(bContainsFilename == TRUE) + ParsePath(szBuf, szPath, dwPathSize, PP_PATH_ONLY); + else + lstrcpy(szPath, szBuf); + + bReturn = TRUE; + } + else + bReturn = FALSE; + } + else if(lstrcmpi(szVerifyExistance, "PATH") == 0) + { + if(bContainsFilename == TRUE) + ParsePath(szBuf, szPath, dwPathSize, PP_PATH_ONLY); + else + lstrcpy(szPath, szBuf); + + if(FileExists(szPath)) + bReturn = TRUE; + else + bReturn = FALSE; + } + else + { + if(bContainsFilename == TRUE) + ParsePath(szBuf, szPath, dwPathSize, PP_PATH_ONLY); + else + lstrcpy(szPath, szBuf); + + bReturn = TRUE; + } + + // break if a valid path was found, else keep looking + if(bReturn == TRUE) + break; + } + + ++dwIndex; + itoa(dwIndex, szIndex, 10); + lstrcpy(szSection, "Locate Previous Product Path"); + lstrcat(szSection, szIndex); + GetPrivateProfileString(szSection, "HKey", "", szHKey, MAX_BUF, szFileIniConfig); + } + + return(bReturn); +} + void SetCustomType() { if(diSetupType.stSetupType3.bVisible == TRUE) @@ -2606,13 +2731,14 @@ void GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue, D DWORD dwErr; char szBuf[MAX_BUF]; - memset(szBuf, '\0', MAX_BUF); + ZeroMemory(szBuf, sizeof(szBuf)); + ZeroMemory(szReturnValue, dwSize); if((dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_READ, &hkResult)) == ERROR_SUCCESS) { dwErr = RegQueryValueEx(hkResult, szName, 0, NULL, szBuf, &dwSize); - if((*szReturnValue != '\0') && (dwErr == ERROR_SUCCESS)) + if((*szBuf != '\0') && (dwErr == ERROR_SUCCESS)) ExpandEnvironmentStrings(szBuf, szReturnValue, MAX_BUF); else *szReturnValue = '\0'; @@ -2651,7 +2777,7 @@ void SetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, DWORD dwType, LPSTR sz } } -HRESULT DecriptVariable(LPSTR szVariable, DWORD dwVariableSize) +HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize) { char szBuf[MAX_BUF]; char szKey[MAX_BUF]; @@ -2659,10 +2785,10 @@ HRESULT DecriptVariable(LPSTR szVariable, DWORD dwVariableSize) char szValue[MAX_BUF]; /* zero out the memory allocations */ - ZeroMemory(szBuf, sizeof(szBuf)); - ZeroMemory(szKey, sizeof(szKey)); - ZeroMemory(szName, sizeof(szName)); - ZeroMemory(szValue, sizeof(szValue)); + ZeroMemory(szBuf, sizeof(szBuf)); + ZeroMemory(szKey, sizeof(szKey)); + ZeroMemory(szName, sizeof(szName)); + ZeroMemory(szValue, sizeof(szValue)); if(lstrcmpi(szVariable, "PROGRAMFILESDIR") == 0) { @@ -2915,13 +3041,33 @@ HRESULT DecriptVariable(LPSTR szVariable, DWORD dwVariableSize) AppendBackSlash(szVariable, dwVariableSize); lstrcat(szVariable, sgProduct.szProgramFolderName); } + else if(lstrcmpi(szVariable, "Netscape Seamonkey CurrentVersion") == 0) + { + /* parse for the current Netscape WinReg key */ + GetWinReg(HKEY_LOCAL_MACHINE, "Software\\Netscape\\Netscape Seamonkey", "CurrentVersion", szBuf, sizeof(szBuf)); + + if(*szBuf == '\0') + return(FALSE); + + wsprintf(szVariable, "Software\\Netscape\\Netscape Seamonkey\\%s", szBuf); + } + else if(lstrcmpi(szVariable, "Mozilla Seamonkey CurrentVersion") == 0) + { + /* parse for the current Mozilla WinReg key */ + GetWinReg(HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Mozilla Seamonkey", "CurrentVersion", szBuf, sizeof(szBuf)); + + if(*szBuf == '\0') + return(FALSE); + + wsprintf(szVariable, "Software\\Mozilla\\Mozilla Seamonkey\\%s", szBuf); + } else return(FALSE); return(TRUE); } -HRESULT DecriptString(LPSTR szOutputStr, LPSTR szInputStr) +HRESULT DecryptString(LPSTR szOutputStr, LPSTR szInputStr) { DWORD dwLenInputStr; DWORD dwCounter; @@ -2935,7 +3081,7 @@ HRESULT DecriptString(LPSTR szOutputStr, LPSTR szInputStr) char szResultStr[MAX_BUF]; BOOL bFoundVar; BOOL bBeginParse; - BOOL bDecripted; + BOOL bDecrypted; /* zero out the memory addresses */ memset(szBuf, '\0', MAX_BUF); @@ -3008,14 +3154,14 @@ HRESULT DecriptString(LPSTR szOutputStr, LPSTR szInputStr) } RemoveBackSlash(szVariable); - bDecripted = TRUE; + bDecrypted = TRUE; } else { - bDecripted = DecriptVariable(szVariable, MAX_BUF); + bDecrypted = DecryptVariable(szVariable, MAX_BUF); } - if(!bDecripted) + if(!bDecrypted) { /* Variable was not able to be dcripted. */ /* Leave the variable as it was read in by adding the '[' and ']' */ @@ -3030,9 +3176,9 @@ HRESULT DecriptString(LPSTR szOutputStr, LPSTR szInputStr) lstrcat(szOutputStr, szVariable); lstrcat(szOutputStr, szAppend); - if(bDecripted) + if(bDecrypted) { - DecriptString(szResultStr, szOutputStr); + DecryptString(szResultStr, szOutputStr); lstrcpy(szOutputStr, szResultStr); } } diff --git a/mozilla/xpinstall/wizard/windows/setup/extra.h b/mozilla/xpinstall/wizard/windows/setup/extra.h index 29fb406b6b7..f2588fd4b09 100644 --- a/mozilla/xpinstall/wizard/windows/setup/extra.h +++ b/mozilla/xpinstall/wizard/windows/setup/extra.h @@ -35,8 +35,8 @@ HRESULT NS_LoadStringAlloc(HANDLE hInstance, DWORD dwID, LPSTR *szStri HRESULT NS_LoadString(HANDLE hInstance, DWORD dwID, LPSTR szStringBuf, DWORD dwStringBuf); HRESULT WinSpawn(LPSTR szClientName, LPSTR szParameters, LPSTR szCurrentDir, int iShowCmd, BOOL bWait); HRESULT ParseConfigIni(LPSTR lpszCmdLine); -HRESULT DecriptString(LPSTR szOutputStr, LPSTR szInputStr); -HRESULT DecriptVariable(LPSTR szVariable, DWORD dwVariableSize); +HRESULT DecryptString(LPSTR szOutputStr, LPSTR szInputStr); +HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize); void GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue, DWORD dwSize); void SetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, DWORD dwType, LPSTR szData, DWORD dwSize); HRESULT InitSetupGeneral(void); @@ -114,6 +114,7 @@ HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSReq void SetCustomType(void); void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine); BOOL NeedReboot(void); +BOOL LocatePreviousPath(LPSTR szPath, DWORD dwPathSize); BOOL bSDInit; diff --git a/mozilla/xpinstall/wizard/windows/setup/ifuncns.c b/mozilla/xpinstall/wizard/windows/setup/ifuncns.c index cbf1cc276f4..35d964a1758 100644 --- a/mozilla/xpinstall/wizard/windows/setup/ifuncns.c +++ b/mozilla/xpinstall/wizard/windows/setup/ifuncns.c @@ -177,9 +177,9 @@ HRESULT ProcessUncompressFile(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection, szFileIniConfig)) { - DecriptString(szSource, szBuf); + DecryptString(szSource, szBuf); GetPrivateProfileString(szSection, "Destination", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szDestination, szBuf); + DecryptString(szDestination, szBuf); GetPrivateProfileString(szSection, "Message", "", szBuf, MAX_BUF, szFileIniConfig); ShowMessage(szBuf, TRUE); @@ -275,9 +275,9 @@ HRESULT ProcessMoveFile(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection, szFileIniConfig)) { - DecriptString(szSource, szBuf); + DecryptString(szSource, szBuf); GetPrivateProfileString(szSection, "Destination", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szDestination, szBuf); + DecryptString(szDestination, szBuf); FileMove(szSource, szDestination); } @@ -363,9 +363,9 @@ HRESULT ProcessCopyFile(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection, szFileIniConfig)) { - DecriptString(szSource, szBuf); + DecryptString(szSource, szBuf); GetPrivateProfileString(szSection, "Destination", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szDestination, szBuf); + DecryptString(szDestination, szBuf); GetPrivateProfileString(szSection, "Fail If Exists", "", szBuf, MAX_BUF, szFileIniConfig); if(lstrcmpi(szBuf, "TRUE") == 0) @@ -425,7 +425,7 @@ HRESULT ProcessCreateDirectory(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection, szFileIniConfig)) { - DecriptString(szDestination, szBuf); + DecryptString(szDestination, szBuf); AppendBackSlash(szDestination, sizeof(szDestination)); CreateDirectoriesAll(szDestination); } @@ -498,7 +498,7 @@ HRESULT ProcessDeleteFile(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection, szFileIniConfig)) { - DecriptString(szDestination, szBuf); + DecryptString(szDestination, szBuf); FileDelete(szDestination); } @@ -576,7 +576,7 @@ HRESULT ProcessRemoveDirectory(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection, szFileIniConfig)) { - DecriptString(szDestination, szBuf); + DecryptString(szDestination, szBuf); GetPrivateProfileString(szSection, "Remove subdirs", "", szBuf, MAX_BUF, szFileIniConfig); bRemoveSubdirs = FALSE; if(lstrcmpi(szBuf, "TRUE") == 0) @@ -614,11 +614,11 @@ HRESULT ProcessRunApp(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection, szFileIniConfig)) { - DecriptString(szTarget, szBuf); + DecryptString(szTarget, szBuf); GetPrivateProfileString(szSection, "Parameters", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szParameters, szBuf); + DecryptString(szParameters, szBuf); GetPrivateProfileString(szSection, "WorkingDir", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szWorkingDir, szBuf); + DecryptString(szWorkingDir, szBuf); GetPrivateProfileString(szSection, "Wait", "", szBuf, MAX_BUF, szFileIniConfig); if(lstrcmpi(szBuf, "FALSE") == 0) @@ -671,7 +671,7 @@ HRESULT ProcessProgramFolder(DWORD dwTiming) { if(TimingCheck(dwTiming, szSection0, szFileIniConfig)) { - DecriptString(szProgramFolder, szBuf); + DecryptString(szProgramFolder, szBuf); dwIndex1 = 0; itoa(dwIndex1, szIndex1, 10); @@ -681,15 +681,15 @@ HRESULT ProcessProgramFolder(DWORD dwTiming) GetPrivateProfileString(szSection1, "File", "", szBuf, MAX_BUF, szFileIniConfig); while(*szBuf != '\0') { - DecriptString(szFile, szBuf); + DecryptString(szFile, szBuf); GetPrivateProfileString(szSection1, "Arguments", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szArguments, szBuf); + DecryptString(szArguments, szBuf); GetPrivateProfileString(szSection1, "Working Dir", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szWorkingDir, szBuf); + DecryptString(szWorkingDir, szBuf); GetPrivateProfileString(szSection1, "Description", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szDescription, szBuf); + DecryptString(szDescription, szBuf); GetPrivateProfileString(szSection1, "Icon Path", "", szBuf, MAX_BUF, szFileIniConfig); - DecriptString(szIconPath, szBuf); + DecryptString(szIconPath, szBuf); GetPrivateProfileString(szSection1, "Icon Id", "", szBuf, MAX_BUF, szFileIniConfig); if(*szBuf != '\0') dwIconId = atol(szBuf); @@ -732,7 +732,7 @@ HRESULT ProcessProgramFolderShowCmd() GetPrivateProfileString(szSection0, "Program Folder", "", szBuf, MAX_BUF, szFileIniConfig); while(*szBuf != '\0') { - DecriptString(szProgramFolder, szBuf); + DecryptString(szProgramFolder, szBuf); GetPrivateProfileString(szSection0, "Show Folder", "", szBuf, MAX_BUF, szFileIniConfig); if(strcmpi(szBuf, "HIDE") == 0) diff --git a/mozilla/xpinstall/wizard/windows/setup/setup.h b/mozilla/xpinstall/wizard/windows/setup/setup.h index 0a2492636fe..1ad4ad77a8c 100644 --- a/mozilla/xpinstall/wizard/windows/setup/setup.h +++ b/mozilla/xpinstall/wizard/windows/setup/setup.h @@ -169,6 +169,8 @@ typedef struct dlgSetupType BOOL bShowDialog; LPSTR szTitle; LPSTR szMessage0; + LPSTR szReadmeFilename; + LPSTR szReadmeApp; st stSetupType0; st stSetupType1; st stSetupType2; diff --git a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h index 12b8631426e..b614a3bf94b 100644 --- a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h +++ b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.h @@ -74,6 +74,8 @@ #define IDC_STATIC_MSG0 1046 #define IDC_MESSAGE 1049 #define IDC_LIST1 1053 +#define IDC_BUTTON1 1055 +#define IDC_README 1055 #define DLG_WELCOME 2001 #define DLG_LICENSE 2002 #define DLG_SETUP_TYPE 2003 @@ -102,9 +104,9 @@ #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 -#define _APS_NEXT_RESOURCE_VALUE 111 +#define _APS_NEXT_RESOURCE_VALUE 112 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1055 +#define _APS_NEXT_CONTROL_VALUE 1058 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc index 428d39c3cac..018b196ed97 100644 --- a/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc +++ b/mozilla/xpinstall/wizard/windows/setuprsc/setuprsc.rc @@ -69,7 +69,7 @@ END DLG_SETUP_TYPE DIALOGEX 51, 56, 315, 205 STYLE WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -FONT 8, "MS Sans Serif", 0, 0, 0x1 +FONT 8, "MS Sans Serif" BEGIN CONTROL "",IDC_RADIO_ST0,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,102,31,65,8 @@ -82,7 +82,6 @@ BEGIN LTEXT "",IDC_STATIC_ST1_DESCRIPTION,175,59,126,24 LTEXT "",IDC_STATIC_ST2_DESCRIPTION,175,86,126,24 GROUPBOX "&Destination Directory",IDC_STATIC,101,147,204,27 - EDITTEXT IDC_EDIT_DESTINATION,106,157,144,12,ES_AUTOHSCROLL PUSHBUTTON "B&rowse...",IDC_BUTTON_BROWSE,255,157,46,12 PUSHBUTTON "< &Back",ID_WIZBACK,134,186,53,12 DEFPUSHBUTTON "&Next >",ID_WIZNEXT,188,186,53,12 @@ -92,6 +91,8 @@ BEGIN WS_EX_CLIENTEDGE CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,11,179,295,1, WS_EX_STATICEDGE + PUSHBUTTON "Readme",IDC_README,11,186,53,12 + LTEXT "Static",IDC_EDIT_DESTINATION,107,160,144,9 END DLG_SELECT_COMPONENTS DIALOGEX 51, 56, 315, 205