зеркало из https://github.com/mozilla/gecko-dev.git
fixing bugs:
16068 16465 25595 27587 27598 18563 23240 34664 34621 33348 affects only Windows platforms.
This commit is contained in:
Родитель
e356de6476
Коммит
98048e5bbc
|
@ -1,3 +1,152 @@
|
|||
function createShortcuts()
|
||||
{
|
||||
var subkey;
|
||||
var valname;
|
||||
var szStartMenuPrograms;
|
||||
var szStartMenu;
|
||||
var szFolderDesktop;
|
||||
var szFolderQuickLaunch;
|
||||
var szFolderSendTo;
|
||||
var winreg;
|
||||
var fWindows;
|
||||
var fTemp;
|
||||
var fCommunicator;
|
||||
var fileExe;
|
||||
var scExeDesc;
|
||||
var scProfileDesc;
|
||||
var scProfileDescParam;
|
||||
var scFolderName;
|
||||
var fFolderPath;
|
||||
var fFolderPathStr;
|
||||
var is_winnt;
|
||||
var szCurrentVersion;
|
||||
|
||||
winreg = getWinRegistry();
|
||||
fWindows = getFolder("Windows");
|
||||
fCommunicator = getFolder("Communicator");
|
||||
fTemp = fCommunicator + "\\mozilla.exe";
|
||||
fileExe = getFolder("file:///", fTemp);
|
||||
scExeDesc = "Mozilla Seamonkey";
|
||||
scProfileDesc = "Profile Manager";
|
||||
scProfileDescParam = "-ProfileManager";
|
||||
scFolderName = "Mozilla Seamonkey";
|
||||
if(winreg != null)
|
||||
{
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
subkey = "SOFTWARE\\Mozilla\\Mozilla Seamonkey\\$UserAgent$\\Main";
|
||||
valname = "Program Folder Path";
|
||||
fFolderPathStr = winreg.getValueString(subkey, valname);
|
||||
if((fFolderPathStr == "") || (fFolderPathStr == null))
|
||||
{
|
||||
/* determine if the script is running under NT or not */
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
|
||||
valname = "CurrentVersion";
|
||||
szCurrentVersion = winreg.getValueString(subkey, valname);
|
||||
logComment("szCurrentVersion: " + szCurrentVersion);
|
||||
if((szCurrentVersion == "") || (szCurrentVersion == null))
|
||||
{
|
||||
is_winnt = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
is_winnt = true;
|
||||
}
|
||||
|
||||
if(is_winnt == false)
|
||||
{
|
||||
logComment("is_winnt is false: " + is_winnt);
|
||||
|
||||
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
||||
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
||||
valname = "Programs";
|
||||
szStartMenuPrograms = winreg.getValueString(subkey, valname);
|
||||
valname = "Start Menu";
|
||||
szStartMenu = winreg.getValueString(subkey, valname);
|
||||
valname = "Desktop";
|
||||
szFolderDesktop = winreg.getValueString(subkey, valname);
|
||||
}
|
||||
else
|
||||
{
|
||||
logComment("is_winnt is true: " + is_winnt);
|
||||
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
||||
valname = "Common Programs";
|
||||
szStartMenuPrograms = winreg.getValueString(subkey, valname);
|
||||
valname = "Common Start Menu";
|
||||
szStartMenu = winreg.getValueString(subkey, valname);
|
||||
valname = "Common Desktop";
|
||||
szFolderDesktop = winreg.getValueString(subkey, valname);
|
||||
}
|
||||
|
||||
winreg.setRootKey(winreg.HKEY_CURRENT_USER);
|
||||
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
|
||||
valname = "SendTo";
|
||||
szFolderSendTo = winreg.getValueString(subkey, valname);
|
||||
|
||||
subkey = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GrpConv\\MapGroups";
|
||||
valname = "Quick Launch";
|
||||
szFolderQuickLaunch = winreg.getValueString(subkey, valname);
|
||||
|
||||
fTemp = szStartMenuPrograms + "\\" + scFolderName;
|
||||
fFolderPath = getFolder("file:///", fTemp);
|
||||
|
||||
logComment("Folder StartMenuPrograms: " + szStartMenuPrograms);
|
||||
logComment("Folder StartMenu: " + szStartMenu);
|
||||
logComment("Folder FolderDesktop: " + szFolderDesktop);
|
||||
logComment("Folder FolderSendTo: " + szFolderSendTo);
|
||||
logComment("Folder FolderQuickLaunch: " + szFolderQuickLaunch);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* convert the path string to a path folder object */
|
||||
fFolderPath = getFolder("file:///", fFolderPathStr);
|
||||
}
|
||||
|
||||
logComment("fileExe: " + fileExe);
|
||||
logComment("fFolderPath: " + fFolderPath);
|
||||
logComment("scExeDesc: " + scExeDesc);
|
||||
logComment("fCommunicator : " + fCommunicator);
|
||||
|
||||
/* explicitly create the fFolderPath even though the windowsShortcut function creates the folder.
|
||||
* This is so that the folder creation gets logged for uninstall to remove it. */
|
||||
File.dirCreate(fFolderPath);
|
||||
|
||||
/* create the shortcuts */
|
||||
File.windowsShortcut(fileExe, fFolderPath, scExeDesc, fCommunicator, "", fileExe, 0);
|
||||
File.windowsShortcut(fileExe, fFolderPath, scProfileDesc, fCommunicator, scProfileDescParam, fileExe, 0);
|
||||
|
||||
/* set the Program Folder Path in the Mozilla key in the Windows Registry */
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
subkey = "SOFTWARE\\Mozilla";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
valname = "CurrentVersion";
|
||||
subkey = "SOFTWARE\\Mozilla\\Mozilla Seamonkey";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
valname = "CurrentVersion";
|
||||
value = "$UserAgent$";
|
||||
err = winreg.setValueString(subkey, valname, value);
|
||||
|
||||
subkey = "SOFTWARE\\Mozilla\\Mozilla Seamonkey\\$UserAgent$";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
subkey = "SOFTWARE\\Mozilla\\Mozilla Seamonkey\\$UserAgent$\\Main";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
valname = "Program Folder Path";
|
||||
value = fFolderPath;
|
||||
err = winreg.setValueString(subkey, valname, value);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
logComment("winreg is null");
|
||||
}
|
||||
}
|
||||
|
||||
function updateWinReg()
|
||||
{
|
||||
//Notes:
|
||||
|
@ -11,27 +160,35 @@ function updateWinReg()
|
|||
if(winreg != null)
|
||||
{
|
||||
winreg.setRootKey(winreg.HKEY_LOCAL_MACHINE);
|
||||
subkey = "SOFTWARE\\Netscape\\Netscape Seamonkey";
|
||||
subkey = "SOFTWARE\\Mozilla";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
subkey = "SOFTWARE\\Mozilla\\Mozilla Seamonkey";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
valname = "CurrentVersion";
|
||||
value = "$UserAgent$";
|
||||
err = winreg.setValueString(subkey, valname, value);
|
||||
|
||||
subkey = "SOFTWARE\\Netscape\\Netscape Seamonkey\\$UserAgent$\\Main";
|
||||
subkey = "SOFTWARE\\Mozilla\\Mozilla Seamonkey\\$UserAgent$";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
subkey = "SOFTWARE\\Mozilla\\Mozilla Seamonkey\\$UserAgent$\\Main";
|
||||
winreg.createKey(subkey,"");
|
||||
|
||||
valname = "Install Directory";
|
||||
value = communicatorFolder;
|
||||
value = fCommunicator;
|
||||
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";
|
||||
value = fCommunicator + "\\mozilla.exe";
|
||||
err = winreg.setValueString(subkey, valname, value);
|
||||
|
||||
valname = "Path";
|
||||
value = communicatorFolder;
|
||||
value = fCommunicator;
|
||||
err = winreg.setValueString(subkey, valname, value);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +196,7 @@ function updateWinReg()
|
|||
// main
|
||||
var srDest;
|
||||
var err;
|
||||
var communicatorFolder;
|
||||
var fCommunicator;
|
||||
var fWindowsSystem;
|
||||
var fileComponentRegStr;
|
||||
var fileComponentReg;
|
||||
|
@ -48,30 +205,31 @@ srDest = $SpaceRequired$:bin;
|
|||
err = startInstall("Mozilla Seamonkey", "Browser", "$Version$");
|
||||
logComment("startInstall: " + err);
|
||||
|
||||
communicatorFolder = getFolder("Communicator");
|
||||
fWindowsSystem = getFolder("Win System");
|
||||
logComment("communicatorFolder: " + communicatorFolder);
|
||||
fCommunicator = getFolder("Communicator");
|
||||
fWindowsSystem = getFolder("Win System");
|
||||
logComment("fCommunicator: " + fCommunicator);
|
||||
|
||||
if(verifyDiskSpace(communicatorFolder, srDest) == true)
|
||||
if(verifyDiskSpace(fCommunicator, srDest) == true)
|
||||
{
|
||||
setPackageFolder(communicatorFolder);
|
||||
setPackageFolder(fCommunicator);
|
||||
err = addDirectory("",
|
||||
"$Version$",
|
||||
"bin", // dir name in jar to extract
|
||||
communicatorFolder, // Where to put this file (Returned from GetFolder)
|
||||
"", // subdir name to create relative to communicatorFolder
|
||||
fCommunicator, // Where to put this file (Returned from GetFolder)
|
||||
"", // subdir name to create relative to fCommunicator
|
||||
true); // Force Flag
|
||||
logComment("addDirectory() of Program returned: " + err);
|
||||
|
||||
// check return value
|
||||
if(!checkError(err))
|
||||
{
|
||||
fileComponentRegStr = communicatorFolder + "\\component.reg";
|
||||
fileComponentRegStr = fCommunicator + "\\component.reg";
|
||||
fileComponentReg = getFolder("file:///", fileComponentRegStr);
|
||||
err = fileDelete(fileComponentReg);
|
||||
logComment("fileDelete() returned: " + err);
|
||||
|
||||
updateWinReg();
|
||||
createShortcuts();
|
||||
|
||||
err = finalizeInstall();
|
||||
logComment("finalizeInstall() returned: " + err);
|
||||
|
|
|
@ -58,7 +58,7 @@ Default Setup Type=Setup Type 0
|
|||
; Default Font Size is 32
|
||||
; Default Font Color is WHITE (of BLACK and GREEN)
|
||||
; Default Font Shadow is TRUE
|
||||
Setup Title0=Mozilla Seamonkey Setup
|
||||
Setup Title0=Mozilla Seamonkey Pr2 Setup
|
||||
Setup Title0 Font Size=
|
||||
Setup Title0 Font Color=
|
||||
Setup Title0 Font Shadow=TRUE
|
||||
|
@ -199,7 +199,7 @@ Message0=Setup will add program icons to the Program Folder listed below. You m
|
|||
[Dialog Site Selector]
|
||||
Show Dialog=FALSE
|
||||
Title=Site Selector
|
||||
Message0=Select the region you wish to download from, or leave it on Default for Setup to automatically determine the best place to download from releative to where you are.
|
||||
Message0=Select the region you wish to download from, or leave it on Default for Setup to automatically determine the best place to download from relative to where you are.
|
||||
|
||||
[Dialog Start Install]
|
||||
Show Dialog=FALSE
|
||||
|
@ -309,7 +309,7 @@ Server Path0=$ServerPath$
|
|||
|
||||
[Core]
|
||||
Source=[XPI PATH]\core.xpi
|
||||
Destination=[TEMP]\core.ns
|
||||
Destination=[WIZTEMP]\core.ns
|
||||
$InstallSize$:core
|
||||
Cleanup=TRUE
|
||||
Message=Preparing Install, please wait...
|
||||
|
@ -404,6 +404,19 @@ Target=[SETUP PATH]\mozilla.exe
|
|||
Parameters=-installer
|
||||
WorkingDir=[SETUP PATH]
|
||||
|
||||
[Windows Registry0]
|
||||
Root Key=HKEY_LOCAL_MACHINE
|
||||
Key=Software\Mozilla\Mozilla Seamonkey\$UserAgent$\Main
|
||||
Name=Program Folder Path
|
||||
Name Value=[Default Folder]
|
||||
Type=REG_SZ
|
||||
Decrypt Key=FALSE
|
||||
Decrypt Name=FALSE
|
||||
Decrypt Name Value=TRUE
|
||||
Overwrite Key=TRUE
|
||||
Overwrite Name=TRUE
|
||||
Timing=pre smartupdate
|
||||
|
||||
; Values for Show Folder:
|
||||
; HIDE Hides the window and activates another window.
|
||||
; MAXIMIZE Maximizes the specified window.
|
||||
|
@ -434,21 +447,21 @@ Timing=post smartupdate
|
|||
Show Folder=SHOW
|
||||
Program Folder=[Default Folder]
|
||||
|
||||
[Program Folder0-Shortcut0]
|
||||
File=[SETUP PATH]\mozilla.exe
|
||||
Arguments=
|
||||
Working Dir=[SETUP PATH]
|
||||
Description=Mozilla Seamonkey
|
||||
Icon Path=[SETUP PATH]\mozilla.exe
|
||||
Icon Id=0
|
||||
;[Program Folder0-Shortcut0]
|
||||
;File=[SETUP PATH]\mozilla.exe
|
||||
;Arguments=
|
||||
;Working Dir=[SETUP PATH]
|
||||
;Description=Mozilla Seamonkey
|
||||
;Icon Path=[SETUP PATH]\mozilla.exe
|
||||
;Icon Id=0
|
||||
|
||||
[Program Folder0-Shortcut1]
|
||||
File=[SETUP PATH]\mozilla.exe
|
||||
Arguments=-ProfileManager
|
||||
Working Dir=[SETUP PATH]
|
||||
Description=Profile Manager
|
||||
Icon Path=[SETUP PATH]\mozilla.exe
|
||||
Icon Id=0
|
||||
;[Program Folder0-Shortcut1]
|
||||
;File=[SETUP PATH]\mozilla.exe
|
||||
;Arguments=-ProfileManager
|
||||
;Working Dir=[SETUP PATH]
|
||||
;Description=Profile Manager
|
||||
;Icon Path=[SETUP PATH]\mozilla.exe
|
||||
;Icon Id=0
|
||||
|
||||
;[Program Folder0-Shortcut2]
|
||||
;File=[SETUP PATH]\bin\Net2fone.exe
|
||||
|
|
|
@ -50,7 +50,7 @@ $inXpiUrl = "ftp://not.needed.com/because/the/xpi/files/will/be/loca
|
|||
|
||||
$seiFileNameGeneric = "nsinstall.exe";
|
||||
$seiFileNameSpecific = "mozilla-win32-installer.exe";
|
||||
$userAgent = "5.0b1 (en)";
|
||||
$userAgent = "5.0b2 (en)";
|
||||
|
||||
# Check for existance of staging path
|
||||
if(!(-e "$inStagePath"))
|
||||
|
@ -104,7 +104,7 @@ exit(0);
|
|||
sub MakeConfigFile
|
||||
{
|
||||
# Make config.ini file
|
||||
if(system("perl makecfgini.pl config.it $inDefaultVersion $inStagePath $inDistPath\\xpi $inRedirIniUrl $inXpiUrl") != 0)
|
||||
if(system("perl makecfgini.pl config.it $inDefaultVersion \"$userAgent\" $inStagePath $inDistPath\\xpi $inRedirIniUrl $inXpiUrl") != 0)
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -29,9 +29,14 @@
|
|||
#
|
||||
# Input: .it file
|
||||
# - which is a .ini template
|
||||
#
|
||||
# version
|
||||
# - version to display on the blue background
|
||||
#
|
||||
# UserAgent
|
||||
# - user agent to use in the windows registry. should be the same as the one
|
||||
# built into the browser (ie "6.0b2 (en)")
|
||||
#
|
||||
# Path to staging area
|
||||
# - path on where the seamonkey built bits are staged to
|
||||
#
|
||||
|
@ -48,20 +53,23 @@
|
|||
# Either ftp:// or http:// can be used
|
||||
# ie: ftp://ftp.netscape.com/pub/seamonkey/xpi
|
||||
#
|
||||
# ie: perl makecfgini.pl config.it 5.0.0.1999120608 k:\windows\32bit\5.0 d:\builds\mozilla\dist\win32_o.obj\install\xpi ftp://ftp.netscape.com/pub/seamonkey/windows/32bit/x86/1999-09-13-10-M10 ftp://ftp.netscape.com/pub/seamonkey/windows/32bit/x86/1999-09-13-10-M10/xpi
|
||||
# ie: perl makecfgini.pl config.it 5.0.0.1999120608 "5.0b1 (en)" k:\windows\32bit\5.0 d:\builds\mozilla\dist\win32_o.obj\install\xpi ftp://ftp.netscape.com/pub/seamonkey/windows/32bit/x86/1999-09-13-10-M10 ftp://ftp.netscape.com/pub/seamonkey/windows/32bit/x86/1999-09-13-10-M10/xpi
|
||||
#
|
||||
#
|
||||
|
||||
# Make sure there are at least two arguments
|
||||
if($#ARGV < 5)
|
||||
if($#ARGV < 6)
|
||||
{
|
||||
die "usage: $0 <.it file> <version> <staging path> <.xpi path> <redirect file url> <xpi url>
|
||||
die "usage: $0 <.it file> <version> <UserAgent> <staging path> <.xpi path> <redirect file url> <xpi url>
|
||||
|
||||
.it file : input ini template file
|
||||
|
||||
version : version to be shown in setup. Typically the same version
|
||||
as show in mozilla.exe.
|
||||
|
||||
UserAgent : user agent to use in the windows registry. should be the same as the one
|
||||
built into the browser (ie \"6.0b2 (en)\")
|
||||
|
||||
staging path : path to where the components are staged at
|
||||
|
||||
.xpi path : path to where the .xpi files have been built to
|
||||
|
@ -78,10 +86,11 @@ if($#ARGV < 5)
|
|||
|
||||
$inItFile = $ARGV[0];
|
||||
$inVersion = $ARGV[1];
|
||||
$inStagePath = $ARGV[2];
|
||||
$inXpiPath = $ARGV[3];
|
||||
$inRedirIniUrl = $ARGV[4];
|
||||
$inUrl = $ARGV[5];
|
||||
$inUserAgent = $ARGV[2];
|
||||
$inStagePath = $ARGV[3];
|
||||
$inXpiPath = $ARGV[4];
|
||||
$inRedirIniUrl = $ARGV[5];
|
||||
$inUrl = $ARGV[6];
|
||||
|
||||
$inDomain;
|
||||
$inServerPath;
|
||||
|
@ -164,6 +173,7 @@ while($line = <fpInIt>)
|
|||
$line =~ s/\$Domain\$/$inDomain/i;
|
||||
$line =~ s/\$ServerPath\$/$inServerPath/i;
|
||||
$line =~ s/\$RedirIniUrl\$/$inRedirIniUrl/i;
|
||||
$line =~ s/\$UserAgent\$/$inUserAgent/i;
|
||||
print fpOutIni $line;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,12 +123,12 @@ PRInt32 nsWinRegItem::Complete()
|
|||
return aReturn;
|
||||
}
|
||||
|
||||
#define kCRK "Create Registry Key "
|
||||
#define kDRK "Delete Registry Key "
|
||||
#define kDRV "Delete Registry Value "
|
||||
#define kSRVS "Store Registry Value String "
|
||||
#define kSRVN "Store Registry Value Number "
|
||||
#define kSRV "Store Registry Value "
|
||||
#define kCRK "Create Registry Key: "
|
||||
#define kDRK "Delete Registry Key: "
|
||||
#define kDRV "Delete Registry Value: "
|
||||
#define kSRVS "Store Registry Value String: "
|
||||
#define kSRVN "Store Registry Value Number: "
|
||||
#define kSRV "Store Registry Value: "
|
||||
#define kUNK "Unknown "
|
||||
|
||||
char* nsWinRegItem::toString()
|
||||
|
|
|
@ -31,8 +31,16 @@
|
|||
#define BAR_SPACING 2
|
||||
#define BAR_WIDTH 6
|
||||
#define MAX_BUF 4096
|
||||
#define WIZ_TEMP_DIR "ns_temp"
|
||||
|
||||
char szTitle[4096];
|
||||
/* Mode of Setup to run in */
|
||||
#define NORMAL 0
|
||||
#define SILENT 1
|
||||
#define AUTO 2
|
||||
|
||||
char szTitle[MAX_BUF];
|
||||
char szCmdLineToSetup[MAX_BUF];
|
||||
DWORD dwMode;
|
||||
HINSTANCE hInst;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -58,12 +66,187 @@ GetFullTempPathName(LPCTSTR lpszFileName, DWORD dwBufferLength, LPTSTR lpszBuffe
|
|||
DWORD dwLen;
|
||||
|
||||
dwLen = GetTempPath(dwBufferLength, lpszBuffer);
|
||||
if (lpszBuffer[dwLen - 1] != '\\')
|
||||
strcat(lpszBuffer, "\\");
|
||||
strcat(lpszBuffer, WIZ_TEMP_DIR);
|
||||
|
||||
dwLen = lstrlen(lpszBuffer);
|
||||
if (lpszBuffer[dwLen - 1] != '\\')
|
||||
strcat(lpszBuffer, "\\");
|
||||
strcat(lpszBuffer, lpszFileName);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Function to remove quotes from a string */
|
||||
void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize)
|
||||
{
|
||||
char *lpszBegin;
|
||||
|
||||
if(lstrlen(lpszSrc) > iDestSize)
|
||||
return;
|
||||
|
||||
if(*lpszSrc == '\"')
|
||||
lpszBegin = &lpszSrc[1];
|
||||
else
|
||||
lpszBegin = lpszSrc;
|
||||
|
||||
lstrcpy(lpszDest, lpszBegin);
|
||||
|
||||
if(lpszDest[lstrlen(lpszDest) - 1] == '\"')
|
||||
lpszDest[lstrlen(lpszDest) - 1] = '\0';
|
||||
}
|
||||
|
||||
/* Function to locate the first non space character in a string,
|
||||
* and return a pointer to it. */
|
||||
LPSTR GetFirstNonSpace(LPSTR lpszString)
|
||||
{
|
||||
int i;
|
||||
int iStrLength;
|
||||
|
||||
iStrLength = lstrlen(lpszString);
|
||||
|
||||
for(i = 0; i < iStrLength; i++)
|
||||
{
|
||||
if(!isspace(lpszString[i]))
|
||||
return(&lpszString[i]);
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Function to return the argument count given a command line input
|
||||
* format string */
|
||||
int GetArgC(LPSTR lpszCommandLine)
|
||||
{
|
||||
int i;
|
||||
int iArgCount;
|
||||
int iStrLength;
|
||||
LPSTR lpszBeginStr;
|
||||
BOOL bFoundQuote;
|
||||
BOOL bFoundSpace;
|
||||
|
||||
iArgCount = 0;
|
||||
lpszBeginStr = GetFirstNonSpace(lpszCommandLine);
|
||||
|
||||
if(lpszBeginStr == NULL)
|
||||
return(iArgCount);
|
||||
|
||||
iStrLength = lstrlen(lpszBeginStr);
|
||||
bFoundQuote = FALSE;
|
||||
bFoundSpace = TRUE;
|
||||
|
||||
for(i = 0; i < iStrLength; i++)
|
||||
{
|
||||
if(lpszCommandLine[i] == '\"')
|
||||
{
|
||||
if(bFoundQuote == FALSE)
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundQuote = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFoundQuote = FALSE;
|
||||
}
|
||||
}
|
||||
else if(bFoundQuote == FALSE)
|
||||
{
|
||||
if(!isspace(lpszCommandLine[i]) && (bFoundSpace == TRUE))
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundSpace = FALSE;
|
||||
}
|
||||
else if(isspace(lpszCommandLine[i]))
|
||||
{
|
||||
bFoundSpace = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(iArgCount);
|
||||
}
|
||||
|
||||
/* Function to return a specific argument parameter from a given command line input
|
||||
* format string. */
|
||||
LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int iArgCount;
|
||||
int iStrLength;
|
||||
LPSTR lpszBeginStr;
|
||||
LPSTR lpszDestTemp;
|
||||
BOOL bFoundQuote;
|
||||
BOOL bFoundSpace;
|
||||
|
||||
iArgCount = 0;
|
||||
lpszBeginStr = GetFirstNonSpace(lpszCommandLine);
|
||||
|
||||
if(lpszBeginStr == NULL)
|
||||
return(NULL);
|
||||
|
||||
lpszDestTemp = (char *)calloc(iDestSize, sizeof(char));
|
||||
if(lpszDestTemp == NULL)
|
||||
{
|
||||
MessageBox(NULL, "Out of memory", NULL, MB_OK | MB_ICONEXCLAMATION);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ZeroMemory(lpszDest, iDestSize);
|
||||
iStrLength = lstrlen(lpszBeginStr);
|
||||
bFoundQuote = FALSE;
|
||||
bFoundSpace = TRUE;
|
||||
j = 0;
|
||||
|
||||
for(i = 0; i < iStrLength; i++)
|
||||
{
|
||||
if(lpszCommandLine[i] == '\"')
|
||||
{
|
||||
if(bFoundQuote == FALSE)
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundQuote = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFoundQuote = FALSE;
|
||||
}
|
||||
}
|
||||
else if(bFoundQuote == FALSE)
|
||||
{
|
||||
if(!isspace(lpszCommandLine[i]) && (bFoundSpace == TRUE))
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundSpace = FALSE;
|
||||
}
|
||||
else if(isspace(lpszCommandLine[i]))
|
||||
{
|
||||
bFoundSpace = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if((iIndex == (iArgCount - 1)) &&
|
||||
((bFoundQuote == TRUE) || (bFoundSpace == FALSE) ||
|
||||
((bFoundQuote == FALSE) && (lpszCommandLine[i] == '\"'))))
|
||||
{
|
||||
if(j < iDestSize)
|
||||
{
|
||||
lpszDestTemp[j] = lpszCommandLine[i];
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpszDestTemp[j] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RemoveQuotes(lpszDestTemp, lpszDest, iDestSize);
|
||||
free(lpszDestTemp);
|
||||
return(lpszDest);
|
||||
}
|
||||
|
||||
// this function appends a backslash at the end of a string,
|
||||
// if one does not already exists.
|
||||
void AppendBackSlash(LPSTR szInput, DWORD dwInputSize)
|
||||
|
@ -80,6 +263,29 @@ void AppendBackSlash(LPSTR szInput, DWORD dwInputSize)
|
|||
}
|
||||
}
|
||||
|
||||
HRESULT CreateDirectoriesAll(char* szPath)
|
||||
{
|
||||
int i;
|
||||
int iLen = lstrlen(szPath);
|
||||
char szCreatePath[MAX_BUF];
|
||||
HRESULT hrResult;
|
||||
|
||||
ZeroMemory(szCreatePath, MAX_BUF);
|
||||
memcpy(szCreatePath, szPath, iLen);
|
||||
for(i = 0; i < iLen; i++)
|
||||
{
|
||||
if((iLen > 1) &&
|
||||
((i != 0) && ((szPath[i] == '\\') || (szPath[i] == '/'))) &&
|
||||
(!((szPath[0] == '\\') && (i == 1)) && !((szPath[1] == ':') && (i == 2))))
|
||||
{
|
||||
szCreatePath[i] = '\0';
|
||||
hrResult = CreateDirectory(szCreatePath, NULL);
|
||||
szCreatePath[i] = szPath[i];
|
||||
}
|
||||
}
|
||||
return(hrResult);
|
||||
}
|
||||
|
||||
// This function removes a directory and its subdirectories
|
||||
HRESULT DirectoryRemove(LPSTR szDestination, BOOL bRemoveSubdirs)
|
||||
{
|
||||
|
@ -128,6 +334,29 @@ HRESULT DirectoryRemove(LPSTR szDestination, BOOL bRemoveSubdirs)
|
|||
return(0);
|
||||
}
|
||||
|
||||
void ParseCommandLine(LPSTR lpszCmdLine)
|
||||
{
|
||||
char szArgVBuf[MAX_BUF];
|
||||
int i;
|
||||
int iArgC;
|
||||
|
||||
ZeroMemory(szCmdLineToSetup, MAX_BUF);
|
||||
dwMode = NORMAL;
|
||||
iArgC = GetArgC(lpszCmdLine);
|
||||
i = 0;
|
||||
while(i < iArgC)
|
||||
{
|
||||
GetArgV(lpszCmdLine, i, szArgVBuf, sizeof(szArgVBuf));
|
||||
if((lstrcmpi(szArgVBuf, "-ms") == 0) || (lstrcmpi(szArgVBuf, "/ms") == 0))
|
||||
{
|
||||
dwMode = SILENT;
|
||||
lstrcat(szCmdLineToSetup, " /ms");
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
// Centers the specified window over the desktop. Assumes the window is
|
||||
// smaller both horizontally and vertically than the desktop
|
||||
static void
|
||||
|
@ -151,10 +380,14 @@ CenterWindow(HWND hWndDlg)
|
|||
static void
|
||||
SetStatusLine(LPCTSTR lpszStatus)
|
||||
{
|
||||
HWND hWndLabel = GetDlgItem(dlgInfo.hWndDlg, IDC_STATUS);
|
||||
HWND hWndLabel;
|
||||
|
||||
SetWindowText(hWndLabel, lpszStatus);
|
||||
UpdateWindow(hWndLabel);
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
hWndLabel = GetDlgItem(dlgInfo.hWndDlg, IDC_STATUS);
|
||||
SetWindowText(hWndLabel, lpszStatus);
|
||||
UpdateWindow(hWndLabel);
|
||||
}
|
||||
}
|
||||
|
||||
// This routine will update the progress bar to the specified percentage
|
||||
|
@ -164,43 +397,50 @@ UpdateProgressBar(unsigned value)
|
|||
{
|
||||
int nBars;
|
||||
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = dlgInfo.nMaxBars * value / 100;
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = dlgInfo.nMaxBars * value / 100;
|
||||
|
||||
// Only paint if we need to display more bars
|
||||
if (nBars > dlgInfo.nBars) {
|
||||
HWND hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE);
|
||||
RECT rect;
|
||||
// Only paint if we need to display more bars
|
||||
if (nBars > dlgInfo.nBars)
|
||||
{
|
||||
HWND hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE);
|
||||
RECT rect;
|
||||
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nBars = nBars;
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nBars = nBars;
|
||||
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
rect.left = BAR_MARGIN + (nBars - 1) * (BAR_WIDTH + BAR_SPACING);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
rect.left = BAR_MARGIN + (nBars - 1) * (BAR_WIDTH + BAR_SPACING);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Window proc for dialog
|
||||
BOOL APIENTRY
|
||||
DialogProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
// Center the dialog over the desktop
|
||||
CenterWindow(hWndDlg);
|
||||
return FALSE;
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG:
|
||||
// Center the dialog over the desktop
|
||||
CenterWindow(hWndDlg);
|
||||
return FALSE;
|
||||
|
||||
case WM_COMMAND:
|
||||
DestroyWindow(hWndDlg);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
DestroyWindow(hWndDlg);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE; // didn't handle the message
|
||||
}
|
||||
|
@ -268,6 +508,7 @@ ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
|
|||
|
||||
// Create a file in the temp directory
|
||||
GetFullTempPathName(lpszName, sizeof(szTmpFile), szTmpFile);
|
||||
CreateDirectoriesAll(szTmpFile);
|
||||
|
||||
// Extract the file
|
||||
hResInfo = FindResource((HINSTANCE)hModule, lpszName, lpszType);
|
||||
|
@ -275,8 +516,7 @@ ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
|
|||
lpBytes = (LPBYTE)LockResource(hGlobal);
|
||||
|
||||
// Create the file
|
||||
hFile = CreateFile(szTmpFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_TEMPORARY, NULL);
|
||||
hFile = CreateFile(szTmpFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_TEMPORARY, NULL);
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE) {
|
||||
DWORD dwSize;
|
||||
|
@ -449,86 +689,93 @@ GaugeWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
// WinMain
|
||||
|
||||
static BOOL
|
||||
RunInstaller(LPSTR lpCmdLine)
|
||||
RunInstaller()
|
||||
{
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO sti;
|
||||
char szCmdLine[MAX_PATH];
|
||||
BOOL bRet;
|
||||
char szText[256];
|
||||
char szTempPath[4096];
|
||||
char szTmp[MAX_PATH];
|
||||
char szCurrentDirectory[MAX_PATH];
|
||||
char szBuf[MAX_PATH];
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO sti;
|
||||
char szCmdLine[MAX_PATH];
|
||||
BOOL bRet;
|
||||
char szText[256];
|
||||
char szTempPath[4096];
|
||||
char szTmp[MAX_PATH];
|
||||
char szCurrentDirectory[MAX_PATH];
|
||||
char szBuf[MAX_PATH];
|
||||
DWORD dwLen;
|
||||
|
||||
// Update UI
|
||||
UpdateProgressBar(100);
|
||||
LoadString(hInst, IDS_STATUS_LAUNCHING_SETUP, szText, sizeof(szText));
|
||||
SetStatusLine(szText);
|
||||
// Update UI
|
||||
UpdateProgressBar(100);
|
||||
LoadString(hInst, IDS_STATUS_LAUNCHING_SETUP, szText, sizeof(szText));
|
||||
SetStatusLine(szText);
|
||||
|
||||
memset(&sti,0,sizeof(sti));
|
||||
sti.cb = sizeof(STARTUPINFO);
|
||||
memset(&sti,0,sizeof(sti));
|
||||
sti.cb = sizeof(STARTUPINFO);
|
||||
|
||||
// Setup program is in the directory specified for temporary files
|
||||
GetFullTempPathName("SETUP.EXE", sizeof(szCmdLine), szCmdLine);
|
||||
GetTempPath(4096, szTempPath);
|
||||
GetCurrentDirectory(MAX_PATH, szCurrentDirectory);
|
||||
GetShortPathName(szCurrentDirectory, szBuf, MAX_PATH);
|
||||
// Setup program is in the directory specified for temporary files
|
||||
GetFullTempPathName("SETUP.EXE", sizeof(szCmdLine), szCmdLine);
|
||||
|
||||
lstrcat(szCmdLine, " -a");
|
||||
lstrcat(szCmdLine, szBuf);
|
||||
dwLen = GetTempPath(4096, szTempPath);
|
||||
if (szTempPath[dwLen - 1] != '\\')
|
||||
strcat(szTempPath, "\\");
|
||||
strcat(szTempPath, WIZ_TEMP_DIR);
|
||||
|
||||
if((lpCmdLine != NULL) && (*lpCmdLine != '\0'))
|
||||
{
|
||||
lstrcat(szCmdLine, " ");
|
||||
lstrcat(szCmdLine, lpCmdLine);
|
||||
GetCurrentDirectory(MAX_PATH, szCurrentDirectory);
|
||||
GetShortPathName(szCurrentDirectory, szBuf, MAX_PATH);
|
||||
|
||||
lstrcat(szCmdLine, " -a ");
|
||||
lstrcat(szCmdLine, szBuf);
|
||||
|
||||
if(szCmdLine != NULL)
|
||||
lstrcat(szCmdLine, szCmdLineToSetup);
|
||||
|
||||
// Launch the installer
|
||||
bRet = CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, szTempPath, &sti, &pi);
|
||||
|
||||
if (!bRet)
|
||||
return FALSE;
|
||||
|
||||
CloseHandle(pi.hThread);
|
||||
|
||||
// Wait for the InstallShield UI to appear before taking down the dialog box
|
||||
WaitForInputIdle(pi.hProcess, 3000); // wait up to 3 seconds
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
DestroyWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
|
||||
// Wait for the installer to complete
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
CloseHandle(pi.hProcess);
|
||||
|
||||
// That was just the installer bootstrapper. Now we need to wait for the
|
||||
// installer itself. We can find the process ID by looking for a window of
|
||||
// class ISINSTALLSCLASS
|
||||
HWND hWnd = FindWindow("ISINSTALLSCLASS", NULL);
|
||||
|
||||
if (hWnd) {
|
||||
DWORD dwProcessId;
|
||||
HANDLE hProcess;
|
||||
|
||||
// Get the associated process handle and wait for it to terminate
|
||||
GetWindowThreadProcessId(hWnd, &dwProcessId);
|
||||
|
||||
// We need the process handle to use WaitForSingleObject
|
||||
hProcess = OpenProcess(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE, FALSE, dwProcessId);
|
||||
|
||||
if (hProcess) {
|
||||
WaitForSingleObject(hProcess, INFINITE);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
|
||||
// Launch the installer
|
||||
bRet = CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, szTempPath, &sti, &pi);
|
||||
|
||||
if (!bRet)
|
||||
return FALSE;
|
||||
|
||||
CloseHandle(pi.hThread);
|
||||
|
||||
// Wait for the InstallShield UI to appear before taking down the dialog box
|
||||
WaitForInputIdle(pi.hProcess, 3000); // wait up to 3 seconds
|
||||
DestroyWindow(dlgInfo.hWndDlg);
|
||||
|
||||
// Wait for the installer to complete
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
CloseHandle(pi.hProcess);
|
||||
|
||||
// That was just the installer bootstrapper. Now we need to wait for the
|
||||
// installer itself. We can find the process ID by looking for a window of
|
||||
// class ISINSTALLSCLASS
|
||||
HWND hWnd = FindWindow("ISINSTALLSCLASS", NULL);
|
||||
|
||||
if (hWnd) {
|
||||
DWORD dwProcessId;
|
||||
HANDLE hProcess;
|
||||
|
||||
// Get the associated process handle and wait for it to terminate
|
||||
GetWindowThreadProcessId(hWnd, &dwProcessId);
|
||||
|
||||
// We need the process handle to use WaitForSingleObject
|
||||
hProcess = OpenProcess(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE, FALSE, dwProcessId);
|
||||
|
||||
if (hProcess) {
|
||||
WaitForSingleObject(hProcess, INFINITE);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
// Delete the files from the temp directory
|
||||
}
|
||||
// Delete the files from the temp directory
|
||||
EnumResourceNames(NULL, "FILE", (ENUMRESNAMEPROC)DeleteTempFilesProc, 0);
|
||||
|
||||
// delete archive.lst file in the temp directory
|
||||
GetFullTempPathName("Archive.lst", sizeof(szTmp), szTmp);
|
||||
DeleteFile(szTmp);
|
||||
GetFullTempPathName("core.ns", sizeof(szTmp), szTmp);
|
||||
GetFullTempPathName("Archive.lst", sizeof(szTmp), szTmp);
|
||||
DeleteFile(szTmp);
|
||||
GetFullTempPathName("core.ns", sizeof(szTmp), szTmp);
|
||||
DirectoryRemove(szTmp, TRUE);
|
||||
return TRUE;
|
||||
DirectoryRemove(szTempPath, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int APIENTRY
|
||||
|
@ -537,28 +784,33 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
WNDCLASS wc;
|
||||
|
||||
hInst = hInstance;
|
||||
LoadString(hInst, IDS_TITLE, szTitle, sizeof(szTitle));
|
||||
LoadString(hInst, IDS_TITLE, szTitle, MAX_BUF);
|
||||
|
||||
// Parse the command line
|
||||
ParseCommandLine(lpCmdLine);
|
||||
|
||||
// Figure out the total size of the resources
|
||||
EnumResourceNames(NULL, "FILE", (ENUMRESNAMEPROC)SizeOfResourcesProc, 0);
|
||||
|
||||
// Register a class for the gauge
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.lpfnWndProc = (WNDPROC)GaugeWndProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wc.lpszClassName = "NSGauge";
|
||||
RegisterClass(&wc);
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
// Register a class for the gauge
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.lpfnWndProc = (WNDPROC)GaugeWndProc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wc.lpszClassName = "NSGauge";
|
||||
RegisterClass(&wc);
|
||||
|
||||
// Display the dialog box
|
||||
dlgInfo.hWndDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXTRACTING),
|
||||
NULL, (DLGPROC)DialogProc);
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
// Display the dialog box
|
||||
dlgInfo.hWndDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXTRACTING), NULL, (DLGPROC)DialogProc);
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
|
||||
// Extract the files
|
||||
EnumResourceNames(NULL, "FILE", (ENUMRESNAMEPROC)ExtractFilesProc, 0);
|
||||
|
||||
// Launch the install program and wait for it to finish
|
||||
RunInstaller(lpCmdLine);
|
||||
RunInstaller();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -39,14 +39,17 @@ void AskCancelDlg(HWND hDlg)
|
|||
char szDlgQuitTitle[MAX_BUF];
|
||||
char szDlgQuitMsg[MAX_BUF];
|
||||
|
||||
if(NS_LoadString(hSetupRscInst, IDS_DLGQUITTITLE, szDlgQuitTitle, MAX_BUF) != WIZ_OK)
|
||||
PostQuitMessage(1);
|
||||
else if(NS_LoadString(hSetupRscInst, IDS_DLGQUITMSG, szDlgQuitMsg, MAX_BUF) != WIZ_OK)
|
||||
PostQuitMessage(1);
|
||||
else if(MessageBox(hDlg, szDlgQuitMsg, szDlgQuitTitle, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND) == IDYES)
|
||||
if((sgProduct.dwMode != SILENT) && (sgProduct.dwMode != AUTO))
|
||||
{
|
||||
DestroyWindow(hDlg);
|
||||
PostQuitMessage(0);
|
||||
if(NS_LoadString(hSetupRscInst, IDS_DLGQUITTITLE, szDlgQuitTitle, MAX_BUF) != WIZ_OK)
|
||||
PostQuitMessage(1);
|
||||
else if(NS_LoadString(hSetupRscInst, IDS_DLGQUITMSG, szDlgQuitMsg, MAX_BUF) != WIZ_OK)
|
||||
PostQuitMessage(1);
|
||||
else if(MessageBox(hDlg, szDlgQuitMsg, szDlgQuitTitle, MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND) == IDYES)
|
||||
{
|
||||
DestroyWindow(hDlg);
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +316,60 @@ LRESULT CALLBACK BrowseHookProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
|
|||
break;
|
||||
|
||||
case IDOK:
|
||||
GetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szTempSetupPath, MAX_BUF);
|
||||
GetDlgItemText(hDlg, IDC_EDIT_DESTINATION, szBuf, MAX_BUF);
|
||||
if(*szBuf == '\0')
|
||||
{
|
||||
char szEDestinationPath[MAX_BUF];
|
||||
|
||||
NS_LoadString(hSetupRscInst, IDS_ERROR_DESTINATION_PATH, szEDestinationPath, MAX_BUF);
|
||||
MessageBox(hDlg, szEDestinationPath, NULL, MB_OK | MB_ICONEXCLAMATION);
|
||||
break;
|
||||
}
|
||||
|
||||
AppendBackSlash(szBuf, sizeof(szBuf));
|
||||
if(FileExists(szBuf) == FALSE)
|
||||
{
|
||||
char szMsgCreateDirectory[MAX_BUF];
|
||||
char szStrCreateDirectory[MAX_BUF];
|
||||
char szBufTemp[MAX_BUF];
|
||||
char szBufTemp2[MAX_BUF];
|
||||
|
||||
NS_LoadString(hSetupRscInst, IDS_STR_CREATE_DIRECTORY, szStrCreateDirectory, MAX_BUF);
|
||||
if(NS_LoadString(hSetupRscInst, IDS_MSG_CREATE_DIRECTORY, szMsgCreateDirectory, MAX_BUF) == WIZ_OK)
|
||||
{
|
||||
lstrcpy(szBufTemp, "\n\n ");
|
||||
lstrcat(szBufTemp, szBuf);
|
||||
RemoveBackSlash(szBufTemp);
|
||||
lstrcat(szBufTemp, "\n\n");
|
||||
wsprintf(szBufTemp2, szMsgCreateDirectory, szBufTemp);
|
||||
}
|
||||
|
||||
if(MessageBox(hDlg, szBufTemp2, szStrCreateDirectory, MB_YESNO | MB_ICONQUESTION) == IDYES)
|
||||
{
|
||||
if(CreateDirectoriesAll(szBuf) == FALSE)
|
||||
{
|
||||
char szECreateDirectory[MAX_BUF];
|
||||
|
||||
lstrcpy(szBufTemp, "\n\n ");
|
||||
lstrcat(szBufTemp, sgProduct.szPath);
|
||||
RemoveBackSlash(szBufTemp);
|
||||
lstrcat(szBufTemp, "\n\n");
|
||||
|
||||
if(NS_LoadString(hSetupRscInst, IDS_ERROR_CREATE_DIRECTORY, szECreateDirectory, MAX_BUF) == WIZ_OK)
|
||||
wsprintf(szBuf, szECreateDirectory, szBufTemp);
|
||||
|
||||
MessageBox(hDlg, szBuf, "", MB_OK | MB_ICONERROR);
|
||||
break;
|
||||
}
|
||||
bCreateDestinationDir = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
lstrcpy(szTempSetupPath, szBuf);
|
||||
DestroyWindow(hDlg);
|
||||
break;
|
||||
}
|
||||
|
@ -325,9 +381,11 @@ LRESULT CALLBACK BrowseHookProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l
|
|||
BOOL BrowseForDirectory(HWND hDlg, char *szCurrDir)
|
||||
{
|
||||
OPENFILENAME of;
|
||||
char ftitle [MAX_PATH];
|
||||
char fname [MAX_PATH];
|
||||
char szCDir [MAX_BUF];
|
||||
char ftitle[MAX_PATH];
|
||||
char fname[MAX_PATH];
|
||||
char szCDir[MAX_BUF];
|
||||
char szBuf[MAX_BUF];
|
||||
char szSearchPathBuf[MAX_BUF];
|
||||
char szDlgBrowseTitle[MAX_BUF];
|
||||
BOOL bRet;
|
||||
|
||||
|
@ -337,6 +395,15 @@ BOOL BrowseForDirectory(HWND hDlg, char *szCurrDir)
|
|||
ZeroMemory(szDlgBrowseTitle, sizeof(szDlgBrowseTitle));
|
||||
NS_LoadString(hSetupRscInst, IDS_DLGBROWSETITLE, szDlgBrowseTitle, MAX_BUF);
|
||||
|
||||
lstrcpy(szSearchPathBuf, szCurrDir);
|
||||
RemoveBackSlash(szSearchPathBuf);
|
||||
while(FileExists(szSearchPathBuf) == FALSE)
|
||||
{
|
||||
RemoveBackSlash(szSearchPathBuf);
|
||||
ParsePath(szSearchPathBuf, szBuf, sizeof(szBuf), PP_PATH_ONLY);
|
||||
lstrcpy(szSearchPathBuf, szBuf);
|
||||
}
|
||||
|
||||
ZeroMemory(ftitle, sizeof(ftitle));
|
||||
strcpy(fname, "*.*");
|
||||
of.lStructSize = sizeof(OPENFILENAME);
|
||||
|
@ -350,7 +417,7 @@ BOOL BrowseForDirectory(HWND hDlg, char *szCurrDir)
|
|||
of.nMaxFile = MAX_PATH;
|
||||
of.lpstrFileTitle = ftitle;
|
||||
of.nMaxFileTitle = MAX_PATH;
|
||||
of.lpstrInitialDir = szCurrDir;
|
||||
of.lpstrInitialDir = szSearchPathBuf;
|
||||
of.lpstrTitle = szDlgBrowseTitle;
|
||||
of.Flags = OFN_NONETWORKBUTTON |
|
||||
OFN_ENABLEHOOK |
|
||||
|
@ -1422,6 +1489,11 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l
|
|||
if(GetClientRect(hDlg, &rDlg))
|
||||
SetWindowPos(hDlg, HWND_TOP, (dwScreenX/2)-(rDlg.right/2), (dwScreenY/2)-(rDlg.bottom/2), 0, 0, SWP_NOSIZE);
|
||||
|
||||
if((diSiteSelector.bShowDialog == FALSE) || (GetTotalArchivesToDownload() == 0))
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_BUTTON_SITE_SELECTOR), SW_HIDE);
|
||||
else
|
||||
ShowWindow(GetDlgItem(hDlg, IDC_BUTTON_SITE_SELECTOR), SW_SHOW);
|
||||
|
||||
break;
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -1438,6 +1510,7 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l
|
|||
break;
|
||||
}
|
||||
lstrcpy(sgProduct.szProgramFolderName, szBuf);
|
||||
dwWizardState = DLG_SITE_SELECTOR;
|
||||
|
||||
DestroyWindow(hDlg);
|
||||
PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);
|
||||
|
@ -1448,6 +1521,12 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l
|
|||
PostMessage(hWndMain, WM_COMMAND, IDWIZBACK, 0);
|
||||
break;
|
||||
|
||||
case IDC_BUTTON_SITE_SELECTOR:
|
||||
dwWizardState = DLG_PROGRAM_FOLDER;
|
||||
DestroyWindow(hDlg);
|
||||
PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);
|
||||
break;
|
||||
|
||||
case IDC_LIST:
|
||||
if((dwIndex = SendDlgItemMessage(hDlg, IDC_LIST, LB_GETCURSEL, 0, 0)) != LB_ERR)
|
||||
{
|
||||
|
@ -1476,7 +1555,7 @@ LRESULT CALLBACK DlgProcSiteSelector(HWND hDlg, UINT msg, WPARAM wParam, LONG lP
|
|||
ssi *ssiTemp;
|
||||
char szCBDefault[MAX_BUF];
|
||||
|
||||
hwndCBSiteSelector = GetDlgItem(hDlg, IDC_SITE_SELECTOR);
|
||||
hwndCBSiteSelector = GetDlgItem(hDlg, IDC_LIST_SITE_SELECTOR);
|
||||
|
||||
switch(msg)
|
||||
{
|
||||
|
@ -1505,7 +1584,7 @@ LRESULT CALLBACK DlgProcSiteSelector(HWND hDlg, UINT msg, WPARAM wParam, LONG lP
|
|||
else
|
||||
SendMessage(hwndCBSiteSelector, CB_SETCURSEL, 0, 0);
|
||||
}
|
||||
else if((iIndex = SendMessage(hwndCBSiteSelector, CB_SELECTSTRING, -1, (LPARAM)szSiteSelectorDescription) != CB_ERR))
|
||||
else if((iIndex = SendMessage(hwndCBSiteSelector, CB_SELECTSTRING, -1, (LPARAM)szSiteSelectorDescription)) != CB_ERR)
|
||||
SendMessage(hwndCBSiteSelector, CB_SETCURSEL, (WPARAM)iIndex, 0);
|
||||
else
|
||||
SendMessage(hwndCBSiteSelector, CB_SETCURSEL, 0, 0);
|
||||
|
@ -1520,6 +1599,7 @@ LRESULT CALLBACK DlgProcSiteSelector(HWND hDlg, UINT msg, WPARAM wParam, LONG lP
|
|||
case IDWIZNEXT:
|
||||
iIndex = SendMessage(hwndCBSiteSelector, CB_GETCURSEL, 0, 0);
|
||||
SendMessage(hwndCBSiteSelector, CB_GETLBTEXT, (WPARAM)iIndex, (LPARAM)szSiteSelectorDescription);
|
||||
dwWizardState = DLG_WINDOWS_INTEGRATION;
|
||||
|
||||
DestroyWindow(hDlg);
|
||||
PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);
|
||||
|
@ -1713,15 +1793,18 @@ void ProcessWindowsMessages()
|
|||
}
|
||||
void ShowMessage(LPSTR szMessage, BOOL bShow)
|
||||
{
|
||||
if((bShow) && (hDlgMessage == NULL))
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
{
|
||||
InstantiateDialog(DLG_MESSAGE, "Message", DlgProcMessage);
|
||||
SendMessage(hDlgMessage, WM_COMMAND, IDC_MESSAGE, (LPARAM)szMessage);
|
||||
}
|
||||
else if(!bShow && hDlgMessage)
|
||||
{
|
||||
DestroyWindow(hDlgMessage);
|
||||
hDlgMessage = NULL;
|
||||
if((bShow) && (hDlgMessage == NULL))
|
||||
{
|
||||
InstantiateDialog(DLG_MESSAGE, "Message", DlgProcMessage);
|
||||
SendMessage(hDlgMessage, WM_COMMAND, IDC_MESSAGE, (LPARAM)szMessage);
|
||||
}
|
||||
else if(!bShow && hDlgMessage)
|
||||
{
|
||||
DestroyWindow(hDlgMessage);
|
||||
hDlgMessage = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1785,7 +1868,7 @@ void DlgSequenceNext()
|
|||
InstantiateDialog(dwWizardState, diSetupType.szTitle, DlgProcSetupType);
|
||||
else
|
||||
{
|
||||
CheckWizardStateCustom(DLG_SELECT_COMPONENTS);
|
||||
CheckWizardStateCustom(DLG_SELECT_ADDITIONAL_COMPONENTS);
|
||||
PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);
|
||||
}
|
||||
break;
|
||||
|
@ -1845,7 +1928,10 @@ void DlgSequenceNext()
|
|||
if(diProgramFolder.bShowDialog)
|
||||
InstantiateDialog(dwWizardState, diProgramFolder.szTitle, DlgProcProgramFolder);
|
||||
else
|
||||
{
|
||||
dwWizardState = DLG_SITE_SELECTOR;
|
||||
PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case DLG_PROGRAM_FOLDER:
|
||||
|
@ -1854,7 +1940,10 @@ void DlgSequenceNext()
|
|||
if(diSiteSelector.bShowDialog)
|
||||
InstantiateDialog(dwWizardState, diSiteSelector.szTitle, DlgProcSiteSelector);
|
||||
else
|
||||
{
|
||||
dwWizardState = DLG_WINDOWS_INTEGRATION;
|
||||
PostMessage(hWndMain, WM_COMMAND, IDWIZNEXT, 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case DLG_SITE_SELECTOR:
|
||||
|
|
|
@ -54,6 +54,7 @@ extern LPSTR szTempSetupPath;
|
|||
extern LPSTR szClassName;
|
||||
extern LPSTR szSetupDir;
|
||||
extern LPSTR szTempDir;
|
||||
extern LPSTR szOSTempDir;
|
||||
extern LPSTR szFileIniConfig;
|
||||
|
||||
extern LPSTR szSiteSelectorDescription;
|
||||
|
|
|
@ -121,7 +121,16 @@ void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH)
|
|||
else
|
||||
wsprintf(szErrorString, "%s", szMsg);
|
||||
|
||||
MessageBox(hWndMain, szErrorString, NULL, MB_ICONEXCLAMATION);
|
||||
if((sgProduct.dwMode != SILENT) && (sgProduct.dwMode != AUTO))
|
||||
{
|
||||
MessageBox(hWndMain, szErrorString, NULL, MB_ICONEXCLAMATION);
|
||||
}
|
||||
else if(sgProduct.dwMode == AUTO)
|
||||
{
|
||||
ShowMessage(szErrorString, TRUE);
|
||||
Delay(5);
|
||||
ShowMessage(szErrorString, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void *NS_GlobalAlloc(DWORD dwMaxBuf)
|
||||
|
@ -184,6 +193,11 @@ HRESULT NS_LoadString(HANDLE hInstance, DWORD dwID, LPSTR szStringBuf, DWORD dwS
|
|||
return(WIZ_OK);
|
||||
}
|
||||
|
||||
void Delay(DWORD dwSeconds)
|
||||
{
|
||||
SleepEx(dwSeconds * 1000, FALSE);
|
||||
}
|
||||
|
||||
HRESULT Initialize(HINSTANCE hInstance)
|
||||
{
|
||||
char szBuf[MAX_BUF];
|
||||
|
@ -261,10 +275,14 @@ HRESULT Initialize(HINSTANCE hInstance)
|
|||
AppendBackSlash(szTempDir, MAX_BUF);
|
||||
lstrcat(szTempDir, "TEMP");
|
||||
}
|
||||
lstrcpy(szOSTempDir, szTempDir);
|
||||
AppendBackSlash(szTempDir, MAX_BUF);
|
||||
lstrcat(szTempDir, WIZ_TEMP_DIR);
|
||||
|
||||
if(!FileExists(szTempDir))
|
||||
{
|
||||
CreateDirectory(szTempDir, NULL);
|
||||
AppendBackSlash(szTempDir, MAX_BUF);
|
||||
CreateDirectoriesAll(szTempDir);
|
||||
if(!FileExists(szTempDir))
|
||||
{
|
||||
char szECreateTempDir[MAX_BUF];
|
||||
|
@ -276,6 +294,7 @@ HRESULT Initialize(HINSTANCE hInstance)
|
|||
}
|
||||
return(1);
|
||||
}
|
||||
RemoveBackSlash(szTempDir);
|
||||
}
|
||||
|
||||
hbmpBoxChecked = LoadBitmap(hSetupRscInst, MAKEINTRESOURCE(IDB_BOX_CHECKED));
|
||||
|
@ -465,6 +484,175 @@ HRESULT SdArchives(LPSTR szFileIdi, LPSTR szDownloadDir)
|
|||
return(hResult);
|
||||
}
|
||||
|
||||
/* Function to remove quotes from a string */
|
||||
void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize)
|
||||
{
|
||||
char *lpszBegin;
|
||||
|
||||
if(lstrlen(lpszSrc) > iDestSize)
|
||||
return;
|
||||
|
||||
if(*lpszSrc == '\"')
|
||||
lpszBegin = &lpszSrc[1];
|
||||
else
|
||||
lpszBegin = lpszSrc;
|
||||
|
||||
lstrcpy(lpszDest, lpszBegin);
|
||||
|
||||
if(lpszDest[lstrlen(lpszDest) - 1] == '\"')
|
||||
lpszDest[lstrlen(lpszDest) - 1] = '\0';
|
||||
}
|
||||
|
||||
/* Function to locate the first non space character in a string,
|
||||
* and return a pointer to it. */
|
||||
LPSTR GetFirstNonSpace(LPSTR lpszString)
|
||||
{
|
||||
int i;
|
||||
int iStrLength;
|
||||
|
||||
iStrLength = lstrlen(lpszString);
|
||||
|
||||
for(i = 0; i < iStrLength; i++)
|
||||
{
|
||||
if(!isspace(lpszString[i]))
|
||||
return(&lpszString[i]);
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* Function to return the argument count given a command line input
|
||||
* format string */
|
||||
int GetArgC(LPSTR lpszCommandLine)
|
||||
{
|
||||
int i;
|
||||
int iArgCount;
|
||||
int iStrLength;
|
||||
LPSTR lpszBeginStr;
|
||||
BOOL bFoundQuote;
|
||||
BOOL bFoundSpace;
|
||||
|
||||
iArgCount = 0;
|
||||
lpszBeginStr = GetFirstNonSpace(lpszCommandLine);
|
||||
|
||||
if(lpszBeginStr == NULL)
|
||||
return(iArgCount);
|
||||
|
||||
iStrLength = lstrlen(lpszBeginStr);
|
||||
bFoundQuote = FALSE;
|
||||
bFoundSpace = TRUE;
|
||||
|
||||
for(i = 0; i < iStrLength; i++)
|
||||
{
|
||||
if(lpszCommandLine[i] == '\"')
|
||||
{
|
||||
if(bFoundQuote == FALSE)
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundQuote = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFoundQuote = FALSE;
|
||||
}
|
||||
}
|
||||
else if(bFoundQuote == FALSE)
|
||||
{
|
||||
if(!isspace(lpszCommandLine[i]) && (bFoundSpace == TRUE))
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundSpace = FALSE;
|
||||
}
|
||||
else if(isspace(lpszCommandLine[i]))
|
||||
{
|
||||
bFoundSpace = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(iArgCount);
|
||||
}
|
||||
|
||||
/* Function to return a specific argument parameter from a given command line input
|
||||
* format string. */
|
||||
LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize)
|
||||
{
|
||||
int i;
|
||||
int j;
|
||||
int iArgCount;
|
||||
int iStrLength;
|
||||
LPSTR lpszBeginStr;
|
||||
LPSTR lpszDestTemp;
|
||||
BOOL bFoundQuote;
|
||||
BOOL bFoundSpace;
|
||||
|
||||
iArgCount = 0;
|
||||
lpszBeginStr = GetFirstNonSpace(lpszCommandLine);
|
||||
|
||||
if(lpszBeginStr == NULL)
|
||||
return(NULL);
|
||||
|
||||
lpszDestTemp = (char *)calloc(iDestSize, sizeof(char));
|
||||
if(lpszDestTemp == NULL)
|
||||
{
|
||||
PrintError("Out of memory", ERROR_CODE_HIDE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ZeroMemory(lpszDest, iDestSize);
|
||||
iStrLength = lstrlen(lpszBeginStr);
|
||||
bFoundQuote = FALSE;
|
||||
bFoundSpace = TRUE;
|
||||
j = 0;
|
||||
|
||||
for(i = 0; i < iStrLength; i++)
|
||||
{
|
||||
if(lpszCommandLine[i] == '\"')
|
||||
{
|
||||
if(bFoundQuote == FALSE)
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundQuote = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
bFoundQuote = FALSE;
|
||||
}
|
||||
}
|
||||
else if(bFoundQuote == FALSE)
|
||||
{
|
||||
if(!isspace(lpszCommandLine[i]) && (bFoundSpace == TRUE))
|
||||
{
|
||||
++iArgCount;
|
||||
bFoundSpace = FALSE;
|
||||
}
|
||||
else if(isspace(lpszCommandLine[i]))
|
||||
{
|
||||
bFoundSpace = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if((iIndex == (iArgCount - 1)) &&
|
||||
((bFoundQuote == TRUE) || (bFoundSpace == FALSE) ||
|
||||
((bFoundQuote == FALSE) && (lpszCommandLine[i] == '\"'))))
|
||||
{
|
||||
if(j < iDestSize)
|
||||
{
|
||||
lpszDestTemp[j] = lpszCommandLine[i];
|
||||
++j;
|
||||
}
|
||||
else
|
||||
{
|
||||
lpszDestTemp[j] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RemoveQuotes(lpszDestTemp, lpszDest, iDestSize);
|
||||
free(lpszDestTemp);
|
||||
return(lpszDest);
|
||||
}
|
||||
|
||||
HRESULT ParseSetupIni()
|
||||
{
|
||||
char szBuf[MAX_BUF];
|
||||
|
@ -558,14 +746,17 @@ HRESULT GetConfigIni()
|
|||
|
||||
BOOL LocateJar(siC *siCObject)
|
||||
{
|
||||
BOOL bRet;
|
||||
char szBuf[MAX_BUF * 2];
|
||||
char szSEADirTemp[MAX_BUF];
|
||||
char szSetupDirTemp[MAX_BUF];
|
||||
char szTempDirTemp[MAX_BUF];
|
||||
|
||||
#ifdef XXX_SSU_VERIFY_XPI_FILE_AGAINST_ARCHIVE_LIST
|
||||
char szArchiveLstFile[MAX_BUF];
|
||||
char *szBufPtr;
|
||||
int iLen;
|
||||
BOOL bRet;
|
||||
#endif
|
||||
|
||||
/* initialize default behavior */
|
||||
bRet = FALSE;
|
||||
|
@ -596,6 +787,26 @@ BOOL LocateJar(siC *siCObject)
|
|||
AppendBackSlash(szTempDirTemp, sizeof(szTempDirTemp));
|
||||
if(lstrcmpi(szTempDirTemp, szSetupDirTemp) == 0)
|
||||
{
|
||||
/* check the temp dir for the .xpi file */
|
||||
lstrcpy(szBuf, szTempDirTemp);
|
||||
AppendBackSlash(szBuf, sizeof(szBuf));
|
||||
lstrcat(szBuf, siCObject->szArchiveName);
|
||||
|
||||
if(FileExists(szBuf))
|
||||
{
|
||||
/* jar file found. Unset attribute to download from the net */
|
||||
siCObject->dwAttributes &= ~SIC_DOWNLOAD_REQUIRED;
|
||||
/* save the path of where jar was found at */
|
||||
lstrcpy(siCObject->szArchivePath, szTempDirTemp);
|
||||
AppendBackSlash(siCObject->szArchivePath, MAX_BUF);
|
||||
bRet = TRUE;
|
||||
}
|
||||
|
||||
#ifdef XXX_SSU_VERIFY_XPI_FILE_AGAINST_ARCHIVE_LIST
|
||||
/* if the archive name is in the archive.lst file, then it was uncompressed
|
||||
* by the self extracting .exe file. Assume that the .xpi file exists.
|
||||
* This is a safe assumption because the self extracting.exe creates the
|
||||
* archive.lst with what it uncompresses everytime it is run. */
|
||||
lstrcpy(szArchiveLstFile, szTempDirTemp);
|
||||
AppendBackSlash(szArchiveLstFile, sizeof(szArchiveLstFile));
|
||||
lstrcat(szArchiveLstFile, "Archive.lst");
|
||||
|
@ -623,9 +834,12 @@ BOOL LocateJar(siC *siCObject)
|
|||
szBufPtr += iLen +1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* check the setup dir for the .xpi file */
|
||||
lstrcpy(szBuf, szSetupDirTemp);
|
||||
AppendBackSlash(szBuf, sizeof(szBuf));
|
||||
lstrcat(szBuf, siCObject->szArchiveName);
|
||||
|
@ -749,33 +963,16 @@ HRESULT AddArchiveToIdiFile(siC *siCObject, char *szSComponent, char *szSFile, c
|
|||
return(0);
|
||||
}
|
||||
|
||||
DWORD NumberOfArchivesToDownload()
|
||||
void SetSetupRunMode(LPSTR szMode)
|
||||
{
|
||||
DWORD dwIndex0;
|
||||
DWORD dwCounter;
|
||||
siC *siCObject = NULL;
|
||||
|
||||
dwIndex0 = 0;
|
||||
dwCounter = 0;
|
||||
siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL);
|
||||
while(siCObject)
|
||||
{
|
||||
if(siCObject->dwAttributes & SIC_SELECTED)
|
||||
{
|
||||
/* if LocateJar returns FALSE, it means that the component could not be found locally,
|
||||
* and therefore needs to be downloaded from the net. */
|
||||
if(LocateJar(siCObject) == FALSE)
|
||||
++dwCounter;
|
||||
}
|
||||
|
||||
++dwIndex0;
|
||||
siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL);
|
||||
}
|
||||
|
||||
return(dwCounter);
|
||||
if(lstrcmpi(szMode, "NORMAL") == 0)
|
||||
sgProduct.dwMode = NORMAL;
|
||||
if(lstrcmpi(szMode, "AUTO") == 0)
|
||||
sgProduct.dwMode = AUTO;
|
||||
if(lstrcmpi(szMode, "SILENT") == 0)
|
||||
sgProduct.dwMode = SILENT;
|
||||
}
|
||||
|
||||
|
||||
long RetrieveRedirectFile()
|
||||
{
|
||||
DWORD dwIndex0;
|
||||
|
@ -791,7 +988,7 @@ long RetrieveRedirectFile()
|
|||
if(lstrcmpi(szBuf, "ENABLED") != 0)
|
||||
return(0);
|
||||
|
||||
if(NumberOfArchivesToDownload() == 0)
|
||||
if(GetTotalArchivesToDownload() == 0)
|
||||
return(0);
|
||||
|
||||
lstrcpy(szFileIdiGetRedirect, szTempDir);
|
||||
|
@ -1475,6 +1672,8 @@ void DeInitDlgReboot(diR *diDialog)
|
|||
|
||||
HRESULT InitSetupGeneral()
|
||||
{
|
||||
char szBuf[MAX_BUF];
|
||||
|
||||
sgProduct.dwMode = NORMAL;
|
||||
sgProduct.dwCustomType = ST_RADIO0;
|
||||
|
||||
|
@ -1500,6 +1699,9 @@ HRESULT InitSetupGeneral()
|
|||
if((szSiteSelectorDescription = NS_GlobalAlloc(MAX_BUF)) == NULL)
|
||||
return(1);
|
||||
|
||||
if(NS_LoadString(hSetupRscInst, IDS_CB_DEFAULT, szBuf, MAX_BUF) == WIZ_OK);
|
||||
lstrcpy(szSiteSelectorDescription, szBuf);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
@ -2410,7 +2612,19 @@ HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPS
|
|||
lstrcpy(szBuf3, szDSAvailable);
|
||||
lstrcat(szBuf3, " K\n\n");
|
||||
wsprintf(szBufMsg, szDlgDiskSpaceCheckMsg, szBufRootPath, szBuf1, szBuf2, szBuf3);
|
||||
return(MessageBox(hWndMain, szBufMsg, szDlgDiskSpaceCheckTitle, dwDlgType | MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND));
|
||||
|
||||
if((sgProduct.dwMode != SILENT) && (sgProduct.dwMode != AUTO))
|
||||
{
|
||||
return(MessageBox(hWndMain, szBufMsg, szDlgDiskSpaceCheckTitle, dwDlgType | MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND));
|
||||
}
|
||||
else if(sgProduct.dwMode == AUTO)
|
||||
{
|
||||
ShowMessage(szBufMsg, TRUE);
|
||||
Delay(5);
|
||||
ShowMessage(szBufMsg, FALSE);
|
||||
}
|
||||
|
||||
return(IDCANCEL);
|
||||
}
|
||||
|
||||
void UpdatePathDiskSpaceRequired(LPSTR szPath, ULONGLONG ullSize, dsN **dsnComponentDSRequirement)
|
||||
|
@ -3264,6 +3478,60 @@ void ResolveDependees(LPSTR szToggledDescriptionShort)
|
|||
ResolveDependees(szToggledDescriptionShort);
|
||||
}
|
||||
|
||||
void ParseCommandLine(LPSTR lpszCmdLine)
|
||||
{
|
||||
char szArgVBuf[MAX_BUF];
|
||||
int i;
|
||||
int iArgC;
|
||||
|
||||
#ifdef XXX_DEBUG
|
||||
char szBuf[MAX_BUF];
|
||||
char szOutputStr[MAX_BUF];
|
||||
#endif
|
||||
|
||||
iArgC = GetArgC(lpszCmdLine);
|
||||
|
||||
#ifdef XXX_DEBUG
|
||||
wsprintf(szOutputStr, "ArgC: %d\n", iArgC);
|
||||
#endif
|
||||
|
||||
i = 0;
|
||||
while(i < iArgC)
|
||||
{
|
||||
GetArgV(lpszCmdLine, i, szArgVBuf, sizeof(szArgVBuf));
|
||||
|
||||
if((lstrcmpi(szArgVBuf, "-a") == 0) || (lstrcmpi(szArgVBuf, "/a") == 0))
|
||||
{
|
||||
++i;
|
||||
GetArgV(lpszCmdLine, i, szArgVBuf, sizeof(szArgVBuf));
|
||||
lstrcpy(sgProduct.szAlternateArchiveSearchPath, szArgVBuf);
|
||||
}
|
||||
else if((lstrcmpi(szArgVBuf, "-ma") == 0) || (lstrcmpi(szArgVBuf, "/ma") == 0))
|
||||
{
|
||||
SetSetupRunMode("AUTO");
|
||||
}
|
||||
else if((lstrcmpi(szArgVBuf, "-ms") == 0) || (lstrcmpi(szArgVBuf, "/ms") == 0))
|
||||
{
|
||||
SetSetupRunMode("SILENT");
|
||||
}
|
||||
|
||||
#ifdef XXX_DEBUG
|
||||
itoa(i, szBuf, 10);
|
||||
lstrcat(szOutputStr, " ");
|
||||
lstrcat(szOutputStr, szBuf);
|
||||
lstrcat(szOutputStr, ": ");
|
||||
lstrcat(szOutputStr, szArgVBuf);
|
||||
lstrcat(szOutputStr, "\n");
|
||||
#endif
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
#ifdef XXX_DEBUG
|
||||
MessageBox(NULL, szOutputStr, "Output", MB_OK);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine)
|
||||
{
|
||||
char szBuf[MAX_PATH];
|
||||
|
@ -3386,7 +3654,18 @@ HRESULT CheckInstances()
|
|||
if(CheckForProcess(szProcessName, sizeof(szProcessName)) == TRUE)
|
||||
{
|
||||
if(*szMessage != '\0')
|
||||
MessageBox(hWndMain, szMessage, NULL, MB_ICONEXCLAMATION);
|
||||
{
|
||||
if((sgProduct.dwMode != SILENT) && (sgProduct.dwMode != AUTO))
|
||||
{
|
||||
MessageBox(hWndMain, szMessage, NULL, MB_ICONEXCLAMATION);
|
||||
}
|
||||
else if(sgProduct.dwMode == AUTO)
|
||||
{
|
||||
ShowMessage(szMessage, TRUE);
|
||||
Delay(5);
|
||||
ShowMessage(szMessage, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
@ -3419,10 +3698,19 @@ HRESULT CheckInstances()
|
|||
if((hwndFW = FindWindow(szClassName, szWN)) != NULL)
|
||||
{
|
||||
if(*szMessage != '\0')
|
||||
MessageBox(hWndMain, szMessage, NULL, MB_ICONEXCLAMATION);
|
||||
{
|
||||
if((sgProduct.dwMode != SILENT) && (sgProduct.dwMode != AUTO))
|
||||
{
|
||||
MessageBox(hWndMain, szMessage, NULL, MB_ICONEXCLAMATION);
|
||||
}
|
||||
else if(sgProduct.dwMode == AUTO)
|
||||
{
|
||||
ShowMessage(szMessage, TRUE);
|
||||
Delay(5);
|
||||
ShowMessage(szMessage, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
// ShowWindow(hwndFW, SW_RESTORE);
|
||||
// SetForegroundWindow(hwndFW);
|
||||
return(TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -3620,9 +3908,6 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
|
|||
if(CheckInstances())
|
||||
return(1);
|
||||
|
||||
ShowWindow(hWndMain, SW_MAXIMIZE);
|
||||
UpdateWindow(hWndMain);
|
||||
|
||||
if(InitSetupGeneral())
|
||||
return(1);
|
||||
if(InitDlgWelcome(&diWelcome))
|
||||
|
@ -3648,17 +3933,17 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
|
|||
if(InitSCoreFile())
|
||||
return(1);
|
||||
|
||||
/* get Alternate Archive Search Path, if there is one */
|
||||
GetAlternateArchiveSearchPath(lpszCmdLine);
|
||||
|
||||
/* get install Mode information */
|
||||
GetPrivateProfileString("General", "Mode", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
if(lstrcmpi(szBuf, "NORMAL") == 0)
|
||||
sgProduct.dwMode = NORMAL;
|
||||
if(lstrcmpi(szBuf, "AUTO") == 0)
|
||||
sgProduct.dwMode = AUTO;
|
||||
if(lstrcmpi(szBuf, "SILENT") == 0)
|
||||
sgProduct.dwMode = SILENT;
|
||||
GetPrivateProfileString("General", "Run Mode", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
SetSetupRunMode(szBuf);
|
||||
ParseCommandLine(lpszCmdLine);
|
||||
|
||||
if((sgProduct.dwMode == NORMAL) || (sgProduct.dwMode == AUTO))
|
||||
{
|
||||
/* show blue background here */
|
||||
ShowWindow(hWndMain, SW_MAXIMIZE);
|
||||
UpdateWindow(hWndMain);
|
||||
}
|
||||
|
||||
/* get product name description */
|
||||
GetPrivateProfileString("General", "Product Name", "", sgProduct.szProductName, MAX_BUF, szFileIniConfig);
|
||||
|
@ -3869,14 +4154,15 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
|
|||
{
|
||||
case AUTO:
|
||||
case SILENT:
|
||||
diWelcome.bShowDialog = FALSE;
|
||||
diLicense.bShowDialog = FALSE;
|
||||
diSetupType.bShowDialog = FALSE;
|
||||
diSelectComponents.bShowDialog = FALSE;
|
||||
diWindowsIntegration.bShowDialog = FALSE;
|
||||
diProgramFolder.bShowDialog = FALSE;
|
||||
diSiteSelector.bShowDialog = FALSE;
|
||||
diStartInstall.bShowDialog = FALSE;
|
||||
diWelcome.bShowDialog = FALSE;
|
||||
diLicense.bShowDialog = FALSE;
|
||||
diSetupType.bShowDialog = FALSE;
|
||||
diSelectComponents.bShowDialog = FALSE;
|
||||
diSelectAdditionalComponents.bShowDialog = FALSE;
|
||||
diWindowsIntegration.bShowDialog = FALSE;
|
||||
diProgramFolder.bShowDialog = FALSE;
|
||||
diSiteSelector.bShowDialog = FALSE;
|
||||
diStartInstall.bShowDialog = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -4047,6 +4333,35 @@ BOOL LocatePathNscpReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize)
|
|||
return(bReturn);
|
||||
}
|
||||
|
||||
DWORD GetTotalArchivesToDownload()
|
||||
{
|
||||
DWORD dwIndex0;
|
||||
DWORD dwTotalArchivesToDownload;
|
||||
siC *siCObject = NULL;
|
||||
char szIndex0[MAX_BUF];
|
||||
|
||||
dwTotalArchivesToDownload = 0;
|
||||
dwIndex0 = 0;
|
||||
itoa(dwIndex0, szIndex0, 10);
|
||||
siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL);
|
||||
while(siCObject)
|
||||
{
|
||||
if(siCObject->dwAttributes & SIC_SELECTED)
|
||||
{
|
||||
if(LocateJar(siCObject) == FALSE)
|
||||
{
|
||||
++dwTotalArchivesToDownload;
|
||||
}
|
||||
}
|
||||
|
||||
++dwIndex0;
|
||||
itoa(dwIndex0, szIndex0, 10);
|
||||
siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL);
|
||||
}
|
||||
|
||||
return(dwTotalArchivesToDownload);
|
||||
}
|
||||
|
||||
BOOL LocatePathWinReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize)
|
||||
{
|
||||
char szHKey[MAX_BUF];
|
||||
|
@ -4208,60 +4523,6 @@ void STGetComponents(LPSTR szSection, st *stSetupType, LPSTR szFileIniConfig)
|
|||
}
|
||||
}
|
||||
|
||||
void GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue, DWORD dwReturnValueSize)
|
||||
{
|
||||
HKEY hkResult;
|
||||
DWORD dwErr;
|
||||
DWORD dwSize;
|
||||
char szBuf[MAX_BUF];
|
||||
|
||||
ZeroMemory(szBuf, sizeof(szBuf));
|
||||
ZeroMemory(szReturnValue, dwReturnValueSize);
|
||||
|
||||
if((dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_READ, &hkResult)) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szBuf);
|
||||
dwErr = RegQueryValueEx(hkResult, szName, 0, NULL, szBuf, &dwSize);
|
||||
|
||||
if((*szBuf != '\0') && (dwErr == ERROR_SUCCESS))
|
||||
ExpandEnvironmentStrings(szBuf, szReturnValue, dwReturnValueSize);
|
||||
else
|
||||
*szReturnValue = '\0';
|
||||
|
||||
RegCloseKey(hkResult);
|
||||
}
|
||||
}
|
||||
|
||||
void SetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, DWORD dwType, LPSTR szData, DWORD dwSize)
|
||||
{
|
||||
HKEY hkResult;
|
||||
DWORD dwErr;
|
||||
DWORD dwDisp;
|
||||
char szBuf[MAX_BUF];
|
||||
|
||||
memset(szBuf, '\0', MAX_BUF);
|
||||
|
||||
dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_WRITE, &hkResult);
|
||||
if(dwErr != ERROR_SUCCESS)
|
||||
dwErr = RegCreateKeyEx(hkRootKey, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkResult, &dwDisp);
|
||||
|
||||
if(dwErr == ERROR_SUCCESS)
|
||||
{
|
||||
/**
|
||||
dwErr = RegQueryValueEx(hkResult, szName, 0, NULL, szBuf, &dwSize);
|
||||
|
||||
if((*szReturnValue != '\0') && (dwErr == ERROR_SUCCESS))
|
||||
ExpandEnvironmentStrings(szBuf, szReturnValue, MAX_BUF);
|
||||
else
|
||||
*szReturnValue = '\0';
|
||||
**/
|
||||
|
||||
dwErr = RegSetValueEx(hkResult, szName, 0, dwType, szData, dwSize);
|
||||
|
||||
RegCloseKey(hkResult);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize)
|
||||
{
|
||||
char szBuf[MAX_BUF];
|
||||
|
@ -4456,13 +4717,20 @@ HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize)
|
|||
/* parse for the "c:\Windows\profiles\All Users\Start Menu\Programs" path */
|
||||
lstrcpy(szVariable, sgProduct.szProgramFolderPath);
|
||||
}
|
||||
else if(lstrcmpi(szVariable, "TEMP") == 0)
|
||||
else if(lstrcmpi(szVariable, "WIZTEMP") == 0)
|
||||
{
|
||||
/* parse for the "c:\Temp" path */
|
||||
lstrcpy(szVariable, szTempDir);
|
||||
if(szVariable[strlen(szVariable) - 1] == '\\')
|
||||
szVariable[strlen(szVariable) - 1] = '\0';
|
||||
}
|
||||
else if(lstrcmpi(szVariable, "TEMP") == 0)
|
||||
{
|
||||
/* parse for the "c:\Temp" path */
|
||||
lstrcpy(szVariable, szOSTempDir);
|
||||
if(szVariable[strlen(szVariable) - 1] == '\\')
|
||||
szVariable[strlen(szVariable) - 1] = '\0';
|
||||
}
|
||||
else if(lstrcmpi(szVariable, "WINDISK") == 0)
|
||||
{
|
||||
/* Locate the drive that Windows is installed on, and only use the drive letter and the ':' character (C:). */
|
||||
|
@ -4567,6 +4835,16 @@ HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize)
|
|||
|
||||
wsprintf(szVariable, "Software\\Netscape\\Netscape 6\\%s", szBuf);
|
||||
}
|
||||
else if(lstrcmpi(szVariable, "NetscapeInstantMessenger CurrentVersion") == 0)
|
||||
{
|
||||
/* parse for the current Netscape WinReg key */
|
||||
GetWinReg(HKEY_LOCAL_MACHINE, "Software\\Netscape\\Netscape Instant Messenger", "CurrentVersion", szBuf, sizeof(szBuf));
|
||||
|
||||
if(*szBuf == '\0')
|
||||
return(FALSE);
|
||||
|
||||
wsprintf(szVariable, "Software\\Netscape\\Netscape Instant Messenger\\%s", szBuf);
|
||||
}
|
||||
else if(lstrcmpi(szVariable, "Mozilla Seamonkey CurrentVersion") == 0)
|
||||
{
|
||||
/* parse for the current Mozilla WinReg key */
|
||||
|
|
|
@ -54,8 +54,6 @@ HRESULT WinSpawn(LPSTR szClientName, LPSTR szParameters, LPSTR szCurre
|
|||
HRESULT ParseConfigIni(LPSTR lpszCmdLine);
|
||||
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);
|
||||
HRESULT InitDlgWelcome(diW *diDialog);
|
||||
HRESULT InitDlgLicense(diL *diDialog);
|
||||
|
@ -113,7 +111,6 @@ HRESULT GetConfigIni(void);
|
|||
void CleanTempFiles(void);
|
||||
void OutputSetupTitle(HDC hDC);
|
||||
HRESULT SdArchives(LPSTR szFileIdi, LPSTR szDownloadDir);
|
||||
DWORD NumberOfArchivesToDownload(void);
|
||||
long RetrieveArchives(void);
|
||||
long RetrieveRedirectFile(void);
|
||||
/* HRESULT SmartUpdateJars(void); */
|
||||
|
@ -167,6 +164,14 @@ void SsiSiteSelectorNodeDelete(ssi *ssiTemp);
|
|||
ssi* SsiGetNode(LPSTR szDescription);
|
||||
void UpdateSiteSelector(void);
|
||||
DWORD GetAdditionalComponentsCount(void);
|
||||
DWORD GetTotalArchivesToDownload();
|
||||
void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize);
|
||||
LPSTR GetFirstNonSpace(LPSTR lpszString);
|
||||
int GetArgC(LPSTR lpszCommandLine);
|
||||
LPSTR GetArgV(LPSTR lpszCommandLine, int iIndex, LPSTR lpszDest, int iDestSize);
|
||||
void ParseCommandLine(LPSTR lpszCmdLine);
|
||||
void SetSetupRunMode(LPSTR szMode);
|
||||
void Delay(DWORD dwSeconds);
|
||||
|
||||
BOOL bSDInit;
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ void ProcessFileOps(DWORD dwTiming)
|
|||
ProcessDeleteFile(dwTiming);
|
||||
ProcessRemoveDirectory(dwTiming);
|
||||
ProcessRunApp(dwTiming);
|
||||
ProcessWinReg(dwTiming);
|
||||
ProcessProgramFolder(dwTiming);
|
||||
}
|
||||
|
||||
|
@ -655,7 +656,7 @@ HRESULT ProcessRunApp(DWORD dwTiming)
|
|||
{
|
||||
lstrcat(szTarget, " ");
|
||||
lstrcat(szTarget, szParameters);
|
||||
SetWinReg(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce", "Netscape", REG_SZ, szTarget, lstrlen(szTarget));
|
||||
SetWinReg(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce", TRUE, "Netscape", TRUE, REG_SZ, szTarget, lstrlen(szTarget));
|
||||
}
|
||||
else
|
||||
WinSpawn(szTarget, szParameters, szWorkingDir, SW_SHOWNORMAL, bWait);
|
||||
|
@ -670,6 +671,231 @@ HRESULT ProcessRunApp(DWORD dwTiming)
|
|||
return(FO_SUCCESS);
|
||||
}
|
||||
|
||||
HKEY ParseRootKey(LPSTR szRootKey)
|
||||
{
|
||||
HKEY hkRootKey;
|
||||
|
||||
if(lstrcmpi(szRootKey, "HKEY_CURRENT_CONFIG") == 0)
|
||||
hkRootKey = HKEY_CURRENT_CONFIG;
|
||||
else if(lstrcmpi(szRootKey, "HKEY_CURRENT_USER") == 0)
|
||||
hkRootKey = HKEY_CURRENT_USER;
|
||||
else if(lstrcmpi(szRootKey, "HKEY_LOCAL_MACHINE") == 0)
|
||||
hkRootKey = HKEY_LOCAL_MACHINE;
|
||||
else if(lstrcmpi(szRootKey, "HKEY_USERS") == 0)
|
||||
hkRootKey = HKEY_USERS;
|
||||
else if(lstrcmpi(szRootKey, "HKEY_PERFORMANCE_DATA") == 0)
|
||||
hkRootKey = HKEY_PERFORMANCE_DATA;
|
||||
else if(lstrcmpi(szRootKey, "HKEY_DYN_DATA") == 0)
|
||||
hkRootKey = HKEY_DYN_DATA;
|
||||
else /* HKEY_CLASSES_ROOT */
|
||||
hkRootKey = HKEY_CLASSES_ROOT;
|
||||
|
||||
return(hkRootKey);
|
||||
}
|
||||
|
||||
DWORD ParseRegType(LPSTR szType)
|
||||
{
|
||||
DWORD dwType;
|
||||
|
||||
if(lstrcmpi(szType, "REG_SZ") == 0)
|
||||
/* Unicode NULL terminated string */
|
||||
dwType = REG_SZ;
|
||||
else if(lstrcmpi(szType, "REG_EXPAND_SZ") == 0)
|
||||
/* Unicode NULL terminated string
|
||||
* (with environment variable references) */
|
||||
dwType = REG_EXPAND_SZ;
|
||||
else if(lstrcmpi(szType, "REG_BINARY") == 0)
|
||||
/* Free form binary */
|
||||
dwType = REG_BINARY;
|
||||
else if(lstrcmpi(szType, "REG_DWORD") == 0)
|
||||
/* 32bit number */
|
||||
dwType = REG_DWORD;
|
||||
else if(lstrcmpi(szType, "REG_DWORD_LITTLE_ENDIAN") == 0)
|
||||
/* 32bit number
|
||||
* (same as REG_DWORD) */
|
||||
dwType = REG_DWORD_LITTLE_ENDIAN;
|
||||
else if(lstrcmpi(szType, "REG_DWORD_BIG_ENDIAN") == 0)
|
||||
/* 32bit number */
|
||||
dwType = REG_DWORD_BIG_ENDIAN;
|
||||
else if(lstrcmpi(szType, "REG_LINK") == 0)
|
||||
/* Symbolic link (unicode) */
|
||||
dwType = REG_LINK;
|
||||
else if(lstrcmpi(szType, "REG_MULTI_SZ") == 0)
|
||||
/* Multiple Unicode strings */
|
||||
dwType = REG_MULTI_SZ;
|
||||
else /* Default is REG_NONE */
|
||||
/* no value type */
|
||||
dwType = REG_NONE;
|
||||
|
||||
return(dwType);
|
||||
}
|
||||
|
||||
BOOL WinRegKeyExists(HKEY hkRootKey, LPSTR szKey)
|
||||
{
|
||||
HKEY hkResult;
|
||||
DWORD dwErr;
|
||||
BOOL bKeyExists = FALSE;
|
||||
|
||||
if((dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_READ, &hkResult)) == ERROR_SUCCESS)
|
||||
{
|
||||
bKeyExists = TRUE;
|
||||
RegCloseKey(hkResult);
|
||||
}
|
||||
|
||||
return(bKeyExists);
|
||||
}
|
||||
|
||||
BOOL WinRegNameExists(HKEY hkRootKey, LPSTR szKey, LPSTR szName)
|
||||
{
|
||||
HKEY hkResult;
|
||||
DWORD dwErr;
|
||||
DWORD dwSize;
|
||||
char szBuf[MAX_BUF];
|
||||
BOOL bNameExists = FALSE;
|
||||
|
||||
ZeroMemory(szBuf, sizeof(szBuf));
|
||||
if((dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_READ, &hkResult)) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szBuf);
|
||||
dwErr = RegQueryValueEx(hkResult, szName, 0, NULL, szBuf, &dwSize);
|
||||
|
||||
if((*szBuf != '\0') && (dwErr == ERROR_SUCCESS))
|
||||
bNameExists = TRUE;
|
||||
|
||||
RegCloseKey(hkResult);
|
||||
}
|
||||
|
||||
return(bNameExists);
|
||||
}
|
||||
|
||||
void GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue, DWORD dwReturnValueSize)
|
||||
{
|
||||
HKEY hkResult;
|
||||
DWORD dwErr;
|
||||
DWORD dwSize;
|
||||
char szBuf[MAX_BUF];
|
||||
|
||||
ZeroMemory(szBuf, sizeof(szBuf));
|
||||
ZeroMemory(szReturnValue, dwReturnValueSize);
|
||||
|
||||
if((dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_READ, &hkResult)) == ERROR_SUCCESS)
|
||||
{
|
||||
dwSize = sizeof(szBuf);
|
||||
dwErr = RegQueryValueEx(hkResult, szName, 0, NULL, szBuf, &dwSize);
|
||||
|
||||
if((*szBuf != '\0') && (dwErr == ERROR_SUCCESS))
|
||||
ExpandEnvironmentStrings(szBuf, szReturnValue, dwReturnValueSize);
|
||||
else
|
||||
*szReturnValue = '\0';
|
||||
|
||||
RegCloseKey(hkResult);
|
||||
}
|
||||
}
|
||||
|
||||
void SetWinReg(HKEY hkRootKey, LPSTR szKey, BOOL bOverwriteKey, LPSTR szName, BOOL bOverwriteName, DWORD dwType, LPSTR szData, DWORD dwSize)
|
||||
{
|
||||
HKEY hkResult;
|
||||
DWORD dwErr;
|
||||
DWORD dwDisp;
|
||||
BOOL bKeyExists;
|
||||
BOOL bNameExists;
|
||||
|
||||
bKeyExists = WinRegKeyExists(hkRootKey, szKey);
|
||||
bNameExists = WinRegNameExists(hkRootKey, szKey, szName);
|
||||
dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_WRITE, &hkResult);
|
||||
|
||||
if(dwErr != ERROR_SUCCESS)
|
||||
dwErr = RegCreateKeyEx(hkRootKey, szKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hkResult, &dwDisp);
|
||||
|
||||
if(dwErr == ERROR_SUCCESS)
|
||||
{
|
||||
if((bNameExists == FALSE) ||
|
||||
((bNameExists == TRUE) && (bOverwriteName == TRUE)))
|
||||
dwErr = RegSetValueEx(hkResult, szName, 0, dwType, szData, dwSize);
|
||||
|
||||
RegCloseKey(hkResult);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT ProcessWinReg(DWORD dwTiming)
|
||||
{
|
||||
char szIndex[MAX_BUF];
|
||||
char szBuf[MAX_BUF];
|
||||
char szKey[MAX_BUF];
|
||||
char szName[MAX_BUF];
|
||||
char szValue[MAX_BUF];
|
||||
char szDecrypt[MAX_BUF];
|
||||
char szOverwriteKey[MAX_BUF];
|
||||
char szOverwriteName[MAX_BUF];
|
||||
char szSection[MAX_BUF];
|
||||
HKEY hRootKey;
|
||||
BOOL bOverwriteKey;
|
||||
BOOL bOverwriteName;
|
||||
DWORD dwIndex;
|
||||
DWORD dwType;
|
||||
|
||||
dwIndex = 0;
|
||||
itoa(dwIndex, szIndex, 10);
|
||||
lstrcpy(szSection, "Windows Registry");
|
||||
lstrcat(szSection, szIndex);
|
||||
GetPrivateProfileString(szSection, "Root Key", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
while(*szBuf != '\0')
|
||||
{
|
||||
if(TimingCheck(dwTiming, szSection, szFileIniConfig))
|
||||
{
|
||||
hRootKey = ParseRootKey(szBuf);
|
||||
|
||||
GetPrivateProfileString(szSection, "Key", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
GetPrivateProfileString(szSection, "Decrypt Key", "", szDecrypt, MAX_BUF, szFileIniConfig);
|
||||
GetPrivateProfileString(szSection, "Overwrite Key", "", szOverwriteKey, MAX_BUF, szFileIniConfig);
|
||||
|
||||
if(lstrcmpi(szDecrypt, "TRUE") == 0)
|
||||
DecryptString(szKey, szBuf);
|
||||
else
|
||||
lstrcpy(szKey, szBuf);
|
||||
|
||||
if(lstrcmpi(szOverwriteKey, "FALSE") == 0)
|
||||
bOverwriteKey = FALSE;
|
||||
else
|
||||
bOverwriteKey = TRUE;
|
||||
|
||||
GetPrivateProfileString(szSection, "Name", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
GetPrivateProfileString(szSection, "Decrypt Name", "", szDecrypt, MAX_BUF, szFileIniConfig);
|
||||
GetPrivateProfileString(szSection, "Overwrite Name", "", szOverwriteName, MAX_BUF, szFileIniConfig);
|
||||
|
||||
if(lstrcmpi(szDecrypt, "TRUE") == 0)
|
||||
DecryptString(szName, szBuf);
|
||||
else
|
||||
lstrcpy(szName, szBuf);
|
||||
|
||||
if(lstrcmpi(szOverwriteName, "FALSE") == 0)
|
||||
bOverwriteName = FALSE;
|
||||
else
|
||||
bOverwriteName = TRUE;
|
||||
|
||||
GetPrivateProfileString(szSection, "Name Value", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
GetPrivateProfileString(szSection, "Decrypt Name Value", "", szDecrypt, MAX_BUF, szFileIniConfig);
|
||||
if(lstrcmpi(szDecrypt, "TRUE") == 0)
|
||||
DecryptString(szValue, szBuf);
|
||||
else
|
||||
lstrcpy(szValue, szBuf);
|
||||
|
||||
GetPrivateProfileString(szSection, "Type", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
dwType = ParseRegType(szBuf);
|
||||
|
||||
/* create/set windows registry key here! */
|
||||
SetWinReg(hRootKey, szKey, bOverwriteKey, szName, bOverwriteName, dwType, szValue, lstrlen(szValue));
|
||||
}
|
||||
|
||||
++dwIndex;
|
||||
itoa(dwIndex, szIndex, 10);
|
||||
lstrcpy(szSection, "Windows Registry");
|
||||
lstrcat(szSection, szIndex);
|
||||
GetPrivateProfileString(szSection, "Root Key", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
}
|
||||
return(FO_SUCCESS);
|
||||
}
|
||||
|
||||
HRESULT ProcessProgramFolder(DWORD dwTiming)
|
||||
{
|
||||
DWORD dwIndex0;
|
||||
|
@ -784,7 +1010,8 @@ HRESULT ProcessProgramFolderShowCmd()
|
|||
iShowFolder = SW_SHOWNORMAL;
|
||||
|
||||
if(iShowFolder != SW_HIDE)
|
||||
WinSpawn(szProgramFolder, NULL, NULL, iShowFolder, TRUE);
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
WinSpawn(szProgramFolder, NULL, NULL, iShowFolder, TRUE);
|
||||
|
||||
++dwIndex0;
|
||||
itoa(dwIndex0, szIndex0, 10);
|
||||
|
|
|
@ -40,6 +40,7 @@ HRESULT ProcessDeleteFile(DWORD dwTiming);
|
|||
HRESULT DirectoryRemove(LPSTR szDestination, BOOL bRemoveSubdirs);
|
||||
HRESULT ProcessRemoveDirectory(DWORD dwTiming);
|
||||
HRESULT ProcessRunApp(DWORD dwTiming);
|
||||
HRESULT ProcessWinReg(DWORD dwTiming);
|
||||
HRESULT CreateALink(LPSTR lpszPathObj,
|
||||
LPSTR lpszPathLink,
|
||||
LPSTR lpszDesc,
|
||||
|
@ -51,5 +52,11 @@ HRESULT ProcessProgramFolder(DWORD dwTiming);
|
|||
HRESULT ProcessProgramFolderShowCmd(void);
|
||||
HRESULT CreateDirectoriesAll(char* szPath);
|
||||
void ProcessFileOps(DWORD dwTiming);
|
||||
void GetWinReg(HKEY hkRootKey, LPSTR szKey, LPSTR szName, LPSTR szReturnValue, DWORD dwSize);
|
||||
void SetWinReg(HKEY hkRootKey, LPSTR szKey, BOOL bOverwriteKey, LPSTR szName, BOOL bOverwriteName, DWORD dwType, LPSTR szData, DWORD dwSize);
|
||||
HKEY ParseRootKey(LPSTR szRootKey);
|
||||
DWORD ParseRegType(LPSTR szType);
|
||||
BOOL WinRegKeyExists(HKEY hkRootKey, LPSTR szKey);
|
||||
BOOL WinRegNameExists(HKEY hkRootKey, LPSTR szKey, LPSTR szName);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -54,6 +54,7 @@ LPSTR szTempSetupPath;
|
|||
LPSTR szClassName;
|
||||
LPSTR szSetupDir;
|
||||
LPSTR szTempDir;
|
||||
LPSTR szOSTempDir;
|
||||
LPSTR szFileIniConfig;
|
||||
|
||||
LPSTR szSiteSelectorDescription;
|
||||
|
|
|
@ -62,6 +62,7 @@ typedef int PRInt32;
|
|||
#define FILE_IDI_GETARCHIVES "getarchives.idi"
|
||||
#define FILE_IDI_GETREDIRECT "getredirect.idi"
|
||||
#define FILE_INI_REDIRECT "redirect.ini"
|
||||
#define WIZ_TEMP_DIR "ns_temp"
|
||||
|
||||
/* PP: Parse Path */
|
||||
#define PP_FILENAME_ONLY 1
|
||||
|
@ -97,6 +98,7 @@ typedef int PRInt32;
|
|||
#define FO_ERROR_DESTINATION_CONFLICT 2
|
||||
#define FO_ERROR_CHANGE_DIR 3
|
||||
|
||||
/* Mode of Setup to run in */
|
||||
#define NORMAL 0
|
||||
#define SILENT 1
|
||||
#define AUTO 2
|
||||
|
|
|
@ -276,28 +276,31 @@ void cbXPIProgress(const char* msg, PRInt32 val, PRInt32 max)
|
|||
char szStrProcessingFileBuf[MAX_BUF];
|
||||
char szStrCopyingFileBuf[MAX_BUF];
|
||||
|
||||
ParsePath((char *)msg, szFilename, sizeof(szFilename), PP_FILENAME_ONLY);
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
{
|
||||
ParsePath((char *)msg, szFilename, sizeof(szFilename), PP_FILENAME_ONLY);
|
||||
|
||||
if(max == 0)
|
||||
{
|
||||
wsprintf(szStrProcessingFileBuf, szStrProcessingFile, szFilename);
|
||||
SetDlgItemText(dlgInfo.hWndDlg, IDC_STATUS3, szStrProcessingFileBuf);
|
||||
bBarberBar = TRUE;
|
||||
UpdateGaugeFileBarber();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bBarberBar == TRUE)
|
||||
if(max == 0)
|
||||
{
|
||||
dlgInfo.nFileBars = 0;
|
||||
++dwCurrentArchive;
|
||||
UpdateGaugeArchiveProgressBar((unsigned)(((double)(dwCurrentArchive)/(double)dwTotalArchives)*(double)100));
|
||||
bBarberBar = FALSE;
|
||||
wsprintf(szStrProcessingFileBuf, szStrProcessingFile, szFilename);
|
||||
SetDlgItemText(dlgInfo.hWndDlg, IDC_STATUS3, szStrProcessingFileBuf);
|
||||
bBarberBar = TRUE;
|
||||
UpdateGaugeFileBarber();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bBarberBar == TRUE)
|
||||
{
|
||||
dlgInfo.nFileBars = 0;
|
||||
++dwCurrentArchive;
|
||||
UpdateGaugeArchiveProgressBar((unsigned)(((double)(dwCurrentArchive)/(double)dwTotalArchives)*(double)100));
|
||||
bBarberBar = FALSE;
|
||||
}
|
||||
|
||||
wsprintf(szStrCopyingFileBuf, szStrCopyingFile, szFilename);
|
||||
SetDlgItemText(dlgInfo.hWndDlg, IDC_STATUS3, szStrCopyingFileBuf);
|
||||
UpdateGaugeFileProgressBar((unsigned)(((double)(val+1)/(double)max)*(double)100));
|
||||
wsprintf(szStrCopyingFileBuf, szStrCopyingFile, szFilename);
|
||||
SetDlgItemText(dlgInfo.hWndDlg, IDC_STATUS3, szStrCopyingFileBuf);
|
||||
UpdateGaugeFileProgressBar((unsigned)(((double)(val+1)/(double)max)*(double)100));
|
||||
}
|
||||
}
|
||||
|
||||
ProcessWindowsMessages();
|
||||
|
@ -349,39 +352,43 @@ ProgressDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
static void
|
||||
UpdateGaugeFileBarber()
|
||||
{
|
||||
int nBars;
|
||||
HWND hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE_FILE);
|
||||
int nBars;
|
||||
HWND hWndGauge;
|
||||
RECT rect;
|
||||
|
||||
if(dwBarberDirection == BDIR_RIGHT)
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
{
|
||||
if(lBarberCounter < 151)
|
||||
++lBarberCounter;
|
||||
else
|
||||
dwBarberDirection = BDIR_LEFT;
|
||||
hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE_FILE);
|
||||
if(dwBarberDirection == BDIR_RIGHT)
|
||||
{
|
||||
if(lBarberCounter < 151)
|
||||
++lBarberCounter;
|
||||
else
|
||||
dwBarberDirection = BDIR_LEFT;
|
||||
}
|
||||
else if(dwBarberDirection == BDIR_LEFT)
|
||||
{
|
||||
if(lBarberCounter > 0)
|
||||
--lBarberCounter;
|
||||
else
|
||||
dwBarberDirection = BDIR_RIGHT;
|
||||
}
|
||||
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = (dlgInfo.nMaxFileBars * lBarberCounter / 100);
|
||||
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nFileBars = nBars;
|
||||
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
else if(dwBarberDirection == BDIR_LEFT)
|
||||
{
|
||||
if(lBarberCounter > 0)
|
||||
--lBarberCounter;
|
||||
else
|
||||
dwBarberDirection = BDIR_RIGHT;
|
||||
}
|
||||
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = (dlgInfo.nMaxFileBars * lBarberCounter / 100);
|
||||
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nFileBars = nBars;
|
||||
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
|
||||
// This routine will update the File Gauge progress bar to the specified percentage
|
||||
|
@ -391,27 +398,30 @@ UpdateGaugeFileProgressBar(unsigned value)
|
|||
{
|
||||
int nBars;
|
||||
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = dlgInfo.nMaxFileBars * value / 100;
|
||||
|
||||
// Only paint if we need to display more bars
|
||||
if((nBars > dlgInfo.nFileBars) || (dlgInfo.nFileBars == 0))
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
{
|
||||
HWND hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE_FILE);
|
||||
RECT rect;
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = dlgInfo.nMaxFileBars * value / 100;
|
||||
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nFileBars = nBars;
|
||||
// Only paint if we need to display more bars
|
||||
if((nBars > dlgInfo.nFileBars) || (dlgInfo.nFileBars == 0))
|
||||
{
|
||||
HWND hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE_FILE);
|
||||
RECT rect;
|
||||
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nFileBars = nBars;
|
||||
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This routine will update the Archive Gauge progress bar to the specified percentage
|
||||
|
@ -421,27 +431,30 @@ UpdateGaugeArchiveProgressBar(unsigned value)
|
|||
{
|
||||
int nBars;
|
||||
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = dlgInfo.nMaxArchiveBars * value / 100;
|
||||
|
||||
// Only paint if we need to display more bars
|
||||
if (nBars > dlgInfo.nArchiveBars)
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
{
|
||||
HWND hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE_ARCHIVE);
|
||||
RECT rect;
|
||||
// Figure out how many bars should be displayed
|
||||
nBars = dlgInfo.nMaxArchiveBars * value / 100;
|
||||
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nArchiveBars = nBars;
|
||||
// Only paint if we need to display more bars
|
||||
if (nBars > dlgInfo.nArchiveBars)
|
||||
{
|
||||
HWND hWndGauge = GetDlgItem(dlgInfo.hWndDlg, IDC_GAUGE_ARCHIVE);
|
||||
RECT rect;
|
||||
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
// Update the gauge state before painting
|
||||
dlgInfo.nArchiveBars = nBars;
|
||||
|
||||
// Only invalidate the part that needs updating
|
||||
GetClientRect(hWndGauge, &rect);
|
||||
InvalidateRect(hWndGauge, &rect, FALSE);
|
||||
|
||||
// Update the whole extracting dialog. We do this because we don't
|
||||
// have a message loop to process WM_PAINT messages in case the
|
||||
// extracting dialog was exposed
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a recessed border around the gauge
|
||||
|
@ -663,26 +676,32 @@ void InitProgressDlg()
|
|||
{
|
||||
WNDCLASS wc;
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.style = CS_GLOBALCLASS;
|
||||
wc.hInstance = hInst;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wc.lpfnWndProc = (WNDPROC)GaugeFileWndProc;
|
||||
wc.lpszClassName = "GaugeFile";
|
||||
RegisterClass(&wc);
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
{
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.style = CS_GLOBALCLASS;
|
||||
wc.hInstance = hInst;
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
|
||||
wc.lpfnWndProc = (WNDPROC)GaugeFileWndProc;
|
||||
wc.lpszClassName = "GaugeFile";
|
||||
RegisterClass(&wc);
|
||||
|
||||
wc.lpfnWndProc = (WNDPROC)GaugeArchiveWndProc;
|
||||
wc.lpszClassName = "GaugeArchive";
|
||||
RegisterClass(&wc);
|
||||
wc.lpfnWndProc = (WNDPROC)GaugeArchiveWndProc;
|
||||
wc.lpszClassName = "GaugeArchive";
|
||||
RegisterClass(&wc);
|
||||
|
||||
// Display the dialog box
|
||||
dlgInfo.hWndDlg = CreateDialog(hSetupRscInst, MAKEINTRESOURCE(DLG_EXTRACTING), hWndMain, (WNDPROC)ProgressDlgProc);
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
// Display the dialog box
|
||||
dlgInfo.hWndDlg = CreateDialog(hSetupRscInst, MAKEINTRESOURCE(DLG_EXTRACTING), hWndMain, (WNDPROC)ProgressDlgProc);
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
}
|
||||
}
|
||||
|
||||
void DeInitProgressDlg()
|
||||
{
|
||||
DestroyWindow(dlgInfo.hWndDlg);
|
||||
UnregisterClass("GaugeFile", hInst);
|
||||
UnregisterClass("GaugeArchive", hInst);
|
||||
if(sgProduct.dwMode != SILENT)
|
||||
{
|
||||
DestroyWindow(dlgInfo.hWndDlg);
|
||||
UnregisterClass("GaugeFile", hInst);
|
||||
UnregisterClass("GaugeArchive", hInst);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,8 +84,10 @@
|
|||
#define IDC_LIST1 1053
|
||||
#define IDC_BUTTON1 1055
|
||||
#define IDC_README 1055
|
||||
#define IDC_BUTTON_SITE_SELECTOR 1055
|
||||
#define IDC_DOWNLOAD_SIZE 1058
|
||||
#define IDC_SITE_SELECTOR 1059
|
||||
#define IDC_LIST_SITE_SELECTOR 1059
|
||||
#define DLG_WELCOME 2001
|
||||
#define DLG_LICENSE 2002
|
||||
#define DLG_SETUP_TYPE 2003
|
||||
|
@ -117,6 +119,7 @@
|
|||
#define IDS_STR_CREATE_DIRECTORY 11016
|
||||
#define IDS_ERROR_PROGRAM_FOLDER_NAME 11017
|
||||
#define IDS_CB_DEFAULT 11018
|
||||
#define IDS_ERROR_DESTINATION_PATH 11019
|
||||
#define IDC_STATIC -1
|
||||
|
||||
// Next default values for new objects
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
|
||||
#define WINVER 0x400
|
||||
#include "setuprsc.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
|
@ -151,10 +149,10 @@ STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
|||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
BEGIN
|
||||
EDITTEXT IDC_EDIT_PROGRAM_FOLDER,101,64,204,12,ES_AUTOHSCROLL
|
||||
LISTBOX IDC_LIST,101,94,204,77,LBS_SORT | LBS_NOINTEGRALHEIGHT |
|
||||
LISTBOX IDC_LIST,101,94,204,79,LBS_SORT | LBS_NOINTEGRALHEIGHT |
|
||||
WS_VSCROLL | WS_HSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "< &Back",IDWIZBACK,134,186,53,14
|
||||
DEFPUSHBUTTON "&Next",IDWIZNEXT,188,186,53,14
|
||||
DEFPUSHBUTTON "&Install",IDWIZNEXT,188,186,53,14
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,252,186,53,14
|
||||
LTEXT "",IDC_MESSAGE0,101,11,204,33,NOT WS_GROUP
|
||||
LTEXT "&Program Folder:",IDC_STATIC,101,54,105,8
|
||||
|
@ -163,6 +161,8 @@ BEGIN
|
|||
WS_EX_CLIENTEDGE
|
||||
CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,11,179,295,1,
|
||||
WS_EX_STATICEDGE
|
||||
PUSHBUTTON "Download Site Selector",IDC_BUTTON_SITE_SELECTOR,11,186,
|
||||
90,14
|
||||
END
|
||||
|
||||
DLG_LICENSE DIALOG DISCARDABLE 51, 56, 315, 205
|
||||
|
@ -250,14 +250,13 @@ END
|
|||
|
||||
DLG_SITE_SELECTOR DIALOGEX 51, 56, 315, 205
|
||||
STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x1
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "&Install",IDWIZNEXT,188,186,53,14
|
||||
DEFPUSHBUTTON "&Ok",IDWIZNEXT,188,186,53,14
|
||||
PUSHBUTTON "&Cancel",IDCANCEL,252,186,53,14
|
||||
COMBOBOX IDC_SITE_SELECTOR,101,49,198,124,CBS_DROPDOWNLIST |
|
||||
COMBOBOX IDC_LIST_SITE_SELECTOR,101,49,198,124,CBS_DROPDOWNLIST |
|
||||
CBS_SORT | CBS_NOINTEGRALHEIGHT | WS_VSCROLL |
|
||||
WS_TABSTOP
|
||||
PUSHBUTTON "< &Back",IDWIZBACK,134,186,53,14
|
||||
LTEXT "Select the region you wish to download from, or leave it on Default for Setup to automatically determine the best place to download from releative to where you are.",
|
||||
IDC_MESSAGE0,101,11,204,33,NOT WS_GROUP
|
||||
CONTROL 108,-1,"Static",SS_BITMAP,11,11,80,160,WS_EX_CLIENTEDGE
|
||||
|
@ -319,6 +318,11 @@ IDB_BOX_CHECKED_DISABLED BITMAP FIXED IMPURE "box_ch_d.bmp"
|
|||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO DISCARDABLE
|
||||
BEGIN
|
||||
DLG_PROGRAM_FOLDER, DIALOG
|
||||
BEGIN
|
||||
HORZGUIDE, 144
|
||||
END
|
||||
|
||||
DLG_EXTRACTING, DIALOG
|
||||
BEGIN
|
||||
BOTTOMMARGIN, 72
|
||||
|
@ -383,6 +387,7 @@ BEGIN
|
|||
"The following directory does not exist:%sWould you like to create it?"
|
||||
IDS_STR_CREATE_DIRECTORY "Create Directory?"
|
||||
IDS_ERROR_PROGRAM_FOLDER_NAME "Invalid program folder name entered."
|
||||
IDS_ERROR_DESTINATION_PATH "Invalid path entered."
|
||||
IDS_CB_DEFAULT "Default"
|
||||
END
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче