Function at 0x401520
Capabilities:
Extract resource via kernel32 functions
Get common file path
Query or enumerate registry value
Read file on windows
Resolve function by parsing pe exports
Write file on windows

Disassembly:
sub esp, 0x5a0
push 0x104
lea eax, [esp + 0x298]
push eax
push 0
mov dword [esp + 0x34], 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
test eax, eax
jne 0x40154e
add esp, 0x5a0
ret
push esi
push edi
mov edi, dword [sym.imp.KERNEL32.dll_CreateFileA]
push 0
push 0
push 3
push 0
push 3
push 0x80000000
lea ecx, [esp + 0x2b4]
push ecx
call edi
mov esi, eax
cmp esi, 0xffffffff
jne 0x401581
pop edi
xor eax, eax
pop esi
add esp, 0x5a0
ret
push ebx
push ebp
lea edx, [esp + 0x4ac]
push edx
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
lea eax, [esp + 0x3a8]
push eax
push 0
push 0x402134
lea ecx, [esp + 0x4b8]
push ecx
call dword [sym.imp.KERNEL32.dll_GetTempFileNameA]
lea edx, [esp + 0x3a8]
push edx
call fcn.00401410
add esp, 4
push 0
push 0
push 2
push 0
push 0
push 0xc0000000
lea eax, [esp + 0x3c0]
push eax
call edi
mov ebp, dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
push 0
push 0x18
push esi
mov edi, eax
call ebp
mov ebx, dword [sym.imp.KERNEL32.dll_ReadFile]
push 0
lea ecx, [esp + 0x1c]
push ecx
push 4
lea edx, [esp + 0x44]
push edx
push esi
call ebx
mov eax, dword [esp + 0x38]
test eax, eax
push 0
je 0x401631
push 0
push eax
push esi
call ebp
push 0
lea eax, [esp + 0x1c]
push eax
push 4
lea ecx, [esp + 0x3c]
push ecx
push esi
call ebx
cmp dword [esp + 0x30], 0x46474550
push 0
je 0x40165c
push str.ERROR:_PATCH_INFO_NOT_FOUND
push str.Patch_information_not_included...
push 0
call dword [sym.imp.USER32.dll_MessageBoxA]
push edi
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call edi
push esi
call edi
pop ebp
pop ebx
pop edi
xor eax, eax
pop esi
add esp, 0x5a0
ret
lea edx, [esp + 0x1c]
push edx
push 4
lea eax, [esp + 0x38]
push eax
push esi
call ebx
push 0
lea ecx, [esp + 0x1c]
push ecx
push 4
lea edx, [esp + 0x40]
push edx
push esi
call ebx
mov ebp, dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
lea eax, [esp + 0x18]
push eax
push 4
lea ecx, [esp + 0x3c]
push ecx
push edi
mov dword [esp + 0x44], 0x46475346
call ebp
push 0
lea edx, [esp + 0x18]
push edx
push 4
lea eax, [esp + 0x38]
push eax
push edi
call ebp
push 0
lea ecx, [esp + 0x18]
push ecx
push 4
lea edx, [esp + 0x40]
push edx
push edi
call ebp
cmp dword [esp + 0x2c], 0
mov dword [esp + 0x24], 0
jbe 0x4018a1
push 0
lea eax, [esp + 0x1c]
push eax
push 4
lea ecx, [esp + 0x54]
push ecx
push esi
call ebx
push 0
lea edx, [esp + 0x1c]
push edx
push 4
lea eax, [esp + 0x1c]
push eax
push esi
call ebx
push 0
lea ecx, [esp + 0x1c]
push ecx
push 4
lea edx, [esp + 0x34]
push edx
push esi
call ebx
mov eax, dword [esp + 0x10]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edx, dword [esp + 0x10]
push 0
lea ecx, [esp + 0x1c]
push ecx
push edx
push eax
push esi
mov dword [esp + 0x34], eax
call ebx
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x20]
push eax
push ecx
lea eax, [esp + 0xa4]
call fcn.004014a0
mov edx, dword [esp + 0x28]
add esp, 8
push edx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
lea eax, [esp + 0x9c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
push 0
lea ecx, [esp + 0x18]
push ecx
push 4
lea edx, [esp + 0x54]
push edx
push edi
mov dword [esp + 0x30], eax
call ebp
push 0
lea eax, [esp + 0x18]
push eax
push 4
lea ecx, [esp + 0x28]
push ecx
push edi
call ebp
mov eax, dword [esp + 0x1c]
push 0
lea edx, [esp + 0x18]
push edx
push eax
lea ecx, [esp + 0xa8]
push ecx
push edi
call ebp
push 0
lea edx, [esp + 0x18]
push edx
push 4
lea eax, [esp + 0x34]
push eax
push edi
call ebp
cmp dword [esp + 0x28], 0
mov dword [esp + 0x3c], 0
jbe 0x40188c
push 0
lea ecx, [esp + 0x1c]
push ecx
push 4
lea edx, [esp + 0x4c]
push edx
push esi
call ebx
push 0
lea eax, [esp + 0x1c]
push eax
push 4
lea ecx, [esp + 0x1c]
push ecx
push esi
call ebx
mov edx, dword [esp + 0x10]
push edx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edx, dword [esp + 0x10]
push 0
lea ecx, [esp + 0x1c]
push ecx
push edx
push eax
push esi
mov dword [esp + 0x34], eax
call ebx
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x20]
push eax
push ecx
lea eax, [esp + 0xa4]
call fcn.004014a0
mov edx, dword [esp + 0x28]
add esp, 8
push edx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push 0
lea eax, [esp + 0x18]
push eax
push 4
lea ecx, [esp + 0x4c]
push ecx
push edi
call ebp
push 0
lea edx, [esp + 0x18]
push edx
push 4
lea eax, [esp + 0x28]
push eax
push edi
call ebp
mov edx, dword [esp + 0x1c]
push 0
lea ecx, [esp + 0x18]
push ecx
push edx
lea eax, [esp + 0xa8]
push eax
push edi
call ebp
mov eax, dword [esp + 0x3c]
add eax, 1
cmp eax, dword [esp + 0x28]
mov dword [esp + 0x3c], eax
jb 0x4017c7
mov eax, dword [esp + 0x24]
add eax, 1
cmp eax, dword [esp + 0x2c]
mov dword [esp + 0x24], eax
jb 0x4016d0
mov eax, dword [esp + 0x34]
cmp eax, 1
jne 0x4018e9
lea ecx, [esp + 0x2a4]
push ecx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
push 0
lea edx, [esp + 0x18]
push edx
mov dword [esp + 0x24], eax
push 4
lea eax, [esp + 0x28]
push eax
push edi
call ebp
mov edx, dword [esp + 0x1c]
push 0
lea ecx, [esp + 0x18]
push ecx
push edx
lea eax, [esp + 0x2b0]
push eax
push edi
call ebp
jmp 0x4019b5
test eax, eax
mov dword [esp + 0x24], 0
jbe 0x4019b5
lea esp, [esp]
push 0
lea ecx, [esp + 0x1c]
push ecx
push 4
lea edx, [esp + 0x1c]
push edx
push esi
call ebx
mov eax, dword [esp + 0x10]
push eax
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov edx, dword [esp + 0x10]
push 0
lea ecx, [esp + 0x1c]
push ecx
push edx
push eax
push esi
mov dword [esp + 0x34], eax
call ebx
mov eax, dword [esp + 0x10]
mov ecx, dword [esp + 0x20]
push eax
push ecx
lea eax, [esp + 0xa4]
call fcn.004014a0
mov edx, dword [esp + 0x28]
add esp, 8
push edx
push 0
call dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
lea eax, [esp + 0x9c]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
push 0
lea ecx, [esp + 0x18]
push ecx
push 4
lea edx, [esp + 0x28]
push edx
push edi
mov dword [esp + 0x30], eax
call ebp
mov ecx, dword [esp + 0x1c]
push 0
lea eax, [esp + 0x18]
push eax
push ecx
lea edx, [esp + 0xa8]
push edx
push edi
call ebp
mov eax, dword [esp + 0x24]
add eax, 1
cmp eax, dword [esp + 0x34]
mov dword [esp + 0x24], eax
jb 0x401900
push edi
mov edi, dword [sym.imp.KERNEL32.dll_CloseHandle]
call edi
push esi
call edi
push str.STUB
push 0x101
xor ebp, ebp
push ebp
call dword [sym.imp.KERNEL32.dll_FindResourceA]
mov esi, eax
push esi
push ebp
call dword [sym.imp.KERNEL32.dll_LoadResource]
push esi
push ebp
mov ebx, eax
call dword [sym.imp.KERNEL32.dll_SizeofResource]
push ebx
mov dword [esp + 0x14], eax
call dword [sym.imp.KERNEL32.dll_LockResource]
mov ecx, dword [esp + 0x10]
push ecx
push eax
lea eax, [esp + 0xa4]
call fcn.004014a0
add esp, 8
lea edx, [esp + 0x4c]
push edx
push 1
push ebp
push str.SOFTWAREBlizzard_EntertainmentStarcraft
push 0x80000002
call dword [sym.imp.ADVAPI32.dll_RegOpenKeyExA]
mov edx, dword [esp + 0x4c]
lea eax, [esp + 0x44]
push eax
lea ecx, [esp + 0x1a4]
push ecx
push ebp
push ebp
push str.Program
mov esi, 0x104
push edx
mov dword [esp + 0x5c], esi
call dword [sym.imp.ADVAPI32.dll_RegQueryValueExA]
push ebp
push ebp
push 3
push ebp
push 3
push 0x80000000
lea eax, [esp + 0x1b8]
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileA]
cmp eax, 0xffffffff
jne 0x401b15
lea edx, [esp + 0x50]
lea ecx, [esp + 0x1a0]
push edx
mov byte [esp + 0x1a4], 0
mov dword [esp + 0x54], 0x4c
mov dword [esp + 0x58], ebp
mov dword [esp + 0x5c], ebp
mov dword [esp + 0x60], str.Executable_Files_.exe_
mov dword [esp + 0x64], ebp
mov dword [esp + 0x68], ebp
mov dword [esp + 0x6c], ebp
mov dword [esp + 0x70], ecx
mov dword [esp + 0x74], esi
mov dword [esp + 0x78], ebp
mov dword [esp + 0x7c], ebp
mov dword [esp + 0x80], ebp
mov dword [esp + 0x84], str.Open_Starcraft_Executable
mov dword [esp + 0x88], 0x81800
mov word [esp + 0x8c], bp
mov word [esp + 0x8e], bp
mov dword [esp + 0x90], 0x4021e8
mov dword [esp + 0x94], ebp
mov dword [esp + 0x98], ebp
mov dword [esp + 0x9c], ebp
call dword [sym.imp.comdlg32.dll_GetOpenFileNameA]
test eax, eax
jne 0x401b18
pop ebp
pop ebx
pop edi
pop esi
add esp, 0x5a0
ret
push eax
call edi
lea eax, [esp + 0x3a8]
push eax
lea ecx, [esp + 0xa0]
push ecx
lea edx, [esp + 0x1a8]
push edx
call fcn.004012c0
add esp, 0xc
pop ebp
pop ebx
pop edi
pop esi
add esp, 0x5a0
ret