Removed GUI junk from expand.c, so you can use it in commandline mode.
Fixed hello5.c.
This commit is contained in:
parent
3e1be2679a
commit
505fadc8e7
|
@ -10,7 +10,7 @@ int PASCAL WinMain(HINSTANCE hinstCurrent,
|
||||||
int nCmdShow)
|
int nCmdShow)
|
||||||
{
|
{
|
||||||
OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
|
OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
|
||||||
char OriginalName[256], WriteBuf[256];
|
char OriginalName[256];
|
||||||
char FAR *lpzDestFile;
|
char FAR *lpzDestFile;
|
||||||
DWORD dwreturn;
|
DWORD dwreturn;
|
||||||
HFILE hSourceFile, hDestFile;
|
HFILE hSourceFile, hDestFile;
|
||||||
|
@ -18,54 +18,19 @@ int PASCAL WinMain(HINSTANCE hinstCurrent,
|
||||||
extern int _ARGC;
|
extern int _ARGC;
|
||||||
extern char **_ARGV;
|
extern char **_ARGV;
|
||||||
|
|
||||||
|
hSourceFile = LZOpenFile(_ARGV[1], (LPOFSTRUCT) &SourceOpenStruct1, OF_READ);
|
||||||
MessageBox((HWND)NULL, (LPCSTR)_ARGV[1], (LPCSTR)"_ARGV[1]:", MB_OK);
|
if ((_ARGC == 3) && (_ARGV[2] != NULL))
|
||||||
MessageBox((HWND)NULL, (LPCSTR)_ARGV[2], (LPCSTR)"_ARGV[2]:", MB_OK);
|
lpzDestFile = _ARGV[2];
|
||||||
|
else {
|
||||||
hSourceFile = LZOpenFile(_ARGV[1], (LPOFSTRUCT) &SourceOpenStruct1,
|
lpzDestFile = OriginalName;
|
||||||
OF_READ);
|
GetExpandedName(_ARGV[1], lpzDestFile);
|
||||||
|
|
||||||
wsprintf(WriteBuf, "Source File Handle: %d\nNo. of args: %d",
|
|
||||||
hSourceFile, _ARGC);
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)WriteBuf, (LPCSTR)NULL, MB_OK);
|
|
||||||
|
|
||||||
if ((_ARGC == 3) && (_ARGV[2] != NULL)) lpzDestFile = _ARGV[2];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lpzDestFile = OriginalName;
|
|
||||||
GetExpandedName(_ARGV[1], lpzDestFile);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)lpzDestFile, (LPCSTR)"Destination File",
|
|
||||||
MB_OK);
|
|
||||||
|
|
||||||
hDestFile = LZOpenFile(lpzDestFile, (LPOFSTRUCT) &SourceOpenStruct2,
|
hDestFile = LZOpenFile(lpzDestFile, (LPOFSTRUCT) &SourceOpenStruct2,
|
||||||
OF_CREATE | OF_WRITE);
|
OF_CREATE | OF_WRITE);
|
||||||
wsprintf(WriteBuf, "Destination File Handle: %d\nNo. of args: %d",
|
|
||||||
hDestFile, _ARGC-1);
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)WriteBuf, (LPCSTR)NULL, MB_OK);
|
|
||||||
|
|
||||||
dwreturn = LZCopy(hSourceFile, hDestFile);
|
dwreturn = LZCopy(hSourceFile, hDestFile);
|
||||||
|
if (dwreturn != 0)
|
||||||
if (dwreturn == LZERROR_BADINHANDLE)
|
fprintf(stderr,"LZCopy failed: return is %ld\n",dwreturn);
|
||||||
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_BADINHANDLE\n", (LPCSTR)NULL, MB_OK);
|
LZClose(hSourceFile);
|
||||||
if (dwreturn == LZERROR_BADOUTHANDLE)
|
LZClose(hDestFile);
|
||||||
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_BADOUTHANDLE\n", (LPCSTR)NULL, MB_OK);
|
|
||||||
if (dwreturn == LZERROR_BADVALUE)
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_BADVALUE\n", (LPCSTR)NULL, MB_OK);
|
|
||||||
if (dwreturn == LZERROR_GLOBALLOC)
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_GLOBALLOC\n", (LPCSTR)NULL, MB_OK);
|
|
||||||
if (dwreturn == LZERROR_GLOBLOCK)
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_GLOBLOCK\n", (LPCSTR)NULL, MB_OK);
|
|
||||||
if (dwreturn == LZERROR_READ)
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_READ\n", (LPCSTR)NULL, MB_OK);
|
|
||||||
if (dwreturn == LZERROR_WRITE)
|
|
||||||
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_WRITE\n", (LPCSTR)NULL, MB_OK);
|
|
||||||
if ((long)dwreturn > 0L)
|
|
||||||
{wsprintf((LPSTR)WriteBuf, (LPCSTR)"Successful decompression from %s to %s\n",
|
|
||||||
_ARGV[1], lpzDestFile);
|
|
||||||
MessageBox((HWND)NULL, (LPSTR)WriteBuf, (LPCSTR)NULL, MB_OK);
|
|
||||||
};
|
|
||||||
LZClose(hSourceFile); LZClose(hDestFile);
|
|
||||||
return dwreturn;
|
return dwreturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
|
||||||
}
|
}
|
||||||
fnGetSystemInfo(&si);
|
fnGetSystemInfo(&si);
|
||||||
fprintf(stderr,"QuerySystemInfo returns:\n");
|
fprintf(stderr,"QuerySystemInfo returns:\n");
|
||||||
fprintf(stderr," wProcessorArchitecture: %d\n",si.u.x.wProcessorArchitecture);
|
fprintf(stderr," wProcessorArchitecture: %d\n",si.u.s.wProcessorArchitecture);
|
||||||
fprintf(stderr," dwPageSize: %ld\n",si.dwPageSize);
|
fprintf(stderr," dwPageSize: %ld\n",si.dwPageSize);
|
||||||
fprintf(stderr," lpMinimumApplicationAddress: %p\n",si.lpMinimumApplicationAddress);
|
fprintf(stderr," lpMinimumApplicationAddress: %p\n",si.lpMinimumApplicationAddress);
|
||||||
fprintf(stderr," lpMaximumApplicationAddress: %p\n",si.lpMaximumApplicationAddress);
|
fprintf(stderr," lpMaximumApplicationAddress: %p\n",si.lpMaximumApplicationAddress);
|
||||||
|
|
Loading…
Reference in New Issue