Function at 0x428810
Capabilities:
Check mutex on windows
Get thread local storage value
Resolve function by parsing pe exports
Set thread local storage value

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x486965
mov eax, dword fs:[0]
push eax
sub esp, 0x60
mov eax, dword [0x49c33c]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, ecx
mov dword [ebp - 0x68], edi
mov eax, dword [ebp + 0x10]
push dword [edi + 0x6c]
mov ebx, dword [ebp + 8]
mov esi, dword [ebp + 0xc]
mov dword [ebp - 0x54], ebx
mov dword [edi + 0x8c], eax
call fcn.0042f876
push dword [edi + 0x74]
call fcn.0042f876
mov ecx, ebx
mov dword [edi + 0xf0], 0
add esp, 8
mov dword [edi + 0xf4], 0
mov dword [edi + 0xf8], 0
mov dword [edi + 0xfc], 0
mov dword [edi + 0x100], 0
lea edx, [ecx + 1]
mov dword [edi + 0x104], 0
mov dword [edi + 0x16c], 0
mov dword [edi + 0x170], 0
mov dword [edi + 0x174], 0
mov byte [edi + 0xe4], 0
mov byte [edi + 0x178], 0
mov al, byte [ecx]
inc ecx
test al, al
jne 0x4288d2
sub ecx, edx
mov dword [edi + 0x70], ecx
lea eax, [ecx + 0x10]
push eax
call fcn.0042f8b9
push dword [ebp - 0x54]
mov ebx, eax
push str._s.in
push ebx
call fcn.00406100
add esp, 0x10
mov dword [edi + 0x6c], ebx
test esi, esi
jne 0x428923
mov eax, dword [edi + 0x70]
add eax, 5
push eax
call fcn.0042f8b9
push dword [ebp - 0x54]
mov dword [edi + 0x74], eax
push str._s.fdb
push eax
call fcn.00406100
add esp, 0x10
jmp 0x42894f
mov ecx, esi
lea edx, [ecx + 1]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x428928
sub ecx, edx
lea eax, [ecx + 1]
push eax
call fcn.0042f8b9
add esp, 4
mov dword [edi + 0x74], eax
sub eax, esi
mov cl, byte [esi]
lea esi, [esi + 1]
mov byte [eax + esi - 1], cl
test cl, cl
jne 0x428942
push ebx
push 1
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateMutexA]
mov dword [edi + 0xc4], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp eax, 0xb7
jne 0x4289c9
push 0xffffffffffffffff
push dword [edi + 0xc4]
call esi
push dword [edi + 0xc4]
neg eax
sbb eax, eax
inc eax
mov dword [ebp - 0x5c], eax
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
cmp dword [ebp - 0x5c], 0
jne 0x4289d9
push 0
push str.Failed_to_start_database_initialization
mov eax, dword [edi]
mov ecx, edi
push 4
call dword [eax]
xor al, al
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0042f865
mov esp, ebp
pop ebp
ret 0x18
cmp dword [edi + 0xc4], 0
je 0x42899a
mov dword [ebp - 0x5c], 2
push dword [ebp - 0x54]
push str._s.dm
push ebx
call fcn.00406100
add esp, 0xc
push ebx
push 0x80048
push 0
push 4
push 0x49e294
push 0xffffffffffffffff
call dword [sym.imp.KERNEL32.dll_CreateFileMappingA]
mov dword [edi + 0xb0], eax
test eax, eax
je 0x428a33
push 0
push 0
push 0
push 0xf001f
push eax
call dword [sym.imp.KERNEL32.dll_MapViewOfFile]
mov dword [edi + 0xac], eax
test eax, eax
jne 0x428a3f
push dword [edi + 0xb0]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0
push str.Failed_to_open_database_monitor
jmp 0x4289a1
push dword [ebp - 0x54]
mov dword [edi + 0xd8], eax
push str._s.ws
push ebx
call fcn.00406100
add esp, 0xc
push ebx
push 0xf4240
push 0
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateSemaphoreA]
mov dword [edi + 0xc8], eax
test eax, eax
jne 0x428a7e
push eax
push str.Failed_to_initialize_database_writers_semaphore
jmp 0x4289a1
push dword [ebp - 0x54]
push str._s.rs
push ebx
call fcn.00406100
add esp, 0xc
push ebx
push 0xf4240
push 0
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateSemaphoreA]
mov dword [edi + 0xcc], eax
test eax, eax
jne 0x428ab7
push eax
push str.Failed_to_initialize_database_readers_semaphore
jmp 0x4289a1
push dword [ebp - 0x54]
push str._s.us
push ebx
call fcn.00406100
add esp, 0xc
push ebx
push 0xf4240
push 0
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateSemaphoreA]
mov dword [edi + 0xd0], eax
test eax, eax
jne 0x428af0
push eax
push str.Failed_to_initialize_database_upgrade_semaphore
jmp 0x4289a1
push dword [ebp - 0x54]
push str._s.bce
push ebx
call fcn.00406100
add esp, 0xc
push ebx
push 0
push 1
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateEventA]
mov dword [edi + 0xd4], eax
test eax, eax
jne 0x428b26
push eax
push str.Failed_to_initialize_database_backup_completed_event
jmp 0x4289a1
mov eax, dword [ebp + 0x18]
or eax, dword [ebp + 0x1c]
je 0x428b91
push dword [ebp - 0x54]
push str._s.dce
push ebx
call fcn.00406100
add esp, 0xc
push ebx
push 0
push 1
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateEventA]
mov dword [edi + 0x144], eax
push 0
test eax, eax
jne 0x428b65
push str.Failed_to_initialize_delayed_commit_event
jmp 0x4289a1
push 0
push 1
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateEventA]
push 0
push 0
push 1
push 0x49e294
mov dword [edi + 0x140], eax
call dword [sym.imp.KERNEL32.dll_CreateEventA]
mov dword [edi + 0x148], eax
push 0
push 0
push 1
push 0x49e294
call dword [sym.imp.KERNEL32.dll_CreateEventA]
mov dword [edi + 0x168], eax
mov ecx, 0x2002
mov eax, dword [edi + 0x14]
cmp eax, ecx
mov dword [edi + 0x16c], 0
cmovb eax, ecx
mov dword [edi + 0xe8], 0
mov ecx, 0x100000
mov dword [edi + 0x7c], 0
lea edx, [eax + 0x3ff]
mov eax, dword [edi + 0xc]
and edx, 0xfffffc00
test eax, eax
mov dword [ebp - 0x60], edx
cmovne ecx, eax
mov eax, edx
shl eax, 4
cmp ecx, eax
cmovae eax, ecx
mov ecx, 0x8004
add eax, 0x7ffff
and eax, 0xfff80000
mov dword [ebp - 0x64], eax
nop dword [eax + eax]
mov eax, dword [edi + 0xe0]
mov dword [ecx + eax], bind
sub ecx, 4
jns 0x428c10
lea eax, [edi + 0x188]
mov dword [edi + 0x60], 2
mov dword [edi + 0x58], 2
mov dword [edi + 0x64], 0
mov dword [edi + 0x5c], 0
mov dword [edi + 0x68], 0
mov dword [edi + 0xdc], 0
mov byte [edi + 0x54], 0
mov dword [eax + 4], eax
mov dword [eax], eax
push dword [edi + 0x38]
call dword [sym.imp.KERNEL32.dll_TlsGetValue]
test eax, eax
jne 0x428d37
push 0xf8
call fcn.0042f87b
mov esi, eax
add esp, 4
mov dword [ebp - 0x58], esi
mov dword [ebp - 0x6c], esi
mov dword [ebp - 4], 0
test esi, esi
je 0x428cdc
mov dword [esi + 4], esi
mov dword [esi], esi
lea eax, [esi + 0x18]
mov dword [eax + 4], eax
mov dword [eax], eax
lea ecx, [esi + 0x20]
mov byte [ebp - 4], 2
call fcn.00418630
mov dword [esi + 0x10], 0
mov dword [esi + 8], 0
mov dword [esi + 0xc], 0
mov dword [esi + 0x14], 0
mov dword [esi + 0xb4], 0
call dword [sym.imp.KERNEL32.dll_GetCurrentThreadId]
mov dword [esi + 0xb0], eax
jmp 0x428ce3
mov dword [ebp - 0x58], 0
cmp byte [edi + 0x1a8], 0
lea esi, [edi + 0x190]
mov dword [ebp - 4], 0xffffffff
je 0x428d00
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov ecx, dword [ebp - 0x58]
lea edx, [edi + 0x188]
mov dword [ecx + 4], edx
mov eax, dword [edx]
mov dword [ecx], eax
mov eax, dword [edx]
mov dword [eax + 4], ecx
mov dword [edx], ecx
cmp byte [esi + 0x18], 0
je 0x428d27
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov ecx, dword [ebp - 0x58]
push ecx
push dword [edi + 0x38]
call dword [sym.imp.KERNEL32.dll_TlsSetValue]
mov esi, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
cmp dword [ebp - 0x5c], 2
jne 0x4292fe
push dword [ebp - 0x54]
push str._s.cs
push ebx
call fcn.00406100
add esp, 0xc
lea ecx, [edi + 0xb4]
push dword [edi + 0xd8]
push ebx
call fcn.00422e90
test al, al
jne 0x428d74
push 0
push str.Failed_to_initialize_database_monitor
jmp 0x4289a1
cmp dword [edi + 8], 3
jne 0x428da5
push dword [ebp - 0x54]
push str._s.mcs
push ebx
call fcn.00406100
mov eax, dword [edi + 0xd8]
lea ecx, [edi + 0xbc]
add esp, 0xc
add eax, 4
push eax
push ebx
call fcn.00422e90
test al, al
je 0x428d68
push 0
push dword [edi + 0xcc]
call esi
test eax, eax
je 0x428da5
push 0
push dword [edi + 0xc8]
call esi
test eax, eax
je 0x428db3
push 0
push dword [edi + 0xd0]
call esi
test eax, eax
je 0x428dc1
mov eax, dword [edi + 0xd8]
push 0x80000
push 0
mov dword [eax + 8], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0xc], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x10], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x14], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x18], 0
mov eax, dword [edi + 0xd8]
mov dword [edi + 0x78], 1
mov dword [eax + 0x38], 1
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x3c], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x20], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x1c], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x34], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x44], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x30], 1
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x2c], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x24], 0
mov eax, dword [edi + 0xd8]
add eax, 0x48
push eax
call fcn.00432290
push dword [edi + 0x78]
push dword [ebp - 0x54]
push str._s._d
push dword [edi + 0x6c]
call fcn.00406100
mov eax, dword [edi + 8]
add esp, 0x1c
test eax, eax
je 0x428ec8
cmp eax, 2
je 0x428ec8
xor al, al
jmp 0x428eca
mov al, 1
push 0
push dword [ebp - 0x64]
lea ecx, [edi + 0x98]
push eax
push dword [edi + 0x6c]
push dword [edi + 0x74]
call fcn.0042f520
test eax, eax
je 0x428f0e
push 0x40
lea ecx, [ebp - 0x50]
push ecx
push eax
call fcn.0042f490
lea eax, [ebp - 0x50]
push eax
push str.File_open_error:__s_n
call fcn.0041a150
add esp, 0x14
push 0
push str.Failed_to_create_database_file
jmp 0x4289a1
mov eax, dword [edi + 0xa4]
mov edx, dword [edi + 0xa8]
mov dword [edi + 0x3c], eax
mov dword [edi + 0x40], eax
mov dword [edi + 0x88], 0
mov ecx, dword [eax + 4]
cmp ecx, 1
jbe 0x428f3e
push 0
push str.Database_file_was_corrupted:_invalid_root_index
jmp 0x4289a1
cmp dword [eax + 0xc], 1
je 0x429297
mov ecx, dword [edi + 8]
test ecx, ecx
je 0x42928b
cmp ecx, 2
je 0x42928b
mov dword [eax + 4], 0
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x28], 0
mov eax, dword [edi + 0x40]
mov dword [eax], edx
mov eax, dword [edi + 0x40]
mov edx, dword [ebp - 0x60]
mov dword [eax + 0x14], 0x1000
mov eax, dword [edi + 0x40]
lea ecx, [edx*4]
lea esi, [ecx + 0x1000]
mov dword [eax + 0x1c], edx
mov eax, dword [edi + 0x40]
mov dword [eax + 0x24], 0x2002
mov eax, dword [edi + 0x40]
mov dword [eax + 0x28], 0
mov eax, dword [edi + 0x40]
mov dword [eax + 0x2c], esi
add esi, ecx
mov eax, dword [edi + 0x40]
lea ebx, [esi + 0x7efff]
mov dword [eax + 0x34], edx
mov eax, dword [edi + 0x40]
mov dword [eax + 0x3c], 0x2002
mov eax, dword [edi + 0x40]
mov dword [eax + 0x40], 0
mov ecx, dword [edi + 0x40]
mov eax, dword [ecx + 0x2c]
mov dword [ecx + 0x18], eax
mov ecx, dword [edi + 0x40]
mov eax, dword [ecx + 0x14]
mov dword [ecx + 0x30], eax
mov eax, dword [edi + 0x40]
mov dword [eax + 0x20], edx
mov eax, dword [edi + 0x40]
mov dword [eax + 0x38], edx
mov eax, dword [edi + 0x40]
mov dword [eax + 0x44], 2
mov eax, dword [edi + 0x40]
mov dword [eax + 0x48], 0x57
mov eax, dword [edi + 0x40]
mov ecx, dword [eax + 0x14]
add ecx, dword [edi + 0x3c]
mov dword [edi + 0x48], ecx
mov eax, dword [edi + 0x40]
mov eax, dword [eax + 0x2c]
add eax, dword [edi + 0x3c]
mov dword [edi + 0x4c], eax
mov eax, 0x2040811
mul ebx
mov dword [ecx], bind
sub ebx, edx
shr ebx, 1
add ebx, edx
shr ebx, 0x12
mov eax, ebx
shl eax, 0xc
add eax, esi
shr eax, 7
push eax
mov eax, dword [edi + 0x3c]
add eax, esi
push 0xff
push eax
call fcn.00432290
add esp, 0xc
xor eax, eax
test ebx, ebx
je 0x42907f
lea ecx, [esi + 1]
mov edx, 8
mov esi, ebx
nop
mov eax, dword [edi + 0x48]
lea edx, [edx + 4]
mov dword [edx + eax - 4], ecx
add ecx, 0x1000
sub esi, 1
jne 0x429060
cmp ebx, 0x2000
jae 0x4290a3
mov eax, ebx
mov edx, 0x2000
lea ecx, [eax*4 + 8]
sub edx, eax
nop dword [eax]
mov eax, dword [edi + 0x48]
lea ecx, [ecx + 4]
mov dword [ecx + eax - 4], 0x80000000
sub edx, 1
jne 0x429090
mov eax, dword [edi + 0x48]
mov esi, 0xa
mov dword [edi + 0x44], eax
xor edx, edx
mov dword [edi + 0x84], 0x2002
mov dword [edi + 0x80], 0
mov ecx, dword [edx + 0x49c178]
lea ebx, [ecx + 1]
nop dword [eax]
mov al, byte [ecx]
inc ecx
test al, al
jne 0x4290d0
sub ecx, ebx
add esi, 3
add edx, 0x10
add esi, ecx
cmp edx, 0x110
jb 0x4290c4
push 0
add esi, 0x320
mov ecx, edi
push esi
call fcn.004207f0
mov ecx, dword [edi + 0x48]
mov dword [ecx + 4], eax
mov ecx, str.Metatable
mov ebx, dword [edi + 0x3c]
add ebx, eax
mov edx, ebx
sub edx, ecx
mov dword [ebx], esi
mov dword [ebx + 8], 0
mov dword [ebx + 4], 0
mov dword [ebx + 0x10], 0x320
mov dword [ebx + 0xc], 0xa
nop dword [eax + eax]
mov al, byte [ecx]
lea ecx, [ecx + 1]
mov byte [ecx + edx + 0x31f], al
test al, al
jne 0x429130
mov dword [ebx + 0x18], 0x34
lea ecx, [ebx + 0x34]
mov dword [ebx + 0x14], 0x11
mov dword [ebx + 0x1c], 0x34
mov dword [ebx + 0x20], 0
mov dword [ebx + 0x24], 5
mov dword [ebx + 0x28], 0
mov dword [ebx + 0x2c], 0
mov dword [ebx + 0x30], 0
mov ebx, dword [ebx + 0xc]
add ebx, 0x2ec
xor edi, edi
nop word [eax + eax]
mov dword [ecx + 4], ebx
mov edx, dword [edi + 0x49c178]
lea esi, [edx + 1]
nop dword [eax]
mov al, byte [edx]
inc edx
test al, al
jne 0x4291a0
sub edx, esi
lea esi, [ecx + ebx]
lea eax, [edx + 1]
mov dword [ecx], eax
mov edx, dword [edi + 0x49c178]
mov al, byte [edx]
lea edx, [edx + 1]
mov byte [esi], al
lea esi, [esi + 1]
test al, al
jne 0x4291b7
add ebx, dword [ecx]
mov dword [ecx + 0xc], ebx
mov dword [ecx + 8], 1
mov byte [ecx + ebx], al
inc ebx
mov dword [ecx + 0x14], ebx
mov dword [ecx + 0x10], 1
mov byte [ecx + ebx], al
sub ebx, 0x2b
mov eax, dword [edi + 0x49c17c]
mov dword [ecx + 0x18], eax
mov eax, dword [edi + 0x49c180]
mov dword [ecx + 0x20], eax
mov eax, dword [edi + 0x49c184]
add edi, 0x10
mov dword [ecx + 0x1c], eax
mov dword [ecx + 0x24], 0
mov dword [ecx + 0x28], 0
add ecx, 0x2c
cmp edi, 0x110
jb 0x429190
mov edi, dword [ebp - 0x68]
mov eax, dword [edi + 0x40]
mov dword [eax + 8], 1
mov eax, dword [edi + 0x84]
shl eax, 2
push eax
push dword [edi + 0x48]
push dword [edi + 0x4c]
call fcn.004323f0
add esp, 0xc
lea ecx, [edi + 0x98]
push 1
call fcn.0042f500
mov eax, dword [edi + 0x40]
lea ecx, [edi + 0x98]
push 1
mov dword [eax + 0xc], 1
call fcn.0042f500
push 1
mov ecx, edi
call fcn.00428330
test al, al
je 0x4289a9
push dword [edi + 0xc4]
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
jmp 0x42937b
push 0
push str.Can_not_open_uninitialized_file_in_read_only_mode
jmp 0x4289a1
mov eax, dword [edi + 0xd8]
mov dword [eax + 0x28], ecx
mov ecx, dword [edi + 0x40]
cmp dword [ecx + 8], 0
je 0x4292e4
push str.Database_was_not_normally_closed:_start_recovery_n
call fcn.0041a150
mov eax, dword [edi + 8]
add esp, 4
test eax, eax
je 0x4292d8
cmp eax, 2
je 0x4292d8
mov ecx, edi
call fcn.00429600
push str.Recovery_completed_n
call fcn.0041a150
add esp, 4
jmp 0x429269
push 0
push str.Can_not_open_dirty_file_in_read_only_moode
jmp 0x4289a1
mov eax, dword [edi + 0xa8]
cmp eax, dword [ecx]
je 0x429269
push 0
push str.Database_file_was_corrupted:_file_size_in_header_differs_from_actual_file_size
jmp 0x4289a1
mov esi, dword [ebp - 0x54]
push esi
push str._s.cs
push ebx
call fcn.00406100
add esp, 0xc
lea eax, [edi + 0xb4]
mov ecx, eax
push dword [edi + 0xd8]
push ebx
call fcn.00429410
test al, al
jne 0x429334
push 0
push str.Failed_to_open_shared_semaphore
jmp 0x4289a1
cmp dword [edi + 8], 3
jne 0x429363
push esi
push str._s.mcs
push ebx
call fcn.00406100
mov eax, dword [edi + 0xd8]
lea ecx, [edi + 0xbc]
add esp, 0xc
add eax, 4
push eax
push ebx
call fcn.00429410
test al, al
je 0x429328
push 0
mov ecx, edi
mov dword [edi + 0x78], 0
call fcn.00428330
test al, al
je 0x4289a9
lea esi, [edi + 0xb4]
mov ecx, esi
call fcn.00423b00
mov eax, dword [edi + 0xd8]
mov ecx, esi
inc dword [eax + 0x3c]
call fcn.004282e0
mov ebx, dword [ebp + 0x18]
mov eax, ebx
or eax, dword [ebp + 0x1c]
mov byte [edi + 0xe4], 1
je 0x429404
cmp byte [edi + 0x120], 0
lea esi, [edi + 0x108]
je 0x4293bf
push esi
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
mov eax, dword [ebp + 0x1c]
lea ecx, [edi + 0x180]
push edi
push 0x4234c0
mov dword [edi + 0xf0], ebx
mov dword [edi + 0xf4], eax
mov dword [edi + 0xf8], ebx
mov dword [edi + 0xfc], eax
call fcn.00401240
push esi
lea ecx, [edi + 0x148]
call fcn.0042b1d0
cmp byte [esi + 0x18], 0
je 0x429404
push esi
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov al, 1
jmp 0x4289ab