Function at 0x409540
Capabilities:
Check if file exists
Copy file
Get common file path
Get file attributes
Set file attributes

Disassembly:
sub esp, 0x31c
push ebx
mov ebx, dword [esp + 0x328]
push ebp
push esi
push edi
mov esi, ecx
push ebx
mov dword [esp + 0x14], esi
mov dword [esp + 0x18], 0
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
mov ebp, dword [esp + 0x330]
cmp eax, 0xffffffff
je 0x4095a8
test al, 1
je 0x409580
and al, 0xfe
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetFileAttributesA]
push ebx
push ebp
mov ecx, esi
call fcn.0040b070
test eax, eax
je 0x409592
cmp eax, 3
jne 0x40959b
push ebx
push ebp
mov ecx, esi
call fcn.00402960
cmp eax, 2
je 0x4095a8
test eax, eax
jne 0x4097b4
push 0
push ebx
push ebp
call dword [sym.imp.KERNEL32.dll_CopyFileA]
test eax, eax
jne 0x4097b4
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0x20
je 0x4095f2
cmp eax, 5
je 0x4095f2
cmp eax, 0x4c8
je 0x4095f2
push ebx
push ebp
push str.Copying__s_____s_FAILED:
push 1
push esi
call fcn.004044c0
add esp, 0x14
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x31c
ret 0xc
push str.kernel32.dll
call dword [sym.imp.KERNEL32.dll_LoadLibraryA]
test eax, eax
mov dword [esp + 0x18], eax
je 0x409730
push str.MoveFileExA
push eax
call dword [sym.imp.KERNEL32.dll_GetProcAddress]
test eax, eax
mov dword [esp + 0x1c], eax
je 0x409719
mov ecx, 0x41
xor eax, eax
lea edi, [esp + 0x124]
rep stosd dword es:[edi], eax
mov ecx, 0x41
lea edi, [esp + 0x228]
rep stosd dword es:[edi], eax
mov ecx, 0x41
lea edi, [esp + 0x20]
rep stosd dword es:[edi], eax
lea eax, [esp + 0x228]
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
push 0x5c
push ebp
call fcn.0040c390
add esp, 8
test eax, eax
jne 0x409677
lea edx, [esp + 0x20]
mov edi, str.SSTEMP
jmp 0x40967e
lea edi, [eax + 1]
lea edx, [esp + 0x20]
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, edx
lea edx, [esp + 0x20]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
lea eax, [esp + 0x228]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea ecx, [esp + 0x124]
push ecx
push 0
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetTempFileNameA]
test eax, eax
je 0x409719
mov esi, dword [esp + 0x1c]
lea ecx, [esp + 0x124]
push 1
push ecx
push ebx
call esi
test eax, eax
je 0x409719
push 0
push ebx
push ebp
call dword [sym.imp.KERNEL32.dll_CopyFileA]
test eax, eax
je 0x4096fe
mov edx, dword [esp + 0x10]
push ebx
push str._s_is_updated
push 0
push edx
mov dword [esp + 0x24], 1
call fcn.004044c0
add esp, 0x10
jmp 0x40970b
push 1
lea eax, [esp + 0x128]
push ebx
push eax
call esi
push 4
lea ecx, [esp + 0x128]
push 0
push ecx
call esi
mov edx, dword [esp + 0x18]
push edx
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov eax, dword [esp + 0x14]
test eax, eax
jne 0x4097b4
mov edi, dword [sym.imp.USER32.dll_wsprintfA]
mov esi, 2
push esi
push ebx
lea eax, [esp + 0x28]
push str._s___d_
push eax
call edi
add esp, 0x10
lea ecx, [esp + 0x20]
push 1
push ecx
push ebp
call dword [sym.imp.KERNEL32.dll_CopyFileA]
test eax, eax
jne 0x409766
inc esi
cmp esi, 0x20
jl 0x40973b
jmp 0x40976b
cmp esi, 0x20
jl 0x409794
mov eax, dword [esp + 0x10]
lea edx, [esp + 0x20]
push edx
push ebp
push str.Copying__s_____s_FAILED:
push 1
push eax
call fcn.004044c0
add esp, 0x14
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x31c
ret 0xc
lea ecx, [esp + 0x20]
push ebx
push ecx
mov ecx, dword [esp + 0x18]
call fcn.0040ae50
test eax, eax
jne 0x4097b4
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x31c
ret 0xc
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
test al, 1
je 0x4097c9
and al, 0xfe
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetFileAttributesA]
pop edi
pop esi
pop ebp
mov eax, 1
pop ebx
add esp, 0x31c
ret 0xc