re-strating the computer

Need to know how to make my program re-strat the computer. its a setup program that needs the computer st re-start after my files have been extracted.

I tried making it RUN the restart.exe file in C:windowssystem32 but all it done was make a DOS windw flash on for a second.

its a tough one but if anyone can tell me how to do it, it would help alot. cheers.

Comments

  • : Need to know how to make my program re-strat the computer. its a setup program that needs the computer st re-start after my files have been extracted.
    :
    : I tried making it RUN the restart.exe file in C:windowssystem32 but all it done was make a DOS windw flash on for a second.
    :
    : its a tough one but if anyone can tell me how to do it, it would help alot. cheers.
    :
    :

    I didn't test it (just in case it works), but try this:

    SHELL "rundll32 user32,ExitWindowsEx ,2"

    or this:

    SHELL "rundll32 user32,ExitWindowsEx 0,2"

    If it works, you can also change 2 to 0 for logoff, 1 for shutdown and add 4 to force the operation.

    0 Logoff
    1 Shutdown
    2 Restart
    4 Force Logoff
    5 Force Shutdown
    6 Force Restart

    "Force" should be used with care. If a program doesn't respond to the command to shutdown or deliberately refuses, Windows will nuke it's thread and the user won't get a chance to save anything.
  • : I didn't test it (just in case it works), but try this:
    :
    : SHELL "rundll32 user32,ExitWindowsEx ,2"
    :
    : or this:
    :
    : SHELL "rundll32 user32,ExitWindowsEx 0,2"
    :
    : If it works, you can also change 2 to 0 for logoff, 1 for shutdown and add 4 to force the operation.
    :
    : 0 Logoff
    : 1 Shutdown
    : 2 Restart
    : 4 Force Logoff
    : 5 Force Shutdown
    : 6 Force Restart
    :
    : "Force" should be used with care. If a program doesn't respond to the command to shutdown or deliberately refuses, Windows will nuke it's thread and the user won't get a chance to save anything.
    :

    I got the parameters backwards (should have been 2,0). The odd thing is that no matter how I played with the params, the best I could get was a logoff (or a quick logoff???) and "rundll32 performed an illegal ...".

    I retested using actual windows code (Visual Basic) and it worked perfectly though I called the function properly instead of shelling rundll.

    The best I can do is to offer to send you a windows program to call the function. The problem is that thought the program is small for VB (about 7.5K), the runtime is outrageously huge (about 1.1MB). I do know someone who is playing with C++ (they might not know how to do this yet, they are only learning) that I can probably get to compile a program to call the function that would be a lot smaller...

    Sorry I couldn't help more,
    KDL

    P.S. restart.exe is probably only designed to work in DOS. Windows is probably trapping the attempt and blocking it.
  • : Need to know how to make my program re-strat the computer. its a
    : setup program that needs the computer st re-start after my files
    : have been extracted.


    'use this:

    OUT &H64, &HFE 'the actual Re-Boot Command


    'or this:

    'Warm Boot
    DEF SEG = 0
    POKE &H473, &H12
    POKE &H472, &H34
    DEF SEG = &HFFFF
    CALL Absolute(0)

    'Cold Boot
    DEF SEG = 0
    POKE &H472, &H12
    POKE &H473, &H34
    DEF SEG = &HFFFF
    CALL Absolute(0)
  • Sorry, but, this code won't work under Windows 9x or newer. Windows traps all calls to address 0xFFFF0 and only closes the DOS Session in which the program is running, but no reboot occurs. I think that a DOS program can't reboot the system, and is always a good programming to ask the user if he (or she) wants to reboot, because the user is the owner of the program, and he (or she) decides if it should reboot or not, but I think you already know this... Then, make a Windows program which calls ExitWindowsEx, with the right parameters in order to reboot the system. All your program must do is spawn this program, but it wont work if the user is in DOS mode...

    The solution is to make the Win program and then, your setup should call it, and use the call to 0xFFFF0, because, if the user is in Windows, the Win program wil reboot, else, the call to 0xFFFF0 will do this.

    Davi Medrade
    Master Programmer of Agnetron Software Ltda.
    davimedrade@hotmail.com
    So Paulo, Brazil

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories