From 527fb9fa9b1d48e2f270f01971a045c662a230ab Mon Sep 17 00:00:00 2001 From: The Wine Synchronizer Date: Fri, 8 Sep 2006 19:33:33 +0000 Subject: [PATCH] Autosyncing with Wine HEAD svn path=/trunk/; revision=23976 --- reactos/dll/win32/cabinet/cabinet.h | 8 ++++--- reactos/dll/win32/cabinet/cabinet_main.c | 30 +++++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/reactos/dll/win32/cabinet/cabinet.h b/reactos/dll/win32/cabinet/cabinet.h index d658cdf31b6..53744afae26 100644 --- a/reactos/dll/win32/cabinet/cabinet.h +++ b/reactos/dll/win32/cabinet/cabinet.h @@ -621,7 +621,7 @@ static const cab_UWORD Zipmask[17] = { struct ExtractFileList { LPSTR filename; struct ExtractFileList *next; - BOOL unknown; /* always 1L */ + BOOL flag; } ; /* the first parameter of the function extract */ @@ -631,8 +631,10 @@ typedef struct { struct ExtractFileList *filelist; /* 0x010 */ long filecount; /* 0x014 */ DWORD flags; /* 0x018 */ - char directory[0x104]; /* 0x01c */ - char lastfile[0x20c]; /* 0x120 */ + char directory[MAX_PATH]; /* 0x01c */ + char lastfile[MAX_PATH]; /* 0x120 */ + char unknown2[MAX_PATH]; /* 0x224 */ + struct ExtractFileList *filterlist; /* 0x328 */ } EXTRACTdest; diff --git a/reactos/dll/win32/cabinet/cabinet_main.c b/reactos/dll/win32/cabinet/cabinet_main.c index fe2739daf3a..ccba93224bb 100644 --- a/reactos/dll/win32/cabinet/cabinet_main.c +++ b/reactos/dll/win32/cabinet/cabinet_main.c @@ -157,7 +157,7 @@ static long fdi_seek(INT_PTR hf, long dist, int seektype) static void fill_file_node(struct ExtractFileList *pNode, LPSTR szFilename) { pNode->next = NULL; - pNode->unknown = TRUE; + pNode->flag = FALSE; pNode->filename = HeapAlloc(GetProcessHeap(), 0, strlen(szFilename) + 1); lstrcpyA(pNode->filename, szFilename); @@ -216,7 +216,8 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf pDestination->filecount++; } - if (pDestination->flags & EXTRACT_EXTRACTFILES) + if ((pDestination->flags & EXTRACT_EXTRACTFILES) || + file_in_list(pDestination->filterlist, pfdin->psz1)) { /* skip this file it it's not in the file list */ if (!file_in_list(pDestination->filelist, pfdin->psz1)) @@ -303,6 +304,7 @@ HRESULT WINAPI Extract(EXTRACTdest *dest, LPCSTR szCabName) HRESULT res = S_OK; HFDI hfdi; ERF erf; + char *str, *path, *name; TRACE("(%p, %s)\n", dest, szCabName); @@ -322,10 +324,32 @@ HRESULT WINAPI Extract(EXTRACTdest *dest, LPCSTR szCabName) if (GetFileAttributesA(dest->directory) == INVALID_FILE_ATTRIBUTES) return S_OK; - if (!FDICopy(hfdi, (LPSTR)szCabName, "", 0, + /* split the cabinet name into path + name */ + str = HeapAlloc(GetProcessHeap(), 0, lstrlenA(szCabName)+1); + if (!str) + { + res = E_OUTOFMEMORY; + goto end; + } + lstrcpyA(str, szCabName); + + path = str; + name = strrchr(path, '\\'); + if (name) + *name++ = 0; + else + { + name = path; + path = NULL; + } + + if (!FDICopy(hfdi, name, path, 0, fdi_notify_extract, NULL, dest)) res = E_FAIL; + HeapFree(GetProcessHeap(), 0, str); +end: + FDIDestroy(hfdi); return res;