Removed GUI junk from expand.c, so you can use it in commandline mode.

Fixed hello5.c.
This commit is contained in:
Marcus Meissner 2000-01-08 22:21:47 +00:00 committed by Alexandre Julliard
parent 3e1be2679a
commit 505fadc8e7
2 changed files with 12 additions and 47 deletions

View File

@ -10,7 +10,7 @@ int PASCAL WinMain(HINSTANCE hinstCurrent,
int nCmdShow)
{
OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
char OriginalName[256], WriteBuf[256];
char OriginalName[256];
char FAR *lpzDestFile;
DWORD dwreturn;
HFILE hSourceFile, hDestFile;
@ -18,54 +18,19 @@ int PASCAL WinMain(HINSTANCE hinstCurrent,
extern int _ARGC;
extern char **_ARGV;
MessageBox((HWND)NULL, (LPCSTR)_ARGV[1], (LPCSTR)"_ARGV[1]:", MB_OK);
MessageBox((HWND)NULL, (LPCSTR)_ARGV[2], (LPCSTR)"_ARGV[2]:", MB_OK);
hSourceFile = LZOpenFile(_ARGV[1], (LPOFSTRUCT) &SourceOpenStruct1,
OF_READ);
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);
hSourceFile = LZOpenFile(_ARGV[1], (LPOFSTRUCT) &SourceOpenStruct1, OF_READ);
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,
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);
if (dwreturn == LZERROR_BADINHANDLE)
MessageBox((HWND)NULL, (LPCSTR)"LZERROR_BADINHANDLE\n", (LPCSTR)NULL, MB_OK);
if (dwreturn == LZERROR_BADOUTHANDLE)
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);
if (dwreturn != 0)
fprintf(stderr,"LZCopy failed: return is %ld\n",dwreturn);
LZClose(hSourceFile);
LZClose(hDestFile);
return dwreturn;
}

View File

@ -22,7 +22,7 @@ int PASCAL WinMain (HANDLE inst, HANDLE prev, LPSTR cmdline, int show)
}
fnGetSystemInfo(&si);
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," lpMinimumApplicationAddress: %p\n",si.lpMinimumApplicationAddress);
fprintf(stderr," lpMaximumApplicationAddress: %p\n",si.lpMaximumApplicationAddress);