fixed compression bug and cleaned up code. Not part of build system yet.

This commit is contained in:
ssu%netscape.com 2000-02-09 02:10:53 +00:00
Родитель 53a54bac98
Коммит 65ed2b842e
3 изменённых файлов: 22 добавлений и 11 удалений

Просмотреть файл

@ -22,11 +22,10 @@
DEPTH=..\..\..\..
MAKE_OBJ_TYPE = EXE
USE_STATIC_LIBS = 1
USE_NON_MT_LIBS = 1
MODULE = nsztool
PROGRAM = .\$(OBJDIR)\$(MODULE).exe
#RESFILE = $(MODULE).res
OBJS = \
.\$(OBJDIR)\nsztool.obj \
@ -45,7 +44,9 @@ include <$(DEPTH)\config\rules.mak>
install:: $(PROGRAM)
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\install
$(DIST)\install\$(MODULE).exe -g $(DIST)\install\nszip.exe $(DIST)\install\nsinstall.exe
clobber_all::
$(RM) $(DIST)\install\$(MODULE).exe
$(RM) $(DIST)\install\nszip.exe

Просмотреть файл

@ -32,8 +32,6 @@
//#define SSU_DEBUG
#define APP_NAME "nsz.exe"
/* Function to show the usage for this application */
void ShowUsage(char *name)
{
@ -390,9 +388,10 @@ void AddFile(LPSTR lpszSeaExe, LPSTR lpszFile)
exit(1);
}
dwFileSize = GetFileSize(hInputFile, NULL);
lpBuf = (LPBYTE)malloc(dwFileSize);
lpBufCmp = (LPBYTE)malloc(dwFileSize + (sizeof(DWORD) * 2));
dwFileSize = GetFileSize(hInputFile, NULL);
dwFileSizeCmp = dwFileSize;
lpBuf = (LPBYTE)malloc(dwFileSize);
lpBufCmp = (LPBYTE)malloc(dwFileSize + (sizeof(DWORD) * 2));
if((lpBuf == NULL) || (lpBufCmp == NULL))
{
PrintError("Out of memory", ERROR_CODE_HIDE);
@ -418,8 +417,19 @@ void AddFile(LPSTR lpszSeaExe, LPSTR lpszFile)
if((hSeaExe = BeginUpdateResource(lpszSeaExe, FALSE)) == NULL)
{
PrintError("BeginUpdateResource() error", ERROR_CODE_SHOW);
exit(1);
DWORD dwErr;
dwErr = GetLastError();
if(dwErr == ERROR_CALL_NOT_IMPLEMENTED)
{
MessageBox(NULL, "This application does not run under this OS", NULL, MB_ICONEXCLAMATION);
exit(0);
}
else
{
PrintError("BeginUpdateResource() error", ERROR_CODE_SHOW);
exit(1);
}
}
if(!UpdateResource(hSeaExe, "FILE", szResourceName, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
lpBufCmp, dwFileSizeCmp + (sizeof(DWORD) * 2)))

Просмотреть файл

@ -22,8 +22,8 @@
* Sean Su <ssu@netscape.com>
*/
#ifndef _NSZ_H_
#define _NSZ_H_
#ifndef _TESTXPI_H_
#define _TESTXPI_H_
#define MAX_BUF 4096