Module: wine Branch: refs/heads/master Commit: 968a4457250e61cdbe5537c375b1d48ad5ce9fd9 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=968a4457250e61cdbe5537c3...
Author: Mike McCormack mike@codeweavers.com Date: Mon Aug 7 13:39:06 2006 +0900
cabinet: Split the cabinet path for FDICopy.
---
dlls/cabinet/cabinet_main.c | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/dlls/cabinet/cabinet_main.c b/dlls/cabinet/cabinet_main.c index fa8f1b4..3c69bf9 100644 --- a/dlls/cabinet/cabinet_main.c +++ b/dlls/cabinet/cabinet_main.c @@ -303,7 +303,7 @@ HRESULT WINAPI Extract(EXTRACTdest *dest HRESULT res = S_OK; HFDI hfdi; ERF erf; - static CHAR empty[] = ""; + char *str, *path, *name;
TRACE("(%p, %s)\n", dest, szCabName);
@@ -323,10 +323,32 @@ HRESULT WINAPI Extract(EXTRACTdest *dest if (GetFileAttributesA(dest->directory) == INVALID_FILE_ATTRIBUTES) return S_OK;
- if (!FDICopy(hfdi, (LPSTR)szCabName, empty, 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;