Function at 0x4158d7
Capabilities:
Check if file exists
Copy file
Create directory
Download url
Read file on windows
Receive data

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x46ff15
mov eax, dword fs:[0]
push eax
push ecx
mov eax, 0x100b4
call fcn.00434ef0
mov eax, dword [0x496b64]
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 dword [ebp - 0x10], esp
mov eax, dword [ebp + 0x38]
mov dword [ebp - 0x100b0], eax
xor ebx, ebx
lea ecx, [ebp - 0x10044]
mov edi, str.fileLogger
inc ebx
push edi
mov dword [ebp - 4], ebx
call fcn.0040701e
lea eax, [ebp - 0x10044]
mov byte [ebp - 4], 2
push eax
lea eax, [ebp - 0x100a8]
push eax
call fcn.0041b7c1
pop ecx
pop ecx
push 0
push ebx
lea ecx, [ebp - 0x10044]
mov byte [ebp - 4], 4
call fcn.0040a6c8
cmp dword [ebp + 0x1c], 8
lea eax, [ebp + 8]
cmovae eax, dword [ebp + 8]
xor esi, esi
push esi
push eax
call dword [sym.imp.KERNEL32.DLL_CreateDirectoryW]
test eax, eax
jne 0x4159f8
call dword [sym.imp.KERNEL32.DLL_GetLastError]
cmp dword [ebp + 0x1c], 8
lea ecx, [ebp - 0x10074]
mov dword [ebp - 0x100b0], eax
lea eax, [ebp + 8]
cmovae eax, dword [ebp + 8]
push edi
mov dword [ebp - 0x100a0], eax
call fcn.0040701e
lea eax, [ebp - 0x10074]
mov byte [ebp - 4], 5
push eax
lea eax, [ebp - 0x100bc]
push eax
call fcn.0041b7c1
pop ecx
pop ecx
lea ecx, [ebp - 0x100b0]
mov byte [ebp - 4], 6
push ecx
lea ecx, [ebp - 0x100a0]
push ecx
mov ecx, dword [eax]
push str.Creating_directory____failed._Error_code_.
push 4
call fcn.004115e4
mov ecx, dword [ebp - 0x100b8]
test ecx, ecx
je 0x4159e6
call fcn.00408d46
push esi
push ebx
lea ecx, [ebp - 0x10074]
call fcn.0040a6c8
jmp 0x415e80
xor eax, eax
mov dword [ebp - 0x10048], 7
mov edi, str.remoteconfig.json
mov dword [ebp - 0x1004c], esi
push edi
mov word [ebp - 0x1005c], ax
call fcn.004501cb
pop ecx
push eax
push edi
lea ecx, [ebp - 0x1005c]
call fcn.0040acad
push 0x4796ac
lea eax, [ebp + 8]
mov byte [ebp - 4], 7
push eax
lea eax, [ebp - 0x1002c]
push eax
call fcn.0040f72b
add esp, 0xc
cmp dword [ebp - 0x10048], 8
lea eax, [ebp - 0x1005c]
mov byte [ebp - 4], 8
cmovae eax, dword [ebp - 0x1005c]
push eax
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
test eax, eax
je 0x415af3
cmp dword [ebp - 0x10018], 8
lea ecx, [ebp - 0x1002c]
push esi
cmovae ecx, dword [ebp - 0x1002c]
lea eax, [ebp - 0x1005c]
cmp dword [ebp - 0x10048], 8
push ecx
cmovae eax, dword [ebp - 0x1005c]
push eax
call dword [sym.imp.KERNEL32.DLL_CopyFileW]
test eax, eax
jne 0x415ada
call dword [sym.imp.KERNEL32.DLL_GetLastError]
mov ecx, dword [ebp - 0x100a8]
mov dword [ebp - 0x100a0], eax
lea eax, [ebp - 0x100a0]
push eax
lea eax, [ebp - 0x1002c]
push eax
lea eax, [ebp - 0x1005c]
push eax
push str.Failed_to_copy_local_remote_config_override_from_path__to_path_._Error_code_.
push 4
call fcn.0041195f
jmp 0x415e66
mov edi, dword [ebp - 0x100a8]
mov ecx, edi
push str.Using_local_remote_config_override.
push 2
call fcn.00403735
jmp 0x415b85
mov edi, dword [ebp - 0x100a8]
mov ecx, edi
push 0x4797c8
push str.Looking_for_remote_config_info_for_product_id_.
push 2
call fcn.00410e8f
lea eax, [ebp + 0x20]
push eax
push ecx
mov eax, esp
mov dword [eax], str.https:__remote_config.gog.com_components_webinstaller_clients__component_version2.0.0
lea eax, [ebp - 0x10044]
push eax
call fcn.00410c07
add esp, 0xc
cmp dword [ebp - 0x10018], 8
lea ecx, [ebp - 0x1002c]
lea eax, [ebp - 0x10044]
mov byte [ebp - 4], 9
cmovae ecx, dword [ebp - 0x1002c]
cmp dword [ebp - 0x10030], 8
cmovae eax, dword [ebp - 0x10044]
xor edx, edx
push edx
push edx
push ecx
push eax
push edx
call sub.urlmon.dll_URLDownloadToFileW
test eax, eax
jne 0x415e2d
push str.Downloaded_latest_remote_config_file.
push 2
mov ecx, edi
call fcn.00403735
xor esi, esi
lea ecx, [ebp - 0x10044]
push esi
push ebx
call fcn.0040a71d
cmp dword [ebp - 0x10018], 8
lea eax, [ebp - 0x1002c]
push esi
cmovae eax, dword [ebp - 0x1002c]
push 0x80
push 3
push esi
push ebx
push 0x80000000
push eax
call dword [sym.imp.KERNEL32.DLL_CreateFileW]
mov dword [ebp - 0x100ac], eax
lea ecx, [ebp - 0x1009c]
lea eax, [ebp - 0x100ac]
mov dword [ebp - 0x10078], esi
mov dword [ebp - 0x100a0], eax
lea eax, [ebp - 0x100a0]
push eax
call fcn.0041008f
push 0x10000
lea eax, [ebp - 0x10014]
mov byte [ebp - 4], 0xa
push esi
push eax
mov dword [ebp - 0x100b4], esi
call fcn.0044e670
add esp, 0xc
cmp dword [ebp - 0x100ac], 0xffffffff
jne 0x415c39
call dword [sym.imp.KERNEL32.DLL_GetLastError]
mov dword [ebp - 0x100a0], eax
lea eax, [ebp - 0x100a0]
push eax
lea eax, [ebp - 0x1002c]
push eax
push str.Failed_to_open_remote_config_file_____error___._Installation_should_process_as_normal.
push 4
mov ecx, edi
call fcn.004117a0
lea ecx, [ebp - 0x1009c]
call fcn.0040779e
jmp 0x415e66
push esi
lea eax, [ebp - 0x100b4]
push eax
push 0xffff
lea eax, [ebp - 0x10014]
push eax
push dword [ebp - 0x100ac]
call dword [sym.imp.KERNEL32.DLL_ReadFile]
test eax, eax
jne 0x415c7e
call dword [sym.imp.KERNEL32.DLL_GetLastError]
mov dword [ebp - 0x100a0], eax
lea eax, [ebp - 0x100a0]
push eax
lea eax, [ebp - 0x1002c]
push eax
push str.Failed_to_read_from_remote_config_file_____error___._Installation_should_proceed_as_normal.
jmp 0x415c20
push 0
lea ecx, [ebp - 0x10034]
mov byte [ebp - 4], 0xb
mov byte [ebp - 0x1003c], 0
call fcn.00413265
sub esp, 0x10
xor esi, esi
mov edi, esp
push esi
sub esp, 0x28
mov eax, esp
mov dword [ebp - 0x100a0], esp
mov dword [eax + 0x24], esi
push ecx
push ecx
mov ecx, esp
mov byte [ebp - 4], 0xe
lea eax, [ebp - 0x14]
mov dword [ebp - 0x100b8], ecx
push eax
lea eax, [ebp - 0x10014]
push eax
call fcn.0040edb3
push edi
mov byte [ebp - 4], 0xd
call fcn.0041cf50
add esp, 0x38
lea ecx, [ebp - 0x1003c]
call fcn.00413b02
mov dword [ebp - 4], 0xc
lea ecx, [ebp - 0x1003c]
push str.content
mov byte [ebp - 4], 0x10
call fcn.0040f45c
push str.windows
mov ecx, eax
call fcn.0040f45c
push 0x479d38
mov ecx, eax
call fcn.0040f45c
lea ecx, [ebp - 0x10074]
push ecx
mov ecx, eax
call fcn.0040f50e
mov ecx, dword [ebp - 0x100b0]
push eax
call fcn.00413b42
push esi
push ebx
lea ecx, [ebp - 0x10074]
call fcn.0040a6c8
push dword [ebp - 0x1003c]
lea ecx, [ebp - 0x10034]
call fcn.00419177
lea ecx, [ebp - 0x1009c]
call fcn.0040779e
push esi
push ebx
lea ecx, [ebp - 0x1002c]
call fcn.0040a71d
push esi
push ebx
lea ecx, [ebp - 0x1005c]
call fcn.0040a71d
mov ecx, dword [ebp - 0x100a4]
test ecx, ecx
je 0x415d81
call fcn.00408d46
push esi
push ebx
lea ecx, [ebp + 8]
call fcn.0040a71d
push esi
push ebx
lea ecx, [ebp + 0x20]
call fcn.0040a71d
xor al, al
jmp 0x415ea5
cmp eax, 0x8007000e
jne 0x415e3b
push str.Failed_to_download_remote_config_to_file_due_to_error_E_OUTOFMEMORY.
jmp 0x415e4e
cmp eax, 0x800c0008
jne 0x415e49
push str.Failed_to_download_remote_config_to_file_due_to_error_INET_E_DOWNLOAD_FAILURE.
jmp 0x415e4e
push str.Failed_to_download_remote_config_to_file_due_to_unknown_error.
push 4
mov ecx, edi
call fcn.00403735
xor esi, esi
lea ecx, [ebp - 0x10044]
push esi
push ebx
call fcn.0040a71d
push esi
push ebx
lea ecx, [ebp - 0x1002c]
call fcn.0040a71d
push esi
push ebx
lea ecx, [ebp - 0x1005c]
call fcn.0040a71d
mov ecx, dword [ebp - 0x100a4]
test ecx, ecx
je 0x415e8f
call fcn.00408d46
push esi
push ebx
lea ecx, [ebp + 8]
call fcn.0040a71d
push esi
push ebx
lea ecx, [ebp + 0x20]
call fcn.0040a71d
mov al, bl
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.004349b3
mov esp, ebp
pop ebp
ret