|
-
May 2nd, 2006, 05:04 AM
#1
CreateFile for directories?
I use the API CreateFile function to get a handle to a file, but it doesn't work if the file is a directory, the function returns -1 = "invalid handle value". Is there some work around? I need the handle in order to call SetFileTime and thus modify the file or directory time stamp.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 2nd, 2006, 05:10 AM
#2
Re: CreateFile for directories?
 Originally Posted by myself
I use the API CreateFile function to get a handle to a file, but it doesn't work if the file is a directory, the function returns -1 = "invalid handle value". Is there some work around? I need the handle in order to call SetFileTime and thus modify the file or directory time stamp.
Well, I've just read that CreateFile can only make read access to directories, unlike files. Thus the question is, how can I write to a directory file to change its time stamp?
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 2nd, 2006, 05:37 AM
#3
Re: CreateFile for directories?
I have found this but it doesn't apply to Win98.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 2nd, 2006, 08:21 AM
#4
Re: CreateFile for directories?
BUMP
So, to cut the long story short, how to time/date stamp a directory?
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 2nd, 2006, 10:05 AM
#5
Re: CreateFile for directories?
Check this example at pscode.com: ChangeFolderTimeAttributes
it says: "This code allows for the changing of the access; modified; and created time stamps for folders..."
-
May 2nd, 2006, 10:26 AM
#6
Re: CreateFile for directories?
 Originally Posted by jcis
Check this example at pscode.com: ChangeFolderTimeAttributes
it says: "This code allows for the changing of the access; modified; and created time stamps for folders..."
Looks like I'll have to study this code very carefully, but it's a nice demo to set me started.
Thanks for the hint.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 3rd, 2006, 04:20 AM
#7
Re: CreateFile for directories?
 Originally Posted by krtxmrtz
Looks like I'll have to study this code very carefully, but it's a nice demo to set me started.
Thanks for the hint.
Unfortunately this code is giving me exactly the same error (see my opening post) in the CreateFile procedure. I wonder if it's not intended for Win98, but I still haven't had a chance to try it under WinXP.
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
-
May 3rd, 2006, 05:40 AM
#8
Re: CreateFile for directories?
 Originally Posted by krtxmrtz
Unfortunately this code is giving me exactly the same error (see my opening post) in the CreateFile procedure. I wonder if it's not intended for Win98, but I still haven't had a chance to try it under WinXP.
Just tried under Windows XP: same thing (returned handle: -1)
Lottery is a tax on people who are bad at maths
If only mosquitoes sucked fat instead of blood...
To do is to be (Descartes). To be is to do (Sartre). To be do be do (Sinatra)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|