home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name ivdisabl -- Disable an installed intervention function.
- *
- * Synopsis ercode = ivdisabl(pctrl);
- *
- * int ercode Error code. Possible values include:
- * 0 if successful,
- * IV_NULL_PTR if pctrl is FARNIL,
- * IV_NOT_ENABLED if not enabled,
- * IV_NOT_INSTALLED if the intervention
- * filters are not currently installed in
- * the proper interrupt vectors or if
- * pctrl is not the address of a valid
- * intervention control block.
- * IV_CTRL far *pctrl
- * Double word address of the intervention
- * control block to disable.
- *
- * Description This function disables an installed intervention
- * function by reinstalling the former values of the
- * interrupt vectors that point to the intervention
- * filters.
- *
- * It will fail if pctrl is not a valid pointer to an
- * installed intervention control block or if the interrupt
- * vectors do not currently point to the associated
- * intervention filters.
- *
- * b_ivmask (the bit mask of employed intervention filters)
- * lists the vectors that will be examined for the presence
- * of the intervention function and that will be restored
- * to their previous values. (However, if the intervention
- * function was installed using fewer filters, no unused
- * vectors will be restored.
- *
- * Returns ercode Error code. Possible values include:
- * 0 if successful,
- * IV_NULL_PTR if pctrl is FARNIL,
- * IV_NOT_ENABLED if not enabled,
- * IV_NOT_INSTALLED if the intervention
- * filters are not currently installed in
- * the proper interrupt vectors or if
- * pctrl is not the address of a valid
- * intervention control block.
- *
- * Version 6.00 (C)Copyright Blaise Computing Inc. 1987,1989
- *
- **/
-
- #include <dos.h>
- #include <string.h>
-
- #include <binterv.h>
- #include <butil.h>
-
- #define OK 0 /* Error codes. */
- #define IV_NOT_ENABLED 1
- #define IV_NOT_INSTALLED 2
- #define IV_NULL_POINTER 3
-
- int ivdisabl(pctrl)
- IV_CTRL far *pctrl;
- {
- IV_VECTORS vecs;
- unsigned save_mask;
-
- if (FARNIL == pctrl)
- return IV_NULL_POINTER;
-
- if (!pctrl->enabled)
- return IV_NOT_ENABLED;
-
- ivvecs(IV_RETVEC,&vecs); /* Check current vectors to be */
- /* sure that the intervention */
- /* function is installed. */
- if (pctrl != ivsense(&vecs,pctrl->ident))
- return IV_NOT_INSTALLED;
-
- pctrl->enabled = 0;
-
- save_mask = b_ivmask; /* Save b_ivmask. */
- b_ivmask &= pctrl->filter_mask; /* Restore no more vectors */
- /* than were installed. */
- ivvecs(IV_SETVEC,&pctrl->prev_vec); /* Restore the vectors. */
- b_ivmask = save_mask; /* Restore b_ivmask. */
-
- return IV_NO_ERROR;
- }