My original understanding was wrong, hence so was my design.
I also didn’t realise there was a lock.
Whilst this in itself isn’t a problem, it’s not ideal from a speed
perspective.
I can see two improved designs:
The first is to pass the PID from the notification back into usermode. Here
I can get a handle to the process, loop the threads and stall them all, then
resume when the additional work is complete. (or call NtSuspendProcess,
although that’s undocumented…)
The second is to forget PsSetCreateProcessNotifyRoutine and instead use
PsSetCreateThreadNotifyRoutine.
When I get notification of the first thread being created in a process, I
can call ZwSuspendThread on that thread and release it when the additional
work is complete.
Any comments are greatly appreciated.
Thanks.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Don Burn
Sent: 19 May 2010 13:57
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] PsSetCreateProcessNotifyRoutine callback context
Yes you are stalling the completion of the CreateProcess by I cannot
understand your design. You block this function and schedule a DPC to
do something and when completed you continue with this function? Why
are you adding the overhead of the DPC? You do realize also you are
blocking any other CreateProcess or TerminateProcess on the system,
since there is lock on the list of routines to call?
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
-----Original Message-----
From: Ged [mailto:xxxxx@googlemail.com]
Posted At: Wednesday, May 19, 2010 8:51 AM
Posted To: ntdev
Conversation: PsSetCreateProcessNotifyRoutine callback context
Subject: RE: PsSetCreateProcessNotifyRoutine callback context
Wow, I have no idea how I missed that. Thanks.
It’s interesting, MSDN has a slightly different take on this (I assume
the OSR
docs are slightly outdated)
" When a process is created, the process-notify routine runs in the
context of
the thread that created the new process. When a process is deleted,
the
process-notify routine runs in the context of the last thread to exit
from the
process"
Is it enough/correct to stall the calling thread?
Obviously this isn’t stalling the process itself, but it’s stalling
the return
to CreateProcessInternalW which completes the call and creates the
first
thread.
Thanks.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@gmail.com
Sent: 19 May 2010 12:16
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] PsSetCreateProcessNotifyRoutine callback context
From: http://www.osronline.com/ddkx/kmarch/k108_5lwy.htm
“The driver’s process-creation notify routine runs at IRQL
PASSIVE_LEVEL,
either in the context of the initial thread within a newly created
process or
in the context of a system thread.”
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
__________ Information from ESET Smart Security, version of virus
signature
database 5128 (20100519) __________
The message was checked by ESET Smart Security.
http://www.eset.com
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