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

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5ae472
mov eax, dword fs:[0]
push eax
sub esp, 0x238
mov eax, dword [0x614040]
xor eax, ebp
mov dword [ebp - 0x14], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov edi, edx
mov dword [ebp - 0x228], edi
mov ebx, ecx
mov eax, dword [edi]
push ecx
sub eax, 0x10
mov esi, esp
push eax
call fcn.00403660
add esp, 4
lea ecx, [ebp - 0x23c]
add eax, 0x10
xor edx, edx
mov dword [esi], eax
call fcn.00587dc0
mov dword [ebp - 4], 0
mov esi, esp
mov eax, dword [edi]
sub eax, 0x10
push eax
call fcn.00403660
add esp, 4
lea ecx, [ebp - 0x238]
add eax, 0x10
mov edx, 1
mov dword [esi], eax
call fcn.00587dc0
add esp, 4
mov byte [ebp - 4], 1
push dword [ebp - 0x23c]
mov esi, dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
call esi
or edi, 0xffffffff
test eax, eax
je 0x566604
push dword [ebp - 0x238]
call esi
test eax, eax
je 0x566604
xor edi, edi
cmp ebx, 0x9fbf1
jne 0x566236
mov edi, 1
mov edx, dword [0x61fa1c]
mov esi, dword [ebp + 8]
test edx, edx
je 0x566267
mov ecx, dword [ebp - 0x228]
mov ecx, dword [ecx]
mov eax, dword [ecx - 0xc]
inc eax
push eax
push ecx
lea eax, [esi + 0x2000001]
push eax
push dword [edi*4 + 0x61feb8]
call edx
mov edx, dword [0x61fa1c]
xor edi, edi
cmp ebx, 0x9fbf1
jne 0x566276
mov edi, 1
test edx, edx
je 0x56629c
mov eax, dword [ebp - 0x23c]
mov ecx, dword [eax - 0xc]
inc ecx
push ecx
push eax
lea eax, [esi + 0x2020001]
push eax
push dword [edi*4 + 0x61feb8]
call edx
mov edx, dword [0x61fa1c]
xor edi, edi
cmp ebx, 0x9fbf1
jne 0x5662ab
mov edi, 1
test edx, edx
je 0x5662cb
mov eax, dword [ebp - 0x238]
mov ecx, dword [eax - 0xc]
inc ecx
push ecx
push eax
lea eax, [esi + 0x2030001]
push eax
push dword [edi*4 + 0x61feb8]
call edx
call fcn.00414eab
xor ecx, ecx
mov edx, eax
test edx, edx
setne cl
test ecx, ecx
jne 0x5662e7
push 0x80004005
call fcn.00402740
mov eax, dword [edx]
mov ecx, edx
call dword [eax + 0xc]
lea esi, [eax + 0x10]
mov dword [ebp - 0x22c], esi
mov byte [ebp - 4], 2
mov edi, 1
mov eax, dword [esi - 8]
mov ecx, edi
sub ecx, dword [esi - 4]
sub eax, 0x104
or eax, ecx
jge 0x566327
push 0x104
lea ecx, [ebp - 0x22c]
call fcn.00402c20
mov esi, dword [ebp - 0x22c]
push 0x104
push esi
push str._APPDATA_CanonIJ_Scan_Utility
call dword [sym.imp.KERNEL32.dll_ExpandEnvironmentStringsW]
push dword [esi - 8]
push esi
call fcn.00528e42
add esp, 8
test eax, eax
js 0x5665fa
cmp eax, dword [esi - 8]
jg 0x5665fa
mov dword [esi - 0xc], eax
xor ecx, ecx
mov word [esi + eax*2], cx
mov eax, dword [ebp - 0x228]
sub edi, dword [esi - 4]
mov dword [ebp - 0x224], esi
mov eax, dword [eax]
mov dword [ebp - 0x230], eax
mov eax, dword [esi - 8]
sub eax, 0x104
or eax, edi
jge 0x566397
push 0x104
lea ecx, [ebp - 0x22c]
call fcn.00402c20
mov esi, dword [ebp - 0x22c]
push dword [ebp - 0x230]
push dword [ebp - 0x224]
push esi
call dword [sym.imp.SHLWAPI.dll_PathCombineW]
push dword [esi - 8]
push esi
call fcn.00528e42
add esp, 8
test eax, eax
js 0x5665fa
cmp eax, dword [esi - 8]
jg 0x5665fa
xor ecx, ecx
mov dword [esi - 0xc], eax
push ecx
mov word [esi + eax*2], cx
mov edi, esp
lea eax, [esi - 0x10]
push eax
mov dword [ebp - 0x234], eax
call fcn.00403660
add esp, 4
add eax, 0x10
mov dword [edi], eax
call fcn.00587320
add esp, 4
xor edx, edx
cmp ebx, 0x9fbf1
jne 0x566401
mov edx, 1
mov ecx, dword [0x61fa1c]
test ecx, ecx
je 0x566426
mov eax, dword [esi - 0xc]
inc eax
push eax
push esi
mov esi, dword [ebp + 8]
lea eax, [esi + 0x2010001]
push eax
push dword [edx*4 + 0x61feb8]
call ecx
jmp 0x566429
mov esi, dword [ebp + 8]
xor eax, eax
mov byte [ebp - 0x21d], 0
cmp ebx, 0x9fbf1
jne 0x56643f
mov eax, 1
mov ecx, dword [0x61fa68]
test ecx, ecx
je 0x566468
push 0x10018
push dword [eax*4 + 0x61feb8]
call ecx
cmp eax, 0x13ba
jne 0x566468
mov dl, 1
or edi, 0xffffffff
jmp 0x566512
push 0x5e8d78
lea eax, [ebp - 0x21c]
mov dword [ebp - 0x224], 0
push 0x104
push eax
call fcn.00529409
mov edx, dword [ebp - 0x228]
lea ecx, [ebp - 0x240]
add esp, 0xc
call fcn.00589050
push dword [eax]
lea eax, [ebp - 0x21c]
push eax
call dword [sym.imp.SHLWAPI.dll_PathAppendW]
mov edx, dword [ebp - 0x240]
or edi, 0xffffffff
add edx, 0xfffffff0
mov ecx, edi
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x5664cd
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
lea eax, [ebp - 0x224]
push eax
push 0x20019
push 0
lea eax, [ebp - 0x21c]
push eax
push reloc.OLEAUT32.dll_SysReAllocString
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExW]
mov eax, dword [ebp - 0x224]
test eax, eax
je 0x56650c
push eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov dword [ebp - 0x224], 0
mov dl, 1
jmp 0x566512
mov dl, byte [ebp - 0x21d]
mov dword [ebp - 0x230], 0
cmp ebx, 0x9fbf1
jne 0x56652e
mov dword [ebp - 0x230], 1
mov ecx, dword [0x61fa38]
test ecx, ecx
je 0x566561
xor eax, eax
test dl, dl
sete al
add eax, 0x127a
push eax
lea eax, [esi + 0x1040001]
push eax
mov eax, dword [ebp - 0x230]
push dword [eax*4 + 0x61feb8]
call ecx
mov ecx, dword [0x61fa38]
mov eax, dword [ebp - 0x228]
mov eax, dword [eax]
cmp dword [eax - 0xc], 0
jl 0x5665a2
push str.Network
push eax
call fcn.00528f1f
add esp, 8
test eax, eax
je 0x56659c
mov ecx, dword [ebp - 0x228]
sub eax, dword [ecx]
sar eax, 1
test eax, eax
jle 0x56659c
mov ecx, dword [0x61fa38]
mov edx, 1
jmp 0x5665a4
mov ecx, dword [0x61fa38]
xor edx, edx
xor eax, eax
test edx, edx
setne al
xor edx, edx
add eax, 0x1270
cmp ebx, 0x9fbf1
jne 0x5665bf
mov edx, 1
test ecx, ecx
je 0x5665d4
push eax
lea eax, [esi + 0x1050001]
push eax
push dword [edx*4 + 0x61feb8]
call ecx
mov edx, dword [ebp - 0x234]
mov ebx, 1
mov byte [ebp - 4], bl
mov ecx, edi
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x566606
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
jmp 0x566606
push 0x80070057
call fcn.00402740
xor ebx, ebx
mov byte [ebp - 4], 0
mov ecx, edi
mov edx, dword [ebp - 0x238]
add edx, 0xfffffff0
lea eax, [edx + 0xc]
lock xadd dword [eax], ecx
dec ecx
test ecx, ecx
jg 0x566629
mov ecx, dword [edx]
push edx
mov eax, dword [ecx]
call dword [eax + 4]
mov dword [ebp - 4], 0xffffffff
mov esi, dword [ebp - 0x23c]
add esi, 0xfffffff0
lea eax, [esi + 0xc]
lock xadd dword [eax], edi
dec edi
test edi, edi
jg 0x56664d
mov ecx, dword [esi]
push esi
mov edx, dword [ecx]
call dword [edx + 4]
mov eax, ebx
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.00527e2c
mov esp, ebp
pop ebp
ret