extrac32: Implementation of the CAB archive extraction.

This commit is contained in:
Ilya Shpigor 2009-11-09 14:04:08 +03:00 committed by Alexandre Julliard
parent 3dc8b28d84
commit 007586ea29
2 changed files with 29 additions and 2 deletions

View File

@ -5,7 +5,7 @@ VPATH = @srcdir@
MODULE = extrac32.exe MODULE = extrac32.exe
APPMODE = -mwindows -municode APPMODE = -mwindows -municode
EXTRADEFS = -DWINE_NO_UNICODE EXTRADEFS = -DWINE_NO_UNICODE
IMPORTS = shell32 user32 kernel32 IMPORTS = shell32 setupapi user32 kernel32
C_SRCS = \ C_SRCS = \
extrac32.c extrac32.c

View File

@ -21,12 +21,39 @@
#include <windows.h> #include <windows.h>
#include <shellapi.h> #include <shellapi.h>
#include <setupapi.h>
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(extrac32); WINE_DEFAULT_DEBUG_CHANNEL(extrac32);
static UINT WINAPI ExtCabCallback(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
{
FILE_IN_CABINET_INFO_W *pInfo;
FILEPATHS_W *pFilePaths;
switch(Notification)
{
case SPFILENOTIFY_FILEINCABINET:
pInfo = (FILE_IN_CABINET_INFO_W*)Param1;
lstrcpyW(pInfo->FullTargetName, (LPCWSTR)Context);
lstrcatW(pInfo->FullTargetName, pInfo->NameInCabinet);
return FILEOP_DOIT;
case SPFILENOTIFY_FILEEXTRACTED:
pFilePaths = (FILEPATHS_W*)Param1;
WINE_TRACE("Extracted %s\n", wine_dbgstr_w(pFilePaths->Target));
return NO_ERROR;
}
return NO_ERROR;
}
static void extract(LPCWSTR cabfile, LPWSTR destdir)
{
if (!SetupIterateCabinetW(cabfile, 0, ExtCabCallback, destdir))
WINE_ERR("Could not extract cab file %s\n", wine_dbgstr_w(cabfile));
}
int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int show) int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int show)
{ {
LPWSTR *argv; LPWSTR *argv;
@ -105,7 +132,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho
break; break;
case 'E': case 'E':
/* Extract CAB archive */ /* Extract CAB archive */
WINE_FIXME("/E not implemented\n"); extract(cabfile, path);
break; break;
case 0: case 0:
case 'D': case 'D':