阅读:2076回复:3
CreateFile老是Access Denied
写一文件过滤驱动,2000/XP下很好,在nt4下测试的时候CreateFile老是返回ERROR_ACCESS_DENIED,怎么办?
CreateFile代码如下: HANDLE hFile = CreateFile( \"\\\\\\\\.\\\\mydriver\", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL ); |
|
|
沙发#
发布于:2003-05-01 11:27
我用filemon的程序改的,他的就行,我写测试程序,打开filemon可以,打开我的驱动还是返回5。我受不了了,怎么办,谁来帮帮我。
|
|
|
板凳#
发布于:2003-05-01 11:29
FILE_ATTRIBUTE_NORMAL改成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 |
|
|