2003-07-25 21:51:30 +00:00
|
|
|
/*
|
|
|
|
* Copyright 1997 Victor Schneider
|
|
|
|
* Copyright 2002 Alexandre Julliard
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2009-10-27 10:34:16 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2003-07-25 21:51:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <windows.h>
|
|
|
|
#include <lzexpand.h>
|
2005-05-12 21:10:10 +00:00
|
|
|
#include <tchar.h>
|
2003-07-25 21:51:30 +00:00
|
|
|
|
2005-05-12 21:10:10 +00:00
|
|
|
#include "resource.h"
|
|
|
|
|
2005-05-29 20:58:38 +00:00
|
|
|
int _tmain(int argc, TCHAR *argv[])
|
2003-07-25 21:51:30 +00:00
|
|
|
{
|
|
|
|
OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
|
|
|
|
LONG ret;
|
2007-10-19 23:21:45 +00:00
|
|
|
HFILE hSourceFile, hDestFile;
|
2005-05-12 21:10:10 +00:00
|
|
|
TCHAR szMsg[RC_STRING_MAX_SIZE];
|
2003-07-25 21:51:30 +00:00
|
|
|
|
|
|
|
if (argc < 2)
|
|
|
|
{
|
2007-10-19 23:21:45 +00:00
|
|
|
LoadString( GetModuleHandle(NULL), IDS_Copy, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
|
|
|
_ftprintf( stderr, szMsg, argv[0] );
|
2003-07-25 21:51:30 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
hSourceFile = LZOpenFile(argv[1], &SourceOpenStruct1, OF_READ);
|
|
|
|
if (argv[2])
|
|
|
|
hDestFile = LZOpenFile(argv[2], &SourceOpenStruct2, OF_CREATE | OF_WRITE);
|
|
|
|
else
|
|
|
|
{
|
2005-05-12 21:10:10 +00:00
|
|
|
TCHAR OriginalName[MAX_PATH];
|
2003-07-25 21:51:30 +00:00
|
|
|
GetExpandedName(argv[1], OriginalName);
|
|
|
|
hDestFile = LZOpenFile(OriginalName, &SourceOpenStruct2, OF_CREATE | OF_WRITE);
|
|
|
|
}
|
|
|
|
ret = LZCopy(hSourceFile, hDestFile);
|
|
|
|
LZClose(hSourceFile);
|
|
|
|
LZClose(hDestFile);
|
2007-10-19 23:21:45 +00:00
|
|
|
LoadString( GetModuleHandle(NULL), IDS_FAILS, (LPTSTR) szMsg,RC_STRING_MAX_SIZE);
|
2005-05-12 21:10:10 +00:00
|
|
|
if (ret <= 0) _ftprintf(stderr,szMsg,ret);
|
2003-07-25 21:51:30 +00:00
|
|
|
return (ret <= 0);
|
|
|
|
}
|