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

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x415f0b
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x428
mov eax, dword [0x4251a4]
push ebx
mov ebx, dword [ebp + 0xc]
xor eax, ebp
push esi
mov dword [esp + 0x428], eax
mov eax, dword [0x4251d4]
test eax, eax
push edi
mov edi, dword [ebp + 8]
mov dword [esp + 0x14], edi
mov dword [esp + 0x10], ebx
je 0x407803
mov ecx, dword [eax + 8]
test ecx, ecx
jle 0x407803
mov eax, dword [0x42504c]
mov esi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push edi
push eax
call esi
mov ecx, dword [0x425048]
push ebx
push ecx
call esi
mov eax, dword [0x4251d4]
jmp 0x407c68
mov eax, dword [0x425b88]
test eax, eax
je 0x407839
push 0
push 0x419d1c
push 0x419d10
push 0
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 [0x4251d4]
jmp 0x407c68
xor esi, esi
xor edx, edx
cmp edx, 0x425428
mov dword [esp + 0xc], esi
je 0x40785d
push 0x425428
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov esi, 0x425428
mov dword [esp + 0xc], esi
mov dword [esp + 0x43c], 0
mov eax, dword [0x4251d4]
test eax, eax
je 0x4078b7
mov eax, dword [0x42504c]
push edi
mov edi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push eax
call edi
mov ecx, dword [0x425048]
push ebx
push ecx
call edi
mov edi, dword [0x4251d4]
mov dword [esp + 0x43c], 0xffffffff
test esi, esi
je 0x407c66
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov dword [esp + 0xc], 0
jmp 0x407c66
call fcn.00401a80
push 0x103
push 0x425220
push eax
mov dword [0x4251d0], eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
mov ecx, 8
mov esi, str.mutexTSLOGTSLOG
lea edi, [esp + 0x18]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
xor eax, eax
mov ecx, 0x79
lea edi, [esp + 0x3a]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
mov ecx, 9
mov esi, str.filemapTSLOGTSLOG
lea edi, [esp + 0x220]
rep movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
xor eax, eax
mov ecx, 0x78
lea edi, [esp + 0x246]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
call dword [sym.imp.KERNEL32.dll_GetCurrentProcessId]
mov edi, dword [sym.imp.MSVCR71.dll_wcslen]
mov esi, eax
push esi
push 0x419cbc
lea edx, [esp + 0x20]
push 0x82
push edx
call edi
mov ebx, dword [sym.imp.MSVCR71.dll__snwprintf]
lea eax, [esp + eax*2 + 0x28]
add esp, 4
push eax
call ebx
add esp, 0x10
push esi
push 0x419cbc
lea ecx, [esp + 0x228]
push 0x82
push ecx
call edi
lea edx, [esp + eax*2 + 0x230]
add esp, 4
push edx
call ebx
add esp, 0x10
lea eax, [esp + 0x18]
push eax
push 1
xor esi, esi
push esi
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
cmp eax, esi
mov dword [0x4251dc], eax
jne 0x4079a6
push 0x10
push 0x425220
push str.CreateMutex_failure
push esi
call dword [sym.imp.USER32.dll_MessageBoxW]
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov edi, dword [sym.imp.KERNEL32.dll_GetLastError]
call edi
cmp eax, 0xb7
jne 0x4079c4
mov ecx, dword [0x4251dc]
push 0xffffffffffffffff
push ecx
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
lea edx, [esp + 0x220]
push edx
push 0x24c
push esi
push 4
push esi
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_CreateFileMappingW]
cmp eax, esi
mov dword [0x4251d8], eax
jne 0x407a20
push 0x10
push 0x425220
push str.CreateFileMapping_failure
push esi
call dword [sym.imp.USER32.dll_MessageBoxW]
mov eax, dword [0x4251dc]
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov ecx, dword [0x4251dc]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0xffffffffffffffff
mov dword [0x4251dc], esi
call dword [sym.imp.KERNEL32.dll_ExitProcess]
call edi
mov edx, dword [0x4251d8]
push 0x24c
push esi
push esi
push 0xf001f
cmp eax, 0xb7
push edx
sete bl
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
cmp eax, esi
mov dword [0x4251d4], eax
jne 0x407a97
push 0x10
push 0x425220
push str.MapViewOfFile_failure
push esi
call dword [sym.imp.USER32.dll_MessageBoxW]
mov eax, dword [0x4251d8]
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
push eax
call edi
mov ecx, dword [0x4251dc]
push ecx
mov dword [0x4251d8], esi
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov edx, dword [0x4251dc]
push edx
call edi
push 0xffffffffffffffff
mov dword [0x4251dc], esi
call dword [sym.imp.KERNEL32.dll_ExitProcess]
mov eax, dword [esp + 0x14]
mov ecx, dword [0x42504c]
mov edi, dword [sym.imp.KERNEL32.dll_TlsSetValue]
push eax
push ecx
call edi
mov edx, dword [esp + 0x10]
mov eax, dword [0x425048]
push edx
push eax
call edi
test bl, bl
mov dword [0x425b88], esi
je 0x407b5a
mov eax, dword [0x4251d4]
mov ecx, dword [eax + 0x244]
mov ebx, 0x1000
cmp ecx, ebx
jae 0x407bf2
mov edi, dword [eax + 0x240]
cmp edi, esi
je 0x407b0e
push edi
call dword [sym.imp.KERNEL32.dll_GlobalUnlock]
push edi
call dword [sym.imp.KERNEL32.dll_GlobalFree]
mov ecx, dword [0x4251d4]
mov dword [ecx + 0x244], esi
mov edx, dword [0x4251d4]
mov dword [edx + 0x240], esi
push 0x2000
push esi
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x4251d4]
mov dword [ecx + 0x240], eax
mov edx, dword [0x4251d4]
mov edi, dword [edx + 0x240]
cmp edi, esi
je 0x407bf2
xor eax, eax
mov ecx, 0x800
rep stosd dword es:[edi], eax
mov eax, dword [0x4251d4]
mov dword [eax + 0x244], ebx
jmp 0x407bf2
mov edi, dword [0x4251d4]
push 0x2000
xor eax, eax
mov ecx, 0x93
push esi
rep stosd dword es:[edi], eax
call dword [sym.imp.KERNEL32.dll_GlobalAlloc]
push eax
call dword [sym.imp.KERNEL32.dll_GlobalLock]
mov ecx, dword [0x4251d4]
mov dword [ecx + 0x240], eax
mov edx, dword [0x4251d4]
mov edi, dword [edx + 0x240]
cmp edi, esi
je 0x407bb0
xor eax, eax
mov ecx, 0x800
rep stosd dword es:[edi], eax
mov eax, dword [0x4251d4]
mov dword [eax + 0x244], 0x1000
mov ecx, dword [0x4251d4]
add ecx, 0xc
push ecx
call dword [sym.imp.KERNEL32.dll_InitializeCriticalSection]
mov edx, dword [0x4251d4]
mov dword [edx], 0x26400
mov eax, dword [0x4251d4]
mov dword [eax + 4], 0x24c
mov ecx, dword [0x4251d4]
push 1
call fcn.004033a0
mov ecx, dword [0x4251d4]
push 1
call fcn.00406b90
mov ecx, dword [0x4251d4]
push 1
add ecx, 8
push ecx
call dword [sym.imp.KERNEL32.dll_InterlockedExchangeAdd]
mov ecx, dword [0x4251d4]
mov edx, dword [ecx + 8]
mov dword [0x4251c8], edx
mov eax, dword [ecx + 0xe8]
or ebx, 0xffffffff
cmp eax, ebx
jne 0x407c33
cmp dword [ecx + 0x2c], esi
je 0x407c33
mov eax, dword [ecx + 0x23c]
inc eax
mov dword [0x4251cc], eax
jmp 0x407c3f
mov edx, dword [ecx + 0x23c]
mov dword [0x4251cc], edx
call fcn.00403f80
mov eax, dword [0x4251dc]
push eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
mov edi, dword [0x4251d4]
mov dword [esp + 0x43c], ebx
lea ecx, [esp + 0xc]
call fcn.00401b00
mov eax, edi
mov ecx, dword [esp + 0x434]
mov dword fs:[0], ecx
mov ecx, dword [esp + 0x42c]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.00414f09
mov esp, ebp
pop ebp
ret