kenli79
驱动小牛
驱动小牛
  • 注册日期2002-06-12
  • 最后登录2003-07-06
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:2022回复:3

CreateFile老是Access Denied

楼主#
更多 发布于:2003-05-01 09:14
写一文件过滤驱动,2000/XP下很好,在nt4下测试的时候CreateFile老是返回ERROR_ACCESS_DENIED,怎么办?
CreateFile代码如下:

HANDLE hFile = CreateFile( \"\\\\\\\\.\\\\mydriver\", GENERIC_READ | GENERIC_WRITE,
0,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL );
超级菜鸟!!!!!!!!!
kenli79
驱动小牛
驱动小牛
  • 注册日期2002-06-12
  • 最后登录2003-07-06
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-05-01 11:27
我用filemon的程序改的,他的就行,我写测试程序,打开filemon可以,打开我的驱动还是返回5。我受不了了,怎么办,谁来帮帮我。
超级菜鸟!!!!!!!!!
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
板凳#
发布于:2003-05-01 11:29
FILE_ATTRIBUTE_NORMAL改成0呢?
kenli79
驱动小牛
驱动小牛
  • 注册日期2002-06-12
  • 最后登录2003-07-06
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-05-02 09:56
找到问题了,就是我调用了IoRegisterFsRegistrationChange,osr的大侠们给我了下面的提示:/*
NOTE: NT4 has a bug - IoRegisterFsRegistrationChange increments the
DeviceObject->ReferenceCount field on the first device object hanging
off this driver to prevent the driver from unload while the FS registration callback is not revoked a) BSOD if no device objects at all yet b) if this device object is exclusive - it will never be opened (IopParseDevice fails CREATE for exclusive device objects with ReferenceCount != 0) NT5+ does not have this bug - it uses ObReferenceObject on the driver object instead.
*/
怎么办? :o
超级菜鸟!!!!!!!!!
游客

返回顶部