MCPcopy Create free account
hub / github.com/qilingframework/qiling / hook_CopyFileA

Function hook_CopyFileA

qiling/os/windows/dlls/kernel32/fileapi.py:860–878  ·  view source on GitHub ↗
(ql: Qiling, address: int, params)

Source from the content-addressed store, hash-verified

858 'bFailIfExists' : BOOL
859})
860def hook_CopyFileA(ql: Qiling, address: int, params):
861 lpExistingFileName = params['lpExistingFileName']
862 lpNewFileName = params['lpNewFileName']
863 bFailIfExists = params['bFailIfExists']
864
865 src = ql.os.path.virtual_to_host_path(lpExistingFileName)
866 dst = ql.os.path.virtual_to_host_path(lpNewFileName)
867
868 if not ql.os.path.is_safe_host_path(src) or not ql.os.path.is_safe_host_path(dst):
869 ql.os.last_error = ERROR_GEN_FAILURE
870 return 0
871
872 if bFailIfExists and os.path.exists(dst):
873 ql.os.last_error = ERROR_FILE_EXISTS
874 return 0
875
876 copyfile(src, dst)
877
878 return 1
879
880# BOOL SetFileAttributesA(
881# LPCSTR lpFileName,

Callers

nothing calls this directly

Calls 3

virtual_to_host_pathMethod · 0.80
is_safe_host_pathMethod · 0.80
existsMethod · 0.45

Tested by

no test coverage detected