Build your own ASPI DLLUse it to interface your SCSI2 devices. Ten useful and ready to use functions included. ForewordsA SCSI2 device can execute SCSI2 commands, but to make something useful a number of consecutive commands is generally required. For example: to make a scanner scan a page you should first test whether the unit is ready, then send it an "object position" and a "set window" commands. Finally you should send the scanner a number of consecutive "read" commands to get the raster data.The best place to put all these SCSI2 commands is a function into a DLL. An application program will simply call that function, pass it some parameters, and wait for the raster data to arrive (or an error code back from the scanner instead). This way application program listings will be very neat and concise, and the code in the DLL will be reusable from many applications. My application programs are usually written in C++ using that fantastic tool that's called Borland C++ Builder. These programs use to call some high level functions to drive SCSI2 devices of my interest. Those *high* level functions are defined and contained into a DLL, written in win32asm, that does all the *low* level job to make devices do something useful like scanning a page. Below I will provide you with a simple DLL skeleton ready to accept new functions that you will define. To make things more interesting I left into the DLL skeleton ten functions of mine:
Actually the last four functions are not ASPI-bound, but have been added here to complete the article about the ESMTP/SMTP client in the C++ section of these web pages for the programmer. ScenarioSuppose you have a SCSI2 tape drive that you used to deal with under DOS, and now you want to operate it from your Win32 programs. You need a DLL.Start building the DLL as shown below, and write a simple C++ program to scan the SCSI2 bus just to see whether the device responds or not (use the supplied SCSI2 bus scan function and eventually have a look at this example). Then revise chapter 10 of SCSI2 specification and refresh the theory of operations for sequential-access devices. Decide which functions you need for your application programs and how to implement it using SCSI2 commands. That's all. Follow the instructions below and good luck. The ingredients of the DLLFour file types are required to build the DLL:
Build itTo build the basic ASPI DLL, i.e. the DLL that contains only the five functions above mentioned, you should follow the steps described below. The only prerequisite is having MASM32 installed in your PC.These are the steps:
Add your functionsNothing is more simple than adding your functions to the ASPI DLL, provided you are acquainted with win32asm programming. For each new function you should do the following:
I left the scan page function to give you a complete example of a working routine that you can look at. Please contact me if I forgot something or some explanation is not clear enough. For those that do not use MASM32 but want to use the SCSI2 bus scan function I put here the zipped version of the compiled DLL. It is 9.728 bytes long (unzipped). Please refer to this project to see how to write an application that scans the SCSI2 bus. |