Function at 0x401710
Capabilities:
Check if file exists
Create directory
Get common file path
Get file attributes
Read .ini file

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
mov eax, 0x1594
call fcn.004110e0
mov eax, dword [0x41c004]
xor eax, esp
mov dword [esp + 0x1590], eax
mov eax, dword [ebp + 8]
push ebx
push esi
push edi
push 0x104
lea ecx, [esp + 0x764]
push ecx
mov dword [esp + 0x24], eax
mov dword [esp + 0x18], 0
call dword [sym.imp.KERNEL32.dll_GetWindowsDirectoryW]
lea edx, [esp + 0x760]
push edx
push str._sTWAIN_32KMTWAINKMSCNTOOL.dll
lea edx, [esp + 0x1190]
call fcn.00408fa0
add esp, 8
lea eax, [esp + 0x1188]
push eax
call dword [sym.imp.KERNEL32.dll_LoadLibraryW]
push 0
push 0x1a
lea ecx, [esp + 0x150]
push ecx
push 0
mov ebx, eax
call dword [sym.imp.SHELL32.dll_SHGetSpecialFolderPathW]
lea edx, [esp + 0x148]
push edx
push str._sKyoceraKM_TWAINKMSCNTOOL
lea edx, [esp + 0x358]
call fcn.00408fa0
add esp, 8
lea eax, [esp + 0x350]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x4017c6
test al, 0x10
jne 0x4017d6
push 0
lea ecx, [esp + 0x354]
push ecx
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
lea edx, [esp + 0x148]
push edx
push str._sKyoceraKM_TWAINRegList.ini
lea edx, [esp + 0xb78]
call fcn.00408fa0
mov esi, dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringW]
add esp, 8
lea eax, [esp + 0xb70]
push eax
push 0x104
lea ecx, [esp + 0x560]
push ecx
push 0x417764
push str.DefaultUse
push str.Setting
call esi
lea edx, [esp + 0x558]
push edx
lea eax, [esp + 0x14c]
push eax
push str._sKyoceraKM_TWAINKM_TWAIN_s.ini
lea edx, [esp + 0xd84]
call fcn.00408fa0
add esp, 0xc
lea ecx, [esp + 0xd78]
push ecx
push 0x104
lea edx, [esp + 0x1398]
push edx
push 0x417764
push str.Unit
push str.Contents
call esi
lea eax, [esp + 0x558]
push eax
lea ecx, [esp + 0x354]
push ecx
push str._sN_LSTSCN_s.xml
lea edx, [esp + 0x974]
call fcn.00408fa0
lea edx, [esp + 0x76c]
push edx
push str._sTWAIN_32KMTWAINN_SCANCONFIG.xsd
lea edx, [esp + 0xf94]
call fcn.00408fa0
add esp, 0x14
test ebx, ebx
je 0x401a22
mov edi, dword [sym.imp.KERNEL32.dll_GetProcAddress]
push str.XMLSCN_Open
push ebx
call edi
push str.XMLSCN_Close
push ebx
mov esi, eax
call edi
push str.XMLSCN_Add
push ebx
mov dword [esp + 0x1c], eax
call edi
push str.XMLSCN_Save
push ebx
mov dword [esp + 0x20], eax
call edi
push 0
mov edi, eax
call dword [sym.imp.ole32.dll_CoInitialize]
test esi, esi
je 0x401905
lea eax, [esp + 0x10]
push eax
lea ecx, [esp + 0xf84]
push ecx
lea edx, [esp + 0x970]
push edx
call esi
add esp, 0xc
mov edx, 0x417794
lea ecx, [esp + 0x1390]
mov ax, word [ecx]
cmp ax, word [edx]
jne 0x401937
test ax, ax
je 0x401933
mov ax, word [ecx + 2]
cmp ax, word [edx + 2]
jne 0x401937
add ecx, 4
add edx, 4
test ax, ax
jne 0x401911
xor eax, eax
jmp 0x40193c
sbb eax, eax
sbb eax, 0xffffffff
neg eax
sbb eax, eax
and eax, 7
add eax, 3
mov dword [esp + 0x20], eax
mov eax, 1
mov edx, 2
mov dword [esp + 0x30], eax
mov dword [esp + 0x38], eax
mov dword [esp + 0x118], eax
mov dword [esp + 0x3c], eax
mov dword [esp + 0x140], eax
mov dword [esp + 0x24], edx
mov dword [esp + 0x28], 6
mov dword [esp + 0x110], edx
mov dword [esp + 0x2c], 0x10
mov dword [esp + 0x34], edx
mov dword [esp + 0x114], 4
xor eax, eax
lea ebx, [ebx]
movzx ecx, word [eax + 0x417764]
mov word [esp + eax + 0x82], cx
add eax, edx
test cx, cx
jne 0x4019a0
xor eax, eax
jmp 0x4019c0
movzx ecx, word [eax + 0x417764]
mov word [esp + eax + 0x40], cx
add eax, edx
test cx, cx
jne 0x4019c0
mov esi, dword [esp + 0x1c]
call fcn.00401a40
mov dword [esp + 0x144], eax
mov eax, dword [esp + 0x18]
test eax, eax
je 0x4019fa
mov edx, dword [esp + 0x10]
lea ecx, [esp + 0x20]
push ecx
push edx
call eax
add esp, 8
test edi, edi
je 0x401a10
mov ecx, dword [esp + 0x10]
lea eax, [esp + 0x968]
push eax
push ecx
call edi
add esp, 8
mov eax, dword [esp + 0x14]
test eax, eax
je 0x401a22
mov edx, dword [esp + 0x10]
push edx
call eax
add esp, 4
push ebx
call dword [sym.imp.KERNEL32.dll_FreeLibrary]
mov ecx, dword [esp + 0x159c]
pop edi
pop esi
pop ebx
xor ecx, esp
xor eax, eax
call fcn.00408fb6
mov esp, ebp
pop ebp
ret