[AD] patch to prevent CTRL-ALT-DEL from killing allegro under windows

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


See <http://www.allegro.cc/forums/thread/547778> for the discussion.

Under Windows XP (probably 2000 as well) pressing CTRL-ALT-DEL will
(usually) terminate an Allegro application. Attached is a patch to
prevent that from happening.

As explained in the thread, when pressing CTRL-ALT-DEL, Allegro
receives 255 scancodes ranging from 0 to 255. In other words, to
Allegro it looks like:

CTRL-ALT-DEL
CTRL-ALT-0x00
(I think 0x01 is skipped)
CTRL-ALT-0x02
CTRL-ALT-0x03
...
CTRL-ALT-0xff

Obviously this means the CTRL-ALT-END sequence gets triggered which
causes Allegro to exit, assuming three_finger_flag is TRUE. I don't
know the purpose of all these codes being sent and I don't know why it
happens or if Allegro can tell Windows not to do it. Instead, the
patch simply instructs Allegro to ignore them.

So with this patch, Allegro will behave like this:

If three_finger_flag is TRUE, then CTRL-ALT-END abort()s the app
If three_finger_flag is FALSE, then CTRL-ALT-END does nothing

Regardless of the three_finger_flag setting, CTRL-ALT-DEL will always
bring up the Task Manager, as it should.

I tested on Windows XP and 98 and noticed no problems with the patch
applied. A few other people tested successfully as well.

--
Matthew Leverton

Attachment: wkeybd.c.diff
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/