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

Disassembly:
mov eax, 0x413ef5
call fcn.00413240
sub esp, 0x428
mov eax, dword [0x4241a4]
push ebx
mov ebx, dword [ebp + 0xc]
xor eax, ebp
push esi
mov dword [ebp - 0x10], eax
mov eax, dword [0x4241d4]
push edi
mov edi, dword [ebp + 8]
xor ecx, ecx
cmp eax, ecx
mov dword [ebp - 0x42c], edi
mov dword [ebp - 0x434], ebx
je 0x408d2a
cmp dword [eax + 8], ecx
jle 0x408d2a
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x42404c]
call esi
push ebx
push dword [0x424048]
call esi
jmp 0x408d53
cmp dword [0x425bc4], ecx
je 0x408d5d
push ecx
push 0x418714
push 0x418708
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 [0x4241d4]
jmp 0x409171
xor eax, eax
mov esi, 0x424428
cmp eax, esi
mov dword [ebp - 0x424], ecx
je 0x408d7b
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov dword [ebp - 0x424], esi
and dword [ebp - 4], 0
cmp dword [0x4241d4], 0
je 0x408dcf
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push dword [0x42404c]
call esi
push ebx
push dword [0x424048]
call esi
mov esi, dword [0x4241d4]
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x424], 0
je 0x40916f
push dword [ebp - 0x424]
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
and dword [ebp - 0x424], 0
jmp 0x40916f
call fcn.00401782
push 0x103
push 0x424220
push eax
mov dword [0x4241d0], 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 0x4186b4
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 0x4186b4
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 [0x4241dc], eax
jne 0x408ebd
push 0x10
push 0x424220
push str.CreateMutex_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
jmp 0x408f95
mov esi, dword [sym.imp.KERNEL32.dll_GetLastError]
call esi
cmp eax, 0xb7
jne 0x408eda
push 0xffffffffffffffff
push dword [0x4241dc]
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 [0x4241d8], eax
jne 0x408f29
push 0x10
push 0x424220
push str.CreateFileMapping_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x4241dc]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x4241dc]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
jmp 0x408f8f
call esi
push edi
push ebx
push ebx
push 0xf001f
push dword [0x4241d8]
cmp eax, 0xb7
sete byte [ebp - 0x425]
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
cmp eax, ebx
mov dword [0x4241d4], eax
jne 0x408f9d
push 0x10
push 0x424220
push str.MapViewOfFile_failure
push ebx
call dword [sym.imp.USER32.dll_MessageBoxW]
push dword [0x4241d8]
mov esi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call esi
push dword [0x4241dc]
mov dword [0x4241d8], ebx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
push dword [0x4241dc]
call esi
mov dword [0x4241dc], ebx
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
push dword [ebp - 0x42c]
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push dword [0x42404c]
call esi
push dword [ebp - 0x434]
push dword [0x424048]
call esi
cmp byte [ebp - 0x425], 0
mov dword [0x425bc4], ebx
je 0x409064
mov eax, dword [0x4241d4]
mov edi, 0x1000
cmp dword [eax + 0x244], edi
jae 0x4090f9
mov esi, dword [eax + 0x240]
cmp esi, ebx
je 0x409016
push esi
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push esi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov eax, dword [0x4241d4]
mov dword [eax + 0x244], ebx
mov eax, dword [0x4241d4]
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 [0x4241d4]
mov dword [ecx + 0x240], eax
mov eax, dword [0x4241d4]
mov eax, dword [eax + 0x240]
cmp eax, ebx
je 0x4090f9
push esi
push ebx
push eax
call sub.MSVCR71.dll_memset
mov eax, dword [0x4241d4]
add esp, 0xc
mov dword [eax + 0x244], edi
jmp 0x4090f9
push edi
push ebx
push dword [0x4241d4]
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 [0x4241d4]
mov dword [ecx + 0x240], eax
mov eax, dword [0x4241d4]
mov eax, dword [eax + 0x240]
cmp eax, ebx
je 0x4090bd
push esi
push ebx
push eax
call sub.MSVCR71.dll_memset
mov eax, dword [0x4241d4]
add esp, 0xc
mov dword [eax + 0x244], 0x1000
mov eax, dword [0x4241d4]
add eax, 0xc
push eax
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov eax, dword [0x4241d4]
mov dword [eax], 0x26099
mov eax, dword [0x4241d4]
mov dword [eax + 4], edi
mov ecx, dword [0x4241d4]
push 1
call fcn.0040402f
mov ecx, dword [0x4241d4]
push 1
call fcn.004082b7
mov eax, dword [0x4241d4]
push 1
add eax, 8
push eax
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
mov ecx, dword [0x4241d4]
mov eax, dword [ecx + 8]
mov dword [0x4241c8], eax
cmp dword [ecx + 0xe8], 0xffffffff
jne 0x40912f
cmp dword [ecx + 0x2c], ebx
je 0x40912f
mov eax, dword [ecx + 0x23c]
inc eax
jmp 0x409135
mov eax, dword [ecx + 0x23c]
mov dword [0x4241cc], eax
call fcn.004055c8
push dword [0x4241dc]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov esi, dword [0x4241d4]
or dword [ebp - 4], 0xffffffff
cmp dword [ebp - 0x424], ebx
je 0x40916f
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.00413159
leave
ret