-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I have the issue, that our windows application is crashing on startup if a 3rd party security appliance (Fast Track Admin by Request) is installed at the computer. The DLL ShellHelper64.dll of the the security appliance is injected on application startup before loading the mimalloc.dll. It seems, that this DLL is doing allocations before the heap manager is redirected to mimalloc. Free the memory after redirection, mimalloc is crashing with an access violation, because it is not able to handle the address of the original heap manager.
I already checked correct position of mimalloc.dll with minject.exe:
minject --list MyApplication.exe
original imported modules (42):
0: mimalloc.dll
1: MyDll1.dll
2: MyDll2.dll
3: fmt.dll
4: opencv_core490.dll
5: opencv_imgcodecs490.dll
6: opencv_imgproc490.dll
...
Load order as it is shown in the crash dump:
MyApplication.exe
ntdll.dll
kernel32.dll
KERNELBASE.dll
ShellHelper64.dll
rpcrt4.dll
shlwapi.dll
ucrtbase.dll
version.dll
msvcrt.dll
user32.dll
win32u.dll
gdi32.dll
gdi32full.dll
msvcp_win.dll
advapi32.dll
sechost.dll
shell32.dll
WinTypes.dll
combase.dll
ole32.dll
ws2_32.dll
fmt.dll
opencv_core490.dll
MyDlll1.dll
mimalloc.dll
<30 other DLLs>
mimalloc-redirect.dll
When I patch the application with minject.exe, mimalloc_redirect.dll is added before mimalloc.dll and the number of imported modules is increased by 1. The load order changes slightly, but the crash remains.
Is there a way to redirect the heap manager for the whole program before another external DLL is injected? Other ideas how to fix the issue?
SystemInfos:
- MiMalloc 3.0.3
- VS2022 17.6.5
- Win11 25H2