Thread: hardware interrupt to shut down

  1. #1
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110

    hardware interrupt to shut down

    As im making a console app to protect my comp ,against nosey-parkers who want to fiddle with my comp while im gone, i was thinking that there has to be some hardware interrupt that can be called from in the app wich will shut down the laptop.

    I believe this can be possible because if i go to start and shut down windows the comp shuts down everything.... you know you dont have to press the "on/Of" button to completely shut down the laptop.
    Therefor i really think there has to be some hardware interrupt that can do the same thing when a person types in the wrong password (after 3 times of course).

    I was wondering if such an interrupt is specific to the comp or to the OS, i think the OS ( win 98 Se).

    If anyone got a link to some usefull info bout that i would appreciate it if they shared it with me .

    Thx in advance

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Even if you wrote a kernel driver to call this interupt it wouldnt be a nice thing to do as windows doesnt like being switched off without notice. You can lose data and corrupt system files that could basically ruin your system.

    A better strategy is to use a windows app and call ExitWindowsEx. That will close down the pc gracefully

  3. #3
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    I don't think it's a specific interrupt. I think that it is an ATX type of command you would send down the External Data Bus to a specific Address... but then again I could be wrong. But yea, APM API is probably your best bet like what Salem and Fordy suggested.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  4. #4
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    Thx all of you ill check out Salems link soon, cause ive got exams right now.
    Even if you wrote a kernel driver to call this interupt it wouldnt be a nice thing to do as windows doesnt like being switched off without notice. You can lose data and corrupt system files that could basically ruin your system.
    I was thinking the same thing when i asked this auestion therefor such a function as you said would be a present from heaven.

    Anyway thx a lot then ill just write an app that checks something and if not let the pc go down peacefully.

  5. #5
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    dont forget to put it in startup hehe

  6. #6
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    Lol Rod...

    Forget everything i said in this original post, figured it.
    I mean i take the direct code from a tut and it wont even compile something bout parameters in winmain... anyhow it works thanks again :P.
    Last edited by GanglyLamb; 06-10-2003 at 05:14 AM.

  7. #7
    I'm starting ASM for making a simple OS, and I'd like to have the power-off function in it. How could I do it? Anybody know?

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by frenchfry164
    I'm starting ASM for making a simple OS, and I'd like to have the power-off function in it. How could I do it? Anybody know?
    Your first problem would be to get it on

    Look at bootloaders first.......

    Then if you get to a position where you want to turn the pc off, lookup Ralf Brown's files and see if the interupt (or which of them apply to your target system) does what you want

  9. #9
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    I made the shutdown app and is it normal that it takes less long to shut down with this app then without??

    Normally my comp would get stuck from time to time on the usual way but now he shuts down very fast and wiithout hanging...+ i dont get that blue screen anymore from the harddisk scan at rebooting.... this app works better then the thingie in windoze itself.

  10. #10
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    I believe that windows uses the regular method of calling every Parent hWnd's after enumeration and then tells them they are shutting down, and give them time to shutdown, however the API also does this. It could also have to do with the method you are shutting down the PC by, sounds like your using a force-powerdown constant.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  11. #11
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    Yeah kind of forced .... it sends the query to evry running process to shut down... if they dont it just shuts down anayway...

  12. #12
    Registered User Xei's Avatar
    Join Date
    May 2002
    Posts
    719
    Yea, thats why it shuts down so much quicker then I prefer that method much more myself.
    "What are you after - the vague post of the week award?" - Salem
    IPv6 Ready.
    Travel the world, meet interesting people...kill them.
    Trying to fix or change something, only guaruntees and perpetuates its existence.
    I don't know about angels, but it is fear that gives men wings.
    The problem with wanting something is the fear of losing it, or never having it. The thought makes you weak.

    E-Mail Xei

  13. #13
    Your first problem would be to get it on

    Look at bootloaders first.......

    Then if you get to a position where you want to turn the pc off, lookup Ralf Brown's files and see if the interupt (or which of them apply to your target system) does what you want
    dude, I already got a command line working, and I can boot it up off of floppy. I made my own bootloader.

  14. #14
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by frenchfry164
    dude, I already got a command line working, and I can boot it up off of floppy. I made my own bootloader.
    Then go see Ralph Brown's files and see what interupts are available...it'll depend on what power management your system has

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pointer within a Struct
    By Bladactania in forum C Programming
    Replies: 11
    Last Post: 04-03-2009, 10:20 PM
  2. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 04:59 PM
  3. interrupt handler functions in Visual C++ 6.0
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 01-07-2002, 07:06 PM
  4. Sound card interrupt problems
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-05-2001, 04:38 AM