I want to only open a directory to read its security settings.
I am of course in kernel mode , and I would assume then that I'd be allowed
to do whatever I might want.

Status = ZwCreateFile(&FileHandle,
GENERIC_READ|GENERIC_WRITE,
&ObjAttrs,
&StatusBlock,
0, //allocation size
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_WRITE|FILE_SHARE_READ, //share
access FILE_OPEN_IF, // disposition
FILE_DIRECTORY_FILE, // CreateOptions,
0, // EaBuffer OPTIONAL,
0);


In many cases this code works, but if the directory has any security
settings, then I've gotten status_access_denied as the status.

I've made this code work by changing the desired access to GENERIC_READ
rather than GENERIC_READ|GENERIC_WRITE.

So my question: If I'm in kernel mode, how come I'm being prohibited from
opening the directory with GENERIC_WRITE access?
--
Gak -
Finecats

Re: ZwCreateFile create directory question by Maxim

Maxim
Fri Jan 14 04:14:13 CST 2005

> Status = ZwCreateFile(&FileHandle,
> GENERIC_READ|GENERIC_WRITE,

Try QUERY_SECURITY here.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com