fixing bug 49456 - installer memory usage too high. r=dveditz, sr=mscott. windows platform only.

git-svn-id: svn://10.0.0.236/trunk@86324 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ssu%netscape.com 2001-02-06 07:15:13 +00:00
parent 6bebd00d88
commit 5cdc2d128a
3 changed files with 21 additions and 4 deletions

View File

@ -620,6 +620,7 @@ ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
HRSRC hResInfo;
HGLOBAL hGlobal;
LPBYTE lpBytes;
LPBYTE lptr;
LPBYTE lpBytesUnCmp;
HANDLE hFile;
char szStatus[128];
@ -655,7 +656,17 @@ ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
GetFullTempPathName("Archive.lst", sizeof(szArcLstFile), szArcLstFile);
WritePrivateProfileString("Archives", lpszName, "TRUE", szArcLstFile);
lpBytesUnCmp = (LPBYTE)malloc((*(LPDWORD)(lpBytes + sizeof(DWORD))) + 1);
lptr = (LPBYTE)malloc((*(LPDWORD)(lpBytes + sizeof(DWORD))) + 1);
if(!lptr)
{
char szBuf[512];
LoadString(hInst, IDS_ERROR_OUT_OF_MEMORY, szBuf, sizeof(szBuf));
MessageBox(NULL, szBuf, NULL, MB_OK | MB_ICONEXCLAMATION);
return FALSE;
}
lpBytesUnCmp = lptr;
dwSizeUnCmp = *(LPDWORD)(lpBytes + sizeof(DWORD));
// Copy the file. The first DWORD specifies the size of the file
@ -679,6 +690,9 @@ ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
wsprintf(szBuf, szText, szTmpFile);
MessageBox(NULL, szBuf, szTitle, MB_OK | MB_ICONEXCLAMATION);
FreeResource(hResInfo);
if(lptr)
free(lptr);
return FALSE;
}
@ -697,6 +711,8 @@ ExtractFilesProc(HANDLE hModule, LPCTSTR lpszType, LPTSTR lpszName, LONG lParam)
// Release the resource
FreeResource(hResInfo);
if(lptr)
free(lptr);
return TRUE; // keep enumerating
}

View File

@ -108,6 +108,7 @@ BEGIN
IDS_STATUS_LAUNCHING_SETUP "Launching Setup..."
IDS_ERROR_FILE_WRITE "Unable to write file %s"
IDS_TITLE "Netscape Communicator Installation"
IDS_ERROR_OUT_OF_MEMORY "Out of memory!"
END
#endif // English (U.S.) resources

View File

@ -22,19 +22,19 @@
* Copyright (C) 1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Contributor(s):
* Troy Chevalier <troy@netscape.com>
* Sean Su <ssu@netscape.com>
*/
#include "winuser.h"
#include "winresrc.h"
#define IDS_PROMPT 1
#define IDS_STATUS_EXTRACTING 2
#define IDS_STATUS_LAUNCHING_SETUP 3
#define IDS_ERROR_FILE_WRITE 4
#define IDS_TITLE 5
#define IDS_ERROR_OUT_OF_MEMORY 6
#define IDD_EXTRACTING 101
#define IDC_STATUS 1001
#define IDC_GAUGE 1002
@ -43,10 +43,10 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 103
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1003
#define _APS_NEXT_SYMED_VALUE 101
#define _APS_NO_MFC 1
#endif
#endif