Function at 0x412d50
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x418830
mov eax, dword fs:[0]
push eax
sub esp, 0x18
push ebx
push esi
push edi
mov eax, dword [0x421080]
xor eax, ebp
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
call fcn.00403900
xor ecx, ecx
mov edx, eax
test edx, edx
setne cl
test ecx, ecx
jne 0x412d94
push 0x80004005
call fcn.00403060
mov eax, dword [edx]
mov ecx, edx
call dword [eax + 0xc]
lea esi, [eax + 0x10]
mov dword [ebp - 0x14], esi
mov eax, dword [esi - 8]
mov ecx, 1
sub ecx, dword [esi - 4]
sub eax, 0x12c
or eax, ecx
mov dword [ebp - 4], 0
jge 0x412dcc
push 0x12c
lea ecx, [ebp - 0x14]
call fcn.004044f0
mov esi, dword [ebp - 0x14]
push 0x12c
push esi
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleHandleW]
push eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameW]
push dword [esi - 8]
push esi
call dword [sym.imp.MSVCR120.dll_wcsnlen]
add esp, 8
test eax, eax
js 0x41308a
cmp eax, dword [esi - 8]
jg 0x41308a
xor ecx, ecx
mov dword [esi - 0xc], eax
push 0x5c
push esi
mov word [esi + eax*2], cx
call dword [sym.imp.MSVCR120.dll_wcsrchr]
add esp, 8
test eax, eax
jne 0x412e1d
or eax, 0xffffffff
jmp 0x412e21
sub eax, esi
sar eax, 1
push eax
lea eax, [ebp - 0x1c]
push eax
lea ecx, [ebp - 0x14]
call fcn.0040b4f0
push eax
lea ecx, [ebp - 0x14]
mov byte [ebp - 4], 1
call fcn.004086e0
mov edx, dword [ebp - 0x1c]
or ebx, 0xffffffff
add edx, 0xfffffff0
mov byte [ebp - 4], 0
mov eax, ebx
lea ecx, [edx + 0xc]
lock xadd dword [ecx], eax
dec eax
test eax, eax
jg 0x412e5e
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
push 0x10
push str.dvOpcServer.cfg
lea ecx, [ebp - 0x14]
call fcn.0040dc00
push 0x4229c0
mov byte [ebp - 0xd], 0
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
xor edi, edi
cmp byte [ebp + 8], 0
mov dword [ebp - 0x24], edi
mov dword [ebp - 0x20], edi
je 0x412f5e
mov esi, dword [ebp - 0x14]
push edi
push 0x80
push 4
push edi
push edi
push 0x40000000
push esi
mov byte [ebp - 4], 2
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
jne 0x412ebf
call fcn.004028c0
test eax, eax
js 0x41304c
jmp 0x412ec4
mov edi, eax
mov dword [ebp - 0x24], edi
push 0
lea eax, [ebp - 0x18]
mov dword [ebp - 0x1c], 0x10000
push eax
push 4
lea eax, [ebp - 0x1c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x412ee7
call fcn.004028c0
push 0x4229e0
lea ecx, [ebp - 0x24]
call fcn.00412c10
call fcn.00403900
xor ecx, ecx
mov edx, eax
test edx, edx
setne cl
test ecx, ecx
jne 0x412f10
push 0x80004005
call fcn.00403060
mov eax, dword [edx]
mov ecx, edx
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x18], eax
mov byte [ebp - 4], 3
call dword [sym.imp.MSVCR120.dll_rand]
push eax
lea eax, [ebp - 0x18]
push 0x41b1bc
push eax
call fcn.0040a3a0
add esp, 0xc
lea eax, [ebp - 0x18]
lea ecx, [ebp - 0x24]
push eax
call fcn.00412c10
push 0x4229e4
lea ecx, [ebp - 0x24]
call fcn.00412c10
mov edx, dword [ebp - 0x18]
mov byte [ebp - 4], 2
jmp 0x413024
mov esi, dword [ebp - 0x14]
push 0
push 0x80
push 3
push 0
push 0
push SysReAllocStringLen
push esi
mov byte [ebp - 4], 4
call dword [sym.imp.KERNEL32.dll_CreateFileW]
cmp eax, 0xffffffff
jne 0x412f92
call fcn.004028c0
test eax, eax
js 0x41304c
jmp 0x412f97
mov edi, eax
mov dword [ebp - 0x24], edi
push 0
lea eax, [ebp - 0x1c]
mov dword [ebp - 0x18], 0x10000
push eax
push 4
lea eax, [ebp - 0x18]
mov dword [ebp - 0x1c], 0
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x412fc1
call fcn.004028c0
cmp dword [ebp - 0x18], 0x10000
jb 0x413041
push 0x4229e0
lea ecx, [ebp - 0x24]
call fcn.00412b60
call fcn.00403900
xor ecx, ecx
mov edx, eax
test edx, edx
setne cl
test ecx, ecx
jne 0x412ff3
push 0x80004005
call fcn.00403060
mov eax, dword [edx]
mov ecx, edx
call dword [eax + 0xc]
add eax, 0x10
mov dword [ebp - 0x1c], eax
lea eax, [ebp - 0x1c]
mov byte [ebp - 4], 5
push eax
lea ecx, [ebp - 0x24]
call fcn.00412b60
push 0x4229e4
lea ecx, [ebp - 0x24]
call fcn.00412b60
mov edx, dword [ebp - 0x1c]
mov byte [ebp - 4], 4
add edx, 0xfffffff0
mov byte [ebp - 0xd], 1
mov ecx, ebx
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x413041
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
test edi, edi
je 0x41304c
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0x4229c0
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
add esi, 0xfffffff0
mov dword [ebp - 4], 0xffffffff
lea eax, [esi + 0xc]
lock xadd dword [eax], ebx
dec ebx
test ebx, ebx
jg 0x413075
mov ecx, dword [esi]
push esi
mov edx, dword [ecx]
call dword [edx + 4]
mov al, byte [ebp - 0xd]
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret
push 0x80070057
call fcn.00403060
int3