From: jan DOT dubois AT ibm DOT net (Jan Dubois) Subject: Re: How to set directory time stamps? 14 Dec 1997 12:33:54 -0800 Message-ID: <34963b25.33670766.cygnus.gnu-win32@smtp1.ibm.net> References: <199712140407 DOT VAA22002 AT tocsy DOT chem DOT utah DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Reinhard Dunkel Cc: gnu-win32 AT cygnus DOT com On Sat, 13 Dec 1997 21:07:51 -0700 (MST), you wrote: >I am trying to port a program which depends on being able to update >directory time stamps. Using GNU-Win32 b18 (with various patches >applied), updating the time stamps of a plain file works. But I >did not succeed to update the time stamps of a directory (Windows NT >4.0 on Pentium II, FAT filesystem): > > bash-2.01$ mkdir TEST > bash-2.01$ touch TEST > touch: TEST: Permission denied > >The same problem appears for a C program using: > > utime(directoryName, NULL); > >(perror() returns something like "Is a directory".) NuTCRACKER fails >too, Microsoft's "_utime()" doesn't work, but the MKS Toolkit "touch" >command works flawlessly (...so it is do-able after all!). Somebody >indicated to me that using "backup semantics to open the directory" >and using "SetFileTime on that handle" should work. Well, I just >entered the Microsoft World of programming. Part two sounds familiar, >but what is "backup semantics"? Any help on solving the mystery of NT >directory time stamp updates would be greatly appreciated! 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. -Jan - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".