系统卷信息:拒绝访问 [英] System Volume Information: Access Denied

查看:35
本文介绍了系统卷信息:拒绝访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个程序,可以从头到尾在扇区级别搜索物理设备.现在我想创建一个只处理逻辑文件的例程.

I have written a program that can search a physical device at the sector level, from start to finish. Now I want to create a routine that will deal only with logical files.

因此,我需要使用本机 C++ 递归列出 NTFS 卷(或 FAT32)上的所有目录和文件.每当我遇到 Windows 系统文件夹时,我遇到的问题是拒绝访问"错误.

Therefore, I need to recursively list all directories and files on an NTFS volume (or FAT32) using native C++. The problem I am running into is an "access denied" error whenever I encounter a Windows System folder.

C:\System Volume Information and
C:\Users

只是这些文件夹的两个示例.

are just two examples of these folders.

我不想跳过"这些目录.相反,它们对手头的项目最重要.

I am NOT looking to "skip over" these directories. On the contrary, they are most important to the project at hand.

我尝试了 C++ 论坛等中提供的各种选项,但似乎所有选项都失败了(访问被拒绝),或者快速回答是跳过"它们.

I have tried a variety of options that have been offered up in C++ forums etc. and all of them seem to either fail (access denied) or the quick answer is to "skip over" them.

此时,我想知道是否需要以某种方式查找这些文件夹的物理扇区并系统地跟踪每个文件夹的物理扇区级别的范围?

At this point, I am wondering if I need to somehow lookup the physical sector for these folders and systematically trace through the extents at the physical sector level for each?

在这里寻求帮助,如果您有任何想法,我将不胜感激.谢谢!

Looking for some help here and I would appreciate any ideas. Thank you!

注意:我认为发布任何示例代码没有意义,因为我尝试了太多组合(其中大多数可以读取目录等),但所有这些都无法导航系统目录.

NOTE: I saw no point in posting any sample code only because I've tried way too many combinations (most of which could read directories etc.) but all of which failed to navigate System directories.

推荐答案

不是我推荐这个,但既然你很坚定,你为什么不使用 SetFileSecurity 这样您就可以打开句柄,然后更改它们再次回来?那应该可行.

Not that I recommend this, but since you're very determined, why don't you just temporarily change the security descriptors on those folders with SetFileSecurity so you can open a handle, then change them back again? That should work.

这篇关于系统卷信息:拒绝访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆