зеркало из https://github.com/mozilla/pjs.git
fixed problem with redirect.ini being deleted when user canceled download.
When redirect.ini was deleted, it cause the download agent to start its download process from the first file when it was restarted. fixed 33357: installer can no longer be run while a copy is already running.
This commit is contained in:
Родитель
f5fa680a53
Коммит
78cebe3802
|
@ -378,6 +378,18 @@ CenterWindow(HWND hWndDlg)
|
|||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Extract Files Dialog
|
||||
|
||||
// This routine processes windows messages that are in queue
|
||||
void ProcessWindowsMessages()
|
||||
{
|
||||
MSG msg;
|
||||
|
||||
while(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
// This routine updates the status string in the extracting dialog
|
||||
static void
|
||||
SetStatusLine(LPCTSTR lpszStatus)
|
||||
|
@ -540,6 +552,8 @@ ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
|
|||
{
|
||||
DWORD dwBytesToWrite, dwBytesWritten;
|
||||
|
||||
ProcessWindowsMessages();
|
||||
|
||||
dwBytesToWrite = dwSizeUnCmp > 4096 ? 4096 : dwSizeUnCmp;
|
||||
if (!WriteFile(hFile, lpBytesUnCmp, dwBytesToWrite, &dwBytesWritten, NULL))
|
||||
{
|
||||
|
@ -768,33 +782,15 @@ RunInstaller()
|
|||
WaitForInputIdle(pi.hProcess, 3000); // wait up to 3 seconds
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
DestroyWindow(dlgInfo.hWndDlg);
|
||||
ShowWindow(dlgInfo.hWndDlg, SW_HIDE);
|
||||
}
|
||||
|
||||
// Wait for the installer to complete
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
CloseHandle(pi.hProcess);
|
||||
|
||||
// That was just the installer bootstrapper. Now we need to wait for the
|
||||
// installer itself. We can find the process ID by looking for a window of
|
||||
// class ISINSTALLSCLASS
|
||||
HWND hWnd = FindWindow("ISINSTALLSCLASS", NULL);
|
||||
DestroyWindow(dlgInfo.hWndDlg);
|
||||
|
||||
if (hWnd) {
|
||||
DWORD dwProcessId;
|
||||
HANDLE hProcess;
|
||||
|
||||
// Get the associated process handle and wait for it to terminate
|
||||
GetWindowThreadProcessId(hWnd, &dwProcessId);
|
||||
|
||||
// We need the process handle to use WaitForSingleObject
|
||||
hProcess = OpenProcess(STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE, FALSE, dwProcessId);
|
||||
|
||||
if (hProcess) {
|
||||
WaitForSingleObject(hProcess, INFINITE);
|
||||
CloseHandle(hProcess);
|
||||
}
|
||||
}
|
||||
// Delete the files from the temp directory
|
||||
EnumResourceNames(NULL, "FILE", (ENUMRESNAMEPROC)DeleteTempFilesProc, 0);
|
||||
|
||||
|
@ -815,14 +811,18 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
hInst = hInstance;
|
||||
LoadString(hInst, IDS_TITLE, szTitle, MAX_BUF);
|
||||
|
||||
/* Allow only one instance of nsinstall to run.
|
||||
* Detect a previous instance of nsinstall, bring it to the
|
||||
* foreground, and quit current instance */
|
||||
if(FindWindow("NSExtracting", "Extracting...") != NULL)
|
||||
return(1);
|
||||
|
||||
// Parse the command line
|
||||
ParseCommandLine(lpCmdLine);
|
||||
|
||||
// Figure out the total size of the resources
|
||||
EnumResourceNames(NULL, "FILE", (ENUMRESNAMEPROC)SizeOfResourcesProc, 0);
|
||||
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
// Register a class for the gauge
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.lpfnWndProc = (WNDPROC)GaugeWndProc;
|
||||
|
@ -831,6 +831,20 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdS
|
|||
wc.lpszClassName = "NSGauge";
|
||||
RegisterClass(&wc);
|
||||
|
||||
// Register a class for the main dialog
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
|
||||
wc.lpfnWndProc = DefDlgProc;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = DLGWINDOWEXTRA;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.lpszClassName = "NSExtracting";
|
||||
RegisterClass(&wc);
|
||||
|
||||
if(dwMode != SILENT)
|
||||
{
|
||||
// Display the dialog box
|
||||
dlgInfo.hWndDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXTRACTING), NULL, (DLGPROC)DialogProc);
|
||||
UpdateWindow(dlgInfo.hWndDlg);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
|
@ -53,6 +54,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
IDD_EXTRACTING DIALOG DISCARDABLE 0, 0, 193, 61
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Extracting..."
|
||||
CLASS "NSExtracting"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
LTEXT "",IDC_STATUS,9,13,159,8
|
||||
|
|
|
@ -1791,6 +1791,7 @@ void ProcessWindowsMessages()
|
|||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
void ShowMessage(LPSTR szMessage, BOOL bShow)
|
||||
{
|
||||
char szBuf[MAX_BUF];
|
||||
|
|
|
@ -1001,7 +1001,16 @@ long RetrieveRedirectFile()
|
|||
char szIndex0[MAX_BUF];
|
||||
char szFileIdiGetRedirect[MAX_BUF];
|
||||
char szKUrl[MAX_BUF];
|
||||
char szFileIniRedirect[MAX_BUF];
|
||||
|
||||
lstrcpy(szFileIniRedirect, szTempDir);
|
||||
AppendBackSlash(szFileIniRedirect, sizeof(szFileIniRedirect));
|
||||
lstrcat(szFileIniRedirect, FILE_INI_REDIRECT);
|
||||
|
||||
if(FileExists(szFileIniRedirect))
|
||||
UpdateSiteSelector();
|
||||
else
|
||||
{
|
||||
GetPrivateProfileString("Redirect", "Status", "", szBuf, MAX_BUF, szFileIniConfig);
|
||||
if(lstrcmpi(szBuf, "ENABLED") != 0)
|
||||
return(0);
|
||||
|
@ -1065,6 +1074,7 @@ long RetrieveRedirectFile()
|
|||
|
||||
UpdateSiteSelector();
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@ -1136,6 +1146,10 @@ long RetrieveArchives()
|
|||
WritePrivateProfileString("Execution", "exe", siSDObject.szExe, szFileIdiGetArchives);
|
||||
WritePrivateProfileString("Execution", "exe_param", siSDObject.szExeParam, szFileIdiGetArchives);
|
||||
|
||||
/* proxy support */
|
||||
// WritePrivateProfileString("Proxy", "server", "chainsaw.mcom.com", szFileIdiGetArchives);
|
||||
// WritePrivateProfileString("Proxy", "port", "8288", szFileIdiGetArchives);
|
||||
|
||||
if((lResult = SdArchives(szFileIdiGetArchives, szTempDir)) != 0)
|
||||
return(lResult);
|
||||
}
|
||||
|
@ -5232,6 +5246,8 @@ void DeleteArchives()
|
|||
++dwIndex0;
|
||||
siCObject = SiCNodeGetObject(dwIndex0, TRUE, AC_ALL);
|
||||
}
|
||||
|
||||
DeleteIniRedirect();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5240,7 +5256,6 @@ void CleanTempFiles()
|
|||
DeleteIdiGetConfigIni();
|
||||
DeleteIdiGetArchives();
|
||||
DeleteIdiGetRedirect();
|
||||
DeleteIniRedirect();
|
||||
|
||||
/* do not delete config.ini file.
|
||||
if it was uncompressed from the self-extracting .exe file,
|
||||
|
|
Загрузка…
Ссылка в новой задаче