Re: [D5] set folder creation date




"Fodox" <fodox.it@xxxxxxxxx> wrote in message
news:731b4726.0504192349.a990e8a@xxxxxxxxxxxxxxxxxxxxx
> it don't work: reading the struct's data i always see ERROR 5 (file
> access denied?). why that?
> how can i do?

I've just been looking through some of my own code, which has some fairly
illuminating comments in it ... stuff I must have figured out a couple of
years back. It says:

//Code below isn't perfect - there is a small window
//for intervening code to mess up the result.

<a bunch of code>

//This still feels a bit dodgy, but problems with getting
//directory attributes - only NT & XP support the create file function for
//directories. Could do a FindFirst op, but prefer not to at the moment.

<another bunch of code>

So what's going on? Well, I'm not going to give you the long answer, because
the search function in MSDN appears to be FUBARRED, but I will say this:

You have Win32 API calls CreateDirectory, CreateFile, SetFileTime etc.

I seem to recall that the various permissions and flags you need to do the
required date handling on the directory varies from platform to platform. I
suspect XP and NT support things that earlier versions don't.

If I were you, I'd resort to using the Win32 API, and copious use of the
"GetLastError" function call :-)

MH.


.



Relevant Pages