expand.c 1.65 KB
Newer Older
1 2
/*
 * Copyright 1997 Victor Schneider
3
 * Copyright 2002 Alexandre Julliard
4 5 6 7 8 9 10 11 12 13 14 15 16
 *
 * 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
17
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 19
 */

20 21
#define WIN32_LEAN_AND_MEAN

Alexandre Julliard's avatar
Alexandre Julliard committed
22 23 24 25 26
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <lzexpand.h>

27
int main(int argc, char *argv[])
Alexandre Julliard's avatar
Alexandre Julliard committed
28 29
{
  OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
30
  LONG ret;
Alexandre Julliard's avatar
Alexandre Julliard committed
31 32
  HFILE hSourceFile, hDestFile;

33 34 35 36 37 38 39 40 41 42 43 44 45 46
  if (argc < 2)
  {
      fprintf( stderr, "Usage: %s infile [outfile]\n", argv[0] );
      return 1;
  }
  hSourceFile = LZOpenFile(argv[1], &SourceOpenStruct1, OF_READ);
  if (argv[2])
      hDestFile = LZOpenFile(argv[2], &SourceOpenStruct2, OF_CREATE | OF_WRITE);
  else
  {
      char OriginalName[MAX_PATH];
      GetExpandedName(argv[1], OriginalName);
      hDestFile = LZOpenFile(OriginalName, &SourceOpenStruct2, OF_CREATE | OF_WRITE);
  }
47
  ret = LZCopy(hSourceFile, hDestFile);
48 49
  LZClose(hSourceFile);
  LZClose(hDestFile);
50 51
  if (ret <= 0) fprintf(stderr,"LZCopy failed: return is %ld\n",ret);
  return (ret <= 0);
Alexandre Julliard's avatar
Alexandre Julliard committed
52
}