From 249da37d53ae8ea2327812e9c1344a3a764f7432 Mon Sep 17 00:00:00 2001 From: "ssu%netscape.com" Date: Thu, 8 Jul 2004 00:47:08 +0000 Subject: [PATCH] fixing bug 47762 - Installer switches focus to itself repeatedly. r=leaf, sr=dveditz, a=asa --- xpinstall/packager/win_gre/install.it | 129 --- xpinstall/packager/win_mfcembed/install.it | 129 --- xpinstall/packager/windows/.cvsignore | 2 + xpinstall/packager/windows/install.it | 129 --- xpinstall/src/.cvsignore | 1 + xpinstall/wizard/windows/setup/dialogs.c | 281 ++++-- xpinstall/wizard/windows/setup/dialogs.h | 86 -- xpinstall/wizard/windows/setup/extra.c | 58 +- xpinstall/wizard/windows/setup/extra.h | 252 ------ xpinstall/wizard/windows/setup/ifuncns.c | 11 +- xpinstall/wizard/windows/setup/setup.c | 230 ----- xpinstall/wizard/windows/setup/setup.h | 670 --------------- xpinstall/wizard/windows/setup/xpi.c | 10 +- xpinstall/wizard/windows/setup/xpnetHook.cpp | 4 +- xpinstall/wizard/windows/setuprsc/setuprsc.rc | 1 + xpinstall/wizard/windows/uninstall/parser.c | 806 ------------------ 16 files changed, 239 insertions(+), 2560 deletions(-) diff --git a/xpinstall/packager/win_gre/install.it b/xpinstall/packager/win_gre/install.it index 25dc31a7c7c..e69de29bb2d 100644 --- a/xpinstall/packager/win_gre/install.it +++ b/xpinstall/packager/win_gre/install.it @@ -1,129 +0,0 @@ -[General] -FONTNAME=MS Sans Serif -FONTSIZE=8 -CHARSET=0 -;Here is a partial list CHAR_SETS -; ANSI_CHARSET = 0 -; DEFAULT_CHARSET = 1 -; SYMBOL_CHARSET = 2 -; SHIFTJIS_CHARSET = 128 -; GB2312_CHARSET = 134 -; HANGEUL_CHARSET = 129 -; CHINESEBIG5_CHARSET = 136 -; OEM_CHARSET 255 - -OK_=&OK -OK=OK -CANCEL=Cancel -CANCEL_=&Cancel -NEXT_=&Next > -BACK_=< &Back -IGNORE_=&Ignore -PROXYSETTINGS=Proxy Settings: -PROXYSETTINGS_=&Proxy Settings -SERVER=Server: -PORT=Port: -USERID=User id: -PASSWORD=Password: -SELECTDIRECTORY=Select a directory -DIRECTORIES_=&Directories: -DRIVES_=Dri&ves: -STATUS=Remaining: -FILE=File: -URL=URL: -TO=To Path: -ACCEPT_=&Accept -DECLINE_=&Decline -PROGRAMFOLDER_=&Program Folder: -EXISTINGFOLDERS_=E&xisting Folders: -SETUPMESSAGE=Setup has finished copying files to your computer. Before you can use $ProductNameInternal$, you must restart Windows or your computer. Choose one of the following options and click OK to finish setup. -RESTART=Restart -YESRESTART=Yes, I want to restart my computer now. -NORESTART=No, I will restart my computer later. -ADDITIONALCOMPONENTS_=&Additional Components: -DESCRIPTION=Description -TOTALDOWNLOADSIZE=Total download size: -SPACEAVAILABLE=Space Available: -COMPONENTS_=C&omponents: -DESTINATIONDIRECTORY=Destination Directory -BROWSE_=B&rowse... -CURRENTSETTINGS=Current Settings: -INSTALL_=&Install -DELETE_=&Delete -CONTINUE_=&Continue -SKIP_=&Skip -README=Re&ad Me -PAUSE_=&Pause -RESUME_=&Resume -CHECKED=Checked -UNCHECKED=Unchecked - -EXTRACTING=Extracting... - - -[Messages] - -ERROR_DIALOG_CREATE=Could not create %s dialog. -ERROR_FAILED=%s failed. -ERROR_FILE_NOT_FOUND=File not found: %s -ERROR_GET_SYSTEM_DIRECTORY_FAILED=GetSystemDirectory() failed. -ERROR_GET_WINDOWS_DIRECTORY_FAILED =GetWindowsDirectory() failed. -DLGQUITTITLE=Exit Setup -DLGQUITMSG=Setup is not complete. If you quit the Setup program now, the program will not be installed. You may run the Setup program at a later time to complete the installation. Are you sure you want to cancel Setup? -DLG_REBOOT_TITLE=Restarting Windows -ERROR_GETPROCADDRESS=GetProcAddress() of %s failed. -ERROR_WRITEPRIVATEPROFILESTRING=WritePrivateProfileString() failed for file %s -MSG_RETRIEVE_CONFIGINI=Please wait while Setup is attempting to retrieve Config.ini, required by Setup, from the Web... -ERROR_CREATE_TEMP_DIR=Setup was unable to create the TEMP directory: %s -DLGBROWSETITLE=Select a directory -ERROR_DETERMINING_DISK_SPACE=Could not determine available disk space for: %s -DLG_DISK_SPACE_CHECK_TITLE=Disk space check -DLG_DISK_SPACE_CHECK_CRUTIAL_MSG=Setup has detected insufficient disk space to continue with installation on %s for the path: %sRequired: %sAvailable: %sClick Retry if more disk space has been made available, or click Cancel to cancel Setup. -DLG_DISK_SPACE_CHECK_MSG=Setup has detected insufficient disk space to continue with installation process on %s for the path: %sRequired: %sAvailable: %sClick OK to go back and choose a different destination path. -ERROR_CREATE_DIRECTORY=Could not create folder: %sMake sure you have access to create the folder. -ERROR_MESSAGE_TITLE=$ProductNameInternal$ Setup Error -STR_FILE_NUMBER=File count: -STR_FILENAME=Filename: -MSG_SMARTUPDATE_START=Preparing Install, please wait... -MSG_CONFIGURING=Configuring %s, please wait... -ERROR_XPI_INSTALL=Error occurred during installation -ERROR_SETUP_REQUIREMENT=Windows95 or greater Operating System is required! Exiting setup... -DLG_EXTRACTING_TITLE=$ProductName$ Setup - Install Progress -STR_PROCESSINGFILE=Preparing file: %s -STR_INSTALLING=Currently installing %s -STR_COPYINGFILE=Copying file: %s -MB_WARNING_STR=Warning -MB_MESSAGE_STR=Message -MB_ATTENTION_STR=Attention -MSG_CREATE_DIRECTORY=The following directory does not exist:%sWould you like to create it? -STR_CREATE_DIRECTORY=Create Directory? -ERROR_PROGRAM_FOLDER_NAME=Invalid Program folder name entered. -CB_DEFAULT=Default -ERROR_DESTINATION_PATH=Invalid path entered. -STR_SETUP_TYPE=Setup Type: -STR_SELECTED_COMPONENTS=Selected Components: -STR_DESTINATION_DIRECTORY=Destination Directory: -STR_PROGRAM_FOLDER=Program Folder: -STR_DELETING_DESTINATION_DIR=Deleting destination directory to be able to upgrade, please wait... -STR_SETUP=Setup -STR_DOWNLOAD_SITE=Download Site: -STR_SAVE_INSTALLER_FILES=Save downloaded and Setup program files to: -MSG_INIT_SETUP=Initializing Setup, please wait... -STR_MESSAGEBOX_TITLE=%s Setup -ERROR_GETVERSION=GetVersionEx() failed! -DLG_USAGE_TITLE=Usage - -STATUS_EXTRACTING=Extracting %s -STATUS_LAUNCHING_SETUP=Launching Setup... -ERROR_FILE_WRITE=Unable to write file %s -TITLE=Installation -ERROR_OUT_OF_MEMORY=Out of memory! - -ERROR_DLL_LOAD=Could not load %s -ERROR_STRING_LOAD=Could not load string resource ID %d -ERROR_STRING_NULL=Null pointer encountered. -ERROR_GLOBALALLOC=Memory allocation error. -MSG_FORCE_QUIT_PROCESS=Setup has detected that %s (%s) is still running. Click OK to quit %s and proceed with installation. Alternatively, use the Windows Task Manager to quit %s, and then click OK to continue with installation. -MSG_FORCE_QUIT_PROCESS_FAILED=Setup will now exit. Setup could not continue because %s (%s) is still running. Try manually quitting %s using Windows Task Manager, and then run Setup again. -ERROR_PATH_WITHIN_WINDIR=Setup has detected that you have selected a directory within the Windows directory and will not allow the installation to proceed. Please choose a different directory. - diff --git a/xpinstall/packager/win_mfcembed/install.it b/xpinstall/packager/win_mfcembed/install.it index 25dc31a7c7c..e69de29bb2d 100644 --- a/xpinstall/packager/win_mfcembed/install.it +++ b/xpinstall/packager/win_mfcembed/install.it @@ -1,129 +0,0 @@ -[General] -FONTNAME=MS Sans Serif -FONTSIZE=8 -CHARSET=0 -;Here is a partial list CHAR_SETS -; ANSI_CHARSET = 0 -; DEFAULT_CHARSET = 1 -; SYMBOL_CHARSET = 2 -; SHIFTJIS_CHARSET = 128 -; GB2312_CHARSET = 134 -; HANGEUL_CHARSET = 129 -; CHINESEBIG5_CHARSET = 136 -; OEM_CHARSET 255 - -OK_=&OK -OK=OK -CANCEL=Cancel -CANCEL_=&Cancel -NEXT_=&Next > -BACK_=< &Back -IGNORE_=&Ignore -PROXYSETTINGS=Proxy Settings: -PROXYSETTINGS_=&Proxy Settings -SERVER=Server: -PORT=Port: -USERID=User id: -PASSWORD=Password: -SELECTDIRECTORY=Select a directory -DIRECTORIES_=&Directories: -DRIVES_=Dri&ves: -STATUS=Remaining: -FILE=File: -URL=URL: -TO=To Path: -ACCEPT_=&Accept -DECLINE_=&Decline -PROGRAMFOLDER_=&Program Folder: -EXISTINGFOLDERS_=E&xisting Folders: -SETUPMESSAGE=Setup has finished copying files to your computer. Before you can use $ProductNameInternal$, you must restart Windows or your computer. Choose one of the following options and click OK to finish setup. -RESTART=Restart -YESRESTART=Yes, I want to restart my computer now. -NORESTART=No, I will restart my computer later. -ADDITIONALCOMPONENTS_=&Additional Components: -DESCRIPTION=Description -TOTALDOWNLOADSIZE=Total download size: -SPACEAVAILABLE=Space Available: -COMPONENTS_=C&omponents: -DESTINATIONDIRECTORY=Destination Directory -BROWSE_=B&rowse... -CURRENTSETTINGS=Current Settings: -INSTALL_=&Install -DELETE_=&Delete -CONTINUE_=&Continue -SKIP_=&Skip -README=Re&ad Me -PAUSE_=&Pause -RESUME_=&Resume -CHECKED=Checked -UNCHECKED=Unchecked - -EXTRACTING=Extracting... - - -[Messages] - -ERROR_DIALOG_CREATE=Could not create %s dialog. -ERROR_FAILED=%s failed. -ERROR_FILE_NOT_FOUND=File not found: %s -ERROR_GET_SYSTEM_DIRECTORY_FAILED=GetSystemDirectory() failed. -ERROR_GET_WINDOWS_DIRECTORY_FAILED =GetWindowsDirectory() failed. -DLGQUITTITLE=Exit Setup -DLGQUITMSG=Setup is not complete. If you quit the Setup program now, the program will not be installed. You may run the Setup program at a later time to complete the installation. Are you sure you want to cancel Setup? -DLG_REBOOT_TITLE=Restarting Windows -ERROR_GETPROCADDRESS=GetProcAddress() of %s failed. -ERROR_WRITEPRIVATEPROFILESTRING=WritePrivateProfileString() failed for file %s -MSG_RETRIEVE_CONFIGINI=Please wait while Setup is attempting to retrieve Config.ini, required by Setup, from the Web... -ERROR_CREATE_TEMP_DIR=Setup was unable to create the TEMP directory: %s -DLGBROWSETITLE=Select a directory -ERROR_DETERMINING_DISK_SPACE=Could not determine available disk space for: %s -DLG_DISK_SPACE_CHECK_TITLE=Disk space check -DLG_DISK_SPACE_CHECK_CRUTIAL_MSG=Setup has detected insufficient disk space to continue with installation on %s for the path: %sRequired: %sAvailable: %sClick Retry if more disk space has been made available, or click Cancel to cancel Setup. -DLG_DISK_SPACE_CHECK_MSG=Setup has detected insufficient disk space to continue with installation process on %s for the path: %sRequired: %sAvailable: %sClick OK to go back and choose a different destination path. -ERROR_CREATE_DIRECTORY=Could not create folder: %sMake sure you have access to create the folder. -ERROR_MESSAGE_TITLE=$ProductNameInternal$ Setup Error -STR_FILE_NUMBER=File count: -STR_FILENAME=Filename: -MSG_SMARTUPDATE_START=Preparing Install, please wait... -MSG_CONFIGURING=Configuring %s, please wait... -ERROR_XPI_INSTALL=Error occurred during installation -ERROR_SETUP_REQUIREMENT=Windows95 or greater Operating System is required! Exiting setup... -DLG_EXTRACTING_TITLE=$ProductName$ Setup - Install Progress -STR_PROCESSINGFILE=Preparing file: %s -STR_INSTALLING=Currently installing %s -STR_COPYINGFILE=Copying file: %s -MB_WARNING_STR=Warning -MB_MESSAGE_STR=Message -MB_ATTENTION_STR=Attention -MSG_CREATE_DIRECTORY=The following directory does not exist:%sWould you like to create it? -STR_CREATE_DIRECTORY=Create Directory? -ERROR_PROGRAM_FOLDER_NAME=Invalid Program folder name entered. -CB_DEFAULT=Default -ERROR_DESTINATION_PATH=Invalid path entered. -STR_SETUP_TYPE=Setup Type: -STR_SELECTED_COMPONENTS=Selected Components: -STR_DESTINATION_DIRECTORY=Destination Directory: -STR_PROGRAM_FOLDER=Program Folder: -STR_DELETING_DESTINATION_DIR=Deleting destination directory to be able to upgrade, please wait... -STR_SETUP=Setup -STR_DOWNLOAD_SITE=Download Site: -STR_SAVE_INSTALLER_FILES=Save downloaded and Setup program files to: -MSG_INIT_SETUP=Initializing Setup, please wait... -STR_MESSAGEBOX_TITLE=%s Setup -ERROR_GETVERSION=GetVersionEx() failed! -DLG_USAGE_TITLE=Usage - -STATUS_EXTRACTING=Extracting %s -STATUS_LAUNCHING_SETUP=Launching Setup... -ERROR_FILE_WRITE=Unable to write file %s -TITLE=Installation -ERROR_OUT_OF_MEMORY=Out of memory! - -ERROR_DLL_LOAD=Could not load %s -ERROR_STRING_LOAD=Could not load string resource ID %d -ERROR_STRING_NULL=Null pointer encountered. -ERROR_GLOBALALLOC=Memory allocation error. -MSG_FORCE_QUIT_PROCESS=Setup has detected that %s (%s) is still running. Click OK to quit %s and proceed with installation. Alternatively, use the Windows Task Manager to quit %s, and then click OK to continue with installation. -MSG_FORCE_QUIT_PROCESS_FAILED=Setup will now exit. Setup could not continue because %s (%s) is still running. Try manually quitting %s using Windows Task Manager, and then run Setup again. -ERROR_PATH_WITHIN_WINDIR=Setup has detected that you have selected a directory within the Windows directory and will not allow the installation to proceed. Please choose a different directory. - diff --git a/xpinstall/packager/windows/.cvsignore b/xpinstall/packager/windows/.cvsignore index 999a0977770..f9d0a337781 100644 --- a/xpinstall/packager/windows/.cvsignore +++ b/xpinstall/packager/windows/.cvsignore @@ -31,3 +31,5 @@ mozilla-win32-stub-installer.template mozilla-win32-stub-installer.js gre.js gre.template +spellcheck.js +spellcheck.template diff --git a/xpinstall/packager/windows/install.it b/xpinstall/packager/windows/install.it index 25dc31a7c7c..e69de29bb2d 100644 --- a/xpinstall/packager/windows/install.it +++ b/xpinstall/packager/windows/install.it @@ -1,129 +0,0 @@ -[General] -FONTNAME=MS Sans Serif -FONTSIZE=8 -CHARSET=0 -;Here is a partial list CHAR_SETS -; ANSI_CHARSET = 0 -; DEFAULT_CHARSET = 1 -; SYMBOL_CHARSET = 2 -; SHIFTJIS_CHARSET = 128 -; GB2312_CHARSET = 134 -; HANGEUL_CHARSET = 129 -; CHINESEBIG5_CHARSET = 136 -; OEM_CHARSET 255 - -OK_=&OK -OK=OK -CANCEL=Cancel -CANCEL_=&Cancel -NEXT_=&Next > -BACK_=< &Back -IGNORE_=&Ignore -PROXYSETTINGS=Proxy Settings: -PROXYSETTINGS_=&Proxy Settings -SERVER=Server: -PORT=Port: -USERID=User id: -PASSWORD=Password: -SELECTDIRECTORY=Select a directory -DIRECTORIES_=&Directories: -DRIVES_=Dri&ves: -STATUS=Remaining: -FILE=File: -URL=URL: -TO=To Path: -ACCEPT_=&Accept -DECLINE_=&Decline -PROGRAMFOLDER_=&Program Folder: -EXISTINGFOLDERS_=E&xisting Folders: -SETUPMESSAGE=Setup has finished copying files to your computer. Before you can use $ProductNameInternal$, you must restart Windows or your computer. Choose one of the following options and click OK to finish setup. -RESTART=Restart -YESRESTART=Yes, I want to restart my computer now. -NORESTART=No, I will restart my computer later. -ADDITIONALCOMPONENTS_=&Additional Components: -DESCRIPTION=Description -TOTALDOWNLOADSIZE=Total download size: -SPACEAVAILABLE=Space Available: -COMPONENTS_=C&omponents: -DESTINATIONDIRECTORY=Destination Directory -BROWSE_=B&rowse... -CURRENTSETTINGS=Current Settings: -INSTALL_=&Install -DELETE_=&Delete -CONTINUE_=&Continue -SKIP_=&Skip -README=Re&ad Me -PAUSE_=&Pause -RESUME_=&Resume -CHECKED=Checked -UNCHECKED=Unchecked - -EXTRACTING=Extracting... - - -[Messages] - -ERROR_DIALOG_CREATE=Could not create %s dialog. -ERROR_FAILED=%s failed. -ERROR_FILE_NOT_FOUND=File not found: %s -ERROR_GET_SYSTEM_DIRECTORY_FAILED=GetSystemDirectory() failed. -ERROR_GET_WINDOWS_DIRECTORY_FAILED =GetWindowsDirectory() failed. -DLGQUITTITLE=Exit Setup -DLGQUITMSG=Setup is not complete. If you quit the Setup program now, the program will not be installed. You may run the Setup program at a later time to complete the installation. Are you sure you want to cancel Setup? -DLG_REBOOT_TITLE=Restarting Windows -ERROR_GETPROCADDRESS=GetProcAddress() of %s failed. -ERROR_WRITEPRIVATEPROFILESTRING=WritePrivateProfileString() failed for file %s -MSG_RETRIEVE_CONFIGINI=Please wait while Setup is attempting to retrieve Config.ini, required by Setup, from the Web... -ERROR_CREATE_TEMP_DIR=Setup was unable to create the TEMP directory: %s -DLGBROWSETITLE=Select a directory -ERROR_DETERMINING_DISK_SPACE=Could not determine available disk space for: %s -DLG_DISK_SPACE_CHECK_TITLE=Disk space check -DLG_DISK_SPACE_CHECK_CRUTIAL_MSG=Setup has detected insufficient disk space to continue with installation on %s for the path: %sRequired: %sAvailable: %sClick Retry if more disk space has been made available, or click Cancel to cancel Setup. -DLG_DISK_SPACE_CHECK_MSG=Setup has detected insufficient disk space to continue with installation process on %s for the path: %sRequired: %sAvailable: %sClick OK to go back and choose a different destination path. -ERROR_CREATE_DIRECTORY=Could not create folder: %sMake sure you have access to create the folder. -ERROR_MESSAGE_TITLE=$ProductNameInternal$ Setup Error -STR_FILE_NUMBER=File count: -STR_FILENAME=Filename: -MSG_SMARTUPDATE_START=Preparing Install, please wait... -MSG_CONFIGURING=Configuring %s, please wait... -ERROR_XPI_INSTALL=Error occurred during installation -ERROR_SETUP_REQUIREMENT=Windows95 or greater Operating System is required! Exiting setup... -DLG_EXTRACTING_TITLE=$ProductName$ Setup - Install Progress -STR_PROCESSINGFILE=Preparing file: %s -STR_INSTALLING=Currently installing %s -STR_COPYINGFILE=Copying file: %s -MB_WARNING_STR=Warning -MB_MESSAGE_STR=Message -MB_ATTENTION_STR=Attention -MSG_CREATE_DIRECTORY=The following directory does not exist:%sWould you like to create it? -STR_CREATE_DIRECTORY=Create Directory? -ERROR_PROGRAM_FOLDER_NAME=Invalid Program folder name entered. -CB_DEFAULT=Default -ERROR_DESTINATION_PATH=Invalid path entered. -STR_SETUP_TYPE=Setup Type: -STR_SELECTED_COMPONENTS=Selected Components: -STR_DESTINATION_DIRECTORY=Destination Directory: -STR_PROGRAM_FOLDER=Program Folder: -STR_DELETING_DESTINATION_DIR=Deleting destination directory to be able to upgrade, please wait... -STR_SETUP=Setup -STR_DOWNLOAD_SITE=Download Site: -STR_SAVE_INSTALLER_FILES=Save downloaded and Setup program files to: -MSG_INIT_SETUP=Initializing Setup, please wait... -STR_MESSAGEBOX_TITLE=%s Setup -ERROR_GETVERSION=GetVersionEx() failed! -DLG_USAGE_TITLE=Usage - -STATUS_EXTRACTING=Extracting %s -STATUS_LAUNCHING_SETUP=Launching Setup... -ERROR_FILE_WRITE=Unable to write file %s -TITLE=Installation -ERROR_OUT_OF_MEMORY=Out of memory! - -ERROR_DLL_LOAD=Could not load %s -ERROR_STRING_LOAD=Could not load string resource ID %d -ERROR_STRING_NULL=Null pointer encountered. -ERROR_GLOBALALLOC=Memory allocation error. -MSG_FORCE_QUIT_PROCESS=Setup has detected that %s (%s) is still running. Click OK to quit %s and proceed with installation. Alternatively, use the Windows Task Manager to quit %s, and then click OK to continue with installation. -MSG_FORCE_QUIT_PROCESS_FAILED=Setup will now exit. Setup could not continue because %s (%s) is still running. Try manually quitting %s using Windows Task Manager, and then run Setup again. -ERROR_PATH_WITHIN_WINDIR=Setup has detected that you have selected a directory within the Windows directory and will not allow the installation to proceed. Please choose a different directory. - diff --git a/xpinstall/src/.cvsignore b/xpinstall/src/.cvsignore index aadde58f2c1..53293626671 100644 --- a/xpinstall/src/.cvsignore +++ b/xpinstall/src/.cvsignore @@ -6,3 +6,4 @@ xpinstal.ilk xpinstal.lib xpinstal.pdb Makefile +dependentLibs.h diff --git a/xpinstall/wizard/windows/setup/dialogs.c b/xpinstall/wizard/windows/setup/dialogs.c index 09248ac85cb..0eed1f8d5ff 100644 --- a/xpinstall/wizard/windows/setup/dialogs.c +++ b/xpinstall/wizard/windows/setup/dialogs.c @@ -92,6 +92,15 @@ const int InstallProgressDlgItemList[] = {IDC_STATUS0, * list, we shouldn't use it. */ +void ClosePreviousDialog() +{ + if(!sgProduct.lastDialog) + return; + + DestroyWindow(sgProduct.lastDialog); + sgProduct.lastDialog = NULL; +} + BOOL AskCancelDlg(HWND hDlg) { char szDlgQuitTitle[MAX_BUF]; @@ -117,7 +126,6 @@ BOOL AskCancelDlg(HWND hDlg) GetPrivateProfileString("Strings", "Message Cancel Setup AUTO mode", "", szMsg, sizeof(szMsg), szFileIniConfig); ShowMessage(szMsg, TRUE); Delay(5); - ShowMessage(szMsg, FALSE); bRv = TRUE; } @@ -204,7 +212,8 @@ void RepositionWindow(HWND aHwndDlg, DWORD aBannerImage) int iLeft, iTop; DWORD width = -1; DWORD height = -1; - DWORD windowFlags = SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE; + DWORD windowFlags = SWP_NOSIZE | SWP_NOACTIVATE; + HWND insertAfterHwnd; GetWindowRect(aHwndDlg, &rect); if(aBannerImage && !gShowBannerImage) @@ -217,7 +226,7 @@ void RepositionWindow(HWND aHwndDlg, DWORD aBannerImage) ShowWindow(hwndBanner, SW_HIDE); width = rect.right; height = rect.bottom - rLogo.bottom + rLogo.top; - windowFlags = SWP_NOZORDER | SWP_NOACTIVATE; + windowFlags = SWP_NOACTIVATE; /* aBannerImage indicates which dialog we need to move it's dlg items * up to fit the resized window. @@ -237,9 +246,21 @@ void RepositionWindow(HWND aHwndDlg, DWORD aBannerImage) } } + if(gSystemInfo.lastWindowIsTopWindow) + insertAfterHwnd = HWND_TOP; + else + insertAfterHwnd = HWND_BOTTOM; + iLeft = (gSystemInfo.lastWindowPosCenterX - ((rect.right - rect.left) / 2)); iTop = (gSystemInfo.lastWindowPosCenterY - ((rect.bottom - rect.top) / 2)); - SetWindowPos(aHwndDlg, NULL, iLeft, iTop, width, height, windowFlags); + SetWindowPos(aHwndDlg, insertAfterHwnd, iLeft, iTop, width, height, windowFlags); + + if(gSystemInfo.lastWindowMinimized) + ShowWindow(aHwndDlg, SW_SHOWMINNOACTIVE); + else if(!gSystemInfo.lastWindowIsTopWindow) + ShowWindow(aHwndDlg, SW_SHOWNOACTIVATE); + else + ShowWindow(aHwndDlg, SW_SHOW); } /* Function: SaveWindowPosition() @@ -251,13 +272,37 @@ void RepositionWindow(HWND aHwndDlg, DWORD aBannerImage) */ void SaveWindowPosition(HWND aDlg) { - RECT rectDlg; + WINDOWPLACEMENT wndPlacement; + HWND hwndForegroundWindow; + HWND hwndTopWindow; + HWND hwndParent = NULL; + HWND hwndWindow = NULL; - if(GetWindowRect(aDlg, &rectDlg)) + if(GetWindowPlacement(aDlg, &wndPlacement)) { - gSystemInfo.lastWindowPosCenterX = ((rectDlg.right - rectDlg.left) / 2) + rectDlg.left; - gSystemInfo.lastWindowPosCenterY = ((rectDlg.bottom - rectDlg.top) / 2) + rectDlg.top; + gSystemInfo.lastWindowPosCenterX = ((wndPlacement.rcNormalPosition.right - wndPlacement.rcNormalPosition.left) / 2) + wndPlacement.rcNormalPosition.left; + gSystemInfo.lastWindowPosCenterY = ((wndPlacement.rcNormalPosition.bottom - wndPlacement.rcNormalPosition.top) / 2) + wndPlacement.rcNormalPosition.top; + gSystemInfo.lastWindowMinimized = (wndPlacement.showCmd & SW_MINIMIZE)?TRUE:FALSE; } + + hwndForegroundWindow = GetForegroundWindow(); + hwndTopWindow = GetTopWindow(NULL); + hwndWindow = NULL; + hwndParent = GetParent(aDlg); + while(hwndParent != NULL) + { + hwndWindow = hwndParent; + hwndParent = GetParent(hwndWindow); + } + + if(hwndParent == aDlg) + gSystemInfo.lastWindowIsTopWindow = TRUE; + else if((hwndParent == NULL) && (hwndWindow == aDlg)) + gSystemInfo.lastWindowIsTopWindow = TRUE; + else if(hwndForegroundWindow == aDlg) + gSystemInfo.lastWindowIsTopWindow = TRUE; + else + gSystemInfo.lastWindowIsTopWindow = FALSE; } LRESULT CALLBACK DlgProcWelcome(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) @@ -284,6 +329,7 @@ LRESULT CALLBACK DlgProcWelcome(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) SendDlgItemMessage (hDlg, IDC_STATIC2, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDWIZNEXT, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDCANCEL, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -291,7 +337,7 @@ LRESULT CALLBACK DlgProcWelcome(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { case IDWIZNEXT: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; @@ -357,6 +403,7 @@ LRESULT CALLBACK DlgProcLicense(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) SendDlgItemMessage (hDlg, IDWIZBACK, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDWIZNEXT, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDCANCEL, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -364,13 +411,13 @@ LRESULT CALLBACK DlgProcLicense(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { case IDWIZNEXT: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -809,6 +856,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara else EnableWindow(GetDlgItem(hDlg, IDC_BUTTON_BROWSE), TRUE); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -912,7 +960,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara dwTempSetupType = dwSetupType; SiCNodeSetItemsSelected(dwSetupType); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; @@ -920,7 +968,7 @@ LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lPara SaveWindowPosition(hDlg); dwTempSetupType = dwSetupType; lstrcpy(szTempSetupPath, sgProduct.szPath); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -974,6 +1022,7 @@ LRESULT CALLBACK DlgProcUpgrade(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) SendDlgItemMessage (hDlg, IDCONTINUE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDSKIP, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDWIZBACK, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -995,7 +1044,7 @@ LRESULT CALLBACK DlgProcUpgrade(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) SiCNodeSetItemsSelected(dwSetupType); SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; @@ -1003,13 +1052,13 @@ LRESULT CALLBACK DlgProcUpgrade(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) sgProduct.doCleanupOnUpgrade = FALSE; SiCNodeSetItemsSelected(dwSetupType); SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -1382,6 +1431,7 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON lstrcat(szBuf, " KB"); SetDlgItemText(hDlg, IDC_DOWNLOAD_SIZE, szBuf); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -1395,13 +1445,13 @@ LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LON case IDWIZNEXT: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -1522,6 +1572,7 @@ LRESULT CALLBACK DlgProcSelectAdditionalComponents(HWND hDlg, UINT msg, WPARAM w lstrcat(szBuf, " KB"); SetDlgItemText(hDlg, IDC_DOWNLOAD_SIZE, szBuf); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -1535,13 +1586,13 @@ LRESULT CALLBACK DlgProcSelectAdditionalComponents(HWND hDlg, UINT msg, WPARAM w case IDWIZNEXT: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -1628,6 +1679,7 @@ LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage (hDlg, IDC_CHECK2, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDC_CHECK3, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDC_MESSAGE1, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -1671,13 +1723,13 @@ LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, L diWindowsIntegration.wiCB3.bCheckBoxState = FALSE; } - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -1740,6 +1792,7 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l SendDlgItemMessage (hDlg, IDC_MESSAGE0, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hDlg, IDC_EDIT_PROGRAM_FOLDER, WM_SETFONT, (WPARAM)sgInstallGui.systemFont, 0L); SendDlgItemMessage (hDlg, IDC_LIST, WM_SETFONT, (WPARAM)sgInstallGui.systemFont, 0L); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -1758,13 +1811,13 @@ LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG l } lstrcpy(sgProduct.szProgramFolderName, szBuf); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -1865,7 +1918,7 @@ LRESULT CALLBACK DlgProcAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LON ShowWindow(GetDlgItem(hDlg, IDC_USE_FTP), SW_HIDE); ShowWindow(GetDlgItem(hDlg, IDC_USE_HTTP), SW_HIDE); } - + ClosePreviousDialog(); break; case WM_COMMAND: @@ -1880,14 +1933,14 @@ LRESULT CALLBACK DlgProcAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LON GetDlgItemText(hDlg, IDC_EDIT_PROXY_PASSWD, diAdvancedSettings.szProxyPasswd, MAX_BUF); SaveDownloadProtocolOption(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: case IDCANCEL: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -2016,6 +2069,7 @@ LRESULT CALLBACK DlgProcAdditionalOptions(HWND hDlg, UINT msg, WPARAM wParam, LO else CheckDlgButton(hDlg, IDC_CHECK_RECAPTURE_HOMEPAGE, BST_UNCHECKED); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -2024,21 +2078,21 @@ LRESULT CALLBACK DlgProcAdditionalOptions(HWND hDlg, UINT msg, WPARAM wParam, LO case IDWIZNEXT: SaveWindowPosition(hDlg); SaveAdditionalOptions(hDlg, hwndCBSiteSelector); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); SaveAdditionalOptions(hDlg, hwndCBSiteSelector); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; case IDC_BUTTON_ADDITIONAL_SETTINGS: SaveWindowPosition(hDlg); SaveAdditionalOptions(hDlg, hwndCBSiteSelector); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(OTHER_DLG_1); break; @@ -2368,6 +2422,7 @@ LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lPa else CheckDlgButton(hDlg, IDC_CHECK_TURBO_MODE, BST_UNCHECKED); + ClosePreviousDialog(); break; case WM_COMMAND: @@ -2383,7 +2438,7 @@ LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lPa diQuickLaunch.bTurboMode = FALSE; } - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; @@ -2396,7 +2451,7 @@ LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lPa else { diQuickLaunch.bTurboMode = FALSE; } - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -2451,7 +2506,7 @@ LRESULT CALLBACK DlgProcStartInstall(HWND hDlg, UINT msg, WPARAM wParam, LONG lP SetDlgItemText(hDlg, IDC_CURRENT_SETTINGS, szMessage); FreeMemory(&szMessage); } - + ClosePreviousDialog(); break; case WM_COMMAND: @@ -2459,13 +2514,13 @@ LRESULT CALLBACK DlgProcStartInstall(HWND hDlg, UINT msg, WPARAM wParam, LONG lP { case IDWIZNEXT: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(NEXT_DLG); break; case IDWIZBACK: SaveWindowPosition(hDlg); - DestroyWindow(hDlg); + sgProduct.lastDialog = hDlg; DlgSequence(PREV_DLG); break; @@ -2554,6 +2609,56 @@ LRESULT CALLBACK DlgProcReboot(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) return(0); } +void ResizeAndSetString(HWND aDlg, LPARAM lParam) +{ + HDC hdcSTMessage; + RECT rDlg; + SIZE sizeString; + LOGFONT logFont; + HFONT hfontTmp; + HFONT hfontOld; + LPSTR string = (LPSTR)lParam; + HWND hSTMessage; + int width; + int height; + + if(!aDlg || !string || (*string == 0)) + return; + + hSTMessage = GetDlgItem(aDlg, IDC_MESSAGE); /* handle to the Static Text message window */ + hdcSTMessage = GetWindowDC(hSTMessage); + SystemParametersInfo(SPI_GETICONTITLELOGFONT, + sizeof(logFont), + (PVOID)&logFont, + 0); + hfontTmp = CreateFontIndirect(&logFont); + if(hfontTmp) + hfontOld = SelectObject(hdcSTMessage, hfontTmp); + + GetTextExtentPoint32(hdcSTMessage, string, lstrlen(string), &sizeString); + SelectObject(hdcSTMessage, hfontOld); + ReleaseDC(hSTMessage, hdcSTMessage); + DeleteObject(hfontTmp); + width = sizeString.cx + 55>150?sizeString.cx + 55:150; + height = sizeString.cy + 50; + SetWindowPos(aDlg, aDlg, + (gSystemInfo.lastWindowPosCenterX)-(width/2), + (gSystemInfo.lastWindowPosCenterY)-(height/2), + width, + height, + SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW); + if(GetClientRect(aDlg, &rDlg)) + SetWindowPos(hSTMessage, + hSTMessage, + rDlg.left, + rDlg.top, + rDlg.right, + rDlg.bottom, + SWP_NOACTIVATE|SWP_NOZORDER|SWP_SHOWWINDOW); + SetDlgItemText(aDlg, IDC_MESSAGE, string); + SaveWindowPosition(aDlg); +} + LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) { RECT rDlg; @@ -2565,6 +2670,7 @@ LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) HFONT hfontOld; char szBuf[MAX_BUF]; char szBuf2[MAX_BUF]; + BOOL wasMinimized = FALSE; ZeroMemory(szBuf, sizeof(szBuf)); ZeroMemory(szBuf2, sizeof(szBuf2)); @@ -2572,6 +2678,7 @@ LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) switch(msg) { case WM_INITDIALOG: + DisableSystemMenuItems(hDlg, TRUE); if(GetPrivateProfileString("Messages", "STR_MESSAGEBOX_TITLE", "", szBuf2, sizeof(szBuf2), szFileIniInstall)) { if((sgProduct.szProductName != NULL) && (*sgProduct.szProductName != '\0')) @@ -2582,48 +2689,33 @@ LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam) else if((sgProduct.szProductName != NULL) && (*sgProduct.szProductName != '\0')) lstrcpy(szBuf, sgProduct.szProductName); + SendDlgItemMessage(hDlg, IDC_MESSAGE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SetWindowText(hDlg, szBuf); RepositionWindow(hDlg, NO_BANNER_IMAGE); break; + case WM_SIZE: + switch(wParam) + { + case SIZE_MINIMIZED: + wasMinimized = TRUE; + break; + + case SIZE_RESTORED: + if(wasMinimized) + { + wasMinimized = FALSE; + ResizeAndSetString(hDlg, lParam); + } + break; + } + return(FALSE); + case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_MESSAGE: - SaveWindowPosition(hDlg); - hdcSTMessage = GetWindowDC(hSTMessage); - - SystemParametersInfo(SPI_GETICONTITLELOGFONT, - sizeof(logFont), - (PVOID)&logFont, - 0); - hfontTmp = CreateFontIndirect(&logFont); - - if(hfontTmp) - hfontOld = SelectObject(hdcSTMessage, hfontTmp); - - GetTextExtentPoint32(hdcSTMessage, (LPSTR)lParam, lstrlen((LPSTR)lParam), &sizeString); - SelectObject(hdcSTMessage, hfontOld); - DeleteObject(hfontTmp); - ReleaseDC(hSTMessage, hdcSTMessage); - - SetWindowPos(hDlg, NULL, - (gSystemInfo.lastWindowPosCenterX)-((sizeString.cx + 55)/2), - (gSystemInfo.lastWindowPosCenterY)-((sizeString.cy + 50)/2), - sizeString.cx + 55, - sizeString.cy + 50, - SWP_SHOWWINDOW|SWP_NOZORDER); - - if(GetClientRect(hDlg, &rDlg)) - SetWindowPos(hSTMessage, - HWND_TOP, - rDlg.left, - rDlg.top, - rDlg.right, - rDlg.bottom, - SWP_SHOWWINDOW|SWP_NOZORDER); - - SetDlgItemText(hDlg, IDC_MESSAGE, (LPSTR)lParam); + ResizeAndSetString(hDlg, lParam); break; } break; @@ -2644,24 +2736,46 @@ void ProcessWindowsMessages() void ShowMessage(LPSTR szMessage, BOOL bShow) { - if(sgProduct.mode != SILENT) + if(sgProduct.mode == SILENT) + return; + + if(bShow) { - if(bShow && szMessage) + if(!szMessage || (*szMessage == '\0')) + return; + + if(!hDlgMessage) { char szBuf[MAX_BUF]; - + ZeroMemory(szBuf, sizeof(szBuf)); GetPrivateProfileString("Messages", "MB_MESSAGE_STR", "", szBuf, sizeof(szBuf), szFileIniInstall); hDlgMessage = InstantiateDialog(hWndMain, DLG_MESSAGE, szBuf, DlgProcMessage); - SendMessage(hDlgMessage, WM_COMMAND, IDC_MESSAGE, (LPARAM)szMessage); - SendDlgItemMessage (hDlgMessage, IDC_MESSAGE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); + } + + if(!IsWindowVisible(hDlgMessage)) + { + DWORD cmdShow = 0x00000000; + + if(gSystemInfo.lastWindowMinimized) + cmdShow = SW_SHOWMINNOACTIVE; + + if(gSystemInfo.lastWindowIsTopWindow) + cmdShow = SW_SHOWNORMAL; + + RepositionWindow(hDlgMessage, NO_BANNER_IMAGE); + ShowWindow(hDlgMessage, cmdShow); } else - { SaveWindowPosition(hDlgMessage); - DestroyWindow(hDlgMessage); - hDlgMessage = NULL; - } + + SendMessage(hDlgMessage, WM_COMMAND, IDC_MESSAGE, (LPARAM)szMessage); + } + else if(hDlgMessage && (IsWindowVisible(hDlgMessage) || gSystemInfo.lastWindowMinimized)) + { + SaveWindowPosition(hDlgMessage); + DestroyWindow(hDlgMessage); + hDlgMessage = NULL; } } @@ -3005,10 +3119,15 @@ void DlgSequence(int iDirection) void CommitInstall(void) { HRESULT hrErr; + char msgPleaseWait[MAX_BUF]; char szDestPath[MAX_BUF]; char szInstallLogFile[MAX_BUF]; long RetrieveResults; + GetPrivateProfileString("Messages", "MSG_PLEASE_WAIT", "", msgPleaseWait, sizeof(msgPleaseWait), szFileIniInstall); + ShowMessage(msgPleaseWait, TRUE); + ClosePreviousDialog(); + LogISShared(); LogISDestinationPath(); LogISSetupType(); @@ -3113,7 +3232,6 @@ void CommitInstall(void) bSDUserCanceled = TRUE; CleanupXpcomFile(); PostQuitMessage(0); - return; } @@ -3133,7 +3251,7 @@ void CommitInstall(void) bSDUserCanceled = TRUE; CleanupXpcomFile(); PostQuitMessage(0); - + ShowMessage(NULL, FALSE); return; } @@ -3152,6 +3270,7 @@ void CommitInstall(void) else hrErr = WIZ_OK; + ShowMessage(msgPleaseWait, TRUE); if((hrErr == WIZ_OK) || (hrErr == 999)) { if(sgProduct.bInstallFiles) @@ -3186,6 +3305,7 @@ void CommitInstall(void) } CleanupXpcomFile(); + ShowMessage(NULL, FALSE); if(NeedReboot()) { LogExitStatus("Reboot"); @@ -3210,5 +3330,6 @@ void CommitInstall(void) CleanupArgsRegistry(); PostQuitMessage(0); } + ShowMessage(NULL, FALSE); gbProcessingXpnstallFiles = FALSE; } diff --git a/xpinstall/wizard/windows/setup/dialogs.h b/xpinstall/wizard/windows/setup/dialogs.h index c16389dc98c..e69de29bb2d 100644 --- a/xpinstall/wizard/windows/setup/dialogs.h +++ b/xpinstall/wizard/windows/setup/dialogs.h @@ -1,86 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Sean Su - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef _DIALOGS_H_ -#define _DIALOGS_H_ - -LRESULT CALLBACK DlgProcMain(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); -LRESULT CALLBACK DlgProcWelcome(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcLicense(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcSetupType(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcSelectComponents(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcSelectAdditionalComponents(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcWindowsIntegration(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcProgramFolder(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcAdditionalOptions(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcAdvancedSettings(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcQuickLaunch(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcSiteSelector(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcStartInstall(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcReboot(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK DlgProcMessage(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); -LRESULT CALLBACK NewListBoxWndProc( HWND, UINT, WPARAM, LPARAM); -LRESULT CALLBACK DlgProcUpgrade(HWND hDlg, UINT msg, WPARAM wParam, LONG lParam); - -void ToggleCheck(HWND hwndListBox, DWORD dwIndex, DWORD dwACFlag); -BOOL AskCancelDlg(HWND hDlg); -void lbAddItem(HWND hList, siC *siCComponent); -HWND InstantiateDialog(HWND hParent, DWORD dwDlgID, LPSTR szTitle, WNDPROC wpDlgProc); -void DlgSequence(int iDirection); -void PaintGradientShade(HWND hWnd, HDC hdc); -BOOL BrowseForDirectory(HWND hDlg, char *szCurrDir); -LRESULT CALLBACK BrowseHookProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -void ShowMessage(LPSTR szMessage, BOOL bShow); -void DrawLBText(LPDRAWITEMSTRUCT lpdis, DWORD dwACFlag); -void DrawCheck(LPDRAWITEMSTRUCT lpdis, DWORD dwACFlag); -void InvalidateLBCheckbox(HWND hwndListBox); -void ProcessWindowsMessages(void); -LPSTR GetStartInstallMessage(void); -void AppendStringWOAmpersand(LPSTR szInputString, DWORD dwInputStringSize, LPSTR szString); -void TruncateString(HWND hWnd, LPSTR szInPath, LPSTR szOutPath, DWORD dwOutPathBufSize); -void SaveAdditionalOptions(HWND hDlg, HWND hwndCBSiteSelector); -WNDPROC SubclassWindow( HWND hWnd, WNDPROC NewWndProc); -LRESULT CALLBACK ListBoxBrowseWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -void DisableSystemMenuItems(HWND hWnd, BOOL bDisableClose); -void CommitInstall(void); -void RepositionWindow(HWND aHwndDlg, DWORD aBannerImage); -void SaveWindowPosition(HWND aDlg); - -#endif /* _DIALOGS_H_ */ - diff --git a/xpinstall/wizard/windows/setup/extra.c b/xpinstall/wizard/windows/setup/extra.c index 4052bad801f..934c088ca83 100644 --- a/xpinstall/wizard/windows/setup/extra.c +++ b/xpinstall/wizard/windows/setup/extra.c @@ -158,8 +158,10 @@ BOOL InitInstance(HINSTANCE hInstance, DWORD dwCmdShow) gSystemInfo.dwScreenX = GetSystemMetrics(SM_CXSCREEN); gSystemInfo.dwScreenY = GetSystemMetrics(SM_CYSCREEN); - gSystemInfo.lastWindowPosCenterX = gSystemInfo.dwScreenX / 2; - gSystemInfo.lastWindowPosCenterY = gSystemInfo.dwScreenY / 2; + gSystemInfo.lastWindowPosCenterX = gSystemInfo.dwScreenX / 2; + gSystemInfo.lastWindowPosCenterY = gSystemInfo.dwScreenY / 2; + gSystemInfo.lastWindowMinimized = FALSE; + gSystemInfo.lastWindowIsTopWindow = TRUE; hInst = hInstance; @@ -204,13 +206,14 @@ void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH) if((sgProduct.mode != SILENT) && (sgProduct.mode != AUTO)) { + ShowMessage(NULL, FALSE); MessageBox(hWndMain, szErrorString, NULL, MB_ICONEXCLAMATION); } else if(sgProduct.mode == AUTO) { ShowMessage(szErrorString, TRUE); Delay(5); - ShowMessage(szErrorString, FALSE); + ShowMessage(NULL, FALSE); } } @@ -296,7 +299,12 @@ HRESULT NS_LoadString(HANDLE hInstance, DWORD dwID, LPSTR szStringBuf, DWORD dwS void Delay(DWORD dwSeconds) { - SleepEx(dwSeconds * 1000, FALSE); + DWORD i; + for(i = 0; i < dwSeconds * 10; i++) + { + SleepEx(100, FALSE); + ProcessWindowsMessages(); + } } BOOL VerifyRestrictedAccess(void) @@ -1765,7 +1773,6 @@ int CRCCheckDownloadedArchives(char *szCorruptedArchiveList, ++dwIndex0; siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL); } - ShowMessage(szMsgCRCCheck, FALSE); return(iResult); } @@ -2587,10 +2594,6 @@ HRESULT CleanupOrphanedGREs() if(greIDListToClean) GlobalFree(greIDListToClean); - // Hide message that orphaned GREs are being cleaned up - if(*sgProduct.greCleanupOrphansMessage != '\0'); - ShowMessage(sgProduct.greCleanupOrphansMessage, FALSE); - return(rv); } @@ -2657,11 +2660,7 @@ void LaunchOneComponent(siC *siCObject, greInfo *aGre) LogISLaunchAppsComponentUncompress(siCObject->szDescriptionShort, dwErr); if(dwErr != FO_SUCCESS) - { - if(*szMessageString != '\0') - ShowMessage(szMessageString, FALSE); return; - } } if(aGre) @@ -2675,9 +2674,6 @@ void LaunchOneComponent(siC *siCObject, greInfo *aGre) if(siCObject->dwAttributes & SIC_UNCOMPRESS) FileDelete(szSpawnFile); - - if(*szMessageString != '\0') - ShowMessage(szMessageString, FALSE); } } } @@ -2706,8 +2702,6 @@ void LaunchExistingGreInstaller(greInfo *aGre) UpdateGreInstallerCmdLine(NULL, szParameterBuf, sizeof(szParameterBuf), FOR_EXISTING_GRE); LogISLaunchAppsComponent(siCObject->szDescriptionShort); WinSpawn(aGre->installerAppPath, szParameterBuf, szTempDir, SW_SHOWNORMAL, WS_WAIT); - if(*szMessageString != '\0') - ShowMessage(szMessageString, FALSE); } HRESULT LaunchApps() @@ -3220,9 +3214,6 @@ HRESULT ProcessXpinstallEngine() if((WIZ_OK == rv) && (siCFXpcomFile.bStatus == STATUS_ENABLED)) rv = ProcessXpcomFile(); - if(*siCFXpcomFile.szMessage != '\0') - ShowMessage(siCFXpcomFile.szMessage, FALSE); - return(rv); } @@ -5004,13 +4995,13 @@ HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPS if((sgProduct.mode != SILENT) && (sgProduct.mode != AUTO)) { + ShowMessage(NULL, FALSE); return(MessageBox(hWndMain, szBufMsg, szDlgDiskSpaceCheckTitle, dwDlgType | MB_ICONEXCLAMATION | MB_DEFBUTTON2 | MB_APPLMODAL | MB_SETFOREGROUND)); } else if(sgProduct.mode == AUTO) { ShowMessage(szBufMsg, TRUE); Delay(5); - ShowMessage(szBufMsg, FALSE); exit(1); } @@ -6308,6 +6299,7 @@ void PrintUsage(void) _snprintf(szUsageMsg, sizeof(szUsageMsg), szBuf, szProcessFilename); szUsageMsg[sizeof(szUsageMsg) - 1] = '\0'; GetPrivateProfileString("Messages", "DLG_USAGE_TITLE", "", strUsage, sizeof(strUsage), szFileIniInstall); + ShowMessage(NULL, FALSE); MessageBox(hWndMain, szUsageMsg, strUsage, MB_ICONEXCLAMATION); } } @@ -6370,7 +6362,7 @@ DWORD ParseForStartupOptions(LPSTR aCmdLine) return(WIZ_OK); } -DWORD ParseCommandLine(LPSTR aMessageToClose, LPSTR lpszCmdLine) +DWORD ParseCommandLine(LPSTR lpszCmdLine) { char szArgVBuf[MAX_BUF]; int i; @@ -6394,7 +6386,7 @@ DWORD ParseCommandLine(LPSTR aMessageToClose, LPSTR lpszCmdLine) if(!lstrcmpi(szArgVBuf, "-h") || !lstrcmpi(szArgVBuf, "/h")) { - ShowMessage(aMessageToClose, FALSE); + ShowMessage(NULL, FALSE); PrintUsage(); return(WIZ_ERROR_UNDEFINED); } @@ -6646,6 +6638,7 @@ HRESULT ShowMessageAndQuitProcess(HWND aHwndFW, char *aMsgQuitProcess, char *aMs { char msgTitleStr[MAX_BUF]; GetPrivateProfileString("Messages", "MB_ATTENTION_STR", "", msgTitleStr, sizeof(msgTitleStr), szFileIniInstall); + ShowMessage(NULL, TRUE); MessageBox(hWndMain, aMsgQuitProcess, msgTitleStr, MB_ICONEXCLAMATION | MB_SETFOREGROUND); break; } @@ -6656,7 +6649,6 @@ HRESULT ShowMessageAndQuitProcess(HWND aHwndFW, char *aMsgQuitProcess, char *aMs * all the windows associated with the process */ ShowMessage(aMsgQuitProcess, TRUE); Delay(5); - ShowMessage(aMsgQuitProcess, FALSE); break; } @@ -6758,6 +6750,7 @@ HRESULT CheckInstances() switch(sgProduct.mode) { case NORMAL: + ShowMessage(NULL, FALSE); MessageBox(hWndMain, buf, msgTitleStr, MB_ICONEXCLAMATION | MB_SETFOREGROUND); break; @@ -6766,7 +6759,6 @@ HRESULT CheckInstances() * all the windows associated with the process */ ShowMessage(buf, TRUE); Delay(5); - ShowMessage(buf, FALSE); break; default: @@ -6981,7 +6973,6 @@ int CRCCheckArchivesStartup(char *szCorruptedArchiveList, DWORD dwCorruptedArchi ++dwIndex0; siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL); } - ShowMessage(szMsgCRCCheck, FALSE); return(iResult); } @@ -7022,7 +7013,6 @@ int StartupCheckArchives(void) GetPrivateProfileString("Strings", "Error Corrupted Archives Detected AUTO mode", "", szBuf, sizeof(szBuf), szFileIniConfig); ShowMessage(szBuf, TRUE); Delay(5); - ShowMessage(szBuf, FALSE); break; } @@ -7232,7 +7222,7 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) if(lstrcmpi(szBuf, "FALSE") == 0) gShowBannerImage = FALSE; - iRv = ParseCommandLine(szMsgInitSetup, lpszCmdLine); + iRv = ParseCommandLine(lpszCmdLine); if(iRv) return(iRv); @@ -7259,11 +7249,9 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) break; case AUTO: - ShowMessage(szMsgInitSetup, FALSE); GetPrivateProfileString("Strings", "Message AUTO Restricted Access", "", szBuf, sizeof(szBuf), szFileIniConfig); ShowMessage(szBuf, TRUE); Delay(5); - ShowMessage(szBuf, FALSE); iRvMB = IDNO; break; @@ -7611,7 +7599,6 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine) LogISProductInfo(); LogMSProductInfo(); CleanupXpcomFile(); - ShowMessage(szMsgInitSetup, FALSE); /* check the windows registry to see if a previous instance of setup finished downloading * all the required archives. */ @@ -9022,6 +9009,12 @@ void DeInitialize() if(gErrorMessageStream.bEnabled && gErrorMessageStream.bSendMessage) SendErrorMessage(); + if(hDlgMessage) + { + DestroyWindow(hDlgMessage); + hDlgMessage = NULL; + } + DeInitSiComponents(&siComponents); DeInitGre(&gGre); DeInitSXpcomFile(); @@ -9140,6 +9133,7 @@ void SaveInstallerFiles() i = 0; while(TRUE) { + ProcessWindowsMessages(); if(*SetupFileList[i] == '\0') break; diff --git a/xpinstall/wizard/windows/setup/extra.h b/xpinstall/wizard/windows/setup/extra.h index 02f2798583a..e69de29bb2d 100644 --- a/xpinstall/wizard/windows/setup/extra.h +++ b/xpinstall/wizard/windows/setup/extra.h @@ -1,252 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Sean Su - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef _EXTRA_H_ -#define _EXTRA_H_ - -#include "supersede.h" - -BOOL InitDialogClass(HINSTANCE hInstance, HINSTANCE hSetupRscInst); -BOOL InitApplication(HINSTANCE hInstance, HINSTANCE hSetupRscInst); -BOOL InitInstance(HINSTANCE hInstance, DWORD dwCmdShow); -void PrintError(LPSTR szMsg, DWORD dwErrorCodeSH); -void FreeMemory(void **vPointer); -void *NS_GlobalReAlloc(HGLOBAL *hgMemory, - DWORD dwMemoryBufSize, - DWORD dwNewSize); -void *NS_GlobalAlloc(DWORD dwMaxBuf); -HRESULT Initialize(HINSTANCE hInstance); -HRESULT NS_LoadStringAlloc(HANDLE hInstance, DWORD dwID, LPSTR *szStringBuf, DWORD dwStringBuf); -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 ParseInstallIni(); -HRESULT DecryptString(LPSTR szOutputStr, LPSTR szInputStr); -HRESULT DecryptVariable(LPSTR szVariable, DWORD dwVariableSize); -void CollateBackslashes(LPSTR szInputOutputStr); -HRESULT InitSetupGeneral(void); -HRESULT InitDlgWelcome(diW *diDialog); -HRESULT InitDlgLicense(diL *diDialog); -HRESULT InitDlgQuickLaunch(diQL *diDialog); -HRESULT InitDlgSetupType(diST *diDialog); -HRESULT InitDlgSelectComponents(diSC *diDialog, DWORD dwSM); -HRESULT InitDlgWindowsIntegration(diWI *diDialog); -HRESULT InitDlgProgramFolder(diPF *diDialog); -HRESULT InitDlgStartInstall(diSI *diDialog); -HRESULT InitDlgSiteSelector(diAS *diDialog); -HRESULT InitSDObject(void); -void DeInitSDObject(void); -siC *CreateSiCNode(void); -void SiCNodeInsert(siC **siCHead, siC *siCTemp); -void SiCNodeDelete(siC *siCTemp); -siCD *CreateSiCDepNode(void); -void SiCDepNodeDelete(siCD *siCDepTemp); -void SiCDepNodeInsert(siCD **siCDepHead, siCD *siCDepTemp); -HRESULT SiCNodeGetAttributes(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -void SiCNodeSetAttributes(DWORD dwIndex, DWORD dwAttributes, BOOL bSet, BOOL bIncludeInvisible, DWORD dwACFlag, HWND hwndListBox); -void SiCNodeSetItemsSelected(DWORD dwSetupType); -char *SiCNodeGetReferenceName(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -char *SiCNodeGetDescriptionShort(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -char *SiCNodeGetDescriptionLong(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -char *SiCNodeGetReferenceName(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -siC *SiCNodeGetObject(DWORD dwIndex, BOOL bIncludeInvisibleObjs, DWORD dwACFlag); -ULONGLONG SiCNodeGetInstallSize(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -ULONGLONG SiCNodeGetInstallSizeSystem(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -ULONGLONG SiCNodeGetInstallSizeArchive(DWORD dwIndex, BOOL bIncludeInvisible, DWORD dwACFlag); -siC *SiCNodeFind(siC *siComponents, char *szInReferenceName); -void InitSiComponents(char *szFileIni); -HRESULT ParseComponentAttributes(char *szBuf, DWORD dwAttributes, BOOL bOverride); -void InitSiteSelector(char *szFileIni); -void DeInitSiCDependencies(siCD *siCDDependencies); -BOOL ResolveDependencies(DWORD dwIndex, HWND hwndListBox); -BOOL ResolveComponentDependency(siCD *siCDInDependency, HWND hwndListBox); -void ResolveDependees(LPSTR szToggledDescriptionShort, HWND hwndListBox); -BOOL ResolveComponentDependee(siCD *siCDInDependee); -void STSetVisibility(st *stSetupType); -HRESULT InitSXpcomFile(void); -void DeInitSXpcomFile(void); -void DeInitialize(void); -void DeInitDlgWelcome(diW *diDialog); -void DeInitDlgLicense(diL *diDialog); -void DeInitDlgQuickLaunch(diQL *diDialog); -void DeInitDlgSetupType(diST *diDialog); -void DeInitDlgSelectComponents(diSC *diDialog); -void DeInitDlgWindowsIntegration(diWI *diDialog); -void DeInitDlgProgramFolder(diPF *diDialog); -void DeInitDlgStartInstall(diSI *diDialog); -void DeInitDlgSiteSelector(diAS *diDialog); -void DetermineOSVersionEx(void); -void DeInitSiComponents(siC **siComponents); -void DeInitSetupGeneral(void); -HRESULT ParseSetupIni(void); -HRESULT GetConfigIni(void); -HRESULT GetInstallIni(void); -void CleanTempFiles(void); -void OutputSetupTitle(HDC hDC); -long RetrieveArchives(void); -long RetrieveRedirectFile(void); -void ParsePath(LPSTR szInput, LPSTR szOutput, DWORD dwOutputSize, BOOL bUseSlash, DWORD dwType); -void RemoveBackSlash(LPSTR szInput); -void AppendBackSlash(LPSTR szInput, DWORD dwInputSize); -void RemoveSlash(LPSTR szInput); -void AppendSlash(LPSTR szInput, DWORD dwInputSize); -BOOL DeleteIdiGetConfigIni(void); -BOOL DeleteIdiGetArchives(void); -BOOL DeleteIdiGetRedirect(void); -BOOL DeleteIdiFileIniConfig(void); -BOOL DeleteIdiFileIniInstall(void); -void DeleteArchives(DWORD dwDeleteCheck); -BOOL DeleteIniRedirect(void); -HRESULT LaunchApps(void); -HRESULT FileExists(LPSTR szFile); -int ExtractDirEntries(char* directory,void* vZip); -int LocateJar(siC *siCObject, LPSTR szPath, int dwPathSize, BOOL bIncludeTempDir); -HRESULT AddArchiveToIdiFile(siC *siCObject, - char *szSFile, - char *szFileIdiGetArchives); -int SiCNodeGetIndexDS(char *szInDescriptionShort); -int SiCNodeGetIndexRN(char *szInReferenceName); -void ViewSiComponentsDependency(char *szBuffer, char *szIndentation, siC *siCNode); -void ViewSiComponentsDependee(char *szBuffer, char *szIndentation, siC *siCNode); -void ViewSiComponents(void); -BOOL IsWin95Debute(void); -ULONGLONG GetDiskSpaceRequired(DWORD dwType); -ULONGLONG GetDiskSpaceAvailable(LPSTR szPath); -HRESULT VerifyDiskSpace(void); -HRESULT ErrorMsgDiskSpace(ULONGLONG ullDSAvailable, ULONGLONG ullDSRequired, LPSTR szPath, BOOL bCrutialMsg); -void SetCustomType(void); -void GetAlternateArchiveSearchPath(LPSTR lpszCmdLine); -BOOL NeedReboot(void); -BOOL LocatePreviousPath(LPSTR szMainSectionName, LPSTR szPath, DWORD dwPathSize); -BOOL LocatePathNscpReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize); -BOOL LocatePathWinReg(LPSTR szSection, LPSTR szPath, DWORD dwPathSize); -BOOL LocatePath(LPSTR szSection, LPSTR szPath, DWORD dwPathSize); -int VR_GetPath(char *component_path, unsigned long sizebuf, char *buf); -dsN *CreateDSNode(); -void DsNodeInsert(dsN **dsNHead, dsN *dsNTemp); -void DsNodeDelete(dsN **dsNTemp); -void DeInitDSNode(dsN **dsnComponentDSRequirement); -void UpdatePathDiskSpaceRequired(LPSTR szPath, ULONGLONG ullInstallSize, dsN **dsnComponentDSRequirement); -HRESULT InitComponentDiskSpaceInfo(dsN **dsnComponentDSRequirement); -HRESULT CheckInstances(); -long RandomSelect(void); -BOOL CheckLegacy(HWND hDlg); -COLORREF DecryptFontColor(LPSTR szColor); -ssi *CreateSsiSiteSelectorNode(); -void SsiSiteSelectorNodeInsert(ssi **ssiHead, ssi *ssiTemp); -void SsiSiteSelectorNodeDelete(ssi *ssiTemp); -ssi* SsiGetNode(LPSTR szDescription); -void UpdateSiteSelector(void); -DWORD GetAdditionalComponentsCount(void); -DWORD GetTotalArchivesToDownload(); -void RemoveQuotes(LPSTR lpszSrc, LPSTR lpszDest, int iDestSize); -int MozCopyStr(LPSTR szSrc, LPSTR szDest, DWORD dwDestBufSize); -LPSTR GetFirstNonSpace(LPSTR lpszString); -LPSTR MozStrChar(LPSTR lpszString, char c); -int GetArgC(LPSTR lpszCommandLine); -LPSTR GetArgV(LPSTR lpszCommandLine, - int iIndex, - LPSTR lpszDest, - int iDestSize); -DWORD ParseCommandLine(LPSTR aMessageToClose, LPSTR lpszCmdLine); -DWORD ParseForStartupOptions(LPSTR aCmdLine); -void SetSetupRunMode(LPSTR szMode); -void Delay(DWORD dwSeconds); -void UnsetSetupState(void); -void SetSetupState(char *szState); -siCD *InitWinInitNodes(char *szInFile); -void UpdateWininit(LPSTR szUninstallFilename); -char *GetSaveInstallerPath(char *szBuf, DWORD dwBufSize); -void SaveInstallerFiles(void); -void ResetComponentAttributes(char *szFileIni); -BOOL IsInList(DWORD dwCurrentItem, - DWORD dwItems, - DWORD *dwItemsSelected); -int LocateExistingPath(char *szPath, - char *szExistingPath, - DWORD dwExistingPathSize); -BOOL ContainsReparseTag(char *szPath, - char *szReparsePath, - DWORD dwReparsePathSize); -BOOL DeleteInstallLogFile(char *szFile); -int CRCCheckDownloadedArchives(char *szCorruptedArchiveList, - DWORD dwCorruptedArchivelistSize, - char *szFileIdiGetArchives); -int CRCCheckArchivesStartup(char *szCorruptedArchiveList, - DWORD dwCorruptedArchiveListSize, - BOOL bIncludeTempPath); -BOOL ResolveForceUpgrade(siC *siCObject); -void RestoreInvisibleFlag(siC *siCNode); -void RestoreAdditionalFlag(siC *siCNode); -void RestoreEnabledFlag(siC *siCNode); -void SwapFTPAndHTTP(char *szInUrl, DWORD dwInUrlSize); -void ClearWinRegUninstallFileDeletion(void); -void RemoveDelayedDeleteFileEntries(const char *aPathToMatch); -int AppendToGlobalMessageStream(char *szInfo); -char *GetOSTypeString(char *szOSType, DWORD dwOSTypeBufSize); -int UpdateIdiFile(char *szPartialUrl, - DWORD dwPartialUrlBufSize, - siC *siCObject, - char *szSection, - char *szKey, - char *szFileIdiGetArchives); -void SetDownloadFile(void); -void UnsetSetupCurrentDownloadFile(void); -void SetSetupCurrentDownloadFile(char *szCurrentFilename); -char *GetSetupCurrentDownloadFile(char *szCurrentDownloadFile, - DWORD dwCurrentDownloadFileBufSize); -BOOL DeleteWGetLog(void); -DWORD ParseOSType(char *szOSType); -BOOL ShowAdditionalOptionsDialog(void); -DWORD GetPreviousUnfinishedState(void); -void RefreshIcons(); -void NeedToInstallFiles(LPSTR szProdDir); -void LaunchOneComponent(siC *siCObject, greInfo *aGre); -HRESULT ProcessXpinstallEngine(void); -void GetXpinstallPath(char *aPath, int aPathBufSize); -BOOL GreInstallerNeedsReboot(void); -void ReplacePrivateProfileStrCR(LPSTR aInputOutputStr); -void UpdateGREAppInstallerProgress(int percent); -BOOL IsPathWithinWindir(); -void CleanupOnUpgrade(); -BOOL IsInstallerProductGRE(void); -HRESULT CleanupOrphanedGREs(void); - -#endif /* _EXTRA_H_ */ - diff --git a/xpinstall/wizard/windows/setup/ifuncns.c b/xpinstall/wizard/windows/setup/ifuncns.c index 3f19e99b670..356631f4b64 100644 --- a/xpinstall/wizard/windows/setup/ifuncns.c +++ b/xpinstall/wizard/windows/setup/ifuncns.c @@ -515,9 +515,6 @@ HRESULT ProcessXpcomFile() char szMsg[MAX_BUF]; char szErrorString[MAX_BUF]; - if(*siCFXpcomFile.szMessage != '\0') - ShowMessage(siCFXpcomFile.szMessage, FALSE); - LogISProcessXpcomFile(LIS_FAILURE, dwErr); GetPrivateProfileString("Strings", "Error File Uncompress", "", szErrorString, sizeof(szErrorString), szFileIniConfig); wsprintf(szMsg, szErrorString, siCFXpcomFile.szSource, dwErr); @@ -603,14 +600,11 @@ HRESULT ProcessUncompressFile(DWORD dwTiming, char *szSectionPrefix) char szMsg[MAX_BUF]; char szErrorString[MAX_BUF]; - ShowMessage(szBuf, FALSE); GetPrivateProfileString("Strings", "Error File Uncompress", "", szErrorString, sizeof(szErrorString), szFileIniConfig); wsprintf(szMsg, szErrorString, szSource, dwErr); PrintError(szMsg, ERROR_CODE_HIDE); return(dwErr); } - - ShowMessage(szBuf, FALSE); } } @@ -1464,11 +1458,8 @@ HRESULT ProcessRunApp(DWORD dwTiming, char *szSectionPrefix) else { GetPrivateProfileString(szSection, "Message", "", szBuf, sizeof(szBuf), szFileIniConfig); - if ( szBuf[0] != '\0' ) - ShowMessage(szBuf, TRUE); + ShowMessage(szBuf, TRUE); WinSpawn(szTarget, szParameters, szWorkingDir, SW_SHOWNORMAL, bWait); - if ( szBuf[0] != '\0' ) - ShowMessage(szBuf, FALSE); } } } diff --git a/xpinstall/wizard/windows/setup/setup.c b/xpinstall/wizard/windows/setup/setup.c index 344872ef330..e69de29bb2d 100644 --- a/xpinstall/wizard/windows/setup/setup.c +++ b/xpinstall/wizard/windows/setup/setup.c @@ -1,230 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Sean Su - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "setup.h" -#include "extra.h" -#include "dialogs.h" -#include "ifuncns.h" - -/* global variables */ -HINSTANCE hInst; -HINSTANCE hSetupRscInst; -HINSTANCE hSDInst; -HINSTANCE hXPIStubInst; - -HBITMAP hbmpBoxChecked; -HBITMAP hbmpBoxCheckedDisabled; -HBITMAP hbmpBoxUnChecked; - -HANDLE hAccelTable; - -HWND hDlgCurrent; -HWND hDlgMessage; -HWND hWndMain; - -LPSTR szEGlobalAlloc; -LPSTR szEStringLoad; -LPSTR szEDllLoad; -LPSTR szEStringNull; -LPSTR szTempSetupPath; -LPSTR szEOutOfMemory; - -LPSTR szSetupDir; -LPSTR szTempDir; -LPSTR szOSTempDir; -LPSTR szFileIniConfig; -LPSTR szFileIniInstall; - -LPSTR szSiteSelectorDescription; - -DWORD dwWizardState; -DWORD dwSetupType; - -DWORD dwTempSetupType; -DWORD gdwUpgradeValue; -DWORD gdwSiteSelectorStatus; - -BOOL bSDUserCanceled; -BOOL bIdiArchivesExists; -BOOL bCreateDestinationDir; -BOOL bReboot; -BOOL gbILUseTemp; -BOOL gbPreviousUnfinishedDownload; -BOOL gbPreviousUnfinishedInstallXpi; -BOOL gbIgnoreRunAppX; -BOOL gbIgnoreProgramFolderX; -BOOL gbRestrictedAccess; -BOOL gbDownloadTriggered; -BOOL gbAllowMultipleInstalls = FALSE; -BOOL gbForceInstall = FALSE; -BOOL gbForceInstallGre = FALSE; -BOOL gShowBannerImage = TRUE; - -setupGen sgProduct; -diS diSetup; -diW diWelcome; -diL diLicense; -diQL diQuickLaunch; -diST diSetupType; -diSC diSelectComponents; -diSC diSelectAdditionalComponents; -diWI diWindowsIntegration; -diPF diProgramFolder; -diDO diAdditionalOptions; -diAS diAdvancedSettings; -diSI diStartInstall; -diD diDownload; -diR diReboot; -siSD siSDObject; -siCF siCFXpcomFile; -siC *siComponents; -ssi *ssiSiteSelector; -installGui sgInstallGui; -sems gErrorMessageStream; -sysinfo gSystemInfo; -dsN *gdsnComponentDSRequirement = NULL; - - -/* do not add setup.exe to the list because we figure out the filename - * by calling GetModuleFileName() */ -char *SetupFileList[] = {"setuprsc.dll", - "config.ini", - "setup.ini", - "install.ini", - "license.txt", - ""}; - -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow) -{ - /***********************************************************************/ - /* HANDLE hInstance; handle for this instance */ - /* HANDLE hPrevInstance; handle for possible previous instances */ - /* LPSTR lpszCmdLine; long pointer to exec command line */ - /* int nCmdShow; Show code for main window display */ - /***********************************************************************/ - - MSG msg; - char szBuf[MAX_BUF]; - int iRv = WIZ_OK; - HWND hwndFW; - - if(!hPrevInstance) - { - if(InitSetupGeneral()) - PostQuitMessage(1); - else if(ParseForStartupOptions(lpszCmdLine)) - PostQuitMessage(1); - else if(((hwndFW = FindWindow(CLASS_NAME_SETUP_DLG, NULL)) != NULL || - ((hwndFW = FindWindow(CLASS_NAME_SETUP, NULL)) != NULL)) && - !gbAllowMultipleInstalls) - { - /* Allow only one instance of setup to run. - * Detect a previous instance of setup, bring it to the - * foreground, and quit current instance */ - - ShowWindow(hwndFW, SW_RESTORE); - SetForegroundWindow(hwndFW); - iRv = WIZ_SETUP_ALREADY_RUNNING; - PostQuitMessage(1); - } - else if(Initialize(hInstance)) - PostQuitMessage(1); - else if(!InitApplication(hInstance, hSetupRscInst)) - { - char szEFailed[MAX_BUF]; - - if(GetPrivateProfileString("Messages", "ERROR_FAILED", "", szEFailed, sizeof(szEFailed), szFileIniInstall)) - { - wsprintf(szBuf, szEFailed, "InitApplication()."); - PrintError(szBuf, ERROR_CODE_SHOW); - } - PostQuitMessage(1); - } - else if(!InitInstance(hInstance, nCmdShow)) - { - char szEFailed[MAX_BUF]; - - if(GetPrivateProfileString("Messages", "ERROR_FAILED", "", szEFailed, sizeof(szEFailed), szFileIniInstall)) - { - wsprintf(szBuf, szEFailed, "InitInstance()."); - PrintError(szBuf, ERROR_CODE_SHOW); - } - PostQuitMessage(1); - } - else if(GetInstallIni()) - { - PostQuitMessage(1); - } - else if(ParseInstallIni()) - { - PostQuitMessage(1); - } - else if(GetConfigIni()) - { - PostQuitMessage(1); - } - else if(ParseConfigIni(lpszCmdLine)) - { - PostQuitMessage(1); - } - else - { - DlgSequence(NEXT_DLG); - } - } - - while(GetMessage(&msg, NULL, 0, 0)) - { - if((!IsDialogMessage(hDlgCurrent, &msg)) && (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - - if(iRv != WIZ_SETUP_ALREADY_RUNNING) - /* Do clean up before exiting from the application */ - DeInitialize(); - - /* garbage collection */ - DeInitSetupGeneral(); - - return(msg.wParam); -} /* End of WinMain */ - diff --git a/xpinstall/wizard/windows/setup/setup.h b/xpinstall/wizard/windows/setup/setup.h index c7bf61f56fb..e69de29bb2d 100644 --- a/xpinstall/wizard/windows/setup/setup.h +++ b/xpinstall/wizard/windows/setup/setup.h @@ -1,670 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Sean Su - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef _SETUP_H_ -#define _SETUP_H_ - -#ifdef __cplusplus -#define PR_BEGIN_EXTERN_C extern "C" { -#define PR_END_EXTERN_C } -#else /* __cplusplus */ -#define PR_BEGIN_EXTERN_C -#define PR_END_EXTERN_C -#endif /* __cplusplus */ - -#define PR_EXTERN(type) type - -typedef unsigned int PRUint32; -typedef int PRInt32; - -#include -#include -#include -#include -#include -#include -#include -#include -#include "setuprsc.h" -#include "resource.h" -#include "zipfile.h" - -#define DEFAULT_SETUP_WINDOW_NAME "Setup" -/* Class name for the invisible window to be created */ -#define CLASS_NAME_SETUP "MozillaSetup" -#define CLASS_NAME_SETUP_DLG "MozillaSetupDlg" -#define FILE_INI_SETUP "setup.ini" -#define FILE_INI_CONFIG "config.ini" -#define FILE_INI_INSTALL "install.ini" -#define FILE_IDI_GETCONFIGINI "getconfigini.idi" -#define FILE_IDI_GETARCHIVES "getarchives.idi" -#define FILE_IDI_GETREDIRECT "getredirect.idi" -#define FILE_INI_REDIRECT "redirect.ini" -#define FILE_WGET_LOG "wget.log" -#define WIZ_TEMP_DIR "ns_temp" -#define FILE_INSTALL_LOG "install_wizard.log" -#define FILE_INSTALL_STATUS_LOG "install_status.log" -#define FILE_ALL_JS "all-proxy.js" -#define VR_DEFAULT_PRODUCT_NAME "Mozilla" - -#define FORCE_ADD_TO_UNINSTALL_LOG TRUE -#define DO_NOT_FORCE_ADD_TO_UNINSTALL_LOG FALSE - -/* defines that indicate whether something should - * be logged to the install_wizardX.log or not - * for uninstallation purposes. - */ -#define ADD_TO_UNINSTALL_LOG TRUE -#define DO_NOT_ADD_TO_UNINSTALL_LOG FALSE - -/* defines that indeicate whether an install command - * should have '*dnu*' prepended. '*dnu*' is parsed - * by the uninstaller and signals that the specific - * install command should _not_ be undone. - */ -#define DNU_UNINSTALL FALSE -#define DNU_DO_NOT_UNINSTALL TRUE - -#define WINREG_OVERWRITE_KEY TRUE -#define WINREG_DO_NOT_OVERWRITE_KEY FALSE -#define WINREG_OVERWRITE_NAME TRUE -#define WINREG_DO_NOT_OVERWRITE_NAME FALSE - -#define INCLUDE_INVISIBLE_OBJS TRUE -#define SKIP_INVISIBLE_OBJS FALSE - -#define NO_BANNER_IMAGE 0x00000000 -#define BANNER_IMAGE_DOWNLOAD 0x00000001 -#define BANNER_IMAGE_INSTALLING 0x00000002 - -#define APPPATH_GRE_PATH_SET 0x00000000 -#define APPPATH_GRE_PATH_NOT_SET 0x00000001 -#define APPPATH_GRE_PATH_ALREADY_SET 0x00000002 - -#define NEXT_DLG 1 -#define PREV_DLG 2 -#define OTHER_DLG_1 3 - -#define MAX_CRC_FAILED_DOWNLOAD_RETRIES 5 -#define MAX_FILE_DOWNLOAD_RETRIES 10 - -#define STATUS_DISABLED 0 -#define STATUS_ENABLED 1 - -#define GRE_SETUP_DIR_NAME "Setup GRE" - -/* filename which contains this product setup's exit status */ -#define SETUP_EXIT_STATUS_LOG "%s Setup Exit Status.log" - -/* LOCAL GRE defines */ -#define GRE_TYPE_NOT_SET -1 -#define GRE_SHARED 0 -#define GRE_LOCAL 1 - -/* WS: WinSpawn wait values */ -#define WS_DO_NOT_WAIT FALSE -#define WS_WAIT TRUE - -#define MAX_KILL_PROCESS_RETRIES 10 - -/* CI: Check Instance */ -#define CI_FORCE_QUIT_PROCESS TRUE -#define CI_CLOSE_PROCESS FALSE - -#define BAR_MARGIN 1 -#define BAR_SPACING 0 -#define BAR_WIDTH 6 -#define BAR_LIBXPNET_MARGIN 1 -#define BAR_LIBXPNET_SPACING 0 -#define BAR_LIBXPNET_WIDTH 1 - -/* W: When for install status logging */ -#define W_START 0 -#define W_END 1 - -/* W: When for crc check failed logging */ -#define W_STARTUP 0 -#define W_DOWNLOAD 1 - -/* UP: Use Protocol */ -#define UP_FTP 0 -#define UP_HTTP 1 - -/* RA: Restricted Access */ -#define RA_IGNORE 0 -#define RA_ONLY_RESTRICTED 1 -#define RA_ONLY_NONRESTRICTED 2 - -/* LIS: Log Install Status */ -#define LIS_SUCCESS 0 -#define LIS_FAILURE 1 - -/* UG: Upgrade */ -#define UG_NONE 0 -#define UG_DELETE 1 -#define UG_IGNORE 2 -#define UG_GOBACK 3 - -/* AP: Archive Path */ -#define AP_NOT_FOUND 0 -#define AP_TEMP_PATH 1 -#define AP_SETUP_PATH 2 -#define AP_ALTERNATE_PATH 3 - -/* PP: Parse Path */ -#define PP_FILENAME_ONLY 1 -#define PP_PATH_ONLY 2 -#define PP_ROOT_ONLY 3 -#define PP_EXTENSION_ONLY 4 - -/* DA: Delete Archive */ -#define DA_ONLY_IF_IN_ARCHIVES_LST 1 -#define DA_ONLY_IF_NOT_IN_ARCHIVES_LST 2 -#define DA_IGNORE_ARCHIVES_LST 3 - -/* T: Timing */ -#define T_PRE_DOWNLOAD 1 -#define T_POST_DOWNLOAD 2 -#define T_PRE_XPCOM 3 -#define T_POST_XPCOM 4 -#define T_PRE_SMARTUPDATE 5 -#define T_POST_SMARTUPDATE 6 -#define T_PRE_LAUNCHAPP 7 -#define T_POST_LAUNCHAPP 8 -#define T_DEPEND_REBOOT 9 -#define T_PRE_ARCHIVE 10 -#define T_POST_ARCHIVE 11 - -#define MAX_BUF 2048 -#define MAX_BUF_TINY 256 -#define MAX_BUF_SMALL 512 -#define MAX_BUF_MEDIUM 1024 -#define MAX_BUF_LARGE MAX_BUF -#define MAX_BUF_XLARGE 4096 -#define MAX_ITOA 46 -#define MAX_INI_SK 128 - -#define ERROR_CODE_HIDE 0 -#define ERROR_CODE_SHOW 1 -#define DLG_NONE 0 -#define DLG_COMMIT_INSTALL 1 -#define CX_CHECKBOX 13 -#define CY_CHECKBOX 13 - -/* WIZ: WIZARD defines */ -#define WIZ_OK 0 -#define WIZ_ERROR_UNDEFINED 1024 -#define WIZ_MEMORY_ALLOC_FAILED 1025 -#define WIZ_OUT_OF_MEMORY WIZ_MEMORY_ALLOC_FAILED -#define WIZ_ARCHIVES_MISSING 1026 -#define WIZ_CRC_PASS WIZ_OK -#define WIZ_CRC_FAIL 1028 -#define WIZ_SETUP_ALREADY_RUNNING 1029 -#define WIZ_TOO_MANY_NETWORK_ERRORS 1030 -#define WIZ_ERROR_PARSING_INTERNAL_STR 1031 -#define WIZ_ERROR_REGKEY 1032 -#define WIZ_ERROR_INIT 1033 -#define WIZ_ERROR_LOADING_RESOURCE_LIB 1034 -#define WIZ_ERROR_CREATE_DIRECTORY 1035 - -/* E: Errors */ -#define E_REBOOT 999 - -/* FO: File Operation */ -#define FO_OK 0 -#define FO_SUCCESS 0 -#define FO_ERROR_FILE_NOT_FOUND 1 -#define FO_ERROR_DESTINATION_CONFLICT 2 -#define FO_ERROR_CHANGE_DIR 3 -#define FO_ERROR_WRITE 4 -#define FO_ERROR_INCR_EXCEEDS_LIMIT 5 - -/* Mode of Setup to run in */ -#define NOT_SET -1 -#define NORMAL 0 -#define SILENT 1 -#define AUTO 2 - -/* ST: Setup Type */ -#define ST_RADIO0 0 -#define ST_RADIO1 1 -#define ST_RADIO2 2 -#define ST_RADIO3 3 - -/* SM: Setup Type Mode */ -#define SM_SINGLE 0 -#define SM_MULTI 1 - -/* SIC: Setup Info Component*/ -#define SIC_SELECTED 0x00000001 -#define SIC_INVISIBLE 0x00000002 -#define SIC_LAUNCHAPP 0x00000004 -#define SIC_DOWNLOAD_REQUIRED 0x00000008 -#define SIC_DOWNLOAD_ONLY 0x00000010 -#define SIC_ADDITIONAL 0x00000020 -#define SIC_DISABLED 0x00000040 -#define SIC_FORCE_UPGRADE 0x00000080 -#define SIC_IGNORE_DOWNLOAD_ERROR 0x00000100 -#define SIC_IGNORE_XPINSTALL_ERROR 0x00000200 -#define SIC_UNCOMPRESS 0x00000400 -#define SIC_SUPERSEDE 0x00000800 - -/* AC: Additional Components */ -#define AC_NONE 0 -#define AC_COMPONENTS 1 -#define AC_ADDITIONAL_COMPONENTS 2 -#define AC_ALL 3 - -/* OS: Operating System */ -#define OS_WIN9x 0x00000001 -#define OS_WIN95_DEBUTE 0x00000002 -#define OS_WIN95 0x00000004 -#define OS_WIN98 0x00000008 -#define OS_NT 0x00000010 -#define OS_NT3 0x00000020 -#define OS_NT4 0x00000040 -#define OS_NT5 0x00000080 -#define OS_NT50 0x00000100 -#define OS_NT51 0x00000200 - -/* DSR: Disk Space Required */ -#define DSR_DESTINATION 0 -#define DSR_SYSTEM 1 -#define DSR_TEMP 2 -#define DSR_DOWNLOAD_SIZE 3 - -/* SS: Site Selector */ -#define SS_HIDE 0 -#define SS_SHOW 1 - -/* PUS: Previous Unfinished State */ -#define PUS_NONE 0 -#define PUS_DOWNLOAD 1 -#define PUS_UNPACK_XPCOM 2 -#define PUS_INSTALL_XPI 3 -#define SETUP_STATE_DOWNLOAD "downloading" -#define SETUP_STATE_UNPACK_XPCOM "unpacking xpcom" -#define SETUP_STATE_INSTALL_XPI "installing xpi" -#define SETUP_STATE_REMOVING_PREV_INST "removing previous installation" - - -typedef struct dlgSetup -{ - DWORD dwDlgID; - WNDPROC fDlgProc; - LPSTR szTitle; -} diS; - -typedef struct dlgWelcome -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessage0; - LPSTR szMessage1; - LPSTR szMessage2; -} diW; - -typedef struct dlgLicense -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szLicenseFilename; - LPSTR szMessage0; - LPSTR szMessage1; -} diL; - -typedef struct dlgQuickLaunch -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessage0; - LPSTR szMessage1; - LPSTR szMessage2; - BOOL bTurboMode; - BOOL bTurboModeEnabled; -} diQL; - - -typedef struct stStruct -{ - BOOL bVisible; - DWORD dwCItems; - DWORD dwCItemsSelected[MAX_BUF]; /* components */ - LPSTR szDescriptionShort; - LPSTR szDescriptionLong; -} st; - -typedef struct dlgSetupType -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessage0; - LPSTR szReadmeFilename; - LPSTR szReadmeApp; - st stSetupType0; - st stSetupType1; - st stSetupType2; - st stSetupType3; -} diST; - -typedef struct dlgSelectComponents -{ - BOOL bShowDialog; - DWORD bShowDialogSM; - LPSTR szTitle; - LPSTR szMessage0; -} diSC; - -typedef struct wiCBstruct -{ - BOOL bEnabled; - BOOL bCheckBoxState; - LPSTR szDescription; - LPSTR szArchive; -} wiCBs; - -typedef struct dlgWindowsIntegration -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessage0; - LPSTR szMessage1; - wiCBs wiCB0; - wiCBs wiCB1; - wiCBs wiCB2; - wiCBs wiCB3; -} diWI; - -typedef struct dlgProgramFolder -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessage0; -} diPF; - -typedef struct dlgAdditionalOptions -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessage0; - LPSTR szMessage1; - BOOL bSaveInstaller; - BOOL bRecaptureHomepage; - BOOL bShowHomepageOption; - DWORD dwUseProtocol; - BOOL bUseProtocolSettings; - BOOL bShowProtocols; -} diDO; - -typedef struct dlgAdvancedSettings -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessage0; - LPSTR szProxyServer; - LPSTR szProxyPort; - LPSTR szProxyUser; - LPSTR szProxyPasswd; -} diAS; - -typedef struct dlgStartInstall -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessageInstall; - LPSTR szMessageDownload; -} diSI; - -typedef struct dlgDownload -{ - BOOL bShowDialog; - LPSTR szTitle; - LPSTR szMessageDownload0; - LPSTR szMessageRetry0; -} diD; - -typedef struct dlgReboot -{ - DWORD dwShowDialog; - LPSTR szTitle; -} diR; - -typedef struct setupStruct -{ - int mode; - int greType; - DWORD dwCustomType; - DWORD dwNumberOfComponents; - LPSTR szPath; - LPSTR szSubPath; - LPSTR szProgramName; - LPSTR szCompanyName; - LPSTR szProductName; - LPSTR szProductNameInternal; - LPSTR szProductNamePrevious; - LPSTR szUninstallFilename; - LPSTR szUserAgent; - LPSTR szProgramFolderName; - LPSTR szProgramFolderPath; - LPSTR szAlternateArchiveSearchPath; - LPSTR szParentProcessFilename; - BOOL bLockPath; - BOOL bSharedInst; - BOOL bInstallFiles; - BOOL checkCleanupOnUpgrade; - BOOL doCleanupOnUpgrade; - LPSTR szAppID; - LPSTR szAppPath; - LPSTR szRegPath; - BOOL greCleanupOrphans; - char greCleanupOrphansMessage[MAX_BUF]; - char greID[MAX_BUF]; - char grePrivateKey[MAX_BUF]; -} setupGen; - -typedef struct sinfoSmartDownload -{ - LPSTR szXpcomFile; - LPSTR szXpcomDir; - LPSTR szNoAds; - LPSTR szSilent; - LPSTR szExecution; - LPSTR szConfirmInstall; - LPSTR szExtractMsg; - LPSTR szExe; - LPSTR szExeParam; - LPSTR szXpcomFilePath; -} siSD; - -typedef struct sinfoXpcomFile -{ - LPSTR szSource; - LPSTR szDestination; - LPSTR szMessage; - BOOL bCleanup; - BOOL bStatus; - ULONGLONG ullInstallSize; -} siCF; - -typedef struct sinfoComponentDep siCD; -struct sinfoComponentDep -{ - LPSTR szDescriptionShort; - LPSTR szReferenceName; - siCD *Next; - siCD *Prev; -}; - -typedef struct sinfoComponent siC; -struct sinfoComponent -{ - ULONGLONG ullInstallSize; - ULONGLONG ullInstallSizeSystem; - ULONGLONG ullInstallSizeArchive; - long lRandomInstallPercentage; - long lRandomInstallValue; - DWORD dwAttributes; - LPSTR szArchiveName; - LPSTR szArchiveNameUncompressed; - LPSTR szArchivePath; - LPSTR szDestinationPath; - LPSTR szDescriptionShort; - LPSTR szDescriptionLong; - LPSTR szParameter; - LPSTR szReferenceName; - BOOL bForceUpgrade; - BOOL bSupersede; - int iNetRetries; - int iCRCRetries; - int iNetTimeOuts; - siCD *siCDDependencies; - siCD *siCDDependees; - siC *Next; - siC *Prev; -}; - -typedef struct ssInfo ssi; -struct ssInfo -{ - LPSTR szDescription; - LPSTR szDomain; - LPSTR szIdentifier; - ssi *Next; - ssi *Prev; -}; - -typedef struct dlgInstall -{ - HFONT systemFont; - HFONT definedFont; - char szFontName[MAX_BUF]; - char szFontSize[MAX_BUF]; - char szCharSet[MAX_BUF]; - char szOk_[MAX_BUF]; - char szOk[MAX_BUF]; - char szCancel_[MAX_BUF]; - char szCancel[MAX_BUF]; - char szNext_[MAX_BUF]; - char szBack_[MAX_BUF]; - char szIgnore_[MAX_BUF]; - char szProxySettings_[MAX_BUF]; - char szProxySettings[MAX_BUF]; - char szServer[MAX_BUF]; - char szPort[MAX_BUF]; - char szUserId[MAX_BUF]; - char szPassword[MAX_BUF]; - char szSelectDirectory[MAX_BUF]; - char szDirectories_[MAX_BUF]; - char szDrives_[MAX_BUF]; - char szStatus[MAX_BUF]; - char szFile[MAX_BUF]; - char szUrl[MAX_BUF]; - char szTo[MAX_BUF]; - char szAccept_[MAX_BUF]; - char szDecline_[MAX_BUF]; - char szProgramFolder_[MAX_BUF]; - char szExistingFolder_[MAX_BUF]; - char szSetupMessage[MAX_BUF]; - char szRestart[MAX_BUF]; - char szYesRestart[MAX_BUF]; - char szNoRestart[MAX_BUF]; - char szAdditionalComponents_[MAX_BUF]; - char szDescription[MAX_BUF]; - char szTotalDownloadSize[MAX_BUF]; - char szSpaceAvailable[MAX_BUF]; - char szComponents_[MAX_BUF]; - char szDestinationDirectory[MAX_BUF]; - char szBrowse_[MAX_BUF]; - char szCurrentSettings[MAX_BUF]; - char szInstall_[MAX_BUF]; - char szDelete_[MAX_BUF]; - char szContinue_[MAX_BUF]; - char szSkip_[MAX_BUF]; - char szExtracting[MAX_BUF]; - char szReadme_[MAX_BUF]; - char szPause_[MAX_BUF]; - char szResume_[MAX_BUF]; - char szChecked[MAX_BUF]; - char szUnchecked[MAX_BUF]; -} installGui; - -/* structure message stream */ -typedef struct sEMsgStream sems; -struct sEMsgStream -{ - char szURL[MAX_BUF]; - char szConfirmationMessage[MAX_BUF]; - char *szMessage; - DWORD dwMessageBufSize; - BOOL bEnabled; - BOOL bSendMessage; - BOOL bShowConfirmation; -}; - -/* structure system info*/ -typedef struct sSysInfo sysinfo; -struct sSysInfo -{ - DWORD dwOSType; - DWORD dwMajorVersion; - DWORD dwMinorVersion; - DWORD dwBuildNumber; - char szExtraString[MAX_BUF]; - DWORD dwMemoryTotalPhysical; - DWORD dwMemoryAvailablePhysical; - DWORD dwScreenX; - DWORD dwScreenY; - DWORD lastWindowPosCenterX; - DWORD lastWindowPosCenterY; - BOOL bScreenReader; - BOOL bRefreshIcons; -}; - -typedef struct diskSpaceNode dsN; -struct diskSpaceNode -{ - ULONGLONG ullSpaceRequired; - LPSTR szPath; - LPSTR szVDSPath; - dsN *Next; - dsN *Prev; -}; - -#endif /* _SETUP_H */ - diff --git a/xpinstall/wizard/windows/setup/xpi.c b/xpinstall/wizard/windows/setup/xpi.c index 5e60b8cf558..37666c2dc06 100644 --- a/xpinstall/wizard/windows/setup/xpi.c +++ b/xpinstall/wizard/windows/setup/xpi.c @@ -263,7 +263,7 @@ HRESULT SmartUpdateJars() } hrResult = pfnXpiInit(szBuf, FILE_INSTALL_LOG, cbXPIProgress); - ShowMessage(szMsgSmartUpdateStart, FALSE); + ShowMessage(NULL, FALSE); InitProgressDlg(); GetTotalArchivesToInstall(); SetWindowText(dlgInfo.hWndDlg, szDlgExtractingTitle); @@ -388,16 +388,13 @@ HRESULT SmartUpdateJars() siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL); } /* while(siCObject) */ + SaveWindowPosition(dlgInfo.hWndDlg); //report 100% progress status for successful installs UpdateGREAppInstallerProgress(100); LogMSXPInstallStatus(NULL, hrResult); pfnXpiExit(); DeInitProgressDlg(); } - else - { - ShowMessage(szMsgSmartUpdateStart, FALSE); - } DeInitializeXPIStub(); LogISXPInstall(W_END); @@ -465,11 +462,12 @@ ProgressDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { case WM_INITDIALOG: DisableSystemMenuItems(hWndDlg, TRUE); - RepositionWindow(hWndDlg, BANNER_IMAGE_INSTALLING); SendDlgItemMessage (hWndDlg, IDC_STATUS0, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_GAUGE_ARCHIVE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_STATUS3, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_GAUGE_FILE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); + RepositionWindow(hWndDlg, BANNER_IMAGE_INSTALLING); + ClosePreviousDialog(); return FALSE; case WM_COMMAND: diff --git a/xpinstall/wizard/windows/setup/xpnetHook.cpp b/xpinstall/wizard/windows/setup/xpnetHook.cpp index 864887d07a0..90d5ae4927d 100644 --- a/xpinstall/wizard/windows/setup/xpnetHook.cpp +++ b/xpinstall/wizard/windows/setup/xpnetHook.cpp @@ -908,6 +908,7 @@ int DownloadFiles(char *szInputIniFile, GetSetupCurrentDownloadFile(szPartiallyDownloadedFilename, sizeof(szPartiallyDownloadedFilename)); + ShowMessage(NULL, FALSE); InitDownloadDlg(); for(giIndex = 0; giIndex < giTotalArchivesToDownload; giIndex++) @@ -1258,7 +1259,6 @@ DownloadDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) sizeof(gszFileInfo), szFileIniConfig); DisableSystemMenuItems(hWndDlg, FALSE); - RepositionWindow(hWndDlg, BANNER_IMAGE_DOWNLOAD); if(gbShowDownloadRetryMsg) SetDlgItemText(hWndDlg, IDC_MESSAGE0, diDownload.szMessageRetry0); else @@ -1283,6 +1283,8 @@ DownloadDlgProc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lParam) SendDlgItemMessage (hWndDlg, IDC_STATUS_FILE, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_STATUS_URL, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); SendDlgItemMessage (hWndDlg, IDC_STATUS_TO, WM_SETFONT, (WPARAM)sgInstallGui.definedFont, 0L); + RepositionWindow(hWndDlg, BANNER_IMAGE_DOWNLOAD); + ClosePreviousDialog(); return FALSE; case WM_SIZE: diff --git a/xpinstall/wizard/windows/setuprsc/setuprsc.rc b/xpinstall/wizard/windows/setuprsc/setuprsc.rc index 79bb70f82bb..f2cd407204f 100644 --- a/xpinstall/wizard/windows/setuprsc/setuprsc.rc +++ b/xpinstall/wizard/windows/setuprsc/setuprsc.rc @@ -248,6 +248,7 @@ END DLG_MESSAGE DIALOG DISCARDABLE 0, 0, 236, 34 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION +STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CLASS "MozillaSetupDlg" FONT 8, "MS Sans Serif" BEGIN diff --git a/xpinstall/wizard/windows/uninstall/parser.c b/xpinstall/wizard/windows/uninstall/parser.c index 78c746718bf..e69de29bb2d 100644 --- a/xpinstall/wizard/windows/uninstall/parser.c +++ b/xpinstall/wizard/windows/uninstall/parser.c @@ -1,806 +0,0 @@ -/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Mozilla Communicator client code, released - * March 31, 1998. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Sean Su - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "extern.h" -#include "logkeys.h" -#include "parser.h" -#include "extra.h" -#include "ifuncns.h" -#include "dialogs.h" - -#define KEY_SHARED_DLLS "Software\\Microsoft\\Windows\\CurrentVersion\\SharedDlls" - -BOOL DeleteOrDelayUntilReboot(LPSTR szFile) -{ - FILE *ofp; - char szWinDir[MAX_BUF]; - char szWininitFile[MAX_BUF]; - BOOL bDelayDelete = FALSE; - BOOL bWriteRenameSection; - - FileDelete(szFile); - if(FileExists(szFile)) - { - bDelayDelete = TRUE; - if(ulOSType & OS_NT) - MoveFileEx(szFile, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); - else - { - if(GetWindowsDirectory(szWinDir, sizeof(szWinDir)) == 0) - return(FALSE); - - lstrcpy(szWininitFile, szWinDir); - AppendBackSlash(szWininitFile, sizeof(szWininitFile)); - lstrcat(szWininitFile, "wininit.ini"); - - if(FileExists(szWininitFile) == FALSE) - bWriteRenameSection = TRUE; - else - bWriteRenameSection = FALSE; - - if((ofp = fopen(szWininitFile, "a+")) == NULL) - return(FALSE); - - if(bWriteRenameSection == TRUE) - fprintf(ofp, "[RENAME]\n"); - - fprintf(ofp, "NUL=%s\n", szFile); - fclose(ofp); - } - } - else - bDelayDelete = FALSE; - - return(bDelayDelete); -} - -void RemoveUninstaller(LPSTR szUninstallFilename) -{ - char szBuf[MAX_BUF]; - char szWinDir[MAX_BUF]; - char szUninstallFile[MAX_BUF]; - - if(SearchForUninstallKeys(szUninstallFilename)) - /* Found the uninstall file name in the windows registry uninstall - * key sections. We should not try to delete ourselves. */ - return; - - if(GetWindowsDirectory(szWinDir, sizeof(szWinDir)) == 0) - return; - - lstrcpy(szBuf, szWinDir); - AppendBackSlash(szBuf, sizeof(szBuf)); - lstrcat(szBuf, szUninstallFilename); - GetShortPathName(szBuf, szUninstallFile, sizeof(szUninstallFile)); - DeleteOrDelayUntilReboot(szUninstallFile); -} - -sil *InitSilNodes(char *szInFile) -{ - FILE *ifp; - char szLineRead[MAX_BUF]; - sil *silTemp; - sil *silHead; - ULONGLONG ullLineCount; - - if(FileExists(szInFile) == FALSE) - return(NULL); - - ullLineCount = 0; - silHead = NULL; - if((ifp = fopen(szInFile, "r")) == NULL) - exit(1); - - while(fgets(szLineRead, MAX_BUF, ifp) != NULL) - { - silTemp = CreateSilNode(); - - silTemp->ullLineNumber = ++ullLineCount; - lstrcpy(silTemp->szLine, szLineRead); - if(silHead == NULL) - { - silHead = silTemp; - } - else - { - SilNodeInsert(silHead, silTemp); - } - - ProcessWindowsMessages(); - } - fclose(ifp); - return(silHead); -} - -void DeInitSilNodes(sil **silHead) -{ - sil *silTemp; - - if(*silHead == NULL) - { - return; - } - else if(((*silHead)->Prev == NULL) || ((*silHead)->Prev == *silHead)) - { - SilNodeDelete(*silHead); - return; - } - else - { - silTemp = (*silHead)->Prev; - } - - while(silTemp != *silHead) - { - SilNodeDelete(silTemp); - silTemp = (*silHead)->Prev; - - ProcessWindowsMessages(); - } - SilNodeDelete(silTemp); -} - -void DeleteWinRegKey(HKEY hkRootKey, LPSTR szKey, BOOL bAbsoluteDelete) -{ - HKEY hkResult; - DWORD dwErr; - DWORD dwTotalSubKeys; - DWORD dwTotalValues; - DWORD dwSubKeySize; - FILETIME ftLastWriteFileTime; - char szSubKey[MAX_BUF]; - char szNewKey[MAX_BUF]; - long lRv; - - dwErr = RegOpenKeyEx(hkRootKey, szKey, 0, KEY_QUERY_VALUE, &hkResult); - if(dwErr == ERROR_SUCCESS) - { - dwTotalSubKeys = 0; - dwTotalValues = 0; - RegQueryInfoKey(hkResult, NULL, NULL, NULL, &dwTotalSubKeys, NULL, NULL, &dwTotalValues, NULL, NULL, NULL, NULL); - RegCloseKey(hkResult); - - if(((dwTotalSubKeys == 0) && (dwTotalValues == 0)) || bAbsoluteDelete) - { - if(dwTotalSubKeys && bAbsoluteDelete) - { - do - { - dwSubKeySize = sizeof(szSubKey); - lRv = 0; - if(RegOpenKeyEx(hkRootKey, szKey, 0, KEY_READ, &hkResult) == ERROR_SUCCESS) - { - if((lRv = RegEnumKeyEx(hkResult, 0, szSubKey, &dwSubKeySize, NULL, NULL, NULL, &ftLastWriteFileTime)) == ERROR_SUCCESS) - { - RegCloseKey(hkResult); - lstrcpy(szNewKey, szKey); - AppendBackSlash(szNewKey, sizeof(szNewKey)); - lstrcat(szNewKey, szSubKey); - DeleteWinRegKey(hkRootKey, szNewKey, bAbsoluteDelete); - } - else - RegCloseKey(hkResult); - } - } while(lRv != ERROR_NO_MORE_ITEMS); - } - - dwErr = RegDeleteKey(hkRootKey, szKey); - } - } -} - -void ParseForUninstallCommand(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwFileBufSize, LPSTR szParam, DWORD dwParamBufSize) -{ - LPSTR szFirstNonSpace; - LPSTR szBeginParamStr; - LPSTR szEndOfFilePath; - LPSTR szEndQuote; - char *cmdStart; - int length; - - ZeroMemory(szFile, dwFileBufSize); - ZeroMemory(szParam, dwParamBufSize); - - length = lstrlen(szString); - if(szString[length - 1] == '\n') - szString[length - 1] = '\0'; - - // get to the beginning of the command given an install log string - cmdStart = szString + lstrlen(szKeyStr); - if((szFirstNonSpace = GetFirstNonSpace(cmdStart)) != NULL) - { - if(*szFirstNonSpace == '\"') - { - ++szFirstNonSpace; - // found a beginning quote, look for the ending quote now - if((szEndQuote = MozStrChar(szFirstNonSpace, '\"')) != NULL) - { - // found ending quote. copy file path string *not* including the quotes - *szEndQuote = '\0'; - MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize); - - // get the params substring now - if((szBeginParamStr = GetFirstNonSpace(++szEndQuote)) != NULL) - { - // the params string should be the first non space char after the - // quoted file path string to the end of the string. - MozCopyStr(szBeginParamStr, szParam, dwParamBufSize); - } - } - else - { - // could not find the ending quote. assume the _entire_ string is the file path - MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize); - } - } - else - { - // no beginning quote found. file path is up to the first space character found - if((szEndOfFilePath = GetFirstSpace(szFirstNonSpace)) != NULL) - { - // found the first space char - *szEndOfFilePath = '\0'; - MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize); - - // get the params substring now - if((szBeginParamStr = GetFirstNonSpace(++szEndOfFilePath)) != NULL) - { - // the params string should be the first non space char after the - // quoted file path string to the end of the string. - MozCopyStr(szBeginParamStr, szParam, dwParamBufSize); - } - } - else - { - // no space char found. assume the _entire_ string is the file path - MozCopyStr(szFirstNonSpace, szFile, dwFileBufSize); - } - } - } -} - -void ParseForFile(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwShortFilenameBufSize) -{ - int iLen; - LPSTR szFirstNonSpace; - char szBuf[MAX_BUF]; - - if((szFirstNonSpace = GetFirstNonSpace(&(szString[lstrlen(szKeyStr)]))) != NULL) - { - iLen = lstrlen(szFirstNonSpace); - if(szFirstNonSpace[iLen - 1] == '\n') - szFirstNonSpace[iLen -1] = '\0'; - - if(lstrcmpi(szKeyStr, KEY_WINDOWS_SHORTCUT) == 0) - { - lstrcpy(szBuf, szFirstNonSpace); - lstrcat(szBuf, ".lnk"); - szFirstNonSpace = szBuf; - } - - lstrcpy(szFile, szFirstNonSpace); - } -} - -void ParseForCopyFile(LPSTR szString, LPSTR szKeyStr, LPSTR szFile, DWORD dwShortFilenameBufSize) -{ - int iLen; - LPSTR szFirstNonSpace; - LPSTR szSubStr = NULL; - char szBuf[MAX_BUF]; - - if((szSubStr = strstr(szString, " to ")) != NULL) - { - if((szFirstNonSpace = GetFirstNonSpace(&(szSubStr[lstrlen(" to ")]))) != NULL) - { - iLen = lstrlen(szFirstNonSpace); - if(szFirstNonSpace[iLen - 1] == '\n') - szFirstNonSpace[iLen -1] = '\0'; - - if(lstrcmpi(szKeyStr, KEY_WINDOWS_SHORTCUT) == 0) - { - lstrcpy(szBuf, szFirstNonSpace); - lstrcat(szBuf, ".lnk"); - szFirstNonSpace = szBuf; - } - - lstrcpy(szFile, szFirstNonSpace); - } - } -} - -HRESULT ParseForWinRegInfo(LPSTR szString, LPSTR szKeyStr, LPSTR szRootKey, DWORD dwRootKeyBufSize, LPSTR szKey, DWORD dwKeyBufSize, LPSTR szName, DWORD dwNameBufSize) -{ - int i; - int iLen; - int iBrackets; - char szStrCopy[MAX_BUF]; - LPSTR szFirstNonSpace; - LPSTR szFirstBackSlash; - BOOL bFoundOpenBracket; - BOOL bFoundName; - - *szRootKey = '\0'; - *szKey = '\0'; - *szName = '\0'; - - lstrcpy(szStrCopy, szString); - if((szFirstNonSpace = GetFirstNonSpace(&(szStrCopy[lstrlen(szKeyStr)]))) != NULL) - { - iLen = lstrlen(szFirstNonSpace); - if(szFirstNonSpace[iLen - 1] == '\n') - { - szFirstNonSpace[--iLen] = '\0'; - } - - szFirstBackSlash = strstr(szFirstNonSpace, "\\"); - if(!szFirstBackSlash) - return(WIZ_ERROR_PARSING_UNINST_STRS); - - szFirstBackSlash[0] = '\0'; - lstrcpy(szRootKey, szFirstNonSpace); - szFirstNonSpace = &(szFirstBackSlash[1]); - iLen = lstrlen(szFirstNonSpace); - - iBrackets = 0; - bFoundName = FALSE; - bFoundOpenBracket = FALSE; - for(i = iLen - 1; i >= 0; i--) - { - if(bFoundName == FALSE) - { - /* Find the Name created in the Windows registry key. - * Since the Name can contain '[' and ']', we have to - * parse for the brackets that denote the Name string in - * szFirstNonSpace. It parses from right to left. - */ - if(szFirstNonSpace[i] == ']') - { - if(iBrackets == 0) - szFirstNonSpace[i] = '\0'; - - ++iBrackets; - } - else if(szFirstNonSpace[i] == '[') - { - bFoundOpenBracket = TRUE; - --iBrackets; - } - - if((bFoundOpenBracket) && (iBrackets == 0)) - { - lstrcpy(szName, &(szFirstNonSpace[i + 1])); - bFoundName = TRUE; - } - } - else - { - /* locate the first non space to the left of the last '[' */ - if(!isspace(szFirstNonSpace[i])) - { - szFirstNonSpace[i + 1] = '\0'; - lstrcpy(szKey, szFirstNonSpace); - break; - } - } - } - } - return(WIZ_OK); -} - -DWORD DecrementSharedFileCounter(char *file) -{ - HKEY keyHandle = 0; - LONG result; - DWORD type = REG_DWORD; - DWORD valbuf = 0; - DWORD valbufsize; - DWORD rv = 0; - - valbufsize = sizeof(DWORD); - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KEY_SHARED_DLLS, 0, KEY_READ | KEY_WRITE, &keyHandle); - if(ERROR_SUCCESS == result) - { - result = RegQueryValueEx(keyHandle, file, NULL, &type, (LPBYTE)&valbuf, (LPDWORD)&valbufsize); - if((ERROR_SUCCESS == result) && (type == REG_DWORD)) - { - rv = --valbuf; - } - - RegSetValueEx(keyHandle, file, 0, REG_DWORD, (LPBYTE)&valbuf, valbufsize); - RegCloseKey(keyHandle); - } - - return(rv); -} - -int GetSharedFileCount(char *file) -{ - HKEY keyHandle = 0; - LONG result; - DWORD type = REG_DWORD; - DWORD valbuf = 0; - DWORD valbufsize; - int rv = -999; - - valbufsize = sizeof(DWORD); - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KEY_SHARED_DLLS, 0, KEY_READ, &keyHandle); - if(ERROR_SUCCESS == result) - { - result = RegQueryValueEx(keyHandle, file, NULL, &type, (LPBYTE)&valbuf, (LPDWORD)&valbufsize); - if((ERROR_SUCCESS == result) && (type == REG_DWORD)) - rv = valbuf; - - RegCloseKey(keyHandle); - } - - return(rv); -} - -BOOL UnregisterServer(char *file) -{ - FARPROC DllUnReg; - HINSTANCE hLib; - BOOL bFailed = FALSE; - - if(file != NULL) - { - if((hLib = LoadLibraryEx(file, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)) != NULL) - { - if((DllUnReg = GetProcAddress(hLib, "DllUnregisterServer")) != NULL) - DllUnReg(); - else - bFailed = TRUE; - - FreeLibrary(hLib); - } - else - bFailed = TRUE; - } - else - bFailed = TRUE; - - return(bFailed); -} - -BOOL DetermineUnRegisterServer(sil *silInstallLogHead, LPSTR szFile) -{ - sil *silInstallLogTemp; - int iSharedFileCount; - char szLCLine[MAX_BUF]; - char szLCFile[MAX_BUF]; - BOOL bRv; - - bRv = FALSE; - if(silInstallLogHead != NULL) - { - silInstallLogTemp = silInstallLogHead; - iSharedFileCount = GetSharedFileCount(szFile); - lstrcpy(szLCFile, szFile); - CharLowerBuff(szLCFile, sizeof(szLCLine)); - - do - { - silInstallLogTemp = silInstallLogTemp->Prev; - lstrcpy(szLCLine, silInstallLogTemp->szLine); - CharLowerBuff(szLCLine, sizeof(szLCLine)); - - if((strstr(szLCLine, szLCFile) != NULL) && - (strstr(szLCLine, KEY_INSTALLING_SHARED_FILE) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - --iSharedFileCount; - } - else if((strstr(szLCLine, szLCFile) != NULL) && - (strstr(szLCLine, KEY_INSTALLING) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - bRv = TRUE; - break; - } - else if((strstr(szLCLine, szLCFile) != NULL) && - (strstr(szLCLine, KEY_REPLACING_SHARED_FILE) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - --iSharedFileCount; - } - else if((strstr(szLCLine, szLCFile) != NULL) && - (strstr(szLCLine, KEY_REPLACING) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - bRv = TRUE; - break; - } - else if((strstr(szLCLine, szLCFile) != NULL) && - (strstr(szLCLine, KEY_COPY_FILE) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - bRv = TRUE; - break; - } - - ProcessWindowsMessages(); - } while(silInstallLogTemp != silInstallLogHead); - } - - if((iSharedFileCount <= 0) && (iSharedFileCount != -999)) - bRv = TRUE; - - return(bRv); -} - -DWORD Uninstall(sil* silInstallLogHead) -{ - sil *silInstallLogTemp; - LPSTR szSubStr; - char szLCLine[MAX_BUF]; - char szKey[MAX_BUF]; - char szRootKey[MAX_BUF]; - char szName[MAX_BUF]; - char szFile[MAX_BUF]; - char szParams[MAX_BUF]; - HKEY hkRootKey; - int rv; - - if(silInstallLogHead != NULL) - { - silInstallLogTemp = silInstallLogHead; - do - { - silInstallLogTemp = silInstallLogTemp->Prev; - lstrcpy(szLCLine, silInstallLogTemp->szLine); - CharLowerBuff(szLCLine, sizeof(szLCLine)); - - if(((szSubStr = strstr(szLCLine, KEY_WINDOWS_REGISTER_SERVER)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - ParseForFile(szSubStr, KEY_WINDOWS_REGISTER_SERVER, szFile, sizeof(szFile)); - if(DetermineUnRegisterServer(silInstallLogHead, szFile) == TRUE) - UnregisterServer(szFile); - } - else if(((szSubStr = strstr(szLCLine, KEY_INSTALLING_SHARED_FILE)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - /* check for "Installing Shared File: " string and delete the file */ - ParseForFile(szSubStr, KEY_INSTALLING_SHARED_FILE, szFile, sizeof(szFile)); - if(DecrementSharedFileCounter(szFile) == 0) - { - if((gdwWhatToDo != WTD_NO_TO_ALL) && (gdwWhatToDo != WTD_YES_TO_ALL)) - { - MessageBeep(MB_ICONEXCLAMATION); - gdwWhatToDo = DialogBoxParam(hInst, MAKEINTRESOURCE(DLG_WHAT_TO_DO), hDlgUninstall, DlgProcWhatToDo, (LPARAM)szFile); - } - - if((gdwWhatToDo == WTD_YES) || (gdwWhatToDo == WTD_YES_TO_ALL)) - { - DeleteWinRegValue(HKEY_LOCAL_MACHINE, KEY_SHARED_DLLS, szFile); - DeleteOrDelayUntilReboot(szFile); - } - else if(gdwWhatToDo == WTD_CANCEL) - return(WTD_CANCEL); - } - } - else if(((szSubStr = strstr(szLCLine, KEY_INSTALLING)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - /* check for "Installing: " string and delete the file */ - ParseForFile(szSubStr, KEY_INSTALLING, szFile, sizeof(szFile)); - DeleteOrDelayUntilReboot(szFile); - } - else if(((szSubStr = strstr(szLCLine, KEY_REPLACING_SHARED_FILE)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - /* check for "Replacing Shared File: " string and delete the file */ - ParseForFile(szSubStr, KEY_REPLACING_SHARED_FILE, szFile, sizeof(szFile)); - if(DecrementSharedFileCounter(szFile) == 0) - { - if((gdwWhatToDo != WTD_NO_TO_ALL) && (gdwWhatToDo != WTD_YES_TO_ALL)) - gdwWhatToDo = DialogBoxParam(hInst, MAKEINTRESOURCE(DLG_WHAT_TO_DO), hDlgUninstall, DlgProcWhatToDo, (LPARAM)szFile); - - if((gdwWhatToDo == WTD_YES) || (gdwWhatToDo == WTD_YES_TO_ALL)) - { - DeleteWinRegValue(HKEY_LOCAL_MACHINE, KEY_SHARED_DLLS, szFile); - DeleteOrDelayUntilReboot(szFile); - } - else if(gdwWhatToDo == WTD_CANCEL) - return(WTD_CANCEL); - } - } - else if(((szSubStr = strstr(szLCLine, KEY_REPLACING)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - /* check for "Replacing: " string and delete the file */ - ParseForFile(szSubStr, KEY_REPLACING, szFile, sizeof(szFile)); - DeleteOrDelayUntilReboot(szFile); - } - else if(((szSubStr = strstr(szLCLine, KEY_STORE_REG_STRING)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - /* check for "Store Registry Value String: " string and remove the key */ - rv = ParseForWinRegInfo(szSubStr, KEY_STORE_REG_STRING, szRootKey, sizeof(szRootKey), szKey, sizeof(szKey), szName, sizeof(szName)); - if(WIZ_OK == rv) - { - hkRootKey = ParseRootKey(szRootKey); - DeleteWinRegValue(hkRootKey, szKey, szName); - } - } - else if(((szSubStr = strstr(szLCLine, KEY_STORE_REG_NUMBER)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - /* check for "Store Registry Value Number: " string and remove the key */ - rv = ParseForWinRegInfo(szSubStr, KEY_STORE_REG_NUMBER, szRootKey, sizeof(szRootKey), szKey, sizeof(szKey), szName, sizeof(szName)); - if(WIZ_OK == rv) - { - hkRootKey = ParseRootKey(szRootKey); - DeleteWinRegValue(hkRootKey, szKey, szName); - } - } - else if(((szSubStr = strstr(szLCLine, KEY_CREATE_REG_KEY)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - rv = ParseForWinRegInfo(szSubStr, KEY_CREATE_REG_KEY, szRootKey, sizeof(szRootKey), szKey, sizeof(szKey), szName, sizeof(szName)); - if(WIZ_OK == rv) - { - hkRootKey = ParseRootKey(szRootKey); - DeleteWinRegKey(hkRootKey, szKey, FALSE); - } - } - else if(((szSubStr = strstr(szLCLine, KEY_CREATE_FOLDER)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - ParseForFile(szSubStr, KEY_CREATE_FOLDER, szFile, sizeof(szFile)); - DirectoryRemove(szFile, FALSE); - } - else if(((szSubStr = strstr(szLCLine, KEY_WINDOWS_SHORTCUT)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - ParseForFile(szSubStr, KEY_WINDOWS_SHORTCUT, szFile, sizeof(szFile)); - DeleteOrDelayUntilReboot(szFile); - } - else if(((szSubStr = strstr(szLCLine, KEY_COPY_FILE)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - /* check for "copy file: " string and delete the file */ - ParseForCopyFile(szSubStr, KEY_COPY_FILE, szFile, sizeof(szFile)); - DeleteOrDelayUntilReboot(szFile); - } - else if(((szSubStr = strstr(szLCLine, KEY_UNINSTALL_COMMAND)) != NULL) && - (strstr(szLCLine, KEY_DO_NOT_UNINSTALL) == NULL)) - { - ParseForUninstallCommand(szSubStr, KEY_UNINSTALL_COMMAND, szFile, sizeof(szFile), szParams, sizeof(szParams)); - //execute szFile with szParams here! - if(FileExists(szFile)) - WinSpawn(szFile, szParams, NULL, SW_HIDE, TRUE); - } - - ProcessWindowsMessages(); - } while(silInstallLogTemp != silInstallLogHead); - } - - return(0); -} - -DWORD GetLogFile(LPSTR szTargetPath, LPSTR szInFilename, LPSTR szOutBuf, DWORD dwOutBufSize) -{ - int iFilenameOnlyLen; - char szSearchFilename[MAX_BUF]; - char szSearchTargetFullFilename[MAX_BUF]; - char szFilenameOnly[MAX_BUF]; - char szFilenameExtensionOnly[MAX_BUF]; - char szNumber[MAX_BUF]; - long dwNumber; - long dwMaxNumber; - LPSTR szDotPtr; - HANDLE hFile; - WIN32_FIND_DATA fdFile; - BOOL bFound; - - if(FileExists(szTargetPath)) - { - /* zero out the memory */ - ZeroMemory(szOutBuf, dwOutBufSize); - ZeroMemory(szSearchFilename, sizeof(szSearchFilename)); - ZeroMemory(szFilenameOnly, sizeof(szFilenameOnly)); - ZeroMemory(szFilenameExtensionOnly, sizeof(szFilenameExtensionOnly)); - - /* parse for the filename w/o extention and also only the extension */ - if((szDotPtr = strstr(szInFilename, ".")) != NULL) - { - *szDotPtr = '\0'; - lstrcpy(szSearchFilename, szInFilename); - lstrcpy(szFilenameOnly, szInFilename); - lstrcpy(szFilenameExtensionOnly, &szDotPtr[1]); - *szDotPtr = '.'; - } - else - { - lstrcpy(szFilenameOnly, szInFilename); - lstrcpy(szSearchFilename, szInFilename); - } - - /* create the wild arg filename to search for in the szTargetPath */ - lstrcat(szSearchFilename, "*.*"); - lstrcpy(szSearchTargetFullFilename, szTargetPath); - AppendBackSlash(szSearchTargetFullFilename, sizeof(szSearchTargetFullFilename)); - lstrcat(szSearchTargetFullFilename, szSearchFilename); - - iFilenameOnlyLen = lstrlen(szFilenameOnly); - dwNumber = 0; - dwMaxNumber = -1; - - /* find the largest numbered filename in the szTargetPath */ - if((hFile = FindFirstFile(szSearchTargetFullFilename, &fdFile)) == INVALID_HANDLE_VALUE) - bFound = FALSE; - else - bFound = TRUE; - - while(bFound) - { - ZeroMemory(szNumber, sizeof(szNumber)); - if((lstrcmpi(fdFile.cFileName, ".") != 0) && (lstrcmpi(fdFile.cFileName, "..") != 0)) - { - lstrcpy(szNumber, &fdFile.cFileName[iFilenameOnlyLen]); - dwNumber = atoi(szNumber); - if(dwNumber > dwMaxNumber) - dwMaxNumber = dwNumber; - } - - bFound = FindNextFile(hFile, &fdFile); - } - - FindClose(hFile); - - lstrcpy(szOutBuf, szTargetPath); - AppendBackSlash(szOutBuf, dwOutBufSize); - lstrcat(szOutBuf, szFilenameOnly); - itoa(dwMaxNumber, szNumber, 10); - lstrcat(szOutBuf, szNumber); - - if(*szFilenameExtensionOnly != '\0') - { - lstrcat(szOutBuf, "."); - lstrcat(szOutBuf, szFilenameExtensionOnly); - } - } - else - return(0); - - return(FileExists(szOutBuf)); -} -