From 2c4db4ada1cb02271191df35ce1bc81aa219af00 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Tue, 2 May 2017 01:26:37 +0200 Subject: [PATCH] Added patch to fix Param2 in SPFILENOTIFY_FILEINCABINET handler. --- patches/patchinstall.sh | 25 +++ ...dd-more-tests-for-SPFILENOTIFY_FILEI.patch | 146 ++++++++++++++++ ...inetName-passed-to-SPFILENOTIFY_CABI.patch | 86 ++++++++++ ...dd-tests-for-cabinet-name-passed-to-.patch | 162 ++++++++++++++++++ ...ameters-of-SPFILENOTIFY_FILEINCABINE.patch | 107 ++++++++++++ .../definition | 1 + 6 files changed, 527 insertions(+) create mode 100644 patches/setupapi-SPFILENOTIFY_FILEINCABINET/0001-setupapi-tests-Add-more-tests-for-SPFILENOTIFY_FILEI.patch create mode 100644 patches/setupapi-SPFILENOTIFY_FILEINCABINET/0002-setupapi-Fix-CabinetName-passed-to-SPFILENOTIFY_CABI.patch create mode 100644 patches/setupapi-SPFILENOTIFY_FILEINCABINET/0003-setupapi-tests-Add-tests-for-cabinet-name-passed-to-.patch create mode 100644 patches/setupapi-SPFILENOTIFY_FILEINCABINET/0004-setupapi-Fix-parameters-of-SPFILENOTIFY_FILEINCABINE.patch create mode 100644 patches/setupapi-SPFILENOTIFY_FILEINCABINET/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index ebe2c016..e733e0cf 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -325,6 +325,7 @@ patch_enable_all () enable_setupapi_DiskSpaceList="$1" enable_setupapi_Display_Device="$1" enable_setupapi_HSPFILEQ_Check_Type="$1" + enable_setupapi_SPFILENOTIFY_FILEINCABINET="$1" enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT="$1" enable_setupapi_SetupDiGetDeviceInterfaceDetail="$1" enable_setupapi_SetupPromptForDisk="$1" @@ -1200,6 +1201,9 @@ patch_enable () setupapi-HSPFILEQ_Check_Type) enable_setupapi_HSPFILEQ_Check_Type="$2" ;; + setupapi-SPFILENOTIFY_FILEINCABINET) + enable_setupapi_SPFILENOTIFY_FILEINCABINET="$2" + ;; setupapi-SP_COPY_IN_USE_NEEDS_REBOOT) enable_setupapi_SP_COPY_IN_USE_NEEDS_REBOOT="$2" ;; @@ -6963,6 +6967,27 @@ if test "$enable_setupapi_HSPFILEQ_Check_Type" -eq 1; then ) >> "$patchlist" fi +# Patchset setupapi-SPFILENOTIFY_FILEINCABINET +# | +# | This patchset fixes the following Wine bugs: +# | * [#42827] Fix Param2 in SPFILENOTIFY_FILEINCABINET handler +# | +# | Modified files: +# | * dlls/setupapi/setupcab.c, dlls/setupapi/tests/setupcab.c +# | +if test "$enable_setupapi_SPFILENOTIFY_FILEINCABINET" -eq 1; then + patch_apply setupapi-SPFILENOTIFY_FILEINCABINET/0001-setupapi-tests-Add-more-tests-for-SPFILENOTIFY_FILEI.patch + patch_apply setupapi-SPFILENOTIFY_FILEINCABINET/0002-setupapi-Fix-CabinetName-passed-to-SPFILENOTIFY_CABI.patch + patch_apply setupapi-SPFILENOTIFY_FILEINCABINET/0003-setupapi-tests-Add-tests-for-cabinet-name-passed-to-.patch + patch_apply setupapi-SPFILENOTIFY_FILEINCABINET/0004-setupapi-Fix-parameters-of-SPFILENOTIFY_FILEINCABINE.patch + ( + printf '%s\n' '+ { "Dmitry Timoshkov", "setupapi/tests: Add more tests for SPFILENOTIFY_FILEINCABINET handler.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "setupapi: Fix CabinetName passed to SPFILENOTIFY_CABINETINFO handler.", 1 },'; + printf '%s\n' '+ { "Sebastian Lackner", "setupapi/tests: Add tests for cabinet name passed to SPFILENOTIFY_FILEEXTRACTED.", 1 },'; + printf '%s\n' '+ { "Dmitry Timoshkov", "setupapi: Fix parameters of SPFILENOTIFY_FILEINCABINET handler.", 1 },'; + ) >> "$patchlist" +fi + # Patchset setupapi-SP_COPY_IN_USE_NEEDS_REBOOT # | # | This patchset fixes the following Wine bugs: diff --git a/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0001-setupapi-tests-Add-more-tests-for-SPFILENOTIFY_FILEI.patch b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0001-setupapi-tests-Add-more-tests-for-SPFILENOTIFY_FILEI.patch new file mode 100644 index 00000000..b6c0458b --- /dev/null +++ b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0001-setupapi-tests-Add-more-tests-for-SPFILENOTIFY_FILEI.patch @@ -0,0 +1,146 @@ +From eff135f5b221772d7ee3c44bd94c680bb9c8169c Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Thu, 20 Apr 2017 17:08:11 +0800 +Subject: setupapi/tests: Add more tests for SPFILENOTIFY_FILEINCABINET + handler. + +--- + dlls/setupapi/tests/setupcab.c | 50 ++++++++++++++++++++++++++++++++---------- + 1 file changed, 38 insertions(+), 12 deletions(-) + +diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c +index 33daae922b..8fdc3734bd 100644 +--- a/dlls/setupapi/tests/setupcab.c ++++ b/dlls/setupapi/tests/setupcab.c +@@ -299,11 +299,17 @@ static void test_invalid_callbackW(void) + + static const char *expected_files[] = {"tristram", "wine", "shandy"}; + ++struct contextA ++{ ++ int count; ++ const char *cabinet; ++}; ++ + static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, + UINT_PTR Param1, UINT_PTR Param2) + { + static int index; +- int *file_count = Context; ++ struct contextA *ctx = Context; + + switch (Notification) + { +@@ -313,14 +319,19 @@ static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, + case SPFILENOTIFY_FILEINCABINET: + { + FILE_IN_CABINET_INFO_A *info = (FILE_IN_CABINET_INFO_A *)Param1; ++ const char *cabinet_file = (const char *)Param2; + +- (*file_count)++; ++ ctx->count++; + + if (index < sizeof(expected_files)/sizeof(char *)) + { + ok(!strcmp(expected_files[index], info->NameInCabinet), + "[%d] Expected file \"%s\", got \"%s\"\n", + index, expected_files[index], info->NameInCabinet); ++todo_wine ++ ok(!strcmp(ctx->cabinet, cabinet_file), ++ "[%d] Expected cabinet \"%s\", got \"%s\"\n", ++ index, ctx->cabinet, cabinet_file); + index++; + return FILEOP_SKIP; + } +@@ -339,17 +350,19 @@ static void test_simple_enumerationA(void) + { + BOOL ret; + char source[MAX_PATH], temp[MAX_PATH]; +- int enum_count = 0; ++ struct contextA ctx; + + GetTempPathA(sizeof(temp), temp); + GetTempFileNameA(temp, "doc", 0, source); + + create_source_fileA(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); + +- ret = SetupIterateCabinetA(source, 0, simple_callbackA, &enum_count); ++ ctx.count = 0; ++ ctx.cabinet = source; ++ ret = SetupIterateCabinetA(source, 0, simple_callbackA, &ctx); + ok(ret == 1, "Expected SetupIterateCabinetA to return 1, got %d\n", ret); +- ok(enum_count == sizeof(expected_files)/sizeof(char *), +- "Unexpectedly enumerated %d files\n", enum_count); ++ ok(ctx.count == sizeof(expected_files)/sizeof(char *), ++ "Unexpectedly enumerated %d files\n", ctx.count); + + DeleteFileA(source); + } +@@ -359,11 +372,17 @@ static const WCHAR wineW[] = {'w','i','n','e',0}; + static const WCHAR shandyW[] = {'s','h','a','n','d','y',0}; + static const WCHAR *expected_filesW[] = {tristramW, wineW, shandyW}; + ++struct contextW ++{ ++ int count; ++ const WCHAR *cabinet; ++}; ++ + static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, + UINT_PTR Param1, UINT_PTR Param2) + { + static int index; +- int *file_count = Context; ++ struct contextW *ctx = Context; + + switch (Notification) + { +@@ -373,14 +392,19 @@ static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, + case SPFILENOTIFY_FILEINCABINET: + { + FILE_IN_CABINET_INFO_W *info = (FILE_IN_CABINET_INFO_W *)Param1; ++ const WCHAR *cabinet_file = (const WCHAR *)Param2; + +- (*file_count)++; ++ ctx->count++; + + if (index < sizeof(expected_filesW)/sizeof(WCHAR *)) + { + ok(!lstrcmpW(expected_filesW[index], info->NameInCabinet), + "[%d] Expected file %s, got %s\n", + index, wine_dbgstr_w(expected_filesW[index]), wine_dbgstr_w(info->NameInCabinet)); ++todo_wine ++ ok(!lstrcmpW(ctx->cabinet, cabinet_file), ++ "[%d] Expected cabinet %s, got %s\n", ++ index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(cabinet_file)); + index++; + return FILEOP_SKIP; + } +@@ -399,7 +423,7 @@ static void test_simple_enumerationW(void) + { + BOOL ret; + WCHAR source[MAX_PATH], temp[MAX_PATH]; +- int enum_count = 0; ++ struct contextW ctx; + + ret = SetupIterateCabinetW(NULL, 0, NULL, NULL); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) +@@ -413,10 +437,12 @@ static void test_simple_enumerationW(void) + + create_source_fileW(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); + +- ret = SetupIterateCabinetW(source, 0, simple_callbackW, &enum_count); ++ ctx.count = 0; ++ ctx.cabinet = source; ++ ret = SetupIterateCabinetW(source, 0, simple_callbackW, &ctx); + ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret); +- ok(enum_count == sizeof(expected_files)/sizeof(WCHAR *), +- "Unexpectedly enumerated %d files\n", enum_count); ++ ok(ctx.count == sizeof(expected_files)/sizeof(WCHAR *), ++ "Unexpectedly enumerated %d files\n", ctx.count); + + DeleteFileW(source); + } +-- +2.12.2 + diff --git a/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0002-setupapi-Fix-CabinetName-passed-to-SPFILENOTIFY_CABI.patch b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0002-setupapi-Fix-CabinetName-passed-to-SPFILENOTIFY_CABI.patch new file mode 100644 index 00000000..5e6828a0 --- /dev/null +++ b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0002-setupapi-Fix-CabinetName-passed-to-SPFILENOTIFY_CABI.patch @@ -0,0 +1,86 @@ +From 3ddb06dbe75951815a5ca499d1bc2611ca8b5c0e Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Tue, 2 May 2017 00:48:45 +0200 +Subject: setupapi: Fix CabinetName passed to SPFILENOTIFY_CABINETINFO handler. + +--- + dlls/setupapi/setupcab.c | 5 +++-- + dlls/setupapi/tests/setupcab.c | 15 +++++++++++++++ + 2 files changed, 18 insertions(+), 2 deletions(-) + +diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c +index 54c0256ee9..0146e575d4 100644 +--- a/dlls/setupapi/setupcab.c ++++ b/dlls/setupapi/setupcab.c +@@ -297,7 +297,7 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p + TRACE(" Cabinet Set#: %d\n", pfdin->setID); + TRACE(" Cabinet Cab#: %d\n", pfdin->iCabinet); */ + WARN("SPFILENOTIFY_CABINETINFO undocumented: guess implementation.\n"); +- ci.CabinetFile = phsc->most_recent_cabinet_name; ++ ci.CabinetFile = ""; + ci.CabinetPath = pfdin->psz3; + ci.DiskName = pfdin->psz2; + ci.SetId = pfdin->setID; +@@ -389,6 +389,7 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p + + static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin) + { ++ static const WCHAR emptyW[] = {0}; + FILE_IN_CABINET_INFO_W fici; + PSC_HSC_W phsc; + CABINET_INFO_W ci; +@@ -423,7 +424,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p + TRACE(" Cabinet Set#: %d\n", pfdin->setID); + TRACE(" Cabinet Cab#: %d\n", pfdin->iCabinet); */ + WARN("SPFILENOTIFY_CABINETINFO undocumented: guess implementation.\n"); +- ci.CabinetFile = phsc->most_recent_cabinet_name; ++ ci.CabinetFile = emptyW; + len = 1 + MultiByteToWideChar(CP_ACP, 0, pfdin->psz3, -1, buf, MAX_PATH); + if ((len > MAX_PATH) || (len <= 1)) + buf[0] = '\0'; +diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c +index 8fdc3734bd..095107f225 100644 +--- a/dlls/setupapi/tests/setupcab.c ++++ b/dlls/setupapi/tests/setupcab.c +@@ -314,8 +314,15 @@ static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, + switch (Notification) + { + case SPFILENOTIFY_CABINETINFO: ++ { ++ CABINET_INFO_A *info = (CABINET_INFO_A *)Param1; ++ ++ ok(!strcmp(info->CabinetFile, ""), ++ "Expected empty CabinetFile, got \"%s\"\n", info->CabinetFile); ++ + index = 0; + return NO_ERROR; ++ } + case SPFILENOTIFY_FILEINCABINET: + { + FILE_IN_CABINET_INFO_A *info = (FILE_IN_CABINET_INFO_A *)Param1; +@@ -381,14 +388,22 @@ struct contextW + static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, + UINT_PTR Param1, UINT_PTR Param2) + { ++ static const WCHAR emptyW[] = {0}; + static int index; + struct contextW *ctx = Context; + + switch (Notification) + { + case SPFILENOTIFY_CABINETINFO: ++ { ++ CABINET_INFO_W *info = (CABINET_INFO_W *)Param1; ++ ++ ok(!lstrcmpW(info->CabinetFile, emptyW), ++ "Expected empty CabinetFile, got %s\n", wine_dbgstr_w(info->CabinetFile)); ++ + index = 0; + return NO_ERROR; ++ } + case SPFILENOTIFY_FILEINCABINET: + { + FILE_IN_CABINET_INFO_W *info = (FILE_IN_CABINET_INFO_W *)Param1; +-- +2.12.2 + diff --git a/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0003-setupapi-tests-Add-tests-for-cabinet-name-passed-to-.patch b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0003-setupapi-tests-Add-tests-for-cabinet-name-passed-to-.patch new file mode 100644 index 00000000..baa77c59 --- /dev/null +++ b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0003-setupapi-tests-Add-tests-for-cabinet-name-passed-to-.patch @@ -0,0 +1,162 @@ +From 7625977bb8c12499761e268ac4e6ddfc96892c84 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Tue, 2 May 2017 01:15:03 +0200 +Subject: setupapi/tests: Add tests for cabinet name passed to + SPFILENOTIFY_FILEEXTRACTED. + +--- + dlls/setupapi/tests/setupcab.c | 56 +++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 52 insertions(+), 4 deletions(-) + +diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c +index 095107f225..010c9d559d 100644 +--- a/dlls/setupapi/tests/setupcab.c ++++ b/dlls/setupapi/tests/setupcab.c +@@ -303,6 +303,7 @@ struct contextA + { + int count; + const char *cabinet; ++ const char *target; + }; + + static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, +@@ -339,8 +340,9 @@ todo_wine + ok(!strcmp(ctx->cabinet, cabinet_file), + "[%d] Expected cabinet \"%s\", got \"%s\"\n", + index, ctx->cabinet, cabinet_file); +- index++; +- return FILEOP_SKIP; ++ ++ strcpy(info->FullTargetName, ctx->target); ++ return FILEOP_DOIT; + } + else + { +@@ -348,6 +350,24 @@ todo_wine + return FILEOP_ABORT; + } + } ++ case SPFILENOTIFY_FILEEXTRACTED: ++ { ++ FILEPATHS_A *info = (FILEPATHS_A *)Param1; ++ ++todo_wine ++ ok(!strcmp(ctx->cabinet, info->Source), ++ "[%d] Expected cabinet \"%s\", got \"%s\"\n", ++ index, ctx->cabinet, info->Source); ++ ok(!strcmp(ctx->target, info->Target), ++ "[%d] Expected target \"%s\", got \"%s\"\n", ++ index, ctx->target, info->Target); ++ ok(info->Win32Error == 0, ++ "[%d] Expected Win32Error 0, got %u\n", ++ index, info->Win32Error); ++ ++ index++; ++ return NO_ERROR; ++ } + default: + return NO_ERROR; + } +@@ -357,21 +377,25 @@ static void test_simple_enumerationA(void) + { + BOOL ret; + char source[MAX_PATH], temp[MAX_PATH]; ++ char target[MAX_PATH]; + struct contextA ctx; + + GetTempPathA(sizeof(temp), temp); + GetTempFileNameA(temp, "doc", 0, source); ++ GetTempFileNameA(temp, "doc", 0, target); + + create_source_fileA(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); + + ctx.count = 0; + ctx.cabinet = source; ++ ctx.target = target; + ret = SetupIterateCabinetA(source, 0, simple_callbackA, &ctx); + ok(ret == 1, "Expected SetupIterateCabinetA to return 1, got %d\n", ret); + ok(ctx.count == sizeof(expected_files)/sizeof(char *), + "Unexpectedly enumerated %d files\n", ctx.count); + + DeleteFileA(source); ++ DeleteFileA(target); + } + + static const WCHAR tristramW[] = {'t','r','i','s','t','r','a','m',0}; +@@ -383,6 +407,7 @@ struct contextW + { + int count; + const WCHAR *cabinet; ++ const WCHAR *target; + }; + + static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, +@@ -420,8 +445,9 @@ todo_wine + ok(!lstrcmpW(ctx->cabinet, cabinet_file), + "[%d] Expected cabinet %s, got %s\n", + index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(cabinet_file)); +- index++; +- return FILEOP_SKIP; ++ ++ lstrcpyW(info->FullTargetName, ctx->target); ++ return FILEOP_DOIT; + } + else + { +@@ -429,6 +455,24 @@ todo_wine + return FILEOP_ABORT; + } + } ++ case SPFILENOTIFY_FILEEXTRACTED: ++ { ++ FILEPATHS_W *info = (FILEPATHS_W *)Param1; ++ ++todo_wine ++ ok(!lstrcmpW(ctx->cabinet, info->Source), ++ "[%d] Expected cabinet %s, got %s\n", ++ index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(info->Source)); ++ ok(!lstrcmpW(ctx->target, info->Target), ++ "[%d] Expected target %s, got %s\n", ++ index, wine_dbgstr_w(ctx->target), wine_dbgstr_w(info->Target)); ++ ok(info->Win32Error == 0, ++ "[%d] Expected Win32Error 0, got %u\n", ++ index, info->Win32Error); ++ ++ index++; ++ return NO_ERROR; ++ } + default: + return NO_ERROR; + } +@@ -438,6 +482,7 @@ static void test_simple_enumerationW(void) + { + BOOL ret; + WCHAR source[MAX_PATH], temp[MAX_PATH]; ++ WCHAR target[MAX_PATH]; + struct contextW ctx; + + ret = SetupIterateCabinetW(NULL, 0, NULL, NULL); +@@ -449,17 +494,20 @@ static void test_simple_enumerationW(void) + + GetTempPathW(sizeof(temp)/sizeof(WCHAR), temp); + GetTempFileNameW(temp, docW, 0, source); ++ GetTempFileNameW(temp, docW, 0, target); + + create_source_fileW(source, comp_cab_zip_multi, sizeof(comp_cab_zip_multi)); + + ctx.count = 0; + ctx.cabinet = source; ++ ctx.target = target; + ret = SetupIterateCabinetW(source, 0, simple_callbackW, &ctx); + ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret); + ok(ctx.count == sizeof(expected_files)/sizeof(WCHAR *), + "Unexpectedly enumerated %d files\n", ctx.count); + + DeleteFileW(source); ++ DeleteFileW(target); + } + + START_TEST(setupcab) +-- +2.12.2 + diff --git a/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0004-setupapi-Fix-parameters-of-SPFILENOTIFY_FILEINCABINE.patch b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0004-setupapi-Fix-parameters-of-SPFILENOTIFY_FILEINCABINE.patch new file mode 100644 index 00000000..9f33f9f4 --- /dev/null +++ b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/0004-setupapi-Fix-parameters-of-SPFILENOTIFY_FILEINCABINE.patch @@ -0,0 +1,107 @@ +From ed71bc3e8c01828f7b58597d5ea0827e2540f4f0 Mon Sep 17 00:00:00 2001 +From: Dmitry Timoshkov +Date: Thu, 20 Apr 2017 17:08:11 +0800 +Subject: setupapi: Fix parameters of SPFILENOTIFY_FILEINCABINET handler. + +Bug 42827 references the setup application that depends on this. +--- + dlls/setupapi/setupcab.c | 17 ++++++++--------- + dlls/setupapi/tests/setupcab.c | 4 ---- + 2 files changed, 8 insertions(+), 13 deletions(-) + +diff --git a/dlls/setupapi/setupcab.c b/dlls/setupapi/setupcab.c +index 0146e575d4..6a02faa4cb 100644 +--- a/dlls/setupapi/setupcab.c ++++ b/dlls/setupapi/setupcab.c +@@ -323,7 +323,7 @@ static INT_PTR CDECL sc_FNNOTIFY_A(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p + fici.DosAttribs = pfdin->attribs; + memset(fici.FullTargetName, 0, MAX_PATH); + err = phsc->msghandler(phsc->context, SPFILENOTIFY_FILEINCABINET, +- (UINT_PTR)&fici, (UINT_PTR)pfdin->psz1); ++ (UINT_PTR)&fici, (UINT_PTR)phsc->most_recent_cabinet_name); + if (err == FILEOP_DOIT) { + TRACE(" Callback specified filename: %s\n", debugstr_a(fici.FullTargetName)); + if (!fici.FullTargetName[0]) { +@@ -459,7 +459,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p + fici.DosAttribs = pfdin->attribs; + memset(fici.FullTargetName, 0, MAX_PATH * sizeof(WCHAR)); + err = phsc->msghandler(phsc->context, SPFILENOTIFY_FILEINCABINET, +- (UINT_PTR)&fici, (UINT_PTR)pfdin->psz1); ++ (UINT_PTR)&fici, (UINT_PTR)phsc->most_recent_cabinet_name); + if (err == FILEOP_DOIT) { + TRACE(" Callback specified filename: %s\n", debugstr_w(fici.FullTargetName)); + if (fici.FullTargetName[0]) { +@@ -587,8 +587,8 @@ BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, + + TRACE("path: %s, cabfile: %s\n", debugstr_a(pszCabPath), debugstr_a(pszCabinet)); + +- /* remember the cabinet name */ +- strcpy(my_hsc.most_recent_cabinet_name, pszCabinet); ++ /* remember original cabinet name */ ++ strcpy(my_hsc.most_recent_cabinet_name, CabinetFile); + + my_hsc.magic = SC_HSC_A_MAGIC; + my_hsc.msghandler = MsgHandler; +@@ -638,19 +638,18 @@ BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, + } + + if (p) { +- strcpyW(my_hsc.most_recent_cabinet_name, p); ++ WideCharToMultiByte(CP_ACP, 0, p, -1, pszCabinet, MAX_PATH, 0, 0); + *p = 0; + len = WideCharToMultiByte(CP_ACP, 0, pszCabPathW, -1, pszCabPath, + MAX_PATH, 0, 0); + if (!len) return FALSE; + } else { +- strcpyW(my_hsc.most_recent_cabinet_name, CabinetFile); ++ WideCharToMultiByte(CP_ACP, 0, CabinetFile, -1, pszCabinet, MAX_PATH, 0, 0); + pszCabPath[0] = '\0'; + } + +- len = WideCharToMultiByte(CP_ACP, 0, my_hsc.most_recent_cabinet_name, -1, +- pszCabinet, MAX_PATH, 0, 0); +- if (!len) return FALSE; ++ /* remember original cabinet name */ ++ strcpyW(my_hsc.most_recent_cabinet_name, CabinetFile); + + TRACE("path: %s, cabfile: %s\n", + debugstr_a(pszCabPath), debugstr_a(pszCabinet)); +diff --git a/dlls/setupapi/tests/setupcab.c b/dlls/setupapi/tests/setupcab.c +index 010c9d559d..f2528865aa 100644 +--- a/dlls/setupapi/tests/setupcab.c ++++ b/dlls/setupapi/tests/setupcab.c +@@ -336,7 +336,6 @@ static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, + ok(!strcmp(expected_files[index], info->NameInCabinet), + "[%d] Expected file \"%s\", got \"%s\"\n", + index, expected_files[index], info->NameInCabinet); +-todo_wine + ok(!strcmp(ctx->cabinet, cabinet_file), + "[%d] Expected cabinet \"%s\", got \"%s\"\n", + index, ctx->cabinet, cabinet_file); +@@ -354,7 +353,6 @@ todo_wine + { + FILEPATHS_A *info = (FILEPATHS_A *)Param1; + +-todo_wine + ok(!strcmp(ctx->cabinet, info->Source), + "[%d] Expected cabinet \"%s\", got \"%s\"\n", + index, ctx->cabinet, info->Source); +@@ -441,7 +439,6 @@ static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, + ok(!lstrcmpW(expected_filesW[index], info->NameInCabinet), + "[%d] Expected file %s, got %s\n", + index, wine_dbgstr_w(expected_filesW[index]), wine_dbgstr_w(info->NameInCabinet)); +-todo_wine + ok(!lstrcmpW(ctx->cabinet, cabinet_file), + "[%d] Expected cabinet %s, got %s\n", + index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(cabinet_file)); +@@ -459,7 +456,6 @@ todo_wine + { + FILEPATHS_W *info = (FILEPATHS_W *)Param1; + +-todo_wine + ok(!lstrcmpW(ctx->cabinet, info->Source), + "[%d] Expected cabinet %s, got %s\n", + index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(info->Source)); +-- +2.12.2 + diff --git a/patches/setupapi-SPFILENOTIFY_FILEINCABINET/definition b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/definition new file mode 100644 index 00000000..d5c5a685 --- /dev/null +++ b/patches/setupapi-SPFILENOTIFY_FILEINCABINET/definition @@ -0,0 +1 @@ +Fixes: [42827] Fix Param2 in SPFILENOTIFY_FILEINCABINET handler