Function at 0x402080
Capabilities:
Check if file exists
Enumerate files on windows
Extract resource via kernel32 functions
Get file attributes
Query environment variable
Set environment variable

Disassembly:
sub esp, 0x694
cmp dword [0x408378], 0
push ebx
mov ebx, dword [sym.imp.KERNEL32.dll_HeapAlloc]
push ebp
mov ebp, dword [sym.imp.KERNEL32.dll_GetProcessHeap]
push esi
push edi
mov dword [esp + 0x14], edx
mov esi, 0x10000
mov dword [esp + 0x1c], ecx
mov dword [0x408380], 1
jne 0x4020c3
push esi
push 0
call ebp
push eax
call ebx
mov dword [0x408378], eax
mov eax, dword [0x408374]
test eax, eax
jne 0x4020d8
push esi
push eax
call ebp
push eax
call ebx
mov dword [0x408374], eax
mov ecx, dword [0x40837c]
test ecx, ecx
jne 0x4020f6
push esi
push ecx
call ebp
push eax
call ebx
mov ecx, eax
mov eax, dword [0x408374]
mov dword [0x40837c], ecx
xor edx, edx
mov byte [0x408500], dl
mov byte [0x408a00], dl
push esi
mov byte [eax], dl
push edx
mov byte [ecx], dl
call ebp
push eax
call ebx
mov ebx, dword [sym.imp.KERNEL32.dll_lstrcpyA]
mov edi, eax
push str._Djava.application.version
mov esi, 0x408880
mov dword [esp + 0x24], edi
push esi
call ebx
push 0x10
push 1
push 0
call dword [sym.imp.KERNEL32.dll_FindResourceA]
test eax, eax
jne 0x40213c
mov byte [edi], al
jmp 0x402171
push eax
push 0
call dword [sym.imp.KERNEL32.dll_LoadResource]
push eax
call dword [sym.imp.KERNEL32.dll_LockResource]
mov ecx, dword [eax + 0x34]
mov edx, dword [eax + 0x30]
movzx eax, cx
push eax
shr ecx, 0x10
push ecx
movzx eax, dx
push eax
shr edx, 0x10
push edx
push str._d._d._d._d
push edi
call dword [sym.imp.msvcrt.dll_sprintf]
add esp, 0x18
push edi
push esi
mov esi, dword [sym.imp.KERNEL32.dll_lstrcatA]
call esi
lea ecx, [esp + 0x598]
call fcn.00402ba1
push str._Djava.application.path
push 0x4088c0
call ebx
lea eax, [esp + 0x598]
push eax
push 0x4088c0
call esi
push str._Djava.security.policy
push 0x4083c0
call ebx
lea eax, [esp + 0x598]
push eax
push 0x4083c0
call esi
push 0x104
push edi
push 0
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
push str._Djava.application.name
push 0x408740
call ebx
push 0x5c
push edi
call dword [sym.imp.msvcrt.dll_strrchr]
pop ecx
pop ecx
inc eax
push eax
push 0x408740
call esi
push 0x405418
push 0x4083c0
call esi
push 0x2e
push edi
call dword [sym.imp.msvcrt.dll_strrchr]
push 0x5c
push edi
mov byte [eax], 0
call dword [sym.imp.msvcrt.dll_strrchr]
add esp, 0x10
mov edi, 0x4083c0
inc eax
push eax
push edi
call esi
push str..policy
push edi
call esi
push 0x4083d7
call dword [sym.imp.KERNEL32.dll_GetFileAttributesA]
movzx ecx, byte [0x4083c0]
xor edx, edx
cmp eax, 0xffffffff
cmove ecx, edx
mov byte [0x4083c0], cl
cmp dword [esp + 0x6ac], edx
je 0x402499
cmp byte [0x408a00], dl
jne 0x4025ec
lea ecx, [esp + 0x140]
call fcn.00402ba1
lea eax, [esp + 0x140]
push eax
lea eax, [esp + 0x494]
push eax
call ebx
push 0x405424
lea eax, [esp + 0x494]
push eax
call esi
lea eax, [esp + 0x350]
push eax
lea eax, [esp + 0x494]
push eax
call dword [sym.imp.KERNEL32.dll_FindFirstFileA]
mov dword [esp + 0x10], eax
cmp eax, 0xffffffff
je 0x402373
xor edi, edi
test byte [esp + 0x350], 0x10
jne 0x4022cf
lea ecx, [esp + 0x350]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_FindNextFileA]
test eax, eax
je 0x4022f3
mov eax, dword [esp + 0x10]
jmp 0x4022ac
push 0x405418
lea eax, [esp + 0x144]
push eax
call esi
lea eax, [esp + 0x37c]
push eax
lea eax, [esp + 0x144]
push eax
call esi
xor edi, edi
inc edi
push dword [esp + 0x10]
call dword [sym.imp.KERNEL32.dll_FindClose]
test edi, edi
je 0x402373
push dword [esp + 0x6a8]
lea edx, [esp + 0x144]
call fcn.0040286a
pop ecx
test eax, eax
je 0x402373
call fcn.00402ddf
test eax, eax
je 0x402330
cmp eax, 0x20
je 0x402330
mov byte [0x408a00], 0
jmp 0x402380
lea eax, [esp + 0x140]
push eax
push str.JAVA_HOME
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
lea eax, [esp + 0x140]
mov edi, 0x408500
push eax
push edi
call ebx
push str._bin
push edi
call esi
lea eax, [esp + 0x140]
mov edi, 0x408620
push eax
push edi
call ebx
push str.libext
push edi
call esi
cmp byte [0x408a00], 0
jne 0x4025ec
lea ecx, [esp + 0x248]
call fcn.00402ba1
lea eax, [esp + 0x248]
push eax
lea eax, [esp + 0x494]
push eax
call ebx
push str...jre
lea eax, [esp + 0x494]
push eax
call esi
lea eax, [esp + 0x350]
push eax
lea eax, [esp + 0x494]
push eax
call dword [sym.imp.KERNEL32.dll_FindFirstFileA]
mov dword [esp + 0x10], eax
cmp eax, 0xffffffff
je 0x402499
xor edi, edi
test byte [esp + 0x350], 0x10
jne 0x4023f5
lea ecx, [esp + 0x350]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_FindNextFileA]
test eax, eax
je 0x402419
mov eax, dword [esp + 0x10]
jmp 0x4023d2
push 0x405418
lea eax, [esp + 0x24c]
push eax
call esi
lea eax, [esp + 0x37c]
push eax
lea eax, [esp + 0x24c]
push eax
call esi
xor edi, edi
inc edi
push dword [esp + 0x10]
call dword [sym.imp.KERNEL32.dll_FindClose]
test edi, edi
je 0x402499
push dword [esp + 0x6a8]
lea edx, [esp + 0x24c]
call fcn.0040286a
pop ecx
test eax, eax
jne 0x402499
call fcn.00402ddf
test eax, eax
je 0x402456
cmp eax, 0x20
je 0x402456
mov byte [0x408a00], 0
jmp 0x4024a6
lea eax, [esp + 0x248]
push eax
push str.JAVA_HOME
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
lea eax, [esp + 0x248]
mov edi, 0x408500
push eax
push edi
call ebx
push str._bin
push edi
call esi
lea eax, [esp + 0x248]
mov edi, 0x408620
push eax
push edi
call ebx
push str.libext
push edi
call esi
cmp byte [0x408a00], 0
jne 0x4025ec
push 0x104
lea eax, [esp + 0x3c]
mov byte [esp + 0x3c], 0
push eax
push str.JAVA_HOME
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
jne 0x402553
and dword [esp + 0x34], eax
mov edi, str.SOFTWAREWow6432NodeJavaSoftJava_Development_Kit
push 0x104
push eax
mov dword [esp + 0x2c], edi
mov dword [esp + 0x30], str.SOFTWAREWow6432NodeJavaSoftJava_Runtime_Environment
mov dword [esp + 0x34], str.SOFTWAREJavaSoftJava_Development_Kit
mov dword [esp + 0x38], str.SOFTWAREJavaSoftJava_Runtime_Environment
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
and dword [esp + 0x18], 0
mov dword [esp + 0x10], eax
mov edx, eax
mov ecx, edi
call fcn.004029e8
test eax, eax
jne 0x40252b
mov eax, dword [esp + 0x18]
inc eax
mov dword [esp + 0x18], eax
mov edi, dword [esp + eax*4 + 0x24]
mov eax, dword [esp + 0x10]
test edi, edi
jne 0x402505
mov edi, eax
jmp 0x402547
mov edi, dword [esp + 0x10]
lea eax, [esp + 0x38]
push edi
push eax
call ebx
lea eax, [esp + 0x38]
push eax
push str.JAVA_HOME
call dword [sym.imp.KERNEL32.dll_SetEnvironmentVariableA]
push edi
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
cmp byte [esp + 0x38], 0
je 0x4025ec
lea eax, [esp + 0x38]
push eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
lea ecx, [esp + 0x38]
cmp byte [eax + ecx - 1], 0x5c
mov eax, ecx
jne 0x40257d
push 0x405518
jmp 0x402582
push str.jre
push eax
call esi
lea ecx, [esp + 0x38]
call fcn.00402bc4
test eax, eax
jne 0x4025a4
lea eax, [esp + 0x38]
push 0x5c
push eax
call dword [sym.imp.msvcrt.dll_strrchr]
pop ecx
pop ecx
mov byte [eax], 0
lea ecx, [esp + 0x38]
call fcn.00402bc4
test eax, eax
je 0x4025ec
lea eax, [esp + 0x38]
mov edi, 0x408500
push eax
push edi
call ebx
push str._bin
push edi
call esi
lea eax, [esp + 0x38]
mov edi, 0x408620
push eax
push edi
call ebx
push str.libext
push edi
call esi
push dword [esp + 0x6a8]
lea edx, [esp + 0x3c]
call fcn.0040286a
pop ecx
push str._Djava.class.path
push dword [0x408378]
call ebx
push str._Djava.ext.dirs
push dword [0x408374]
call ebx
push str._Djava.library.path._
push dword [0x40837c]
call ebx
mov eax, dword [esp + 0x1c]
test eax, eax
je 0x40267d
push str._:_.
push eax
jmp 0x40266f
push 0x405568
push edi
call dword [sym.imp.msvcrt.dll_strstr]
pop ecx
pop ecx
test eax, eax
jne 0x402652
lea eax, [esp + 0x598]
push eax
push dword [0x408378]
call esi
push 0x405418
push dword [0x408378]
call esi
push edi
push dword [0x408378]
call esi
push 0x40556c
push dword [0x408378]
call esi
push str._:_.
push 0
call dword [sym.imp.msvcrt.dll_strtok]
mov edi, eax
pop ecx
pop ecx
test edi, edi
jne 0x402623
push 0x405570
push dword [0x408378]
call esi
cmp dword [esp + 0x14], 0
je 0x402810
push 0x104
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
push dword [esp + 0x14]
mov edi, eax
call dword [sym.imp.KERNEL32.dll_lstrlenA]
inc eax
push eax
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
push dword [esp + 0x14]
mov dword [esp + 0x14], eax
push eax
call ebx
push 0x40556c
push dword [esp + 0x14]
jmp 0x4027e1
push 0x405568
push eax
mov byte [edi], 0
call dword [sym.imp.msvcrt.dll_strstr]
pop ecx
pop ecx
test eax, eax
jne 0x4026ff
lea eax, [esp + 0x598]
push eax
push edi
call esi
push 0x405418
push edi
call esi
push dword [esp + 0x14]
push edi
call esi
mov ecx, edi
call fcn.00402bc4
test eax, eax
je 0x4027da
push edi
call dword [sym.imp.KERNEL32.dll_lstrlenA]
add eax, 2
mov edx, edi
mov dword [esp + 0x18], eax
xor ecx, ecx
lea eax, [esp + 0x18]
push eax
call fcn.00402be7
pop ecx
push dword [esp + 0x18]
push 8
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapAlloc]
push edi
push eax
mov dword [esp + 0x1c], eax
call ebx
push 0
push edi
call dword [sym.imp.KERNEL32.dll_lstrlenA]
mov ecx, dword [esp + 0x18]
mov edx, edi
inc ecx
add ecx, eax
call fcn.00402be7
mov eax, dword [esp + 0x18]
mov ebx, eax
pop ecx
cmp byte [eax], 0
je 0x4027c8
push 0x40556c
push dword [0x408378]
call esi
push ebx
push dword [0x408378]
call esi
push ebx
push dword [0x408374]
call esi
push 0x40556c
push dword [0x408374]
call esi
push ebx
push dword [0x40837c]
call esi
push 0x40556c
push dword [0x40837c]
call esi
mov ecx, ebx
call fcn.00402b1b
push ebx
call dword [sym.imp.KERNEL32.dll_lstrlenA]
inc ebx
add ebx, eax
cmp byte [ebx], 0
jne 0x40276c
mov eax, dword [esp + 0x14]
push eax
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
mov ebx, dword [sym.imp.KERNEL32.dll_lstrcpyA]
push 0x40556c
push 0
call dword [sym.imp.msvcrt.dll_strtok]
mov dword [esp + 0x1c], eax
pop ecx
pop ecx
test eax, eax
jne 0x4026d7
push dword [esp + 0x10]
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push edi
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
push 0x408620
push dword [0x408374]
call esi
mov edi, dword [esp + 0x20]
push 0x10000
push edi
push 0x405574
call dword [sym.imp.KERNEL32.dll_GetEnvironmentVariableA]
test eax, eax
je 0x40283f
push edi
push dword [0x40837c]
call esi
mov ecx, 0x408500
call fcn.00402b1b
mov ecx, 0x408a00
call fcn.00402b1b
push edi
push 0
call ebp
push eax
call dword [sym.imp.KERNEL32.dll_HeapFree]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x694
ret