home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / winnt / mswin32 / lib13 / class.lzh / README.TXT < prev    next >
Encoding:
Text File  |  1993-04-06  |  4.0 KB  |  81 lines

  1. *** Generic SCSI class driver sample ***
  2. *** Written by Thomas Nielsen, DMC   ***
  3. *** Release date: 06/04-1993         ***
  4.  
  5.  
  6. This sample (hopefully) demonstrates how to write a custom SCSI class driver for
  7. various SCSI devices running under Windows NT, october release.
  8. I have tried to insert as many comments as possible without making the code too
  9. un-readable.
  10. The generic sample consists of the following files:
  11.  
  12.    SCANNER.C   (Generic SCSI Class driver - finds all SCSI scanner devices
  13.                 connected to the SCSI bus)
  14.    SCANNER.RC  (Resource file for the SCSI Class driver)
  15.    MAKEFILE    (Makefile for the Class driver - use the Build utility to build
  16.                 the Class driver).
  17.    SOURCES     (Specifies the environment needed for the Build utility)
  18.  
  19.    \WIN32\DEV.C    (Win32 sample how to access the SCSI Class driver including
  20.                     sample code how to send SCSI TestUnitReady and Inquiry commands).
  21.    \WIN32\MAKEFILE (Makefile for the Win32 application)
  22.  
  23.  
  24. The Class driver sample and the Win32 needs the October SDK plus the October DDK in
  25. order to compile/link sucessfully. As soon as I receive the March DDK, there will be
  26. a new revision of the sample..... (-:
  27.  
  28. The Class driver sample searches the installed SCSI adapters, and then searches the
  29. SCSI bus for "unclaimed" devices (devices not already owned by another class driver -
  30. such as the CD-ROM device, etc.). The class driver then enumerates each found device
  31. as "Scanner0", "Scanner1", etc.
  32. The Class driver creates a device object for each found scanner and in the end creates
  33. a symbolic link in order to have Win32 to recognize the scanner devices (so you can
  34. access the device via CreateFile("\\\\.\\Scanner0"...
  35.  
  36. I have included a sample in the SCANNER.C file that demonstrates how to send user-
  37. defined ioctls to the class driver using the DeviceIoControl API. To test it, insert
  38. the ioctl code (in the specific case: 100) instead of the the IOCTL_SCSI_PASS_THROUGH
  39. in the DeviceIoControl call.
  40. The class driver then builds an SCSI srb and passes it via the SendSrbSynchronous to
  41. the appropriate function in the CLASS.C file. Please feel free to extend the class
  42. driver with more ioctl codes....
  43.  
  44. Note: The maximum block transfer is limited by the SCSI adapter capabilities.
  45.       The normal max. block size = 64K plus the pagesize = 4K = 68K
  46.       It is the class drivers responsibility to break down larger requests into
  47.       smaller blocks.
  48.  
  49. Installation of the class driver:
  50.  
  51.   1. Copy the class driver (scsiscan.sys) into the \WINNT\SYSTEM\DRIVERS directory
  52.   2. Start the Regedit utility
  53.   3. Go to \HKEY_LOCALMACHINE\SYSTEM\CurrentControlSet\Services
  54.   4. Add new key "Scsiscan"
  55.   5. Add the following values under the Scsiscan key:
  56.      Type: REG_DWORD: 0x1         /* Device driver */
  57.      Group: REG_SZ: SCSI Class    /* Member of the SCSI class driver group */
  58.      ErrorControl: REG_DWORD: 0x1 /* The system will boot even if this driver */
  59.                                   /* fails to load !!!                        */
  60.      DependOnGroup: REG_MULTI_SZ: SCSI miniport  /* The driver will only be loaded */
  61.                                                  /* if there is an installed SCSI  */
  62.                                                  /* adapter - quite vital (-:      */
  63.      Start: REG_DWORD: 0x2        /* Non-boot related driver - ie. is not vital */
  64.                                   /* for the system in order to work properly   */
  65.  
  66.  
  67.   8. Quit the Regedit utility
  68.   7. Re-boot the system - the driver will the be loaded - otherwise you might need
  69.      to activate the Kernel debugger (KD).
  70.  
  71. The Class driver and the Win32 sample have been sucessfylly tested on both I386
  72. and R3000/R4000 machines with different SCSI controllers and SCSI devices.
  73.  
  74. Hope this can help you developing other SCSI class drivers. Don't hesitate to drop me
  75. a message if you have any questions or problems...
  76.  
  77.  
  78. Thomas Nielsen
  79. CIS mail: 100065, 2167
  80. Fax: +45 66 14 71 81
  81.