Hello EverBody

Do anyone know how to get a file CreationTime. I am trying to get it two ways. FindFirst is more important to me because i use it a lot and i think it is already in there but i don't know how to set it up properly.



by GetFileTime
; xxxxx I tried this but return is zero ... Api Help File say use ReadFile to create Handle

PUSH 0
PUSH 0
PUSH OPEN_EXISTING
PUSH 0
PUSH 0
PUSH GENERIC_READ
PUSH offset myFile01
CALL CreateFileA
mov hFile, eax
; .....................................
PUSH 0
PUSH offset n0000000o
PUSH 40
PUSH offset ta01icona
PUSH hFile
CALL ReadFile
; .....................................
; .....................................
PUSH NULL
PUSH NULL
PUSH ft.dwLowDateTime
PUSH hFile
CALL GetFileTime

xor eax,eax
mov eax, ft.dwLowDateTime
; ....................................
push eax
push offset FORMATTEXT
push offset buffer
CALL wsprintfA
; ....................................
push 0
push 0
push offset buffer
push 0
CALL MessageBoxA


PUSH hFile
CALL CloseHandle


; xxxxx I tried this but return is 0. But wfd.nFileSizeLow will work as in M32lib.FileSize but i tried it with wfd.ftCreationTime and it don't work. I tried working with ftCreationTime FILETIME <> but nothing i did with it would work.

FILETIME STRUCT
dwLowDateTime DWORD ?
dwHighDateTime DWORD ?
FILETIME ENDS

W32_FIND_DATA STRUCT
dwFileAttributes DWORD ?
ftCreationTime FILETIME <>
ftLastAccessTime FILETIME <>
ftLastWriteTime FILETIME <>
nFileSizeHigh DWORD ?
nFileSizeLow DWORD ?
dwReserved0 DWORD ?
dwReserved1 DWORD ?
cFileName BYTE MAX_PATH dup(?)
cAlternate BYTE 14 dup(?)
W32_FIND_DATA ENDS



by FindFirstFile

PUSH offset wfd
PUSH offset myFile01
CALL FindFirstFileA

xor eax,eax
mov eax, wfd.ftCreationTime
; ....................................
push eax
push offset FORMATTEXT
push offset buffer
CALL wsprintfA
; ....................................
push 0
push 0
push offset buffer
push 0
CALL MessageBoxA

Thanks in advance
Posted on 2003-03-05 18:20:35 by cmax

PUSH NULL
PUSH NULL
PUSH ft.dwLowDateTime
PUSH hFile
CALL GetFileTime
Well, it looks like you're using MASM (or TASM) and not FASM or NASM. You should be passing a FILETIME pointer to GetFileTime.
    push NULL

push NULL
lea eax,ft
push eax
push hFile
call GetFileTime
Posted on 2003-03-06 00:59:13 by tenkey
Thanks tenkey

I got GetFileSize to work. David have a half way working example ( THE ONLY NEAR REAL THING ) because it give me a bunch of strange numbers 29555203 02344566985 and stuff like that. The bigger example shown nothing but slash and zeros. At lease his sample proved that i was on the right track on my own. I almost made it...

It would be nice to see a full working code that makes it work right. There is nothing that really works in asm that i can see....

"Using it through FindFirst" I did a search and this have never been addressed here before. And as you see even GetFileTime is a B. To be so close to find more mess than needed.

So if i got to go through that i rather learn the REST of the HARD WAY by using FINDFIRST...FIRST
Posted on 2003-03-06 08:06:41 by cmax
I get the year of creation time using FindFirstFile and GetFileTime. It fails with GetFileTime when working on itself, z.exe, only.
Posted on 2003-03-06 09:21:36 by roaknog
Now i know how to work ALL your examples after this... I once thought it was all about Console *the hard stuff to me* and never until now made an true effort to explore them, but now i know better and got a lot of Z'sss to RE-investigate...

It worked soooo easy and the code is so small ... Great Work ... and Thanks for ALL.

But i have two question, why do you use %d instead of %lu. It works also. I forgot the other question. Just too happy to know that Windows and it API is not so bad after all. I bet even 95 can be made much more secure if someone took time out to work on that instead of trying to out do it. Those who can write an OS and super low level codes i bet they can go under and do ANYTHING GOOD with it. I bet Bill would show that person how. I bet that is his side-line dream.... The only problem is he got to let em run free. One man can only do and take so much....

I'm Going over board as usual,

Thank again roaknog
Posted on 2003-03-07 00:41:48 by cmax