阅读:1599回复:5
ds生成的驱动程序,为什么测试是读写结果都是0?
我用DS生成一个带读写功能的驱动程序,和测试程序,结果如下:C:\\>D:\\SerialCom\\exe\\objchk\\i386\\Test_SerialCom.exe r 32 w 32
Test application Test_SerialCom starting... Device found, handle open. Reading from device - 0 bytes read from device (32 requested). ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Writing to device - 0 bytes written to device (32 attempted). g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a, b, c, d, e, f, g, h, i, j, k, l, 结果看起来尝试了读写,但既未读到,也未写入,谁能告诉我为什么? |
|
|
沙发#
发布于:2002-07-15 17:07
我用DS生成一个带读写功能的驱动程序,和测试程序,结果如下:C:\\>D:\\SerialCom\\exe\\objchk\\i386\\Test_SerialCom.exe r 32 w 32
Test application Test_SerialCom starting... Device found, handle open. Reading from device - 0 bytes read from device (32 requested). ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Writing to device - 0 bytes written to device (32 attempted). g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, a, b, c, d, e, f, g, h, i, j, k, l, 结果看起来尝试了读写,但既未读到,也未写入,谁能告诉我为什么? 驱动里面你是不是什么都没有改呀!当然会显示0 bytes written 你还是看看里面的那个information变量,呵呵 |
|
|
板凳#
发布于:2002-07-15 17:24
把information的值改为dwTotalSize,结果显示是对了,谢谢!
|
|
|
地板#
发布于:2002-07-16 15:52
对了,为什么读出来的都是问号?我对于读写到设备的什么地址不太清楚。
|
|
|
地下室#
发布于:2002-07-16 16:21
对了,为什么读出来的都是问号?我对于读写到设备的什么地址不太清楚。 读出来是什么东西是你驱动里定的呀,你在Onread函数中作了什么操作? |
|
|
5楼#
发布于:2002-07-16 16:34
是ds自动生成的,我没做改动,不知应该怎样改才能读到自己写入的信息?
NTSTATUS SerialComDevice::Read(KIrp I) { t << \"Entering SerialComDevice::Read, \" << I << EOL; if (FALSE) { I.Information() = 0; return I.PnpComplete(this,US_INVALID_PARAMETER); } if (I.ReadSize() == 0) { I.Information() = 0; return I.PnpComplete(this, STATUS_SUCCESS); } return m_DriverManagedQueue.QueueIrp(I); } |
|
|