예제 #1
0
파일: expand.c 프로젝트: howard5888/wineT
int main(int argc, char *argv[])
{
  OFSTRUCT SourceOpenStruct1, SourceOpenStruct2;
  LONG ret;
  HFILE hSourceFile, hDestFile;

  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);
  }
  ret = LZCopy(hSourceFile, hDestFile);
  LZClose(hSourceFile);
  LZClose(hDestFile);
  if (ret <= 0) fprintf(stderr,"LZCopy failed: return is %ld\n",ret);
  return (ret <= 0);
}
예제 #2
0
// @pymethod string|win32lz|GetExpandedName|Retrieves the original name of an expanded file,
static PyObject *
PyGetExpandedName(PyObject *self, PyObject *args)
{
	TCHAR outName[_MAX_PATH+1];
	TCHAR *nameIn;
	PyObject *obnameIn;
	if (!PyArg_ParseTuple(args, "O:GetExpandedName", &obnameIn )) // @pyparm str|Source||Name of a compressed file
		return NULL;
	if (!PyWinObject_AsTCHAR(obnameIn, &nameIn, FALSE))
		return NULL;
	// @pyseeapi GetExpandedName
	int ret = GetExpandedName(nameIn, outName);
	PyWinObject_FreeTCHAR(nameIn);
	if (ret!=1)
		return ReturnLZError("GetExpandedName", ret);
	return PyWinObject_FromTCHAR(outName);
}