include c:\masm32\include\windows.inc
include c:\masm32\include\gdi32.inc
includelib c:\masm32\lib\gdi32.lib
include c:\masm32\include\user32.inc
includelib c:\masm32\lib\user32.lib
include c:\masm32\include\kernel32.inc
includelib c:\masm32\lib\kernel32.lib
.data?
hFile db ?
szTest db ?
lpCreatfile db ?
szBuffer db 12 dup(?)
.const
szFileName db 'c:\\masm32\\js\\AutoBack\\pkm',0
szCaption db 'AutoBack',0
szText db '读取文件失败!',0
szFormat db '文件读取成功-hFile:%08x',0dh,0
szDataF db 'c:\\masm32\\js\\AutoBack\\pkm%02d-%02d-%02d',0dh,0
.code
_WinMain proc
local @hFile,@szBuffer
local @Filetime:FILETIME
local @stUTC:SYSTEMTIME
include windows.inc
include gdi32.inc
includelib gdi32.lib
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
.data?
szBuffer db 256 dup(?)
lpCreationTime FILETIME <?>
.const
szFileName db 'c:\123.txt',0
szCaption db 'AutoBack',0
szText db '读取文件失败!',0
szDataF db '文件创建的时间是:%d年%d月%d日',0
MASM32编程获取文件最后修改时间
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;FileName: FileTime.asm
;Function: Show the last write time of file "C:\IO.SYS"
; Author: Purple Endurer
;
;Date Summary
;---------------------------------------------------------------------------
; 2006.10.28 Created and Passed!
.386
.model flat, stdcall
option casemap: none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
;///////////////////////////////////////
; Get the last write time of a file
; input: lpstrFileSpec--the pointer to the file specifier
; output: eax > 0, fail, eax = the begin addr of error message
; eax = 0, success, the time str is stored in g_buffer1
;///////////////////////////////////////
GetFileLastWriteTime PROC lpstrFileSpec: LPSTR, lpstrBuf: LPSTR
LOCAL hOpenFile: HANDLE
LOCAL stFileLastWriteTime: FILETIME
LOCAL stLocalFileTime: FILETIME
LOCAL stSysTime: SYSTEMTIME
LOCAL dwResult: DWORD
; BOOL GetFileTime(
; HANDLE hFile, // identifies the file
; LPFILETIME lpCreationTime, // address of creation time
; LPFILETIME lpLastAccessTime,// address of last access time
; LPFILETIME lpLastWriteTime // address of last write time
; );