mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 15:02:16 +00:00
[EXPAND]
* Sync with Wine 1.5.26. svn path=/trunk/; revision=58800
This commit is contained in:
parent
d5c3c87735
commit
65ef84b840
2 changed files with 28 additions and 23 deletions
|
@ -28,6 +28,21 @@
|
|||
#include <lzexpand.h>
|
||||
#include <setupapi.h>
|
||||
|
||||
static int myprintf(const char* format, ...)
|
||||
{
|
||||
va_list va;
|
||||
char tmp[8192];
|
||||
DWORD w = 0;
|
||||
int len;
|
||||
|
||||
va_start(va, format);
|
||||
len = vsnprintf(tmp, sizeof(tmp), format, va);
|
||||
if (len > 0)
|
||||
WriteFile(GetStdHandle(STD_ERROR_HANDLE), tmp, len, &w, NULL);
|
||||
va_end(va);
|
||||
return w;
|
||||
}
|
||||
|
||||
static UINT CALLBACK set_outfile( PVOID context, UINT notification, UINT_PTR param1, UINT_PTR param2 )
|
||||
{
|
||||
FILE_IN_CABINET_INFO_A *info = (FILE_IN_CABINET_INFO_A *)param1;
|
||||
|
@ -85,9 +100,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (argc < 3)
|
||||
{
|
||||
fprintf( stderr, "Usage:\n" );
|
||||
fprintf( stderr, "\t%s infile outfile\n", argv[0] );
|
||||
fprintf( stderr, "\t%s /r infile\n", argv[0] );
|
||||
myprintf( "Usage:\n" );
|
||||
myprintf( "\t%s infile outfile\n", argv[0] );
|
||||
myprintf( "\t%s /r infile\n", argv[0] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -98,7 +113,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (!SetupGetFileCompressionInfoExA( infile, actual_name, sizeof(actual_name), NULL, NULL, NULL, &comp ))
|
||||
{
|
||||
fprintf( stderr, "%s: can't open input file %s\n", argv[0], infile );
|
||||
myprintf( "%s: can't open input file %s\n", argv[0], infile );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -107,50 +122,42 @@ int main(int argc, char *argv[])
|
|||
switch (comp)
|
||||
{
|
||||
case FILE_COMPRESSION_MSZIP:
|
||||
{
|
||||
outfile_basename[0] = 0;
|
||||
if (!SetupIterateCabinetA( infile, 0, set_outfile, outfile_basename ))
|
||||
{
|
||||
fprintf( stderr, "%s: can't determine original name\n", argv[0] );
|
||||
myprintf( "%s: can't determine original name\n", argv[0] );
|
||||
return 1;
|
||||
}
|
||||
GetFullPathNameA( infile, sizeof(outfile), outfile, &basename_index );
|
||||
*basename_index = 0;
|
||||
strcat( outfile, outfile_basename );
|
||||
break;
|
||||
}
|
||||
case FILE_COMPRESSION_WINLZA:
|
||||
{
|
||||
GetExpandedNameA( infile, outfile_basename );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
fprintf( stderr, "%s: can't determine original\n", argv[0] );
|
||||
myprintf( "%s: can't determine original\n", argv[0] );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
GetFullPathNameA( argv[2], sizeof(outfile), outfile, NULL );
|
||||
|
||||
if (!lstrcmpiA( infile, outfile ))
|
||||
{
|
||||
fprintf( stderr, "%s: can't expand file to itself\n", argv[0] );
|
||||
myprintf( "%s: can't expand file to itself\n", argv[0] );
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (comp)
|
||||
{
|
||||
case FILE_COMPRESSION_MSZIP:
|
||||
{
|
||||
if (!SetupIterateCabinetA( infile, 0, extract_callback, outfile ))
|
||||
{
|
||||
fprintf( stderr, "%s: cabinet extraction failed\n", argv[0] );
|
||||
myprintf( "%s: cabinet extraction failed\n", argv[0] );
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case FILE_COMPRESSION_WINLZA:
|
||||
{
|
||||
INT hin, hout;
|
||||
|
@ -159,13 +166,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
if ((hin = LZOpenFileA( infile, &ofin, OF_READ )) < 0)
|
||||
{
|
||||
fprintf( stderr, "%s: can't open input file %s\n", argv[0], infile );
|
||||
myprintf( "%s: can't open input file %s\n", argv[0], infile );
|
||||
return 1;
|
||||
}
|
||||
if ((hout = LZOpenFileA( outfile, &ofout, OF_CREATE | OF_WRITE )) < 0)
|
||||
{
|
||||
LZClose( hin );
|
||||
fprintf( stderr, "%s: can't open output file %s\n", argv[0], outfile );
|
||||
myprintf( "%s: can't open output file %s\n", argv[0], outfile );
|
||||
return 1;
|
||||
}
|
||||
error = LZCopy( hin, hout );
|
||||
|
@ -175,20 +182,18 @@ int main(int argc, char *argv[])
|
|||
|
||||
if (error < 0)
|
||||
{
|
||||
fprintf( stderr, "%s: LZCopy failed, error is %ld\n", argv[0], error );
|
||||
myprintf( "%s: LZCopy failed, error is %d\n", argv[0], error );
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (!CopyFileA( infile, outfile, FALSE ))
|
||||
{
|
||||
fprintf( stderr, "%s: CopyFileA failed\n", argv[0] );
|
||||
myprintf( "%s: CopyFileA failed\n", argv[0] );
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ reactos/base/applications/regedit # Out of sync
|
|||
reactos/base/applications/winhlp32 # Synced to Wine-1.5.26
|
||||
reactos/base/applications/wordpad # Synced to Wine-1.5.26
|
||||
reactos/base/services/rpcss # Synced to Wine-20081105
|
||||
reactos/base/system/expand # Autosync
|
||||
reactos/base/system/expand # Synced to Wine-1.5.26
|
||||
reactos/base/system/msiexec # Autosync
|
||||
reactos/modules/rosapps/winfile # Autosync
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue