Function at 0x406540
Capabilities:
Check mutex on windows
Get common file path
Move file

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x6f4
mov eax, dword [0x4fa2a0]
xor eax, ebp
mov dword [ebp - 4], eax
mov eax, dword [ebp + 8]
mov ecx, dword [ebp + 0x10]
push ebx
push esi
xor ebx, ebx
push ebx
mov dword [ebp - 0x6f0], eax
mov dword [ebp - 0x6ec], ecx
call dword [sym.imp.ole32.dll_CoInitialize]
cmp dword [0x4ff104], ebx
jne 0x40659d
push 0x24d4
call fcn.0042d9ac
add esp, 4
cmp eax, ebx
je 0x406597
mov esi, eax
call fcn.00411390
mov dword [0x4ff104], eax
jmp 0x40659d
mov dword [0x4ff104], ebx
push str.NeoCellInterUninstallMutex
push 1
push ebx
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
je 0x406a6a
push edi
xor edi, edi
jmp 0x4065c3
xor ebx, ebx
cmp dword [0x4ff104], ebx
jne 0x4065f0
push 0x24d4
call fcn.0042d9ac
add esp, 4
cmp eax, ebx
je 0x4065ea
mov esi, eax
call fcn.00411390
mov dword [0x4ff104], eax
jmp 0x4065f0
mov dword [0x4ff104], ebx
call fcn.00411720
push 0x64
call dword [sym.imp.KERNEL32.dll_Sleep]
cmp dword [0x4ff104], ebx
jne 0x40662a
push 0x24d4
call fcn.0042d9ac
add esp, 4
cmp eax, ebx
je 0x406624
mov esi, eax
call fcn.00411390
mov dword [0x4ff104], eax
jmp 0x40662a
mov dword [0x4ff104], ebx
mov ebx, str.NeoCell.exe
call fcn.004117f0
test eax, eax
je 0x40663e
inc edi
cmp edi, 0xa
jb 0x4065c1
mov eax, dword [0x4ff104]
test eax, eax
jne 0x406668
push 0x24d4
call fcn.0042d9ac
add esp, 4
test eax, eax
je 0x406661
mov esi, eax
call fcn.00411390
jmp 0x406663
xor eax, eax
mov dword [0x4ff104], eax
mov ecx, dword [ebp - 0x6ec]
mov ebx, eax
call fcn.00411510
mov esi, dword [0x4ff108]
xor edi, edi
cmp esi, edi
jne 0x4066cf
push 0x18
call fcn.0042d9ac
mov esi, eax
add esp, 4
cmp esi, edi
je 0x4066c7
mov dword [esi], edi
mov dword [esi + 4], edi
mov dword [esi + 8], edi
mov edx, dword [0x4fb44c]
mov eax, dword [edx + 0xc]
mov ecx, 0x4fb44c
call eax
add eax, 0x10
mov dword [esi + 0x10], eax
mov edx, dword [0x4fb44c]
mov eax, dword [edx + 0xc]
mov ecx, 0x4fb44c
call eax
add eax, 0x10
mov dword [esi + 0x14], eax
jmp 0x4066c9
xor esi, esi
mov dword [0x4ff108], esi
mov edx, dword [0x4fb44c]
mov eax, dword [edx + 0xc]
mov ecx, 0x4fb44c
mov dword [ebp - 0x6f4], esi
call eax
mov ecx, str._replace
lea esi, [eax + 0x10]
mov dword [ebp - 0x6ec], esi
test ecx, 0xffff0000
jne 0x40681e
mov edx, ecx
movzx edi, dx
call fcn.004030e0
test eax, eax
je 0x406721
push eax
mov eax, edi
lea edi, [ebp - 0x6ec]
call fcn.004034a0
mov esi, dword [ebp - 0x6ec]
xor edi, edi
mov ebx, dword [ebp - 0x6f4]
lea eax, [ebp - 0x6ec]
call fcn.00404910
add esi, 0xfffffff0
mov ebx, eax
lea edx, [esi + 0xc]
or eax, 0xffffffff
lock xadd dword [edx], eax
dec eax
test eax, eax
jg 0x406752
mov ecx, dword [esi]
mov edx, dword [ecx]
mov eax, dword [edx + 4]
push esi
call eax
cmp ebx, edi
je 0x4067ca
push 0x206
lea edx, [ebp - 0x20a]
xor ecx, ecx
push edi
push edx
mov word [ebp - 0x20c], cx
call fcn.00436f70
add esp, 0xc
push edi
push 0x1c
lea eax, [ebp - 0x20c]
push eax
push edi
call dword [sym.imp.SHELL32.dll_SHGetSpecialFolderPathW]
lea eax, [ebp - 0x20c]
add eax, 0xfffffffe
mov edi, edi
mov cx, word [eax + 2]
add eax, 2
cmp cx, di
jne 0x406790
mov edi, eax
mov ecx, 0xb
mov esi, str.NeoCell_appconfig.dat
rep movsd dword es:[edi], dword [esi]
lea ecx, [ebp - 0x20c]
push ecx
push 0x4d4e70
push 0x4d4e74
push str.generate
movsw word es:[edi], word [esi]
call dword [sym.imp.KERNEL32.dll_WritePrivateProfileStringW]
xor edi, edi
mov esi, dword [0x4ff108]
cmp esi, edi
jne 0x40685b
push 0x18
call fcn.0042d9ac
mov esi, eax
add esp, 4
cmp esi, edi
je 0x406853
mov dword [esi], edi
mov dword [esi + 4], edi
mov dword [esi + 8], edi
mov edx, dword [0x4fb44c]
mov eax, dword [edx + 0xc]
mov ecx, 0x4fb44c
call eax
add eax, 0x10
mov dword [esi + 0x10], eax
mov edx, dword [0x4fb44c]
mov eax, dword [edx + 0xc]
mov ecx, 0x4fb44c
call eax
add eax, 0x10
mov dword [esi + 0x14], eax
jmp 0x406855
mov eax, str._replace
lea edx, [eax + 2]
mov cx, word [eax]
add eax, 2
cmp cx, di
jne 0x406826
sub eax, edx
sar eax, 1
push str._replace
lea ecx, [ebp - 0x6ec]
push ecx
mov ebx, eax
call fcn.00403540
mov esi, dword [ebp - 0x6ec]
jmp 0x406723
xor esi, esi
mov dword [0x4ff108], esi
mov eax, esi
call fcn.00404bf0
test eax, eax
jne 0x406936
mov eax, dword [0x4ff104]
cmp eax, edi
jne 0x406894
push 0x24d4
call fcn.0042d9ac
add esp, 4
cmp eax, edi
je 0x40688d
mov esi, eax
call fcn.00411390
jmp 0x40688f
xor eax, eax
mov dword [0x4ff104], eax
add eax, 0xa28
push str.silent
push eax
call fcn.0042f261
add esp, 8
test eax, eax
je 0x406936
mov ecx, dword [ebp - 0x6f0]
push ecx
call sym.Setup.exe_public:_static_void___cdecl_DuiLib::CPaintManagerUI::SetInstance_struct_HINSTANCE____
add esp, 4
lea esi, [ebp - 0x6e8]
call fcn.00406b30
push edi
push edi
push SysReAllocString
push SysReAllocString
push SysReAllocString
push SysReAllocString
push 0x60000
push 0x10cf0000
push 0x4d4de0
push edi
mov ecx, esi
call sym.Setup.exe_protected_virtual:_int___thiscall_DuiLib::WindowImplBase::CreateMainFrame_struct_HWND_____wchar_t_const___unsigned_long_int__unsigned_long_int__int__int__int__int__struct_HMENU_____bool_
test eax, eax
je 0x406911
mov ecx, esi
call sym.Setup.exe_public:_void___thiscall_DuiLib::CWindowWnd::CenterWindow_void_
push 1
mov ecx, esi
call sym.Setup.exe_public:_struct_HWND______thiscall_DuiLib::CWindowWnd::operator_struct_HWND____void_const
push eax
call dword [sym.imp.USER32.dll_ShowWindow]
call sym.Setup.exe_public:_static_void___cdecl_DuiLib::CPaintManagerUI::MessageLoop_void_
call sym.Setup.exe_public:_static_void___cdecl_DuiLib::CPaintManagerUI::Term_void_
lea eax, [ebp - 0x6e8]
call fcn.00407bc0
lea esi, [ebp - 0x6e8]
call fcn.00406c20
jmp 0x406a32
call fcn.0040a590
call fcn.0040a8f0
call fcn.0040b240
mov eax, dword [0x4ff104]
cmp eax, edi
jne 0x40696f
push 0x24d4
call fcn.0042d9ac
add esp, 4
cmp eax, edi
je 0x406968
mov esi, eax
call fcn.00411390
jmp 0x40696a
xor eax, eax
mov dword [0x4ff104], eax
mov esi, eax
call fcn.0040fc40
call fcn.0040b4e0
call fcn.0040bab0
mov eax, dword [0x4ff108]
cmp eax, edi
jne 0x4069d8
push 0x18
call fcn.0042d9ac
mov esi, eax
add esp, 4
cmp esi, edi
je 0x4069d1
mov dword [esi], edi
mov dword [esi + 4], edi
mov dword [esi + 8], edi
mov edx, dword [0x4fb44c]
mov eax, dword [edx + 0xc]
mov ecx, 0x4fb44c
call eax
add eax, 0x10
mov dword [esi + 0x10], eax
mov edx, dword [0x4fb44c]
mov eax, dword [edx + 0xc]
mov ecx, 0x4fb44c
call eax
add eax, 0x10
mov dword [esi + 0x14], eax
mov eax, esi
jmp 0x4069d3
xor eax, eax
mov dword [0x4ff108], eax
call fcn.00404dc0
test eax, eax
je 0x406a27
push 0x206
lea edx, [ebp - 0x20a]
xor ecx, ecx
push edi
push edx
mov word [ebp - 0x20c], cx
call fcn.00436f70
add esp, 0xc
push 0x104
lea eax, [ebp - 0x20c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 4
push edi
lea ecx, [ebp - 0x20c]
push ecx
call dword [sym.imp.KERNEL32.dll_MoveFileExW]
push edi
push 3
jmp 0x406a2a
push edi
push 1
call fcn.00414bf0
add esp, 8
mov eax, dword [0x4ff104]
cmp eax, edi
jne 0x406a5c
push 0x24d4
call fcn.0042d9ac
add esp, 4
cmp eax, edi
je 0x406a55
mov esi, eax
call fcn.00411390
jmp 0x406a57
xor eax, eax
mov dword [0x4ff104], eax
mov edi, eax
call fcn.00410000
call dword [sym.imp.ole32.dll_CoUninitialize]
pop edi
mov ecx, dword [ebp - 4]
pop esi
xor ecx, ebp
xor eax, eax
pop ebx
call fcn.0042cf67
mov esp, ebp
pop ebp
ret 0x10