Hook Process Creation

Experts,
I need to hook process creation in win95/98/NT.... I know I could have a thread which checks if a process is added say every 100ms, but this may take up valuable resource time and it's not too efficient (as a process may be created within that 100ms of sleep).
I can hook window creation with the WH_SHELL hook, but I need something equivalent for process creation.
Thanx,
Afzal.
afzaljAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

WynCommented:
All way to create process is by using CreateProcess() directly or indirectly.So you can hook this function.
0
afzaljAuthor Commented:
How ?
0
WxWCommented:
You can't hook a specific function ( I wish we could ... )

But you still can use the shell hook and then GetWindowThreadProcessId() . If the thread returned is new , you can assume its a new process . However , this requires that the process will create a window ( not always that happens )

0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

alexoCommented:
First, look here:
  http://www.internals.com/utilities_main.htm

There are some programs on SysInternals that use API hooking.  You can get sample source from:
  http://www.sysinternals.com/regsrc.zip

More sample code is available from:
  http://support.microsoft.com/support/kb/articles/q122/2/74.asp

Some comments and pointers can be found here:
  http://www.deja.com/=dnc/getdoc.xp?AN=475707613
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MadshiCommented:
Two more links about API interception (both NOT system wide):

http://research.microsoft.com/sn/detours/

http://www.geocities.com/SiliconValley/1741/miscprog/mp_main.html

Regards, Madshi.
0
WynCommented:
>>You can't hook a specific function ( I wish we could ... )

No , we can.
0
alexoCommented:
afzalj?
0
alexoCommented:
Oh well...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.