home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / aspisrc.zip / STRATEGY.C < prev    next >
C/C++ Source or Header  |  1998-11-29  |  3KB  |  83 lines

  1. #include <devhelp.h>
  2. #include <devtype.h>
  3. #include <devrp.h>
  4.  
  5.  
  6.  
  7. WORD16 StratInit(RP FAR* _rp);
  8. WORD16 StratIOCtl(RP FAR* _rp);
  9. WORD16 StratRemove(RP FAR* _rp);
  10. WORD16 StratShutdown(RP FAR* _rp);
  11. WORD16 StratError(RP FAR* _rp);
  12. WORD16 StratOpen(RP FAR* _rp);
  13. WORD16 StratClose(RP FAR* _rp);
  14. WORD16 StratRead(RP FAR* _rp);
  15. WORD16 StratWrite(RP FAR* _rp);
  16.  
  17. // Strategy dispatch table
  18. //
  19. // This table is used by the strategy routine to dispatch strategy requests
  20.  
  21. typedef WORD16 (*RPHandler)(RP FAR* rp);
  22. RPHandler StratDispatch[] =
  23.   {
  24.   StratInit,                  // 00 (BC): Initialization
  25.   StratError,                 // 01 (B ): Media check
  26.   StratError,                 // 02 (B ): Build BIOS parameter block
  27.   StratError,                 // 03 (  ): Unused
  28.   StratRead,                 // 04 (BC): Read
  29.   StratError,                 // 05 ( C): Nondestructive read with no wait
  30.   StratError,                 // 06 ( C): Input status
  31.   StratError,                 // 07 ( C): Input flush
  32.   StratWrite,                 // 08 (BC): Write
  33.   StratError,                 // 09 (BC): Write verify
  34.   StratError,                 // 0A ( C): Output status
  35.   StratError,                 // 0B ( C): Output flush
  36.   StratError,                 // 0C (  ): Unused
  37.   StratOpen,                 // 0D (BC): Open
  38.   StratClose,                 // 0E (BC): Close
  39.   StratError,                 // 0F (B ): Removable media check
  40.   StratIOCtl,                 // 10 (BC): IO Control
  41.   StratError,                 // 11 (B ): Reset media
  42.   StratError,                 // 12 (B ): Get logical unit
  43.   StratError,                 // 13 (B ): Set logical unit
  44.   StratRemove,                // 14 ( C): Deinstall character device driver
  45.   StratError,                 // 15 (  ): Unused
  46.   StratError,                 // 16 (B ): Count partitionable fixed disks
  47.   StratError,                 // 17 (B ): Get logical unit mapping of fixed disk
  48.   StratError,                 // 18 (  ): Unused
  49.   StratError,                 // 19 (  ): Unused
  50.   StratError,                 // 1A (  ): Unused
  51.   StratError,                 // 1B (  ): Unused
  52.   StratShutdown,              // 1C (BC): Notify start or end of system shutdown
  53.   StratError,                 // 1D (B ): Get driver capabilities
  54.   StratError,                 // 1E (  ): Unused
  55.   StratError                  // 1F (BC): Notify end of initialization
  56.   };
  57.  
  58.  
  59.  
  60. // Strategy entry point
  61. //
  62. // The strategy entry point must be declared according to the STRATEGY
  63. // calling convention, which fetches arguments from the correct registers.
  64.  
  65. // For now, we'll declare it as extern "C", so that the name is exported
  66. // without being mangled.  That way, it can be accessed by the header
  67. // data structure in header.asm.  (See that file for more info.)
  68.  
  69. extern "C" VOID Strategy(RP FAR* rp);
  70.  
  71.  
  72. #pragma aux (STRATEGY) Strategy;
  73.  
  74. VOID Strategy(RP FAR* rp)
  75.   {
  76.   if (rp->Command < sizeof(StratDispatch)/sizeof(StratDispatch[0]))
  77.     rp->Status = StratDispatch[rp->Command](rp);
  78.   else
  79.     rp->Status = RPDONE | RPERR_COMMAND;
  80.  
  81.   return;
  82.   }
  83.