Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56209
-- v4: advpack: Ignore lines that begin with '@' in (Un)RegisterOCXs sections.
From: Alex Henrie alexhenrie24@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56209 --- dlls/advpack/install.c | 8 +++++++ dlls/advpack/tests/Makefile.in | 2 +- dlls/advpack/tests/install.c | 44 ++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 3 deletions(-)
diff --git a/dlls/advpack/install.c b/dlls/advpack/install.c index b32a6f4c972..81ceebbe7aa 100644 --- a/dlls/advpack/install.c +++ b/dlls/advpack/install.c @@ -128,6 +128,14 @@ static HRESULT register_ocxs_callback(HINF hinf, PCWSTR field, const void *arg) if (!SetupGetStringFieldW(&context, 1, buffer, ARRAY_SIZE(buffer), NULL)) continue;
+ /* RegisterOCXs and UnRegisterOCXs sections can include lines that start with an at sign and + * do not have any discernable or documented effect */ + if (buffer[0] == '@') + { + FIXME("Ignoring inf line %s\n", debugstr_w(buffer)); + continue; + } + hm = LoadLibraryExW(buffer, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (hm) { diff --git a/dlls/advpack/tests/Makefile.in b/dlls/advpack/tests/Makefile.in index 084d67955ce..4b80f988e77 100644 --- a/dlls/advpack/tests/Makefile.in +++ b/dlls/advpack/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = advpack.dll -IMPORTS = cabinet advapi32 advpack +IMPORTS = cabinet advapi32 advpack user32
SOURCES = \ advpack.c \ diff --git a/dlls/advpack/tests/install.c b/dlls/advpack/tests/install.c index bdf02c5a397..063bbd5e1e9 100644 --- a/dlls/advpack/tests/install.c +++ b/dlls/advpack/tests/install.c @@ -26,7 +26,7 @@ static HMODULE hAdvPack; /* function pointers */ static HRESULT (WINAPI *pRunSetupCommand)(HWND, LPCSTR, LPCSTR, LPCSTR, LPCSTR, HANDLE*, DWORD, LPVOID); -static HRESULT (WINAPI *pLaunchINFSection)(HWND, HINSTANCE, LPSTR, INT); +static INT (WINAPI *pLaunchINFSection)(HWND, HINSTANCE, LPSTR, INT); static HRESULT (WINAPI *pLaunchINFSectionEx)(HWND, HINSTANCE, LPSTR, INT);
static char CURR_DIR[MAX_PATH]; @@ -66,7 +66,15 @@ static void create_inf_file(LPCSTR filename) "Signature="$Chicago$"\n" "AdvancedINF=2.5\n" "[DefaultInstall]\n" - "CheckAdminRights=1\n"; + "CheckAdminRights=1\n" + "[OcxInstallBad]\n" + "RegisterOCXs=BadOCXsToRegister\n" + "[BadOCXsToRegister]\n" + "foobar\n" + "[OcxInstallAtBad]\n" + "RegisterOCXs=AtBadOCXsToRegister\n" + "[AtBadOCXsToRegister]\n" + "@foobar\n";
WriteFile(hf, data, sizeof(data) - 1, &dwNumberOfBytesWritten, NULL); CloseHandle(hf); @@ -262,6 +270,37 @@ static void test_LaunchINFSectionEx(void) DeleteFileA("test.inf"); }
+static LRESULT CALLBACK hide_window_hook(int code, WPARAM wparam, LPARAM lparam) +{ + if (code == HCBT_CREATEWND) + { + /* Suppress the "Error registering the OCX" dialog */ + return 1; + } + + return CallNextHookEx(NULL, code, wparam, lparam); +} + +static void test_RegisterOCXs(void) +{ + static char bad_section[] = "test.inf,OcxInstallBad,4,0"; + static char at_bad_section[] = "test.inf,OcxInstallAtBad,4,0"; + HHOOK hook; + INT res; + + create_inf_file("test.inf"); + + hook = SetWindowsHookExW(WH_CBT, hide_window_hook, NULL, GetCurrentThreadId()); + res = pLaunchINFSection(NULL, NULL, bad_section, 0); + ok(res == 1, "Expected 1, got %d\n", res); + UnhookWindowsHookEx(hook); + + res = pLaunchINFSection(NULL, NULL, at_bad_section, 0); + ok(res == 0, "Expected 0, got %d\n", res); + + DeleteFileA("test.inf"); +} + START_TEST(install) { DWORD len; @@ -289,6 +328,7 @@ START_TEST(install) test_RunSetupCommand(); test_LaunchINFSection(); test_LaunchINFSectionEx(); + test_RegisterOCXs();
FreeLibrary(hAdvPack); SetCurrentDirectoryA(prev_path);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150634
Your paranoid android.
=== w1064v1507 (32 bit report) ===
advpack: install.c:295: Test failed: Expected 1, got 0
=== w1064v1507 (64 bit report) ===
advpack: install.c:295: Test failed: Expected 1, got 0
On Sun Dec 29 22:02:44 2024 +0000, Alex Henrie wrote:
changed this line in [version 4 of the diff](/wine/wine/-/merge_requests/4878/diffs?diff_id=150540&start_sha=da9258ae3f663c7b579bba35992f70ecd6db0c3a#cf31ea0209da6be75959da190166d24fa49c5d94_74_70)
Based on feedback from Zeb and Fabian, I've improved the test to show that installation of the non-existent OCX fails unless its file name is prepended with the `@` sign. I hope that is convincing enough. At the very least, this patch does not make Wine any worse than it was before the regression.