Function at 0x405959
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, 0x411308
call fcn.00410db0
sub esp, 0x218
push ebx
push esi
push edi
xor edi, edi
mov dword [ebp - 0x10], esp
push edi
push edi
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileW]
push dword [ebp + 0x14]
mov dword [ebp - 4], edi
push edi
push 1
push dword [ebp + 0x10]
push dword [ebp + 8]
call ebx
cmp eax, 0xffffffff
mov dword [ebp - 0x18], eax
jne 0x405c75
push 0x5c
push dword [ebp + 8]
call sub.MSVCRT.dll_wcsrchr
pop ecx
cmp eax, edi
pop ecx
je 0x405b73
mov esi, dword [sym.imp.KERNEL32.dll_lstrcmpiW]
inc eax
inc eax
push str.IDMan.exe
push eax
mov dword [ebp - 0x14], eax
call esi
test eax, eax
jne 0x405a33
mov dword [ebp - 0x14], edi
cmp dword [ebp - 0x18], 0xffffffff
jne 0x405c75
push 0x64
call fcn.004058d8
pop ecx
push edi
push edi
push dword [ebp + 0x14]
push edi
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 0x405a27
lea eax, [ebp - 0x1c]
push eax
push str.IDMan.exe
call fcn.0040bbea
pop ecx
cmp eax, edi
pop ecx
je 0x4059c4
push dword [ebp - 0x1c]
push edi
push 1
call dword [sym.imp.KERNEL32.dll_OpenProcess]
mov esi, eax
cmp esi, edi
je 0x4059c4
push edi
push esi
call dword [sym.imp.KERNEL32.dll_TerminateProcess]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
cmp dword [ebp - 0x14], 0x14
jg 0x405b69
jmp 0x4059c4
push str.IDMNetMon.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMNetMon64.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMNetMonAA.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMIntegratorAA.exe
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMIntegrator64.exe
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.idmbrbtn.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.idmbrbtn64.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.idmbrbtnAA.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMVMPrs.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMVMPrs64.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMVMPrsAA.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMFType64.dll
push dword [ebp - 0x14]
call esi
test eax, eax
je 0x405af5
push str.IDMFType.dll
push dword [ebp - 0x14]
call esi
test eax, eax
jne 0x405b73
lea eax, [ebp - 0x14]
push eax
push 0xf003f
push edi
push str.SoftwareInternet_Download_Manager
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
test eax, eax
jne 0x405b73
lea eax, [ebp - 0x1c]
push 4
push eax
push 4
push edi
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 esi, esi
cmp dword [ebp - 0x18], 0xffffffff
jne 0x405c75
push 0x64
call fcn.004058d8
pop ecx
push edi
push edi
push dword [ebp + 0x14]
push edi
push 1
push dword [ebp + 0x10]
push dword [ebp + 8]
call ebx
push 0x23
mov dword [ebp - 0x18], eax
inc esi
pop eax
cmp esi, eax
jle 0x405b3c
cmp dword [ebp - 0x18], 0xffffffff
jne 0x405c75
push dword [ebp + 8]
lea eax, [ebp - 0x224]
push eax
call dword [sym.imp.KERNEL32.dll_lstrcpyW]
lea eax, [ebp - 0x224]
push 0x417218
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 0x405bb4
lea eax, [ebp - 0x224]
push eax
call dword [sym.imp.KERNEL32.dll_DeleteFileW]
mov esi, dword [sym.imp.KERNEL32.dll_MoveFileExW]
lea eax, [ebp - 0x224]
push 9
push eax
push dword [ebp + 8]
call esi
cmp eax, edi
jne 0x405c2e
lea eax, [ebp - 0x224]
push 0x417214
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 0x405bfd
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 esi
cmp eax, edi
jne 0x405c2e
cmp dword [ebp + 0x20], edi
je 0x405c27
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 edi
call dword [sym.imp.USER32.dll_MessageBoxW]
xor eax, eax
jmp 0x405d2c
cmp dword [ebp + 0x20], edi
je 0x405c3d
mov dword [0x41cd38], 1
lea eax, [ebp - 0x14]
push edi
push eax
lea eax, [ebp - 0x18]
push eax
lea eax, [ebp - 0x224]
push eax
mov dword [ebp - 0x18], edi
call fcn.00405ef6
push edi
push edi
push dword [ebp + 0x14]
push edi
push 1
push dword [ebp + 0x10]
push dword [ebp + 8]
call ebx
cmp eax, 0xffffffff
mov dword [ebp - 0x18], eax
jne 0x405c75
jmp 0x405c27
mov esi, dword [ebp - 0x18]
push edi
push esi
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 0x405ca0
mov dword [ebp + 8], 2
mov dword [ebp + 0x10], 4
jmp 0x405cb7
cmp dword [ebp + 0x10], 0xc0000000
jne 0x405cb7
mov dword [ebp + 8], 4
mov dword [ebp + 0x10], 2
push edi
push ecx
push edi
push dword [ebp + 8]
push edi
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov ebx, eax
cmp ebx, edi
jne 0x405cd7
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x405c27
cmp dword [ebp + 0x18], edi
je 0x405cf2
push 0x41c708
push 0x41c718
push 0x41c710
push esi
call dword [sym.imp.KERNEL32.dll_GetFileTime]
cmp dword [ebp + 0x1c], edi
je 0x405d0d
push 0x41c708
push 0x41c718
push 0x41c710
push esi
call dword [sym.imp.KERNEL32.dll_SetFileTime]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push edi
push edi
push edi
push dword [ebp + 0x10]
push ebx
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
push ebx
mov esi, eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, esi
mov ecx, dword [ebp - 0xc]
pop edi
pop esi
mov dword fs:[0], ecx
pop ebx
leave
ret