home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / IVSENSE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  2.2 KB  |  68 lines

  1. /**
  2. *
  3. * Name        ivsense -- Detect an installed intervention function
  4. *
  5. * Synopsis    pctrl = ivsense(pvectors,pident);
  6. *
  7. *        IV_CTRL far *pctrl
  8. *                  Far pointer to the intervention control
  9. *                  block of the found function, or FARNIL
  10. *                  if the function is not found.
  11. *        const IV_VECTORS far *pvectors
  12. *                  Address of structure containing
  13. *                  a set of interrupt vectors to examine.
  14. *        const char far *pident
  15. *                  Address of array of 16 bytes of
  16. *                  identifying information
  17. *
  18. * Description    This function examines the contents of memory pointed to
  19. *        by a set of interrupt vectors to see whether it contains
  20. *        a particular intervention control block.  If so, the
  21. *        function returns the address of the control block; if
  22. *        not, the function returns FARNIL.
  23. *
  24. *        The contents of the control block contain the
  25. *        information required to disable the intervention
  26. *        function and to remove the program containing it.
  27. *
  28. *        The global variable b_ivmask lists the vectors that will
  29. *        be examined for the presence of the intervention
  30. *        function.
  31. *
  32. * Limitation    This function assumes that the intervention filters were
  33. *        the most recently installed handlers for their
  34. *        respective interrupts.    This function does NOT trace
  35. *        chains of "cascaded" interrupt handlers.  If the ISR
  36. *        pointed to by any of the interrupt vectors does not
  37. *        belong to the intervention function but merely passes
  38. *        control to the intervention function, the intervention
  39. *        function will not be found.
  40. *
  41. *        You can partially overcome this limitation via IVDETECT,
  42. *        which can detect an intervention control block even if
  43. *        only one of its filters is exposed to direct examination
  44. *        (i.e., not covered by other ISRs).
  45. *
  46. * Returns    pctrl          Far pointer to the intervention control
  47. *                  block of the found function, or FARNIL
  48. *                  if the function is not found.
  49. *
  50. * Version    6.00 (C)Copyright Blaise Computing Inc. 1987,1989
  51. *
  52. **/
  53.  
  54. #include <binterv.h>
  55. #include <butil.h>
  56.  
  57. IV_CTRL far *ivsense(pvectors,pident)
  58. const IV_VECTORS far *pvectors;
  59. const char     far *pident;
  60. {
  61.     unsigned     mask;
  62.     IV_CTRL far *pctrl;
  63.  
  64.     return ((IV_NO_ERROR == ivdetect(pvectors,pident,&pctrl,&mask))
  65.         ? pctrl
  66.         : FARNIL);
  67. }
  68.