Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> dossetprotvec()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosSetProtVec()
------------------------------------------------------------------------------
 Purpose:
 Install a protected mode interrupt handler.

 Syntax:
 USHORT BLXAPI DosSetProtVec(USHORT intno,
                             PINTHAN newhandler,
                             PINTHAN __far *prevhandler);

 Parameters:
 intno        Interrupt number.
 newhandler   Pointer to new handler.
 prevhandler  Pointer to a function pointer to receive the address of the
              previous interrupt handler.

 Returns:
 Address of the previous interrupt handler.

 Description:
 DosSetProtVec() installs a protected mode interrupt handler for the
 specified protected mode interrupt. DosSetProtVec() also returns a pointer
 to the previous interrupt handler.

 Example:
 #include <stdio.h>                                                          
 #include <dos.h>                                                            
 #include <blx286.h>                                                         
                                                                             
 USHORT ticks;                                                               
 PINTHAN prevhandler;                                                        
                                                                             
 void interrupt far timer1c(REGS16 r)                                        
    {                                                                        
    ticks++;                                                                 
    _chain_intr(prevhandler);                                                
    }                                                                        
 void main(void)                                                             
 {                                                                           
 PINTHAN     newhandler;                                                     
 int         cnt0,cnt1;                                                      
                                                                             
 ticks = 0;                                                                  
 newhandler = timer1c;                                                       
 if (DosSetProtVec(0x1c, newhandler, &prevhandler) == 0)                     
    {                                                                        
    printf("User timer hooked successfully\n");                              
    printf("Waiting a few seconds\n");                                       
    for (cnt0 = 0; cnt0 < 500; cnt0++)                                       
       for (cnt1 = 0; cnt1 < 32000; cnt1++);                                 
    if (DosSetProtVec(0x1c, prevhandler, NULL) == 0)                         
       printf("Timer handler deinstalled\n");                                
    else                                                                     
       printf("Unable to deinstall timer handler\n");                        
    printf("Number of protected mode ticks : %04X\n", ticks);                
    }                                                                        
 else                                                                        
    printf("Unable to hook timer tick.\n");                                  
 }                                                                           

See Also: DosGetProtVec() DosGetRealProtVec() DosSetRealVec()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson