> > Greetings all,
> >
[quoted text clipped - 18 lines]
>
> If this can be replicated it seems like a bug to me..
I've managed to repeat this, using VB.Net. I believe it may be a
windows filesystem "feature". I cannot find a reference for it, but I
believe it's been done like this to support scenarios where an
application is about to write out an updated copy of a file, but wants
to support being able to retrieve the "old" version, if there's a
problem during the write.
Obviously, you cannot overwrite the existing file, so you have to
rename it first, and then write out the new version using the old
filename. And then windows (I believe. Might be .Net, but I suspect
windows) steps in and says "Aha! This is obviously just an updated copy
of the file that's just been moved, it should inherit some meta-data,
such as the creation date (and permissions)". I think it's done on a
per-process basis (so if one process renames a file, and another writes
the new one, it will not inherit the meta data).
Now, final two bits. First, they have the same handle because the first
free handle is obtained when you open the file, and then is freed by
the Close() call, so that when you come to open the second file, it
finds the first free handle (which happens to be the same handle
previously used). Had you reopened the moved file (for reading say),
before you had created the second file, you'd have probably had
different handle values.
Secondly, if you need the new file to have the correct creation
datetime, I think you'll need to open it twice. Create it, Close it,
Call SetCreationTime, then open it for writing.
Damien
Damien - 12 Jul 2006 16:41 GMT
> > > Greetings all,
> > >
[quoted text clipped - 34 lines]
> per-process basis (so if one process renames a file, and another writes
> the new one, it will not inherit the meta data).
Found it in MSDN, under CreateFile in Platform SDK, Storage. CreateFile
is the Win32 call underneath the framework functionality.
On the 2003 version, the link is
ms-help://MS.MSDNQTR.2003FEB.1033/fileio/base/createfile.htm
If you look down below the Remarks section, there is a section for each
type of item that can be accessed using CreateFile. In the Files
section, the fourth paragraph has:
--Start quote
If you rename or delete a file, then restore it shortly thereafter, the
system searches the cache for file information to restore. Cached
information includes its short/long name pair and creation time.
--End Quote
So, that's what you're getting.
Damien
C# Dev - 13 Jul 2006 12:28 GMT
Ok.
Although I don't agree with this as a preferred behaviour it certainly sheds
some light of what is going on. And that is what I need to proceed :-)
Thank you.
> > > > Greetings all,
> > > >
[quoted text clipped - 54 lines]
>
> Damien