I want to disable CTRL+ALT+DEL in Windows XP in my ANSI-C code. Is it possible to do it?
No.
The Windows Alt+Ctrl+Delete functionality is designed to be impossible to interfere with so that users can trust it to bring up genuine dialogs that they can trust with their password.
Why do all the answers say it isn't possible? It is very much possible, for example here's how to enable it in case a virus has disabled it:
Click Start Click Run Enter gpedit.msc in the Open box and click OK In the Group Policy settings window Select User Configuration Select Administrative Templates Select System Select Ctrl+Alt+Delete options Select Enable Task Manager
How to make this disable it and how to do it from code I'll let you figure out (hint: you'll probably want to edit some registry keys) as this question is pretty fishy.
You can also install various keyboard hooks that alter the functionality of ctrl + alt + delete.
You can read about the registry API here.
If you want NOTHING to happen when you press ctrl alt delete, look into windows hooks and windows API hooking. Those are not easy to code; if you want API hooking then I suggest this library - you might be able to do this with classic windows hooks however.
You'll need to write your own msgina.dll to rigurously hook this function. If you don't absolutely have to cut off any response to this command (and you probably don't), then you can most likely get away with simpler methods.
First of all, Trapping Ctrl-Alt-Del (Secure Attention Sequence) and disabling it is two different things. Despite misconceptions of many it is possible to disable SAS.
Here are 3 ways to do it:
Set HKCU/Software/Microsoft/Windows/CurrentVersion/Policies/System/DisableTaskMgr = 1
Replace msgina.dll with your own or write a keyboard driver.
Go to the Start menu, select Run, and type "gpedit.msc" to run the Group Policy editor. Look in User Configuration | Administrative Templates | System and you'll find a section called Ctrl+Alt+Del Options - "Remove Task Manager"
In order to trap SAS, you could write a GINA stub, create a keyboard driver or replace TaskMgr.exe
These requirements arise mainly for embedded systems and you have control over how the WinXP image is made.
Reference: MSDN Mag Sept 2002
Putting hooks into the keyboard system is not going to do the trick, despite what some here are saying.
The keyboard system works by issuing a particular hardware interrupt. The OS traps this interrupt and responds to it appropriately. This would be the thing affected by keyboard hooks.
The sequence CTRL-ALT-DEL issues a separate hardware interrupt from the other keys. This was done originally so that the reboot command would be available even when the other keyboard commands were frozen. (Although a terminate-stay-resident application in MS-DOS could still trap and handle the interrupt.)
The reason the key sequence is used now for log-in is because of this behavior. Since it issues a separate hardware interrupt, the sequence is used to verify that some other application hasn't put its hooks in. This is to prevent spoofing the login prompt.
I am not saying that it is impossible to trap this interrupt and modify its behavior. I don't know that it's not. But it will not be as simple as putting hooks into the keyboard handling code.
Winlogon just calls SetWindowsHookEx on the default desktop to trap CAD. Since only a thread that called SetWindowsHookEx can unregister the hook, it is made sure that no other process can steal it. In additon the keybboard hook only works on the process desktop. You can try to switch to a new desktop and hit CAD. Some internal info you'll find here.
This is in response to what the OP wants to do, not the question itself...
The easiest way accomplish your goal would be to write a keyboard filter driver, which discards all input. (This is really the only correct way of disabling all input I can think of, and is the method used by products such as LogMeIn)