Hi all;
I want to inactivate process monitoring for a while and because this task
is done through “secur32.dll” module, I want to unload it from memory for a
few seconds.
I’ve searched to see which processes use this dll OR which process loads it
on the memory. I found that “svchost.exe” process uses it, so I run
below command in the windows7 (32 bit) command prompt:
*tasklist /m /fi “imagename eq svchost.exe” *
and I saw a list as a result that put part of it here:
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Image Name PID Modules
========================= ========
svchost.exe 696 ntdll.dll, kernel32.dll, KERNELBASE.dll,
msvcrt.dll, sechost.dll, RPCRT4.dll,
svchost.exe 800 ntdll.dll, kernel32.dll, KERNELBASE.dll,
rpcepmap.dll, RpcRtRemote.dll,
secur32.dll,
svchost.exe 936 ntdll.dll, kernel32.dll, KERNELBASE.dll,
msvcrt.dll, sechost.dll, RPCRT4.dll,
secur32.dll, SSPICLI.DLL, credssp.dll,
…
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Multiple svchost.exe processes with the PIDs [800, 936, 1008, 1048, 1260,
1344, 1716, 1772, 2352, 2508, 3104] used secur32.dll.
I also run the above command in Windows XP (32 bit) and saw a similar
result:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Image Name PID Modules
========================= ======
svchost.exe 852 ntdll.dll, kernel32.dll, ADVAPI32.dll,
RPCRT4.dll, ShimEng.dll, AcGenral.DLL,
USER32.dll, GDI32.dll, WINMM.dll,
ole32.dll,
msvcrt.dll, OLEAUT32.dll, MSACM32.dll,
svchost.exe 948 ntdll.dll, kernel32.dll, ADVAPI32.dll,
RPCRT4.dll, ShimEng.dll, AcGenral.DLL,
WS2HELP.dll, Secur32.dll, xpsp2res.dll,
…
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
In the above list, processes with PIDs [852, 948, 1064, 1328] use
secur32.dll module.
Now, my question is:
How should I unload this dll for a while and afterward load it into memory
rapidly to prevent a SYSTEM CRASH?
I mean, how to get handle of a memory-resident dll (secur32.dll in here!)
to unload it from memory?
I guess that first should get svchost.exe process handle (I don’t know with
which PID, of course!) and then use this handle to get secure32.dll handle.
Then pass the dll handle to the unloadlibrary function, sleep some
miliseconds and then load the dll again to svchost.exe process address
space to prevent system crash.
But I don’t know which Windows functions should use respectively to
implement this steps?
Or have you another & better solution for this purpose?
Could you put here a sample code to do this work in C++ please?
Thanks in Advance.