[comp.windows.ms.programmer] Using DOS device driver under Windows

spyen@netcom.COM (Shyh-Pei Yen) (06/28/91)

I have a question about using DOS device driver with Windows application.
Please help me out if you have experienced this.

I am trying to read data from the scanner via bi-directional parallel port
by using the scanner's DOS device driver. To do so, I use OpenFile() to
open the device driver and then use _lread() to input data and _lwrite() to
output data. Everything works fine except it's horriblily slow (maybe I
exagerate a little bit, but it IS slow). After a lot of time fooling around,
we figured out that the Windows seems did something bad to the _lread() call
and read the data one byte at a time from the driver until the number of
bytes specified in the function's parameter of data read in the buffer, then
return the call. We set the driver into raw mode. It's no use. Windows just
keeps doing that no matter driver is in raw mode or cooked mode.

Rumor has it that we should use GlobalDosAlloc() function to allocate the
buffer memory for device driver. I don't know if it will solve the problem
(will it?). I want to give it a try. But the problem is I can find the
GlobalDosAlloc() function in Windows SDK reference manual, but Microsoft's
linker seems have problem locating this function in it's library. This
function is not defined in the windows.h header file, and every time I did
the link, GlobalDosAlloc() always is an unresolved external function.

Any idea why these are happenning?

I appreciate any input.

spyen@netcom.com