很简单
include
windows.h
;常用数据结构、类型定义
include
kernel32.inc
;CopyFile的包含文件头
includelib kernel32.lib
;CopyFile的实现,由于不是静态库。实际上这里会被编译程序构造为'PE'导入表
.data
SrcFile
db 'c:\1.txt',0
;源文件路径
DestFile db 'd:\11.txt',0
;目标文件路径
.........
invoke CopyFile,offset SrcFile,offset DestFile,FALSE
;调用函数,完成Copy
..........
MSDN具体说明:
BOOL WINAPI CopyFile(
__in
LPCTSTR lpExistingFileName,
__in
LPCTSTR lpNewFileName,
__in
BOOL bFailIfExists
);
Parameters
lpExistingFileName [in]
The name of an existing file.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.
If lpExistingFileName does not exist, CopyFile fails, and GetLastError returns ERROR_FILE_NOT_FOUND.
lpNewFileName [in]
The name of the new file.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.
bFailIfExists [in]
If this parameter is TRUE and the new file specified by lpNewFileName already exists, the function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.