Thread: Generate Ctrl-Alt-Del programmatically

  1. #16
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    Just a note: I am very positive that I have connected to a server (with WinVNC, if I recall correctly) that I could send a CTRL-ALT-DEL to, to lock the workstation, and it worked. This would seem to indicate that it is possible to emulate it, as the workstation which is also running Win VNC must give the command to lock the station (unless, of course, there is another way to do this, and it is using that method, instead). Any ideas?

  2. #17
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Maybe they used the LockWorkStation function?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #18
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    I figured a command existed to do that. This eliminates Win VNC from being proof that sending a real CTRL-ALT-DEL is possible.

  4. #19
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    Not really. LockWorkstation() does the same as pressing CTRL+ALT+DEL *AND* selecting "Lock Workstation". It doesn't just simulate the CTRL+ALT+DEL shortcut.

  5. #20
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    No, but Jason's suspicion was based on the fact that VNC on a remote machine was able to lock the remote workstation, i.e. may have generated the Ctrl-Alt-Del sequence programatically on the remote host.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  6. #21
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    There is a command in WinVNC to send CTRL-ALT-DEL. This is used to log on, etc.., so it must be sending the command.
    I looked briefly in the source, and they seem to be using a Java class for this.

  7. #22
    jasondoucette.com JasonD's Avatar
    Join Date
    Mar 2003
    Posts
    278
    This was my suspicion, as adrianxw noted, but if there are other commands that can be performed on the local version of WinVNC to perform these same actions, then sending a CTRL-ALT-DEL is not necessary from the remote WinVNC, nor the local one. Assuming these other commands exist, such as LockWorkStation(), then the remote WinVNC can simply send a message that indicates what command should be performed, and the local WinVNC interpretes the message, and calls one of these other commands that emulates what would have happened if a local user pressed CTRL-ALT-DEL.

  8. #23
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    So is there no way to manually send the interrupt information that CTRL-ALT-DELETE does? I mean, maybe using assembler or something?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  9. #24
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    Why exactly do you need to send ctrl-alt-del? In the VncViewer source they use the function below to simulate this. You can download the source from the posted link:

    Code:
    BOOL
    vncService::SimulateCtrlAltDel()
    {
    	vnclog.Print(LL_ALL, VNCLOG("preparing to generate ctrl-alt-del\n"));
    
    	// Are we running on NT?
    	if (IsWinNT())
    	{
    		vnclog.Print(LL_ALL, VNCLOG("spawn ctrl-alt-del thread...\n"));
    
    		// *** This is an unpleasant hack.  Oh dear.
    
    		// I simulate CtrAltDel by posting a WM_HOTKEY message to all
    		// the windows on the Winlogon desktop.
    		// This requires that the current thread is part of the Winlogon desktop.
    		// But the current thread has hooks set & a window open, so it can't
    		// switch desktops, so I instead spawn a new thread & let that do the work...
    
    		omni_thread *thread = omni_thread::create(SimulateCtrlAltDelThreadFn);
    		if (thread == NULL)
    			return FALSE;
    		thread->join(NULL);
    
    		return TRUE;
    	}
    
    	return TRUE;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Ctrl Alt Del
    By cboard_member in forum A Brief History of Cprogramming.com
    Replies: 27
    Last Post: 07-20-2005, 07:36 AM
  2. how to capture CTRL, SHIFT and ALT ?
    By goldenrock in forum C Programming
    Replies: 3
    Last Post: 11-06-2003, 01:20 AM
  3. Trapping Ctrl Alt Delete
    By emus21 in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-17-2003, 12:10 PM
  4. how to trap Ctrl + Alt + Del
    By samudrala_99 in forum Windows Programming
    Replies: 5
    Last Post: 12-16-2002, 01:01 AM
  5. Ctrl + Alt +Delete
    By golfinguy4 in forum Windows Programming
    Replies: 4
    Last Post: 10-27-2002, 07:46 PM