How do I open a directory with CreateFile in C# to examine entries of deleted files? Or is it now impossible? I remember way back when being able to open a directory on an
I'm not sure what you mean by examining deleted directories, but you should be able to get a handle to a directory by passing the FILE_FLAG_BACKUP_SEMANTICS flag into CreateFile and by making sure to specify OPEN_EXISTING for the creation disposition. From the MSDN article on CreateFile:
To open a directory using CreateFile, specify the
FILE_FLAG_BACKUP_SEMANTICSflag as part of dwFlagsAndAttributes. Appropriate security checks still apply when this flag is used withoutSE_BACKUP_NAMEandSE_RESTORE_NAMEprivileges.
It looks like you've previously tried some of this but commented it out? If this doesn't work for you, you might want to make sure that they the user you're running as has permission to acess the directory in question.