[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosSetProtVec()               Install protected mode interrupt handler
------------------------------------------------------------------------------

 Function : Install a protected mode interrupt handler

 Syntax   : USHORT BLXAPI DosSetProtVec( USHORT intno,
            PIHANDLER newhandler, PIHANDLER _far * prevhandler);

 intno      Interrupt number.

 newhandler Pointer to new handler.

 prevhandlerPointer to a function pointer to receive the address of the
            previous interrupt handler.

 Return   : Address of the previous interrupt handler.

 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 <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() DosSetRealVec()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson