阅读:952回复:2
free and checked
各位大虾:
我用ds编写了一wdm驱动程序,在win98下用checked编译连接成功,并且上层程序能正确调用,但用free编译也连接成功,上层程序 调用后(打开成功),deviceiocontrol(..)不能返回值. 帮忙解决! |
|
沙发#
发布于:2003-06-25 11:46
把你驱动中对 IRP_MJ_DEVICE_CONTROL 处理的代码仔细看看,贴上来。
|
|
|
板凳#
发布于:2003-06-25 12:31
NTSTATUS PIDSDevice::DeviceControl(KIrp I) { NTSTATUS status; t << \"Entering PIDSDevice::Device Control, \" << I << EOL; //////////////////////////我的代码//////////////////////////////////////// ioBuffer = I.IoctlBuffer(); ULONG ioInSize = I.IoctlInputBufferSize(); ULONG ioOutSize = I.IoctlOutputBufferSize(); I.Information() = 0; switch (I.IoctlCode()) { case DIOC_OPEN://打开WDM命令,对应CreatFile break; case BA_PORTA://卡初始化命令 设置并口地址 t << \"deviceiocontrol te BA_PORTA \"<<EOL; ii=(short int *)ioBuffer;// i1=(short int *)ioBuffer;//返回成功与否信息 hd.PORTA=*ii; *i1=hd.PORTA; I.Information() = sizeof(short int); break; case BA_INIT://卡初始化命令 i1=(short int *)ioBuffer;//返回成功与否信息 *i1=hd.InitCard(); // m_IoPortRangeTest.outb(0x61,0x00);//测试语句 I.Information() = sizeof(short int); break; default: // Unrecognized IOCTL request status = STATUS_INVALID_PARAMETER; break; } // If the IRP was queued, or its IOCTL handler deferred processing using some // driver specific scheme, the status variable is set to STATUS_PENDING. // In this case we simply return that status, and the IRP will be completed // later. Otherwise, complete the IRP using the status returned by the // IOCTL handler. if (status == STATUS_PENDING) { return status; } else { return I.PnpComplete(this, status); } } |
|