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

Disassembly:
push ebp
sub esp, 0x410
lea ebp, [esp - 4]
mov eax, dword [0x4313f4]
xor eax, ebp
mov dword [ebp + 0x410], eax
push 0x14
mov eax, 0x41b3fa
call fcn.004127a4
mov eax, dword [ebp + 0x420]
mov edi, dword [ebp + 0x41c]
mov dword [ebp - 0x18], eax
mov eax, dword [0x4317fc]
xor ebx, ebx
mov dword [ebp - 0x20], edi
cmp eax, ebx
je 0x40737f
mov eax, dword [eax + 8]
test eax, eax
jle 0x40737f
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x431018]
call esi
push dword [ebp - 0x18]
push dword [0x43101c]
call esi
mov eax, dword [0x4317fc]
jmp 0x407770
mov eax, dword [0x431f84]
test eax, eax
je 0x4073ab
push ebx
push 0x420310
push 0x420304
push ebx
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]
jmp 0x407375
xor eax, eax
mov esi, 0x43159c
mov dword [ebp - 0x10], ebx
cmp eax, esi
je 0x4073c3
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [ebp - 0x10], esi
mov dword [ebp - 4], ebx
cmp dword [0x4317fc], ebx
je 0x4073ed
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x431018]
call esi
push dword [ebp - 0x18]
push dword [0x43101c]
call esi
jmp 0x407753
call fcn.0040172d
push 0x103
push 0x4315b8
push eax
mov dword [0x431800], eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push 8
pop ecx
mov esi, str.mutexTSLOGTSLOG
lea edi, [ebp]
rep movsd dword es:[edi], dword [esi]
push 0x1e6
lea eax, [ebp + 0x22]
push ebx
push eax
movsw word es:[edi], word [esi]
call sub.MSVCR90.dll_memset
push 9
pop ecx
mov esi, str.filemapTSLOGTSLOG
lea edi, [ebp + 0x208]
rep movsd dword es:[edi], dword [esi]
push 0x1e2
lea eax, [ebp + 0x22e]
push ebx
push eax
movsw word es:[edi], word [esi]
call sub.MSVCR90.dll_memset
add esp, 0x18
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
mov esi, dword [sym.imp.MSVCR90.dll_wcslen]
push eax
push 0x4202b0
mov dword [ebp - 0x1c], eax
lea eax, [ebp]
push 0x82
push eax
call esi
mov edi, dword [sym.imp.MSVCR90.dll__snwprintf]
pop ecx
lea eax, [ebp + eax*2]
push eax
call edi
add esp, 0x10
push dword [ebp - 0x1c]
lea eax, [ebp + 0x208]
push 0x4202b0
push 0x82
push eax
call esi
pop ecx
lea eax, [ebp + eax*2 + 0x208]
push eax
call edi
add esp, 0x10
lea eax, [ebp]
push eax
push 1
push ebx
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
mov dword [0x4317f4], eax
cmp eax, ebx
jne 0x4074d3
push 0x10
push 0x4315b8
push str.CreateMutex_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
cmp eax, 0xb7
jne 0x4074f0
push 0xffffffffffffffff
push dword [0x4317f4]
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea eax, [ebp + 0x208]
push eax
mov edi, 0x24c
push edi
push ebx
push 4
push ebx
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
mov dword [0x4317f8], eax
cmp eax, ebx
jne 0x407545
push 0x10
push 0x4315b8
push str.CreateFileMapping_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x4317f4]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x4317f4]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov dword [0x4317f4], ebx
jmp 0x4074cb
call esi
push edi
push ebx
push ebx
push 0xf001f
push dword [0x4317f8]
cmp eax, 0xb7
sete byte [ebp - 0x11]
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov dword [0x4317fc], eax
cmp eax, ebx
jne 0x4075aa
push 0x10
push 0x4315b8
push str.MapViewOfFile_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x4317f8]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [0x4317f4]
mov dword [0x4317f8], ebx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x4317f4]
call esi
jmp 0x40753d
push dword [ebp - 0x20]
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push dword [0x431018]
call esi
push dword [ebp - 0x18]
push dword [0x43101c]
call esi
mov dword [0x431f84], ebx
cmp byte [ebp - 0x11], bl
je 0x407667
mov eax, dword [0x4317fc]
mov edi, 0x1000
cmp dword [eax + 0x244], edi
jae 0x4076fc
mov esi, dword [eax + 0x240]
cmp esi, ebx
je 0x407619
push esi
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov eax, dword [0x4317fc]
mov dword [eax + 0x244], ebx
mov eax, dword [0x4317fc]
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 [0x4317fc]
mov dword [ecx + 0x240], eax
mov eax, dword [0x4317fc]
add eax, 0x240
cmp dword [eax], ebx
je 0x4076fc
push esi
push ebx
push dword [eax]
call sub.MSVCR90.dll_memset
mov eax, dword [0x4317fc]
add esp, 0xc
mov dword [eax + 0x244], edi
jmp 0x4076fc
push edi
push ebx
push dword [0x4317fc]
call sub.MSVCR90.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 [0x4317fc]
mov dword [ecx + 0x240], eax
mov eax, dword [0x4317fc]
add eax, 0x240
cmp dword [eax], ebx
je 0x4076c0
push esi
push ebx
push dword [eax]
call sub.MSVCR90.dll_memset
mov eax, dword [0x4317fc]
add esp, 0xc
mov dword [eax + 0x244], 0x1000
mov eax, dword [0x4317fc]
add eax, 0xc
push eax
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov eax, dword [0x4317fc]
mov dword [eax], 0x28100
mov eax, dword [0x4317fc]
mov dword [eax + 4], edi
mov ecx, dword [0x4317fc]
push 1
call fcn.00402f71
mov ecx, dword [0x4317fc]
push 1
call fcn.00405e82
mov eax, dword [0x4317fc]
push 1
add eax, 8
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
mov eax, dword [0x4317fc]
mov eax, dword [eax + 8]
mov ecx, dword [0x4317fc]
mov dword [0x431808], eax
cmp dword [ecx + 0xe8], 0xffffffff
jne 0x407737
cmp dword [ecx + 0x2c], ebx
je 0x407737
mov eax, dword [ecx + 0x23c]
inc eax
jmp 0x40773d
mov eax, dword [ecx + 0x23c]
mov dword [0x431804], eax
call fcn.004071a2
push dword [0x4317f4]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov esi, dword [0x4317fc]
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x10], ebx
je 0x40776e
push dword [ebp - 0x10]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [ebp - 0x10], ebx
mov eax, esi
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp + 0x410]
xor ecx, ebp
call fcn.0041276a
add ebp, 0x414
leave
ret