3333|4

68

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

createfile 一个驱动sys 在xp下没问题 在2000下错误 [复制链接]

getlasterror代码是 2 找不到指定的文件

xp下 别人的xp下 都是对的

但是2000下 就是createfile失败了

为什么啊

最新回复

到驱动的代码里看看,看是不是判断系统不同,创建的名字不一样。 另外,2000和xp有可能驱动所属的路径不同,你看看驱动里的代码 举个例子:sfilter里面 RtlInitUnicodeString( &nameString, L"\\FileSystem\\Filters\\SFilter" );     status = IoCreateDevice( DriverObject,                              //0,                      //has no device extension                              sizeof(SFILTER_DEVICE_EXTENSION),                              &nameString,                              FILE_DEVICE_DISK_FILE_SYSTEM,                              FILE_DEVICE_SECURE_OPEN,                              FALSE,                              &gSFilterControlDeviceObject );     if (status == STATUS_OBJECT_PATH_NOT_FOUND) {         //         //  This must be a version of the OS that doesn't have the Filters         //  path in its namespace.  This was added in Windows XP.         //         //  We will try just putting our control device object in the \FileSystem         //  portion of the object name space.         //         RtlInitUnicodeString( &nameString, L"\\FileSystem\\SFilterCDO" );         status = IoCreateDevice( DriverObject,                                  0,                      //has no device extension                                  &nameString,                                  FILE_DEVICE_DISK_FILE_SYSTEM,                                  FILE_DEVICE_SECURE_OPEN,                                  FALSE,                                  &gSFilterControlDeviceObject );         if (!NT_SUCCESS( status )) {                         KdPrint(( "SFilter!DriverEntry: Error creating control device object "%wZ", status=%08x\n", &nameString, status ));             return status;         }              } else if (!NT_SUCCESS( status )) {         KdPrint(( "SFilter!DriverEntry: Error creating control device object "%wZ", status=%08x\n", &nameString, status ));         return status;     } 复制代码  详情 回复 发表于 2010-5-7 11:40
点赞 关注

回复
举报

86

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
各位编写过驱动的帮帮忙啊
 
 

回复

71

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
还没有人回复我吗。谢谢帮忙啊
 
 
 

回复

66

帖子

0

TA的资源

一粒金砂(初级)

4
 
贴下代码看看
 
 
 

回复

71

帖子

0

TA的资源

一粒金砂(初级)

5
 
到驱动的代码里看看,看是不是判断系统不同,创建的名字不一样。
另外,2000和xp有可能驱动所属的路径不同,你看看驱动里的代码
举个例子:sfilter里面

  1. RtlInitUnicodeString( &nameString, L"\\FileSystem\\Filters\\SFilter" );

  2.     status = IoCreateDevice( DriverObject,
  3.                              //0,                      //has no device extension
  4.                              sizeof(SFILTER_DEVICE_EXTENSION),
  5.                              &nameString,
  6.                              FILE_DEVICE_DISK_FILE_SYSTEM,
  7.                              FILE_DEVICE_SECURE_OPEN,
  8.                              FALSE,
  9.                              &gSFilterControlDeviceObject );

  10.     if (status == STATUS_OBJECT_PATH_NOT_FOUND) {

  11.         //
  12.         //  This must be a version of the OS that doesn't have the Filters
  13.         //  path in its namespace.  This was added in Windows XP.
  14.         //
  15.         //  We will try just putting our control device object in the \FileSystem
  16.         //  portion of the object name space.
  17.         //

  18.         RtlInitUnicodeString( &nameString, L"\\FileSystem\\SFilterCDO" );

  19.         status = IoCreateDevice( DriverObject,
  20.                                  0,                      //has no device extension
  21.                                  &nameString,
  22.                                  FILE_DEVICE_DISK_FILE_SYSTEM,
  23.                                  FILE_DEVICE_SECURE_OPEN,
  24.                                  FALSE,
  25.                                  &gSFilterControlDeviceObject );

  26.         if (!NT_SUCCESS( status )) {
  27.            
  28.             KdPrint(( "SFilter!DriverEntry: Error creating control device object "%wZ", status=%08x\n", &nameString, status ));
  29.             return status;
  30.         }
  31.         
  32.     } else if (!NT_SUCCESS( status )) {

  33.         KdPrint(( "SFilter!DriverEntry: Error creating control device object "%wZ", status=%08x\n", &nameString, status ));
  34.         return status;
  35.     }
复制代码
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/10 下一条
报名最后一周!2025 英飞凌消费、计算与通讯创新大会-北京站
会议时间:3月18日(周二)09:30签到
参会奖励:电动螺丝刀套装、户外登山包、京东卡

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表