Do you get an error pop-up when this happens? If yes you should be able to attach a debugger to the process and examine it at that point.
If the process dies before you can attach to it, you can try debugging the service itself with the “debug child processes” option. Configure debugger to intercept ntdll loads in each child process and set a breakpoint on ntdll!LdrpRecordFailureInfo:
(This is assuming win7, but I think you should be able to do something similar on previous releases as well)
C:\debuggers>cdb.exe -gG -pn MyService.exe
Ctrl+C
0:000> .childdbg 1
0:000> sxe -c “bp ntdll!LdrpRecordFailureInfo; g” ld ntdll.dll
0:000> g
Once the LdrpRecordFailureInfo breakpoint hits, step out of the function and examine ntdll!LdrpFailureData:
0:000> gu
0:000> dc ntdll!LdrpFailureData
This should tell you which DLL failed to load, and then you can set additional breakpoints etc. to further narrow it down.
Thanks,
Pavel
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Friday, November 05, 2010 2:03 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to debug 0xc000142 ?
Hi,
My service creates a process w/o errors. However, the new process is immediately terminated with error 0xc0000142. The strange thing is that this happens randomly - sometimes the process runs successfuly, sometimes - terminated.
I’d appreciate any hints about how to debug this thing.
Thanks,
Anatoly.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer