Function at 0x5659d0
Capabilities:
Check if file exists
Query environment variable

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x577a27
mov eax, dword fs:[0]
push eax
sub esp, 0x22c
mov eax, dword [0x5d52e0]
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 eax, dword [edi]
push 0
push ecx
sub eax, 0x10
mov dword [ebp - 0x228], esp
mov esi, esp
push eax
mov dword [ebp - 0x230], edi
call fcn.00401a10
add eax, 0x10
mov dword [esi], eax
lea eax, [ebp - 0x21c]
add esp, 4
push eax
call fcn.0052e330
add esp, 0xc
mov dword [ebp - 4], 0
mov eax, dword [edi]
push 1
push ecx
sub eax, 0x10
mov dword [ebp - 0x228], esp
mov esi, esp
push eax
call fcn.00401a10
lea ecx, [ebp - 0x224]
add esp, 4
add eax, 0x10
push ecx
mov dword [esi], eax
call fcn.0052e330
add esp, 0xc
mov byte [ebp - 4], 1
mov edx, dword [ebp - 0x21c]
mov esi, dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
push edx
call esi
test eax, eax
je 0x565e8d
mov eax, dword [ebp - 0x224]
push eax
call esi
test eax, eax
je 0x565e8d
xor esi, esi
cmp dword [ebp + 8], 0x9fbf1
jne 0x565aa3
mov esi, 1
mov ecx, dword [0x5dd53c]
mov ebx, dword [ebp + 0xc]
test ecx, ecx
je 0x565acf
mov eax, dword [edi]
mov edx, dword [eax - 0xc]
inc edx
push edx
push eax
mov eax, dword [esi*4 + 0x5dd9a0]
lea edx, [ebx + 0x2000001]
push edx
push eax
call ecx
mov ecx, dword [0x5dd53c]
xor esi, esi
cmp dword [ebp + 8], 0x9fbf1
jne 0x565adf
mov esi, 1
test ecx, ecx
je 0x565b06
mov eax, dword [ebp - 0x21c]
mov edx, dword [eax - 0xc]
inc edx
push edx
push eax
mov eax, dword [esi*4 + 0x5dd9a0]
lea edx, [ebx + 0x2020001]
push edx
push eax
call ecx
mov ecx, dword [0x5dd53c]
xor esi, esi
cmp dword [ebp + 8], 0x9fbf1
jne 0x565b16
mov esi, 1
test ecx, ecx
je 0x565b37
mov eax, dword [ebp - 0x224]
mov edx, dword [eax - 0xc]
inc edx
push edx
mov edx, dword [esi*4 + 0x5dd9a0]
push eax
add ebx, 0x2030001
push ebx
push edx
call ecx
call fcn.0040c84f
xor ecx, ecx
test eax, eax
setne cl
test ecx, ecx
jne 0x565b51
push 0x80004005
call fcn.004010a0
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0xc]
call eax
lea esi, [eax + 0x10]
mov dword [ebp - 0x220], esi
mov byte [ebp - 4], 2
mov eax, dword [esi - 8]
mov ecx, 1
sub ecx, dword [esi - 4]
sub eax, 0x104
or eax, ecx
jge 0x565b91
push 0x104
lea ecx, [ebp - 0x220]
call fcn.004019b0
mov esi, dword [ebp - 0x220]
push 0x104
push esi
push str._APPDATA_CanonIJ_Scan_Utility
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
mov eax, dword [esi - 8]
push eax
push esi
call fcn.004ff818
add esp, 8
test eax, eax
js 0x565e83
cmp eax, dword [esi - 8]
jg 0x565e83
mov dword [esi - 0xc], eax
xor ecx, ecx
mov word [esi + eax*2], cx
mov eax, dword [esi - 8]
mov edi, dword [edi]
mov ecx, 1
sub ecx, dword [esi - 4]
sub eax, 0x104
or eax, ecx
mov ebx, esi
jge 0x565bf7
push 0x104
lea ecx, [ebp - 0x220]
call fcn.004019b0
mov esi, dword [ebp - 0x220]
push edi
push ebx
push esi
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
mov eax, dword [esi - 8]
push eax
push esi
call fcn.004ff818
add esp, 8
test eax, eax
js 0x565e83
cmp eax, dword [esi - 8]
jg 0x565e83
mov dword [esi - 0xc], eax
xor edx, edx
push ecx
mov word [esi + eax*2], dx
lea eax, [esi - 0x10]
mov dword [ebp - 0x228], esp
mov edi, esp
push eax
mov dword [ebp - 0x228], eax
call fcn.00401a10
add eax, 0x10
add esp, 4
mov dword [edi], eax
call fcn.0052bad0
mov edi, dword [ebp + 8]
add esp, 4
xor eax, eax
cmp edi, 0x9fbf1
jne 0x565c61
mov eax, 1
mov edx, dword [0x5dd53c]
test edx, edx
je 0x565c85
mov ecx, dword [esi - 0xc]
mov eax, dword [eax*4 + 0x5dd9a0]
inc ecx
push ecx
mov ecx, dword [ebp + 0xc]
push esi
add ecx, 0x2010001
push ecx
push eax
call edx
xor bl, bl
xor eax, eax
cmp edi, 0x9fbf1
jne 0x565c96
mov eax, 1
mov ecx, dword [0x5dd530]
test ecx, ecx
je 0x565cc1
mov edx, dword [eax*4 + 0x5dd9a0]
push 0x10018
push edx
call ecx
cmp eax, 0x13ba
jne 0x565cc1
mov esi, dword [ebp - 0x230]
jmp 0x565d67
push 0x5aa900
lea eax, [ebp - 0x218]
push 0x104
push eax
mov dword [ebp - 0x22c], 0
call fcn.00500277
mov esi, dword [ebp - 0x230]
add esp, 0xc
lea ecx, [ebp - 0x234]
push esi
push ecx
call fcn.005301e0
mov eax, dword [eax]
add esp, 8
push eax
lea edx, [ebp - 0x218]
push edx
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
mov eax, dword [ebp - 0x234]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x565d2c
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
lea ecx, [ebp - 0x22c]
push ecx
push 0x20019
push 0
lea edx, [ebp - 0x218]
push edx
push reloc.OLEAUT32.dll_SysReAllocString
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
mov eax, dword [ebp - 0x22c]
test eax, eax
je 0x565d69
push eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov dword [ebp - 0x22c], 0
mov bl, 1
xor eax, eax
cmp edi, 0x9fbf1
jne 0x565d78
mov eax, 1
mov ecx, dword [0x5dd534]
test ecx, ecx
je 0x565da4
mov eax, dword [eax*4 + 0x5dd9a0]
xor edx, edx
test bl, bl
sete dl
add edx, 0x127a
push edx
mov edx, dword [ebp + 0xc]
add edx, 0x1040001
push edx
push eax
call ecx
mov eax, dword [esi]
cmp dword [eax - 0xc], 0
jl 0x565dcd
push str.Network
push eax
call fcn.004fffd1
add esp, 8
test eax, eax
je 0x565dcd
sub eax, dword [esi]
sar eax, 1
test eax, eax
jle 0x565dcd
mov eax, 1
jmp 0x565dcf
xor eax, eax
xor ecx, ecx
test eax, eax
setne cl
xor eax, eax
add ecx, 0x1270
cmp edi, 0x9fbf1
jne 0x565deb
mov eax, 1
mov edx, dword [0x5dd534]
test edx, edx
je 0x565e0a
mov eax, dword [eax*4 + 0x5dd9a0]
push ecx
mov ecx, dword [ebp + 0xc]
add ecx, 0x1050001
push ecx
push eax
call edx
mov eax, dword [ebp - 0x228]
mov byte [ebp - 4], 1
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x565e2d
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov byte [ebp - 4], 0
mov eax, dword [ebp - 0x224]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x565e53
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov dword [ebp - 4], 0xffffffff
mov eax, dword [ebp - 0x21c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x565e7c
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov eax, 1
jmp 0x565ede
push 0x80070057
call fcn.004010a0
mov byte [ebp - 4], 0
mov eax, dword [ebp - 0x224]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x565eb3
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
mov dword [ebp - 4], 0xffffffff
mov eax, dword [ebp - 0x21c]
add eax, 0xfffffff0
lea ecx, [eax + 0xc]
or edx, 0xffffffff
lock xadd dword [ecx], edx
dec edx
test edx, edx
jg 0x565edc
mov ecx, dword [eax]
mov edx, dword [ecx]
push eax
mov eax, dword [edx + 4]
call eax
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.004ff57c
mov esp, ebp
pop ebp
ret