[Issue 7819] std.file.setTimes throws error on folders

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 4 21:26:34 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=7819



--- Comment #1 from Jay Norwood <jayn at prismnet.com> 2012-04-04 21:27:09 PDT ---
It looks like CreateFile requires a special flag, FILE_FLAG_BACKUP_SEMANTICS , 
in order to get a handle from a directory that can be used with the SetFileTime
call. Below is an excerpt from a discussion on the topic.

http://cygwin.com/ml/cygwin/1997-12/msg00350.html

Windows NT: You can obtain a handle to a directory by calling the
CreateFile function with the FILE_FLAG_BACKUP_SEMANTICS flag set, as
follows:
hDir = CreateFile (
    DirName,
    GENERIC_READ,
    FILE_SHARE_READ|FILE_SHARE_DELETE,
    NULL,
    OPEN_EXISTING,
    FILE_FLAG_BACKUP_SEMANTICS,
    NULL
);

You can pass a directory handle to the following SetFileTime function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list