From edda4637b449cd17a7c091cac867d1e5a6896f2a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 29 Dec 2008 14:50:26 +0100 Subject: [PATCH] cabinet: Make sure that parent directories exist when creating a new directory. --- dlls/cabinet/cabinet_main.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/cabinet/cabinet_main.c b/dlls/cabinet/cabinet_main.c index 35810e3b65..4748a99404 100644 --- a/dlls/cabinet/cabinet_main.c +++ b/dlls/cabinet/cabinet_main.c @@ -237,7 +237,18 @@ static INT_PTR fdi_notify_extract(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pf /* create the destination directory if it doesn't exist */ if (GetFileAttributesA(szDirectory) == INVALID_FILE_ATTRIBUTES) + { + char *ptr; + + for(ptr = szDirectory + strlen(pDestination->Destination)+1; *ptr; ptr++) { + if(*ptr == '\\') { + *ptr = 0; + CreateDirectoryA(szDirectory, NULL); + *ptr = '\\'; + } + } CreateDirectoryA(szDirectory, NULL); + } hFile = CreateFileA(szFullPath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); -- 2.33.8