I’m tracking loaded images via a PsLoadImage callback. I’m seeing a few odd behaviors that I’m hoping someone can help me understand. I’m doing my testing on a VM running Win 7 x64.
First, sometimes I’ll get multiple callbacks for the same image loading into the same PID from the same context. I have a global counter which increments for at callback so these identical loadings will occur one right after the other. The second issue is I’m seeing a few images being loaded but no trace of them when enumerating the process in Process Explorer. For example, I can run calc.exe and when most of the standard libraries have loaded it will show that slui.exe, sppuinotify.dll, and sppsvc.exe are loaded into the calc.exe process while running in the calc.exe context. Here is a snippet of my debug output that highlights the two issues (calc ProcessId = 2388).
Image Load: ‘\Windows\System32\sppuinotify.dll’, nameLen = 66, opCnt = 1232, PsGetCurrentProcessId = 2388, ProcessId = 2388
Image Load: ‘\Windows\System32\sppuinotify.dll’, nameLen = 66, opCnt = 1233, PsGetCurrentProcessId = 2388, ProcessId = 2388
Image Load: ‘\Windows\System32\slui.exe’, nameLen = 52, opCnt = 1234, PsGetCurrentProcessId = 2388, ProcessId = 2388
Image Load: ‘\Windows\System32\slui.exe’, nameLen = 52, opCnt = 1235, PsGetCurrentProcessId = 2388, ProcessId = 2388
Image Load: ‘\Windows\System32\sppsvc.exe’, nameLen = 56, opCnt = 1236, PsGetCurrentProcessId = 2388, ProcessId = 2388
Image Load: ‘\Windows\System32\sppsvc.exe’, nameLen = 56, opCnt = 1237, PsGetCurrentProcessId = 2388, ProcessId = 2388
Lastly, some libraries have slightly mangled names. By that I mean the last two characters will be repeated so "\Program Files\proc.exe’ will be ‘\Program Files\proc.exexe’
It’s frustrating because I’m just printing what is available in the callback but what I’m seeing does not match with what I understand about loading and what the callback is supposed to provide. Thanks.