Detect Windows shutdown etc.

c++ / delphi package - dll injection and api hooking

Detect Windows shutdown etc.

Postby Decko » Sun Jul 18, 2004 6:13 pm

How can i see wheter Windows is shutting down, rebooting etc.???
Decko
 
Posts: 7
Joined: Sun Jul 18, 2004 6:06 pm
Location: Denmark

Postby madshi » Mon Jul 19, 2004 7:27 am

madshi
Site Admin
 
Posts: 9645
Joined: Sun Mar 21, 2004 5:25 pm

Postby Decko » Mon Jul 19, 2004 8:02 am

hmm...dunno quite what to do. How can i see the difference between shutdonwn and log off? I just need to save wheter the pc shutdown or reboots.
Decko
 
Posts: 7
Joined: Sun Jul 18, 2004 6:06 pm
Location: Denmark

Postby madshi » Mon Jul 19, 2004 8:34 am

Well, have you read the experts-exchange thread? Windows doesn't tell you whether you have a shutdown or reboot. The only way (that I know) to get this information is to hook the shutdown APIs - which is very ugly.
madshi
Site Admin
 
Posts: 9645
Joined: Sun Mar 21, 2004 5:25 pm

Postby Decko » Mon Jul 19, 2004 8:44 am

why is that ugly?
Decko
 
Posts: 7
Joined: Sun Jul 18, 2004 6:06 pm
Location: Denmark

Postby madshi » Mon Jul 19, 2004 8:51 am

Because hooking APIs system wide is quite a "big thing". It results in a hook dll being injected into all running processes. Sounds a bit like overkill for just wanting to know whether Windows gets shut down or restarted. Whatever, it's the only solution I know.
madshi
Site Admin
 
Posts: 9645
Joined: Sun Mar 21, 2004 5:25 pm

Postby Decko » Mon Jul 19, 2004 8:56 am

oooh......so it takes a lot of cpu-use?
Decko
 
Posts: 7
Joined: Sun Jul 18, 2004 6:06 pm
Location: Denmark

Postby madshi » Mon Jul 19, 2004 9:24 am

No. There's a slight danger of instability, if the hook dll does bad things. But if you code it cleanly things should be just fine. Performance should be no problem (= no measureable performance loss).
madshi
Site Admin
 
Posts: 9645
Joined: Sun Mar 21, 2004 5:25 pm

Postby Decko » Mon Jul 19, 2004 9:38 am

k....how do i do??? ill just give it a try...if it goes bad ill just find another solution
Decko
 
Posts: 7
Joined: Sun Jul 18, 2004 6:06 pm
Location: Denmark


Return to madCodeHook

Who is online

Users browsing this forum: No registered users and 2 guests

cron