shjdriver
驱动牛犊
驱动牛犊
  • 注册日期2003-04-01
  • 最后登录2008-04-02
  • 粉丝0
  • 关注0
  • 积分277分
  • 威望30点
  • 贡献值0点
  • 好评度26点
  • 原创分0分
  • 专家分0分
阅读:883回复:2

free and checked

楼主#
更多 发布于:2003-06-25 10:12
各位大虾:
    我用ds编写了一wdm驱动程序,在win98下用checked编译连接成功,并且上层程序能正确调用,但用free编译也连接成功,上层程序
调用后(打开成功),deviceiocontrol(..)不能返回值.
帮忙解决!
swf2003
驱动中牛
驱动中牛
  • 注册日期2003-02-13
  • 最后登录2011-10-28
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望22点
  • 贡献值0点
  • 好评度20点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-06-25 11:46
把你驱动中对 IRP_MJ_DEVICE_CONTROL 处理的代码仔细看看,贴上来。
你的认可是对我最大的鼓励!
shjdriver
驱动牛犊
驱动牛犊
  • 注册日期2003-04-01
  • 最后登录2008-04-02
  • 粉丝0
  • 关注0
  • 积分277分
  • 威望30点
  • 贡献值0点
  • 好评度26点
  • 原创分0分
  • 专家分0分
板凳#
发布于: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);
}
}
游客

返回顶部