Skip to content

Commit

Permalink
Taskbar10: Don't crash if stobject.dll is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
Amrsatrio committed Nov 7, 2024
1 parent 5451e1e commit 6add299
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions ExplorerPatcher/dllmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -9969,6 +9969,9 @@ typedef struct SSOEntry

void PatchStobject(HANDLE hStobject)
{
if (!hStobject)
return;

PBYTE beginRData = NULL;
DWORD sizeRData = 0;

Expand Down Expand Up @@ -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())
{
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)
if (hStobject)
{
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)
Expand Down

0 comments on commit 6add299

Please sign in to comment.