From 6add2999abf7fc245369e53f13fe0546809e49f9 Mon Sep 17 00:00:00 2001 From: Amrsatrio Date: Thu, 7 Nov 2024 21:23:57 +0700 Subject: [PATCH] Taskbar10: Don't crash if stobject.dll is not present --- ExplorerPatcher/dllmain.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/ExplorerPatcher/dllmain.c b/ExplorerPatcher/dllmain.c index 779a879..d63389e 100644 --- a/ExplorerPatcher/dllmain.c +++ b/ExplorerPatcher/dllmain.c @@ -9969,6 +9969,9 @@ typedef struct SSOEntry void PatchStobject(HANDLE hStobject) { + if (!hStobject) + return; + PBYTE beginRData = NULL; DWORD sizeRData = 0; @@ -10689,21 +10692,24 @@ DWORD Inject(BOOL bIsExplorer) HANDLE hStobject = LoadLibraryW(L"stobject.dll"); - VnPatchIAT(hStobject, "api-ms-win-core-registry-l1-1-0.dll", "RegGetValueW", stobject_RegGetValueW); - VnPatchIAT(hStobject, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", stobject_CoCreateInstanceHook); - if (IsWindows11()) + if (hStobject) { - VnPatchDelayIAT(hStobject, "user32.dll", "TrackPopupMenu", stobject_TrackPopupMenuHook); - VnPatchDelayIAT(hStobject, "user32.dll", "TrackPopupMenuEx", stobject_TrackPopupMenuExHook); - } - else - { - VnPatchIAT(hStobject, "user32.dll", "TrackPopupMenu", stobject_TrackPopupMenuHook); - VnPatchIAT(hStobject, "user32.dll", "TrackPopupMenuEx", stobject_TrackPopupMenuExHook); - } - if (global_rovi.dwBuildNumber >= 25236 && bOldTaskbar) - { - PatchStobject(hStobject); + VnPatchIAT(hStobject, "api-ms-win-core-registry-l1-1-0.dll", "RegGetValueW", stobject_RegGetValueW); + VnPatchIAT(hStobject, "api-ms-win-core-com-l1-1-0.dll", "CoCreateInstance", stobject_CoCreateInstanceHook); + if (IsWindows11()) + { + VnPatchDelayIAT(hStobject, "user32.dll", "TrackPopupMenu", stobject_TrackPopupMenuHook); + VnPatchDelayIAT(hStobject, "user32.dll", "TrackPopupMenuEx", stobject_TrackPopupMenuExHook); + } + else + { + VnPatchIAT(hStobject, "user32.dll", "TrackPopupMenu", stobject_TrackPopupMenuHook); + VnPatchIAT(hStobject, "user32.dll", "TrackPopupMenuEx", stobject_TrackPopupMenuExHook); + } + if (global_rovi.dwBuildNumber >= 25236 && bOldTaskbar) + { + PatchStobject(hStobject); + } } #ifdef USE_PRIVATE_INTERFACES if (bSkinIcons)