Function at 0x405485
Capabilities:
Check if file exists
Delete file
Get file attributes
Get file size
Move file
Set registry value
Terminate process
Timestomp file

Disassembly:
mov eax, 0x4109cc
call fcn.00410480
sub esp, 0x218
push ebx
push esi
push edi
xor esi, esi
mov dword [ebp - 0x10], esp
push esi
push esi
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileW]
push dword [ebp + 0x14]
mov dword [ebp - 4], esi
push esi
push 1
push dword [ebp + 0x10]
push dword [ebp + 8]
call ebx
cmp eax, 0xffffffff
mov dword [ebp - 0x18], eax
jne 0x40574f
push 0x5c
push dword [ebp + 8]
call sub.MSVCRT.dll_wcsrchr
pop ecx
cmp eax, esi
pop ecx
je 0x40564d
mov edi, dword [sym.imp.KERNEL32.dll_lstrcmpiW]
inc eax
inc eax
push str.IDMan.exe
push eax
mov dword [ebp - 0x14], eax
call edi
test eax, eax
jne 0x40555f
mov dword [ebp - 0x14], esi
cmp dword [ebp - 0x18], 0xffffffff
jne 0x40574f
push 0x64
call fcn.00405404
pop ecx
push esi
push esi
push dword [ebp + 0x14]
push esi
push 1
push dword [ebp + 0x10]
push dword [ebp + 8]
call ebx
inc dword [ebp - 0x14]
cmp dword [ebp - 0x14], 0xa
mov dword [ebp - 0x18], eax
jne 0x405553
lea eax, [ebp - 0x1c]
push eax
push str.IDMan.exe
call fcn.0040b44e
pop ecx
cmp eax, esi
pop ecx
je 0x4054f0
push dword [ebp - 0x1c]
push esi
push 1
call dword [sym.imp.KERNEL32.dll_OpenProcess]
mov edi, eax
cmp edi, esi
je 0x4054f0
push esi
push edi
call dword [sym.imp.KERNEL32.dll_TerminateProcess]
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x14], 0x14
jg 0x405643
jmp 0x4054f0
push str.IDMNetMon.dll
push dword [ebp - 0x14]
call edi
test eax, eax
je 0x4055cf
push str.IDMNetMon64.dll
push dword [ebp - 0x14]
call edi
test eax, eax
je 0x4055cf
push str.idmbrbtn.dll
push dword [ebp - 0x14]
call edi
test eax, eax
je 0x4055cf
push str.idmbrbtn64.dll
push dword [ebp - 0x14]
call edi
test eax, eax
je 0x4055cf
push str.IDMVMPrs.dll
push dword [ebp - 0x14]
call edi
test eax, eax
je 0x4055cf
push str.IDMVMPrs64.dll
push dword [ebp - 0x14]
call edi
test eax, eax
je 0x4055cf
push str.IDMFType64.dll
push dword [ebp - 0x14]
call edi
test eax, eax
je 0x4055cf
push str.IDMFType.dll
push dword [ebp - 0x14]
call edi
test eax, eax
jne 0x40564d
lea eax, [ebp - 0x14]
push eax
push 0xf003f
push esi
push str.SoftwareInternet_Download_Manager
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x40564d
lea eax, [ebp - 0x1c]
push 4
push eax
push 4
push esi
push str.InstallStatus
push dword [ebp - 0x14]
mov dword [ebp - 0x1c], 2
call dword [sym.imp.ADVAPI32.dll_RegSetValueExW]
push dword [ebp - 0x14]
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
xor edi, edi
cmp dword [ebp - 0x18], 0xffffffff
jne 0x40574f
push 0x64
call fcn.00405404
pop ecx
push esi
push esi
push dword [ebp + 0x14]
push esi
push 1
push dword [ebp + 0x10]
push dword [ebp + 8]
call ebx
push 0x23
mov dword [ebp - 0x18], eax
inc edi
pop eax
cmp edi, eax
jle 0x405616
cmp dword [ebp - 0x18], 0xffffffff
jne 0x40574f
push dword [ebp + 8]
lea eax, [ebp - 0x224]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
lea eax, [ebp - 0x224]
push 0x416004
push eax
call dword [sym.imp.KERNEL32.dll_lstrcatW]
lea eax, [ebp - 0x224]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x40568e
lea eax, [ebp - 0x224]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
mov edi, dword [sym.imp.KERNEL32.dll_MoveFileExW]
lea eax, [ebp - 0x224]
push 9
push eax
push dword [ebp + 8]
call edi
cmp eax, esi
jne 0x405708
lea eax, [ebp - 0x224]
push 0x416000
push eax
call dword [sym.imp.KERNEL32.dll_lstrcatW]
lea eax, [ebp - 0x224]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4056d7
lea eax, [ebp - 0x224]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
lea eax, [ebp - 0x224]
push 9
push eax
push dword [ebp + 8]
call edi
cmp eax, esi
jne 0x405708
cmp dword [ebp + 0x20], esi
je 0x405701
push 0x10
push str.Cannot_install_new_version
push str.Error_replacing_a_file._r_nPlease_uninstall_your_current_version_of_IDM__reboot__and_try_to_install_the_new_version_again
push esi
call dword [sym.imp.USER32.dll_MessageBoxW]
xor eax, eax
jmp 0x40580d
cmp dword [ebp + 0x20], esi
je 0x405717
mov dword [0x41b968], 1
lea eax, [ebp - 0x18]
push esi
push eax
lea eax, [ebp - 0x14]
push eax
lea eax, [ebp - 0x224]
push eax
mov dword [ebp - 0x14], esi
call fcn.004059d7
push esi
push esi
push dword [ebp + 0x14]
push esi
push 1
push dword [ebp + 0x10]
push dword [ebp + 8]
call ebx
cmp eax, 0xffffffff
mov dword [ebp - 0x18], eax
jne 0x40574f
jmp 0x405701
push esi
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov ecx, dword [ebp + 0xc]
add dword [ecx], eax
cmp dword [ebp + 0x10], 0x80000000
mov ecx, dword [ecx]
jne 0x405779
mov dword [ebp + 8], 2
mov dword [ebp + 0x10], 4
jmp 0x405790
cmp dword [ebp + 0x10], 0xc0000000
jne 0x405790
mov dword [ebp + 8], 4
mov dword [ebp + 0x10], 2
push esi
push ecx
push esi
push dword [ebp + 8]
push esi
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov edi, eax
cmp edi, esi
jne 0x4057b4
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x405701
cmp dword [ebp + 0x18], esi
je 0x4057d1
push 0x41b338
push 0x41b348
push 0x41b340
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_GetFileTime]
cmp dword [ebp + 0x1c], esi
je 0x4057ee
push 0x41b338
push 0x41b348
push 0x41b340
push dword [ebp - 0x18]
call dword [sym.imp.KERNEL32.dll_SetFileTime]
push dword [ebp - 0x18]
mov ebx, dword [sym.imp.KERNEL32.dll_CloseHandle]
call ebx
push esi
push esi
push esi
push dword [ebp + 0x10]
push edi
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
push edi
mov esi, eax
call ebx
mov eax, esi
mov ecx, dword [ebp - 0xc]
pop edi
pop esi
mov dword fs:[0], ecx
pop ebx
leave
ret