From 007586ea29859a2698a0c05ffe81045f9d94fbbf Mon Sep 17 00:00:00 2001 From: Ilya Shpigor Date: Mon, 9 Nov 2009 14:04:08 +0300 Subject: [PATCH] extrac32: Implementation of the CAB archive extraction. --- programs/extrac32/Makefile.in | 2 +- programs/extrac32/extrac32.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/programs/extrac32/Makefile.in b/programs/extrac32/Makefile.in index 31aa7e0aaa1..78e4fefb86b 100644 --- a/programs/extrac32/Makefile.in +++ b/programs/extrac32/Makefile.in @@ -5,7 +5,7 @@ VPATH = @srcdir@ MODULE = extrac32.exe APPMODE = -mwindows -municode EXTRADEFS = -DWINE_NO_UNICODE -IMPORTS = shell32 user32 kernel32 +IMPORTS = shell32 setupapi user32 kernel32 C_SRCS = \ extrac32.c diff --git a/programs/extrac32/extrac32.c b/programs/extrac32/extrac32.c index e6fefc9fc3b..7e66458af43 100644 --- a/programs/extrac32/extrac32.c +++ b/programs/extrac32/extrac32.c @@ -21,12 +21,39 @@ #include #include +#include #include "wine/unicode.h" #include "wine/debug.h" 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) { LPWSTR *argv; @@ -105,7 +132,7 @@ int PASCAL wWinMain(HINSTANCE hInstance, HINSTANCE prev, LPWSTR cmdline, int sho break; case 'E': /* Extract CAB archive */ - WINE_FIXME("/E not implemented\n"); + extract(cabfile, path); break; case 0: case 'D':