Function at 0x40d780
Capabilities:
Check if file exists
Create directory
Print debug messages
Read .ini file

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x41fc9b
mov eax, dword fs:[0]
push eax
sub esp, 0x64c
mov eax, dword [0x42a010]
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 ebx, ecx
xor eax, eax
push 0x208
push eax
mov word [ebp - 0x220], ax
lea eax, [ebp - 0x21e]
push eax
call fcn.00411600
add esp, 8
lea eax, [ebp - 0x220]
mov edx, str.AgLogCfg.ini
mov ecx, 0x4259a0
push eax
call fcn.0040bb30
add esp, 8
test eax, eax
je 0x40da07
mov edi, dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
je 0x40da07
mov esi, dword [sym.imp.SHLWAPI.dll_PathIsDirectoryW]
lea eax, [ebp - 0x220]
push eax
call esi
test eax, eax
jne 0x40da07
push 0x208
push eax
mov word [ebp - 0x430], ax
lea eax, [ebp - 0x42e]
push eax
call fcn.00411600
add esp, 0xc
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
je 0x40d872
lea eax, [ebp - 0x220]
push eax
push 0x104
lea eax, [ebp - 0x430]
push eax
push 0x4259a0
push str.LogPath
push str.AgLog
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringW]
test eax, eax
jne 0x40d8a4
lea ecx, [ebp - 0x430]
lea edx, [ecx + 2]
jmp 0x40d880
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d880
sub ecx, edx
sar ecx, 1
jne 0x40d8a4
lea ecx, [ebp - 0x430]
call fcn.0040b850
test eax, eax
je 0x40da07
lea eax, [ebp - 0x430]
push eax
call dword [sym.imp.SHLWAPI.dll_PathIsRelativeW]
test eax, eax
je 0x40d9a3
push 0x20a
push 0
push 0x42caa0
call fcn.00411600
add esp, 0xc
test ebx, ebx
je 0x40d93d
xor eax, eax
push 0x208
push eax
mov word [ebp - 0x640], ax
lea eax, [ebp - 0x63e]
push eax
call fcn.00411600
add esp, 0xc
lea ecx, [ebp - 0x640]
call fcn.0040b850
test eax, eax
je 0x40da07
lea eax, [ebp - 0x430]
push eax
lea eax, [ebp - 0x640]
push eax
lea eax, [ebp - 0x430]
push eax
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
push ecx
push 0x42caa0
mov edx, str.Aglog.log
lea ecx, [ebp - 0x430]
call fcn.0040bb30
add esp, 8
test eax, eax
jmp 0x40da01
lea ecx, [ebp - 0x658]
call fcn.0040b750
lea eax, [ebp - 0x430]
mov dword [ebp - 4], 0
push eax
lea ecx, [ebp - 0x658]
call fcn.00401150
cmp dword [ebp - 0x644], 8
lea ecx, [ebp - 0x658]
mov edx, str.Aglog.log
cmovae ecx, dword [ebp - 0x658]
push ecx
push 0x42caa0
call fcn.0040bb30
add esp, 8
lea ecx, [ebp - 0x658]
test eax, eax
jne 0x40d999
call fcn.00401460
jmp 0x40da07
call fcn.00401460
jmp 0x40daac
lea ecx, [ebp - 0x430]
lea edx, [ecx + 2]
lea esp, [esp]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d9b0
sub ecx, edx
sar ecx, 1
movzx eax, word [ebp + ecx*2 - 0x432]
cmp eax, 0x2f
je 0x40da25
cmp eax, 0x5c
je 0x40da25
lea eax, [ebp - 0x430]
push eax
push 0x105
push 0x42caa0
call fcn.0040fb31
mov ecx, 0x42caa0
add esp, 0xc
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40d9f2
sub ecx, edx
sar ecx, 1
jne 0x40daac
xor eax, eax
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.0040ed40
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x430]
push eax
call esi
test eax, eax
lea eax, [ebp - 0x430]
je 0x40da5e
push str.Aglog.log
push eax
push 0x42caa0
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
mov ecx, 0x42caa0
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40da51
jmp 0x40d9fd
push 0
push eax
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
jne 0x40da78
push 0x427200
call dword [sym.imp.KERNEL32.dll_OutputDebugStringW]
jmp 0x40da07
push str.Aglog.log
lea eax, [ebp - 0x430]
push eax
push 0x42caa0
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
mov ecx, 0x42caa0
lea edx, [ecx + 2]
mov ax, word [ecx]
add ecx, 2
test ax, ax
jne 0x40da97
sub ecx, edx
sar ecx, 1
je 0x40da07
lea eax, [ebp - 0x220]
push eax
call edi
mov esi, dword [sym.imp.KERNEL32.dll_GetPrivateProfileIntW]
test eax, eax
je 0x40dae8
lea eax, [ebp - 0x220]
push eax
push 0xa00000
push str.MaxLogSize
push str.AgLog
call esi
mov dword [0x42b5e8], eax
cmp eax, 0xa00000
jge 0x40dae8
cmp eax, 1
jge 0x40daf2
mov dword [0x42b5e8], 0xa00000
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
je 0x40db23
lea eax, [ebp - 0x220]
push eax
push 0x14
push str.MaxLogCount
push str.AgLog
call esi
mov dword [0x42b5ec], eax
cmp eax, 0x14
jge 0x40db23
cmp eax, 1
jge 0x40db2d
mov dword [0x42b5ec], 0x14
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
je 0x40db4f
lea eax, [ebp - 0x220]
push eax
push 0
push str.FileName
push str.Debug
call esi
mov dword [0x42ccb4], eax
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
je 0x40db76
lea eax, [ebp - 0x220]
push eax
push 0
push str.LineNum
push str.Debug
call esi
mov dword [0x42ccb0], eax
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
je 0x40db9d
lea eax, [ebp - 0x220]
push eax
push 0
push str.FunctionName
push str.Debug
call esi
mov dword [0x42ccac], eax
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
je 0x40dbc4
lea eax, [ebp - 0x220]
push eax
push 0
push str.Output
push str.Debug
call esi
mov dword [0x42ca9c], eax
lea eax, [ebp - 0x220]
push eax
call edi
test eax, eax
jne 0x40dbef
mov dword [0x42ca98], eax
mov eax, 1
mov dword [0x42ccb8], 1
jmp 0x40da09
lea eax, [ebp - 0x220]
push eax
push 0
push str.FilterLevel
push str.Debug
call esi
xor ecx, ecx
mov dword [0x42ccb8], 1
test eax, eax
cmovs eax, ecx
mov dword [0x42ca98], eax
lea eax, [ecx + 1]
jmp 0x40da09