Tech Support > Microsoft Windows > Development Resources > Problem creating directory
Problem creating directory
Posted by Chris Saunders on December 7th, 2003


I am trying to open a directory using:

HANDLE handle = CreateFile ("C:",
FILE_LIST_DIRECTORY |
FILE_READ_ATTRIBUTES |
FILE_READ_DATA |
FILE_READ_EA |
FILE_TRAVERSE |
STANDARD_RIGHTS_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);

GetLastError() is returning "Access is denied."

I am using Windows 2000 and am logged on as Administrator.
I cannot see why access should be denied in this instance.
Any ideas?

Regards
Chris Saunders
chris.saunders@sympatico.ca


Posted by lev on December 7th, 2003


Add FILE_FLAG_BACKUP_SEMANTICS frag tp the second paramter

"Chris Saunders" <chris.saunders@sympatico.ca> wrote in message
news:F8wAb.18245$yd.2888545@news20.bellglobal.com. ..


Posted by Chris Saunders on December 7th, 2003


My thanks to lev.

Your suggestion worked perfectly except I needed to add
the flag to the second last parameter. This is mentioned in
the online documentation but this function is so complex it
is easy to miss something.

My thanks again.
Chris Saunders
chris.saunders@sympatico.ca

"lev" <ltsentsiper@brandsoft.com> wrote in message
news:kNzAb.47522$_M.215678@attbi_s54...



Similar Posts