Function at 0x408140
Capabilities:
Check if file exists
Get file attributes
Query or enumerate registry key
Query or enumerate registry value
Read .ini file

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xc74
mov dword [ebp - 0x938], 0
mov eax, dword [ebp + 0xc]
cmp eax, dword [0x41b0bc]
jne 0x40816a
mov dword [ebp - 0xc74], 0x41beb0
jmp 0x408174
mov dword [ebp - 0xc74], 0x41beb8
mov ecx, dword [ebp + 0x10]
push ecx
mov edx, dword [ebp - 0xc74]
push edx
push 0x41bec0
lea eax, [ebp - 0x628]
push eax
call fcn.0040dddb
add esp, 0x10
cmp dword [0x420a88], 0
je 0x4081d9
cmp dword [ebp + 0x14], 0xffffffff
jne 0x4081d9
mov ecx, dword [ebp + 0x18]
and ecx, 0xff
push ecx
push 0
push 0
push 0
push 0
lea edx, [ebp - 0x628]
push edx
lea eax, [ebp - 0x628]
push eax
push 0
mov ecx, dword [ebp + 0x14]
push ecx
push 0
mov edx, dword [ebp + 8]
push edx
call fcn.0040652e
add esp, 0x2c
mov dword [ebp + 0x14], eax
lea eax, [ebp - 0x938]
push eax
push 0x20019
push 0
mov ecx, dword [ebp + 0x10]
push ecx
mov edx, dword [ebp + 0xc]
push edx
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0
je 0x40820c
mov eax, dword [ebp + 0x14]
jmp 0x408886
mov dword [ebp - 4], 0
jmp 0x40821e
mov eax, dword [ebp - 4]
add eax, 1
mov dword [ebp - 4], eax
mov dword [ebp - 0xa4c], 0x104
mov dword [ebp - 0xa48], 0x104
lea ecx, [ebp - 0xa48]
push ecx
lea edx, [ebp - 0x318]
push edx
push 0
push 0
lea eax, [ebp - 0xa4c]
push eax
lea ecx, [ebp - 0x830]
push ecx
mov edx, dword [ebp - 4]
push edx
mov eax, dword [ebp - 0x938]
push eax
call dword [sym.imp.ADVAPI32.dll_RegEnumValueA]
test eax, eax
je 0x40826c
jmp 0x40852f
lea ecx, [ebp - 0x318]
push ecx
push str._sScripts.Ini
lea edx, [ebp - 0xa44]
push edx
call fcn.0040dddb
add esp, 0xc
lea eax, [ebp - 0xa44]
push eax
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
jne 0x40829e
jmp 0x408215
mov dword [ebp - 0x940], 0
jmp 0x4082b9
mov ecx, dword [ebp - 0x940]
add ecx, 1
mov dword [ebp - 0x940], ecx
mov edx, dword [ebp - 0x940]
push edx
push str._dCmdLine
lea eax, [ebp - 0x41c]
push eax
call fcn.0040dddb
add esp, 0xc
lea ecx, [ebp - 0xa44]
push ecx
push 0x104
lea edx, [ebp - 0xb54]
push edx
push 0x420b78
lea eax, [ebp - 0x41c]
push eax
lea ecx, [ebp - 0x830]
push ecx
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringA]
mov dword [ebp - 0xa50], eax
cmp dword [ebp - 0xa50], 0
jne 0x408314
jmp 0x40852a
mov edx, dword [ebp - 0x940]
push edx
push str._dParameters
lea eax, [ebp - 0x41c]
push eax
call fcn.0040dddb
add esp, 0xc
lea ecx, [ebp - 0xa44]
push ecx
push 0x104
lea edx, [ebp - 0xc5c]
push edx
push 0x420b7c
lea eax, [ebp - 0x41c]
push eax
lea ecx, [ebp - 0x830]
push ecx
call dword [sym.imp.KERNEL32.dll_GetPrivateProfileStringA]
cmp dword [ebp - 0xa50], 2
jle 0x4083a2
push 2
push 0x41bef4
lea edx, [ebp - 0xb54]
push edx
call fcn.0040e320
add esp, 0xc
test eax, eax
je 0x40838a
movsx eax, byte [ebp - 0xb53]
cmp eax, 0x3a
jne 0x4083a2
lea ecx, [ebp - 0xb54]
push ecx
lea edx, [ebp - 0x934]
push edx
call fcn.0040dc70
add esp, 8
jmp 0x4083cb
lea eax, [ebp - 0xb54]
push eax
lea ecx, [ebp - 0x830]
push ecx
lea edx, [ebp - 0x318]
push edx
push str._s_s_s
lea eax, [ebp - 0x934]
push eax
call fcn.0040dddb
add esp, 0x14
lea ecx, [ebp - 0x934]
push ecx
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
cmp eax, 0xffffffff
jne 0x4083e2
jmp 0x4082aa
push 0
lea edx, [ebp - 0x934]
push edx
call fcn.00403360
add esp, 8
mov dword [ebp - 0xc60], eax
lea eax, [ebp - 0x520]
push eax
lea ecx, [ebp - 0x10c]
push ecx
mov edx, dword [ebp - 0xc60]
push edx
call fcn.004038ca
add esp, 0xc
mov dword [ebp - 0xb58], eax
mov eax, dword [ebp - 0xb58]
push eax
push 0xffffffffffffffff
push 0
push 1
push 0x1002
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.USER32.dll_SendMessageA]
push eax
call dword [sym.imp.COMCTL32.dll_ImageList_ReplaceIcon]
mov dword [ebp - 0xc64], eax
lea edx, [ebp - 0xc5c]
push edx
lea eax, [ebp - 0x934]
push eax
push str._s__s
lea ecx, [ebp - 0x41c]
push ecx
call fcn.0040dddb
add esp, 0x10
lea edx, [ebp - 0x72c]
push edx
lea eax, [ebp - 0x10c]
push eax
mov ecx, dword [ebp - 0xc60]
push ecx
lea edx, [ebp - 0x41c]
push edx
mov eax, dword [ebp + 8]
push eax
call fcn.00406381
add esp, 0x14
and eax, 0xff
test eax, eax
je 0x408525
cmp dword [ebp + 0x14], 0xffffffff
jne 0x4084d9
mov ecx, dword [ebp + 0x18]
and ecx, 0xff
push ecx
push 0
push 0
push 0
push 0
lea edx, [ebp - 0x628]
push edx
lea eax, [ebp - 0x628]
push eax
push 0
mov ecx, dword [ebp + 0x14]
push ecx
push 0
mov edx, dword [ebp + 8]
push edx
call fcn.0040652e
add esp, 0x2c
mov dword [ebp + 0x14], eax
mov eax, dword [ebp + 0x18]
and eax, 0xff
push eax
lea ecx, [ebp - 0x72c]
push ecx
lea edx, [ebp - 0x520]
push edx
lea eax, [ebp - 0x10c]
push eax
mov ecx, dword [ebp - 0xc60]
push ecx
lea edx, [ebp - 0x934]
push edx
lea eax, [ebp - 0x41c]
push eax
push 9
mov ecx, dword [ebp + 0x14]
push ecx
mov edx, dword [ebp - 0xc64]
push edx
mov eax, dword [ebp + 8]
push eax
call fcn.0040652e
add esp, 0x2c
jmp 0x4082aa
jmp 0x408215
mov ecx, dword [ebp - 0x938]
push ecx
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
lea edx, [ebp - 0x938]
push edx
push 0x20019
push 0
mov eax, dword [ebp + 0x10]
push eax
mov ecx, dword [ebp + 0xc]
push ecx
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0
je 0x40856f
mov eax, dword [ebp + 0x14]
jmp 0x408886
mov dword [ebp - 4], 0
jmp 0x408581
mov edx, dword [ebp - 4]
add edx, 1
mov dword [ebp - 4], edx
mov dword [ebp - 8], 0x104
push 0
push 0
push 0
push 0
lea eax, [ebp - 8]
push eax
lea ecx, [ebp - 0x830]
push ecx
mov edx, dword [ebp - 4]
push edx
mov eax, dword [ebp - 0x938]
push eax
call dword [sym.imp.ADVAPI32.dll_RegEnumKeyExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0x103
jne 0x4085c3
jmp 0x408876
cmp dword [ebp - 0x93c], 0
je 0x4085d1
jmp 0x408876
lea ecx, [ebp - 0x214]
push ecx
push 0x20019
push 0
lea edx, [ebp - 0x830]
push edx
mov eax, dword [ebp - 0x938]
push eax
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0
je 0x408607
jmp 0x408578
mov dword [ebp - 8], 0x104
lea ecx, [ebp - 8]
push ecx
lea edx, [ebp - 0x41c]
push edx
push 0
push 0
push str.DisplayName
mov eax, dword [ebp - 0x214]
push eax
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0
jne 0x408864
jmp 0x40864d
mov ecx, dword [ebp - 4]
add ecx, 1
mov dword [ebp - 4], ecx
mov dword [ebp - 8], 0x104
push 0
push 0
push 0
push 0
lea edx, [ebp - 8]
push edx
lea eax, [ebp - 0x210]
push eax
mov ecx, dword [ebp - 4]
push ecx
mov edx, dword [ebp - 0x214]
push edx
call dword [sym.imp.ADVAPI32.dll_RegEnumKeyExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0x103
jne 0x40868f
jmp 0x408864
cmp dword [ebp - 0x93c], 0
je 0x40869d
jmp 0x408864
lea eax, [ebp - 0x524]
push eax
push 0x20019
push 0
lea ecx, [ebp - 0x210]
push ecx
mov edx, dword [ebp - 0x214]
push edx
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0
je 0x4086d3
jmp 0x408644
mov dword [ebp - 8], 0x104
lea eax, [ebp - 8]
push eax
lea ecx, [ebp - 0x934]
push ecx
push 0
push 0
push str.Script
mov edx, dword [ebp - 0x524]
push edx
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
mov dword [ebp - 0x93c], eax
cmp dword [ebp - 0x93c], 0
jne 0x408852
push 0
lea eax, [ebp - 0x934]
push eax
call fcn.00403360
add esp, 8
mov dword [ebp - 0xc6c], eax
lea ecx, [ebp - 0x520]
push ecx
lea edx, [ebp - 0x10c]
push edx
mov eax, dword [ebp - 0xc6c]
push eax
call fcn.004038ca
add esp, 0xc
mov dword [ebp - 0xc68], eax
mov ecx, dword [ebp - 0xc68]
push ecx
push 0xffffffffffffffff
push 0
push 1
push 0x1002
mov edx, dword [ebp + 8]
push edx
call dword [sym.imp.USER32.dll_SendMessageA]
push eax
call dword [sym.imp.COMCTL32.dll_ImageList_ReplaceIcon]
mov dword [ebp - 0xc70], eax
lea eax, [ebp - 0x830]
push eax
lea ecx, [ebp - 0x628]
push ecx
push 0x41bf20
lea edx, [ebp - 0x318]
push edx
call fcn.0040dddb
add esp, 0x10
lea eax, [ebp - 0x72c]
push eax
lea ecx, [ebp - 0x10c]
push ecx
mov edx, dword [ebp - 0xc6c]
push edx
lea eax, [ebp - 0x41c]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.00406381
add esp, 0x14
and eax, 0xff
test eax, eax
je 0x408852
cmp dword [ebp + 0x14], 0xffffffff
jne 0x408805
mov edx, dword [ebp + 0x18]
and edx, 0xff
push edx
push 0
push 0
push 0
push 0
lea eax, [ebp - 0x628]
push eax
lea ecx, [ebp - 0x628]
push ecx
push 0
mov edx, dword [ebp + 0x14]
push edx
push 0
mov eax, dword [ebp + 8]
push eax
call fcn.0040652e
add esp, 0x2c
mov dword [ebp + 0x14], eax
mov ecx, dword [ebp + 0x18]
and ecx, 0xff
push ecx
lea edx, [ebp - 0x72c]
push edx
lea eax, [ebp - 0x520]
push eax
lea ecx, [ebp - 0x10c]
push ecx
mov edx, dword [ebp - 0xc6c]
push edx
lea eax, [ebp - 0x318]
push eax
lea ecx, [ebp - 0x41c]
push ecx
push 2
mov edx, dword [ebp + 0x14]
push edx
mov eax, dword [ebp - 0xc70]
push eax
mov ecx, dword [ebp + 8]
push ecx
call fcn.0040652e
add esp, 0x2c
mov edx, dword [ebp - 0x524]
push edx
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
jmp 0x408644
mov eax, dword [ebp - 0x214]
push eax
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
jmp 0x408578
mov ecx, dword [ebp - 0x938]
push ecx
call dword [sym.imp.ADVAPI32.dll_RegCloseKey]
mov eax, dword [ebp + 0x14]
mov esp, ebp
pop ebp
ret