TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Michal Rybarik
from: Peter Fitzsimmons
date: 1996-10-27 17:01:40
subject: Ctrl-Alt-Del problem

MR> I have written a resident programm under DOS, which disables Ctrl-Alt-Del
 MR> sequence (also, if C-A-D is pressed, my procedure is 
 MR> called). This programm
 MR> redirects int 09h. It works well under DOS. But I need this to work under
 MR> OS/2 in DOS task. But it doesn't work... :-((( When I press Ctrl-Alt-Del,
 MR> it performs something like "cold boot" - after rebooting, when OS/2
 MR> starts, it runs CHKDSK...

 MR> Summary: I want to write a resident program, which will run under DOS
 MR> task in OS/2, and when I press Ctrl-Alt-Del, it will call my own
 MR> procedure. That's all...


The following OS/2 program will disable C-A-D (and CTRL-ESC, ALT-ESC). Once
it is disabled,  your legacy code _might_ work.  If it doesn't, the only
way I can think to make this work is to modify the keyboard device driver
(IBMKBD.SYS) to cooperate with your DOS program.  This would be fine for an
internal solution,  but not for shrink-wrap or shareware (since people
don't like replacing system device drivers).


 // From my "Undocumented OS/2" coloradOS/2'95 seminar
 // P.Fitzsimmons
 #define INCL_NOPMAPI
 #define INCL_DOS
 #define INCL_DOSDEVIOCTL
 #include 
 #include 
 #include 

 int main(void)
 {
     HOTKEY hk;
     HFILE hf;
     APIRET rc;
     ULONG dummy;
     ULONG parminout=0;
     ULONG datainout=0;

     rc = DosOpen("KBD$", &hf, &dummy, 0L, FILE_NORMAL, FILE_OPEN,
         OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYNONE |
         OPEN_FLAGS_FAIL_ON_ERROR, 0L);
     if(!rc){
         memset(&hk, 0, sizeof(HOTKEY));
         hk.idHotKey = -1;       // special id -- see PDD.INF
         parminout=sizeof(HOTKEY);
         rc=DosDevIOCtl(hf,
                        IOCTL_KEYBOARD,
                        KBD_SETSESMGRHOTKEY,
                        &hk,
                        sizeof(HOTKEY),
                        &parminout,
                        NULL,
                        0,
                        &datainout);
     }
     if(rc) printf("error %04x\n", rc);
     return rc;
 }



--- Maximus/2 3.00
* Origin: Sol 3 * Toronto * V.32 * (905)858-8488 (1:259/414)
SEEN-BY: 50/99 270/101 620/243 625/160 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 624 628 713/317 800/1
@PATH: 259/414 400 99 250/99 3615/50 396/1 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.