(ql: Qiling, address: int, params)
| 858 | 'bFailIfExists' : BOOL |
| 859 | }) |
| 860 | def 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, |
nothing calls this directly
no test coverage detected