Function at 0x422d00
Capabilities:
Check if file exists
Check mutex and terminate process on windows
Check mutex on windows
Create thread
Read .ini file
Terminate process

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x57d4ec
mov eax, dword fs:[0]
push eax
sub esp, 0x310
mov eax, dword [0x5ef220]
xor eax, esp
mov dword [esp + 0x308], eax
push ebx
push esi
push edi
mov eax, dword [0x5ef220]
xor eax, esp
push eax
lea eax, [esp + 0x320]
mov dword fs:[0], eax
mov edi, ecx
call fcn.00433e2f
call fcn.004346d7
push 0
call fcn.004349a4
add esp, 4
lea eax, [edi + 0xe0]
push 0
push eax
lea eax, [edi + 0xf0]
push eax
call dword [sym.imp.gdiplus.dll_GdiplusStartup]
push dword [edi + 0x48]
lea ecx, [esp + 0x14]
call fcn.0040f690
mov dword [esp + 0x328], 0
mov eax, dword [esp + 0x10]
cmp dword [eax - 0xc], 0
jge 0x422d92
or eax, 0xffffffff
jmp 0x422daf
push str.__fhpos
push eax
call fcn.00558e99
add esp, 8
test eax, eax
jne 0x422da9
or eax, 0xffffffff
jmp 0x422daf
sub eax, dword [esp + 0x10]
sar eax, 1
mov edx, dword [edi + 0x48]
test eax, eax
mov ecx, edx
setns bl
lea esi, [ecx + 2]
lea esp, [esp]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x422dc0
sub ecx, esi
mov esi, dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
sar ecx, 1
je 0x422e3e
test bl, bl
jne 0x422e3e
mov ecx, dword [edi + 0xcc]
push edx
call fcn.00402ad0
test al, al
jne 0x422eab
mov dword [esp + 0x328], 0xffffffff
or ecx, 0xffffffff
mov edx, dword [esp + 0x10]
add edx, 0xfffffff0
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x422e18
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
xor eax, eax
mov ecx, dword [esp + 0x320]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x308]
xor ecx, esp
call fcn.00557f7f
mov esp, ebp
pop ebp
ret
xor eax, eax
push 0x206
push eax
mov word [esp + 0x2c], ax
lea eax, [esp + 0x2e]
push eax
call fcn.0055c960
add esp, 0xc
lea eax, [esp + 0x24]
push 0x104
push eax
push 0
call esi
lea eax, [esp + 0x24]
push eax
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
mov ecx, dword [edi + 0xcc]
lea eax, [esp + 0x24]
push eax
call fcn.00403180
test al, al
je 0x422def
test bl, bl
je 0x422eab
mov eax, dword [edi + 0xcc]
push dword [edi + 0x48]
push 0x104
mov eax, dword [eax]
add eax, 0x20c
push eax
call fcn.00558864
add esp, 0xc
push dword [edi + 0x50]
push 1
push 0
call dword [sym.imp.KERNEL32.dll_CreateMutexW]
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x422f26
xor eax, eax
push 0x206
push eax
mov word [esp + 0x2c], ax
lea eax, [esp + 0x2e]
push eax
call fcn.0055c960
add esp, 0xc
lea eax, [esp + 0x24]
push 0x104
push eax
push 0
call esi
lea eax, [esp + 0x24]
push eax
call dword [sym.imp.SHLWAPI.dll_PathRemoveFileSpecW]
lea eax, [esp + 0x24]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAddBackslashW]
push str.cgmclient.exe
lea eax, [esp + 0x28]
push eax
call dword [sym.imp.SHLWAPI.dll_StrCatW]
lea eax, [esp + 0x24]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x422def
mov ecx, dword [edi + 0xcc]
call fcn.004085e0
push 0
push 0
push 1
push 0
call dword [sym.imp.KERNEL32.dll_CreateEventW]
push 0
push 0
push edi
push 0x423330
push 0
push 0
mov dword [edi + 0xd4], eax
call fcn.00559716
mov ebx, dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
add esp, 0x18
mov dword [edi + 0xd0], eax
push 0xffffffffffffffff
push eax
call ebx
mov ecx, edi
call fcn.00423230
dec eax
je 0x422fd0
dec eax
jne 0x422fef
push ecx
lea ecx, [esp + 0x28]
call fcn.00424d10
lea eax, [esp + 0x24]
mov byte [esp + 0x328], 1
mov ecx, eax
mov dword [edi + 0x20], eax
call fcn.00435b3e
cmp eax, 2
je 0x422fbd
mov ecx, dword [edi + 0xcc]
call fcn.00403370
mov esi, dword [edi + 0xcc]
mov ecx, esi
call fcn.004083c0
mov ecx, esi
call fcn.004081d0
lea ecx, [esp + 0x24]
mov byte [esp + 0x328], 0
call fcn.00423160
jmp 0x422fef
mov ecx, dword [edi + 0xcc]
call fcn.00403370
mov esi, dword [edi + 0xcc]
mov ecx, esi
call fcn.004083c0
mov ecx, esi
call fcn.004081d0
lea ecx, [esp + 0x20]
call fcn.004299d0
push str.gamepatchconfig.ini
push eax
lea eax, [esp + 0x24]
mov byte [esp + 0x330], 2
push eax
call fcn.0040f190
add esp, 0xc
push dword [eax]
push 0
push 0x5cad24
push 0x5c39b0
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileIntW]
mov dword [esp + 0x14], eax
or esi, 0xffffffff
mov eax, dword [esp + 0x1c]
mov ecx, esi
add eax, 0xfffffff0
mov dword [esp + 0x18], eax
lea edx, [eax + 0xc]
lock xadd dword [edx], ecx
dec ecx
test ecx, ecx
jg 0x423052
mov ecx, dword [eax]
push dword [esp + 0x18]
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [esp + 0x328], 0
mov ecx, esi
mov edx, dword [esp + 0x20]
add edx, 0xfffffff0
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x423077
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
cmp dword [esp + 0x14], 0
jle 0x42309f
push 0
push 0
push edi
push 0x4234b0
push 0
push 0
call fcn.00559716
add esp, 0x18
mov dword [edi + 0xd8], eax
push 0xffffffffffffffff
push eax
call ebx
lea ecx, [esp + 0x18]
call fcn.004299d0
push str.gamepatchconfig.ini
push eax
lea eax, [esp + 0x1c]
mov byte [esp + 0x330], 3
push eax
call fcn.0040f190
add esp, 0xc
push dword [eax]
push 0
push 0x5cad24
push str.bf_data
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileIntW]
mov dword [esp + 0x1c], eax
mov edx, esi
mov eax, dword [esp + 0x14]
add eax, 0xfffffff0
mov dword [esp + 0x20], eax
lea ecx, [eax + 0xc]
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x4230ff
mov ecx, dword [eax]
push dword [esp + 0x20]
mov eax, dword [ecx]
call dword [eax + 4]
mov byte [esp + 0x328], 0
mov edx, dword [esp + 0x18]
add edx, 0xfffffff0
lea eax, [edx + 0xc]
lock xadd dword [eax], esi
dec esi
test esi, esi
jg 0x423122
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
cmp dword [esp + 0x1c], 0
jle 0x42314a
push 0
push 0
push edi
push 0x424210
push 0
push 0
call fcn.00559716
add esp, 0x18
mov dword [edi + 0xdc], eax
push 0xffffffffffffffff
push eax
call ebx
push 0
call dword [sym.imp.KERNEL32.dll_ExitProcess]