阅读:2013回复:11
发IRP读网络文件返回STATUS_ACCESS_DENIED
在Create历程里面发IRP读网络文件,经常发现返回 STATUS_ACCESS_DENIED 或者 STATUS_INVALID_HANDLE
这是什么原因,拿到了FileObject,然后发IRP读都不行,那该怎么办呢? |
|
|
沙发#
发布于:2007-08-07 19:31
去SERVER那边用FILESPY看看呗
|
|
板凳#
发布于:2007-08-12 23:30
到处都看了,就找不到原因,
|
|
|
地板#
发布于:2007-08-13 11:19
看看是不是M$的bug~
|
|
|
地下室#
发布于:2007-08-13 12:36
引用第3楼killvxk于2007-08-13 11:19发表的 : 您真牛,咱从来没有敢这样想过 不过,换句话说,你的意思就是在网络文件Create之后拿到FileObject是肯定可以发IRP去读的吗? 谢谢 |
|
|
5楼#
发布于:2007-08-13 15:42
发IRP读网络文件, 涉及到环境问题.
以前用楚狂人的土方法去解决文件重入问题, 操作网络文件时, 文件打开一直不成功, 道理应该 是一样的吧 |
|
|
6楼#
发布于:2007-08-13 16:27
引用第5楼xiabl于2007-08-13 15:42发表的 : 呵呵,最近好像看到个帖子说那个防重入的什么IoCreate... 函数有Bug 不用那个土方法那你用了什么方法呢 环境问题,是什么呢 |
|
|
7楼#
发布于:2007-08-13 16:31
楚狂人的方法 操作网络文件时没有考虑网络访问的令牌的问题,所以打不开
我现在的问题是已经拿到了FileObject却没法读 |
|
|
8楼#
发布于:2007-08-13 22:24
In which thread-context (user/system) is your code, particularly MJ_READ, executing ?
What access flag you set when opening the file? |
|
9楼#
发布于:2007-08-13 23:01
引用第8楼michaelgz于2007-08-13 22:24发表的 : 我只是跟踪Word,Word去打开一个网络上的文件,我的文件过滤在Create的IRP之后得到了这个FileObject,然后发出一个Read的IRP去读一下这个文件, ........ Irp = IoBuildAsynchronousFsdRequest(IRP_MJ_READ,...); Irp->Flags |= IRP_NOCACHE; ........ 在这里用PsGetCurrentProcessId得到的是Word的进程ID |
|
|
10楼#
发布于:2007-08-14 04:08
Assume your read IRPs are sent down in the same thread as MJ_CREATE and you are using the FileObject returned by MJ_CREATE:
I believe the reason your read IRPs failed is that the file is not opened for read. For example if a file is only opened for write, all read IRPs should be failed. Here is one of the differences between local FS and network FS. I think you are using the same approach for local FS which is working because access validation is done in IO Manager and your own read IRPs bypassed IO Manager. But for network FS, all requests need to be validated on server side. So if a network file is not opened for read, all READ IRPs from client side should be failed. One solution could be that, for network files, append READ access flag always, though this may have some side-effects and not recommended normally. |
|
11楼#
发布于:2007-08-14 10:23
多谢michaelgz !
|
|
|