Programatically bypass CTRL + Alt + Del on restart?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfibrik
    New Member
    • Sep 2007
    • 5

    Programatically bypass CTRL + Alt + Del on restart?

    hi,

    when i ask my program to restart the PC by Code ((Shell "Shutdown -r -f -t 0"))

    it's open again up to the login windows

    I need the code which allow me to send the ctrl+alt+Del to open the windows to complete my instantiation and running the program

    can anyone help me.

    thanks
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    I think the whole reason MS used the Ctrl-Alt-Del sequence at startup was to prevent programs from doing that without user intervention. Or to put it another way, I don't think you can.

    I could be wrong, of course.

    Comment

    • pureenhanoi
      New Member
      • Mar 2007
      • 175

      #3
      Originally posted by mfibrik
      hi,

      when i ask my program to restart the PC by Code ((Shell "Shutdown -r -f -t 0"))

      it's open again up to the login windows

      I need the code which allow me to send the ctrl+alt+Del to open the windows to complete my instantiation and running the program

      can anyone help me.

      thanks
      You can restart windows by code without sending "Ctrl+Alt+D el" combination key.

      Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Boolean
      Public Const EWX_SHUTDOWN = 1
      Public Const EWX_REBOOT = 2
      Public Const EWX_LOGOFF = 0

      To restart window:
      Dim ret As Boolean
      ret = ExitWindowsEx(E WX_REBOOT,0)

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by pureenhanoi
        You can restart windows by code ...
        Are you saying this will make Windows restart and log on again automatically, without user input?

        Comment

        • mfibrik
          New Member
          • Sep 2007
          • 5

          #5
          Originally posted by Killer42
          Are you saying this will make Windows restart and log on again automatically, without user input?

          Thanks for all of u

          I mean really that reopen the windows automatic after I send the parameters with the User and Password,

          As if you open the computer from Symantec pcAnywhere or Logmein.
          I rather if you can visit www.Logmein.com to know what I am looking for

          ex. I need code to let me open the windows from the user and password as when u press Ctrl+ alt+ del when you login (with domain ) not a sample user

          best wishes

          Comment

          • Martin2007
            New Member
            • Jul 2007
            • 21

            #6
            Originally posted by mfibrik
            I mean really that reopen the windows automatic ...
            Surely any program you have running will be killed when you restart the pc...? So your code won't be running even if you could send ctrl-alt-del?

            Comment

            • pureenhanoi
              New Member
              • Mar 2007
              • 175

              #7
              Originally posted by Killer42
              Are you saying this will make Windows restart and log on again automatically, without user input?
              There is no way to logon automatically after restarting Windows. After restarting, Windows need user input Username and password to complete logon. If your computer has only one active user (except Administrator and Guest - thats often disabled), and this user has not password protected, the windows will automatically logon to this account. But if the windows has more User, it cant be logged on untill has user input.
              If you want keep program still running, there is one complexibility technique that store all ram memory into hard disk. The next time windows logged on, you must manually copy data from harddisk into ram memory, so the program continue running. ( This is complexibility technique, so there is no more people can do that.)
              If you just want open again your program after restarting windows (do not keep its running status), so the Setup program must store a Key in to Registry (at: HKLM\Software\M icrosoft\Window s\CurrentVersio n\Run). This key has type of String, and its value must be the full path to Executeable file (you maybe want it point to your program). If you want your program continue running at startup, so do nothing, otherwise, remove this key at the first running of application.
              Note: with this method, your program just be opened after the windows logged on and it runs in the starting point ( cannot keep running status ).
              Dont try logon to windows without user input. Microsoft will not give you permission.

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by pureenhanoi
                There is no way to logon automatically after restarting Windows. ...
                That was my point. The OP was asking how to bypass the manual logon process. I didn't think you could.

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  Originally posted by pureenhanoi
                  ... Dont try logon to windows without user input. Microsoft will not give you permission.
                  Yeah. Even when Windows Update installs an update and reboots, you have to go through the usual logon process. If MS won't even let themselves do it...

                  Comment

                  • pureenhanoi
                    New Member
                    • Mar 2007
                    • 175

                    #10
                    Originally posted by Killer42
                    Yeah. Even when Windows Update installs an update and reboots, you have to go through the usual logon process. If MS won't even let themselves do it...
                    Of course they can do. But they don't do that. Windows Update often takes a long time to download and install into machine. Imagine that, you let Windows automatically download and install the update, meanwhile, you go out for a cup of coffee. When you come back, the update process has completed and Windows automatically logged on. There may be many users who can use your computer and do things that are harmful to your computer.
                    Of course, hackers can use some techniques to logon to the computer without knowing your password. But that's Microsoft's security. Windows is their product and they know how to log on without user input.
                    You were wrong if you said that: "MS won't event let themselves do it"
                    Last edited by Killer42; Oct 25 '07, 07:18 AM.

                    Comment

                    • chrisfry
                      New Member
                      • Oct 2007
                      • 6

                      #11
                      Originally posted by mfibrik
                      when i ask my program to restart the PC by Code ((Shell "Shutdown -r -f -t 0"))

                      it's open again up to the login windows

                      I need the code which allow me to send the ctrl+alt+Del to open the windows to complete my instantiation and running the program
                      Hi mfibrik,

                      This isn't an exact answer to what you've asked. As others have mentioned, being able to bypass Ctrl+Alt+Del without action from a person would be a security flaw. Am I right however, in assuming that what you're really trying to do is get a program to start up automatically when you restart a computer?

                      That can be done in a number of ways.

                      1. Create a windows service to start the app. You could use a method like the one described here, which lets you create custom services for applications: http://www.tacktech.com/display.cfm?ttid=197

                      2. Configure an account to log in automatically, then write a script (Windows logon or startup) to start the program then lock your computer so it isn't sitting there logged in.

                      For autologon there are two methods here:


                      The first one worked fine for me when I tested it. I made an account called AutoLogon to test it with first:
                      Originally posted by http://windowsxp.mvps. org/Autologon.htm
                      Click Start, Run and type CONTROL USERPASSWORDS2, and click Ok. Select the user account from the list (the account to which you want to automatically logon). Uncheck Users must enter a user name and password to use this computer option, and click Ok. Type the user account password and complete the process.
                      You can always log off the account and log into another, once you've set this up. Also, you can hold Shift while Windows is loading to cancel the autologon.

                      Here's an example script that starts Notepad (replace with the path to your application), then locks your computer. Copy this into a text file, save it as something like loadAppAndLock. vbs, then put a shortcut to it in the Startup folder for the account that will log on automatically. Alternatively, you could just put a shortcut to your application in the Startup folder too and ommit lines 10, 11, 15 and 16.

                      Code:
                      ' loadAppAndLock.vbs
                      
                      ' Opens APPLICATION_NAME then locks the workstation.
                      ' Author: Chris Fry, Canberra, Australia
                      ' 25th October, 2007
                      ' -----------------------------------------------------'
                      On Error Resume Next
                      
                      'Change this to your application path
                      CONST APPLICATION_NAME = "C:\WINDOWS\system32\Notepad.exe"
                      
                      Set objShell = CreateObject("Wscript.Shell")
                      
                      'Start application
                      objShell.Run APPLICATION_NAME
                      
                      'Lock computer
                      objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"
                      
                      'End of loadAppAndLock.vbs
                      One concern with this method is that there is a period of time between when the logon happens and the lock where your computer will be logged on and presumably unattended. Do some tests and decide if it's appropriate for your situation. For me it's about 5 seconds.

                      Add a post if you'd like any further clarification.

                      Hope that helps,

                      Chris Fry
                      Canberra, Australia
                      Last edited by Killer42; Oct 25 '07, 07:22 AM.

                      Comment

                      • Killer42
                        Recognized Expert Expert
                        • Oct 2006
                        • 8429

                        #12
                        Thanks for the info, Chris. I'm sure many of us (myself included) will find it useful.

                        Comment

                        • chrisfry
                          New Member
                          • Oct 2007
                          • 6

                          #13
                          A couple of minor corrections - I tried the "shift" thing to stop auto logon, but it didn't work for me :-)
                          It probably either only works with the second auto logon method on the site I referenced using the Tweak UI PowerToy (I haven't tried that) or requires a PS2 keyboard.

                          Also, the omissions to get rid of the application start up should have been lines 9, 10, 14 and 15.

                          Chris

                          Comment

                          Working...