Function at 0x405b88
Capabilities:
Check mutex and terminate process on windows
Check mutex on windows
Set thread local storage value
Terminate process

Disassembly:
mov eax, 0x4120e3
call fcn.004114d0
sub esp, 0x428
mov eax, dword [0x4211a4]
push ebx
mov ebx, dword [ebp + 0xc]
xor eax, ebp
push esi
mov dword [ebp - 0x10], eax
mov eax, dword [0x4211d4]
push edi
mov edi, dword [ebp + 8]
xor ecx, ecx
cmp eax, ecx
mov dword [ebp - 0x42c], edi
mov dword [ebp - 0x434], ebx
je 0x405be1
cmp dword [eax + 8], ecx
jle 0x405be1
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x42104c]
call esi
push ebx
push dword [0x421048]
call esi
jmp 0x405c0a
cmp dword [0x421b88], ecx
je 0x405c14
push ecx
push 0x415d2c
push 0x415d20
push ecx
call dword [sym.imp.USER32.dll_MessageBoxW]
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_GetCurrentProcess]
push eax
call dword [sym.imp.KERNEL32.dll_TerminateProcess]
mov eax, dword [0x4211d4]
jmp 0x406028
xor eax, eax
mov esi, 0x421428
cmp eax, esi
mov dword [ebp - 0x424], ecx
je 0x405c32
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [ebp - 0x424], esi
and dword [ebp - 4], 0
cmp dword [0x4211d4], 0
je 0x405c86
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x42104c]
call esi
push ebx
push dword [0x421048]
call esi
mov esi, dword [0x4211d4]
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x424], 0
je 0x406026
push dword [ebp - 0x424]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
and dword [ebp - 0x424], 0
jmp 0x406026
call fcn.004016fc
push 0x103
push str.C:Program_FilesXMP.exe
push eax
mov dword [0x4211d0], eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 8
pop ecx
mov esi, str.mutexTSLOGTSLOG
lea edi, [ebp - 0x218]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
push 0x79
pop ecx
xor eax, eax
lea edi, [ebp - 0x1f6]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
push 9
pop ecx
mov esi, str.filemapTSLOGTSLOG
lea edi, [ebp - 0x420]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
push 0x78
pop ecx
xor eax, eax
lea edi, [ebp - 0x3fa]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
mov esi, dword [sym.imp.MSVCR71.dll_wcslen]
push eax
push 0x415ccc
mov dword [ebp - 0x430], eax
mov ebx, 0x82
lea eax, [ebp - 0x218]
push ebx
push eax
call esi
mov edi, dword [sym.imp.MSVCR71.dll__snwprintf]
pop ecx
lea eax, [ebp + eax*2 - 0x218]
push eax
call edi
add esp, 0x10
push dword [ebp - 0x430]
lea eax, [ebp - 0x420]
push 0x415ccc
push ebx
push eax
call esi
pop ecx
lea eax, [ebp + eax*2 - 0x420]
push eax
call edi
add esp, 0x10
lea eax, [ebp - 0x218]
push eax
push 1
xor ebx, ebx
push ebx
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
cmp eax, ebx
mov dword [0x4211dc], eax
jne 0x405d74
push 0x10
push str.C:Program_FilesXMP.exe
push str.CreateMutex_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
jmp 0x405e4c
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
cmp eax, 0xb7
jne 0x405d91
push 0xffffffffffffffff
push dword [0x4211dc]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea eax, [ebp - 0x420]
push eax
mov edi, 0x24c
push edi
push ebx
push 4
push ebx
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
cmp eax, ebx
mov dword [0x4211d8], eax
jne 0x405de0
push 0x10
push str.C:Program_FilesXMP.exe
push str.CreateFileMapping_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x4211dc]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x4211dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x405e46
call esi
push edi
push ebx
push ebx
push 0xf001f
push dword [0x4211d8]
cmp eax, 0xb7
sete byte [ebp - 0x425]
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
cmp eax, ebx
mov dword [0x4211d4], eax
jne 0x405e54
push 0x10
push str.C:Program_FilesXMP.exe
push str.MapViewOfFile_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x4211d8]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [0x4211dc]
mov dword [0x4211d8], ebx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x4211dc]
call esi
mov dword [0x4211dc], ebx
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
push dword [ebp - 0x42c]
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push dword [0x42104c]
call esi
push dword [ebp - 0x434]
push dword [0x421048]
call esi
cmp byte [ebp - 0x425], 0
mov dword [0x421b88], ebx
je 0x405f1b
mov eax, dword [0x4211d4]
mov edi, 0x1000
cmp dword [eax + 0x244], edi
jae 0x405fb0
mov esi, dword [eax + 0x240]
cmp esi, ebx
je 0x405ecd
push esi
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov eax, dword [0x4211d4]
mov dword [eax + 0x244], ebx
mov eax, dword [0x4211d4]
mov dword [eax + 0x240], ebx
mov esi, 0x2000
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x4211d4]
mov dword [ecx + 0x240], eax
mov eax, dword [0x4211d4]
mov eax, dword [eax + 0x240]
cmp eax, ebx
je 0x405fb0
push esi
push ebx
push eax
call sub.MSVCR71.dll_memset
mov eax, dword [0x4211d4]
add esp, 0xc
mov dword [eax + 0x244], edi
jmp 0x405fb0
push edi
push ebx
push dword [0x4211d4]
call sub.MSVCR71.dll_memset
add esp, 0xc
mov esi, 0x2000
push esi
push ebx
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x4211d4]
mov dword [ecx + 0x240], eax
mov eax, dword [0x4211d4]
mov eax, dword [eax + 0x240]
cmp eax, ebx
je 0x405f74
push esi
push ebx
push eax
call sub.MSVCR71.dll_memset
mov eax, dword [0x4211d4]
add esp, 0xc
mov dword [eax + 0x244], 0x1000
mov eax, dword [0x4211d4]
add eax, 0xc
push eax
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov eax, dword [0x4211d4]
mov dword [eax], 0x26400
mov eax, dword [0x4211d4]
mov dword [eax + 4], edi
mov ecx, dword [0x4211d4]
push 1
call fcn.00402910
mov ecx, dword [0x4211d4]
push 1
call fcn.0040516e
mov eax, dword [0x4211d4]
push 1
add eax, 8
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
mov ecx, dword [0x4211d4]
mov eax, dword [ecx + 8]
mov dword [0x4211c8], eax
cmp dword [ecx + 0xe8], 0xffffffff
jne 0x405fe6
cmp dword [ecx + 0x2c], ebx
je 0x405fe6
mov eax, dword [ecx + 0x23c]
inc eax
jmp 0x405fec
mov eax, dword [ecx + 0x23c]
mov dword [0x4211cc], eax
call fcn.004030dc
push dword [0x4211dc]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov esi, dword [0x4211d4]
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x424], ebx
je 0x406026
push dword [ebp - 0x424]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [ebp - 0x424], ebx
mov eax, esi
mov ecx, dword [ebp - 0xc]
pop edi
mov dword fs:[0], ecx
mov ecx, dword [ebp - 0x10]
pop esi
xor ecx, ebp
pop ebx
call fcn.004113e5
leave
ret