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.
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.
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开发者_Go百科.) but all of which failed to navigate System directories.
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.
精彩评论