全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3061
推到 Plurk!
推到 Facebook!

鎖住Ctrl+C,Ctrl+Break,Ctrl+Alt+Del

 
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-12-11 17:51:39 IP:61.218.xxx.xxx 未訂閱
鎖住Ctrl+C,Ctrl+Break,Ctrl+Alt+Del    想把break鎖掉,不讓使用者中斷你的程式嗎??當然就得攔int 9囉!!本程式教你如何改寫int 9,讓這些組合鍵失效..    
/***********************************************************************/
/*  The following routines are public domain which have been uploaded  */
/*  to the Borland Information Retrieval System. Technical Support     */
/*  distributes these routines free of charge as a courtesy to our     */
/*  users that do not have immediate access to a modem.                */
/*                                                                     */
/*  These routines are public domain, not developed by Borland         */
/*  International. If you need assistance, Borland is unable to        */
/*  provide any technical assistance for public domain routines.       */
/***********************************************************************/    #include 
#include 
#include     char far *modifiers = MK_FP(0,0x417); /* address of modifier flags     */
void interrupt (*oldint9) (void);     /* storage for old INT 9 handler */    void interrupt myint9(void)
{
    /*    ((*modifiers)&4)==4 indicates the CTRL key is being pressed */
    /*    inportb(0x60)==46 indicates the C key is being pressed      */
    /*    inportb(0x60)==70 indicates the SCROLL LOCK/BREAK key "     */
    /*                                                                */
    /*    The emit code is required to clean the keypress up from the */
    /*    BIOS.                                                       */        if( (((*modifiers)&4)==4) &&
        ((inportb(0x60)==46) || (inportb(0x60)==70)) )
        __emit__(0xe4,0x61,   /* asm        IN        AL,61 */
                 0x8a,0xe0,   /* asm        MOV         AH,AL */
                 0x0c,0x80,   /* asm        OR        AL,80 */
                 0xe6,0x61,   /* asm        OUT         61,AL */
                 0x86,0xe0,   /* asm        XCHG         AL,AH */
                 0xe6,0x61,   /* asm        OUT         61,AL */
                 0xb0,0x20,   /* asm        MOV         AL,20 */
                 0xe6,0x20);  /* asm        OUT         20,AL */
    else
/* If the key is not CTRL-C or CTRL-BREAK, call the old INT 9 handler */
        oldint9();
}    void exitfunc(void)
{
/* Restore the old INT 9 handler */
    setvect(9,oldint9);
}    main()
{
    int i;        oldint9=getvect(9);  /* store old interrupt vector */
    setvect(9,myint9);   /* set up new interrupt handler */
    atexit(exitfunc);    /* set up exit handler to restore INT 9 */        /* ... */            /* code that will not CTRL-BREAK or CTRL-C */        return 0;
}
聯盟----Visita網站http://www.vista.org.tw ---[ 發問前請先找找舊文章 ]---
系統時間:2024-03-29 5:03:55
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!