Function at 0x4036d7
Capabilities:
Check if file exists

Disassembly:
push ebp
mov ebp, esp
sub esp, 0xec
push ebx
push esi
push edi
xor ebx, ebx
mov eax, ecx
push ebx
push 0x2000000
push 3
push ebx
push 7
push 0x80000000
push eax
mov dword [ebp - 0x20], eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov esi, eax
cmp esi, 0xffffffff
jne 0x403720
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x403c4c
mov eax, 0x65b
jmp 0x403c4c
push ebx
push ebx
push ebx
push ebx
lea eax, [ebp - 0x4c]
push eax
push ebx
push ebx
push esi
call dword [sym.imp.KERNEL32.dll_GetVolumeInformationByHandleW]
mov ecx, eax
call fcn.0044bc68
push esi
mov edi, eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test edi, edi
je 0x40374c
mov eax, edi
jmp 0x403c4c
push 0x10
pop ecx
mov esi, str.EFIMicrosoftBoot_bootmgfw.efi
lea edi, [ebp - 0xc0]
rep movsd dword es:[edi], dword [esi]
lea eax, [ebp - 0xc0]
push eax
push dword [ebp - 0x20]
lea ecx, [ebp - 0x1c]
movsw word es:[edi], word [esi]
call fcn.0043b487
mov edx, eax
lea ecx, [ebp - 8]
call fcn.0043ab55
pop ecx
push dword [eax]
call dword [sym.imp.SHLWAPI.dll_PathFileExistsW]
mov ecx, dword [ebp - 8]
mov esi, eax
add ecx, 0xfffffff0
call fcn.0043c924
mov ecx, dword [ebp - 0x1c]
add ecx, 0xfffffff0
call fcn.0043c924
test esi, esi
jne 0x4037b9
push str.bootmgfw.efi
push 0x48d69c
push 1
call dword [sym.imp.CBSHost.dll_DismWriteLog]
push 2
pop eax
jmp 0x403c4c
push 2
call dword [sym.imp.ADVAPI32.dll_ImpersonateSelf]
test eax, eax
je 0x403708
lea eax, [ebp - 0x78]
mov dword [ebp - 0x78], 0x491664
push eax
lea ecx, [ebp - 0xe8]
mov dword [ebp - 0x54], eax
call fcn.0043aa99
lea ecx, [ebp - 0x78]
call fcn.0043aa7b
lea eax, [ebp - 0x25]
push eax
push 1
push 1
push 0x16
call dword [sym.imp.ntdll.dll_RtlAdjustPrivilege]
mov esi, eax
test esi, esi
je 0x403820
push str.SE_SYSTEM_ENVIRONMENT_PRIVILEGE
push 0x48d69c
push 1
call dword [sym.imp.CBSHost.dll_DismWriteLog]
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ebx, eax
jmp 0x403c3f
push 0x64
pop eax
mov dword [ebp - 0x2c], eax
mov esi, 0xc0000023
mov dword [ebp - 0x18], ebx
mov dword [ebp - 0x14], ebx
mov dword [ebp - 0x10], ebx
push eax
lea ecx, [ebp - 0x18]
call fcn.00430a19
lea eax, [ebp - 0x2c]
push eax
push dword [ebp - 0x18]
call dword [sym.imp.ntdll.dll_ZwQueryBootEntryOrder]
cmp eax, esi
jne 0x403853
mov eax, dword [ebp - 0x2c]
jmp 0x403834
test eax, eax
jne 0x403c2e
push dword [ebp - 0x2c]
lea ecx, [ebp - 0x18]
call fcn.00430a19
mov dword [ebp - 0x30], 0x400
call fcn.0043c5cd
push eax
lea ecx, [ebp - 0x1c]
call fcn.0043ac50
push dword [ebp - 0x30]
lea ecx, [ebp - 0x1c]
call fcn.0043aa22
lea ecx, [ebp - 0x30]
push ecx
push eax
call dword [sym.imp.ntdll.dll_ZwEnumerateBootEntries]
cmp eax, esi
je 0x40387b
test eax, eax
jns 0x4038a7
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ebx, eax
jmp 0x403c21
cmp dword [ebp - 0x30], 4
jbe 0x403ada
call fcn.0043c5cd
push eax
lea ecx, [ebp - 4]
call fcn.0043ac50
mov edi, dword [ebp - 0x1c]
mov esi, dword [ebp - 4]
jmp 0x403a44
mov ecx, dword [edi + 0x18]
test ecx, ecx
je 0x403a38
mov eax, dword [esi - 8]
mov dword [ebp - 0x34], eax
lea eax, [edi + 4]
add eax, ecx
cmp dword [esi - 4], 1
mov dword [ebp - 8], eax
jle 0x4038f7
push dword [esi - 0xc]
lea ecx, [ebp - 4]
call fcn.0043abd1
mov esi, dword [ebp - 4]
lea eax, [ebp - 0x34]
mov dword [ebp - 0x38], esi
push eax
push esi
push 3
push dword [ebp - 8]
call dword [sym.imp.ntdll.dll_NtTranslateFilePath]
cmp eax, 0xc0000023
jne 0x403941
mov ebx, dword [ebp - 8]
push dword [ebp - 0x34]
lea ecx, [ebp - 4]
call fcn.0043aa22
mov edi, eax
lea eax, [ebp - 0x34]
push eax
push edi
push 3
push ebx
mov dword [ebp - 0x38], edi
call dword [sym.imp.ntdll.dll_NtTranslateFilePath]
cmp eax, 0xc0000023
je 0x403914
mov edi, dword [ebp - 0xc]
xor ebx, ebx
mov esi, dword [ebp - 4]
test eax, eax
js 0x403a38
mov eax, dword [ebp - 0x38]
mov ebx, dword [eax + 4]
lea edi, [eax + 0xc]
sub ebx, 0xc
mov dword [ebp - 8], edi
shr ebx, 1
push ebx
push edi
call dword [sym.imp.msvcrt.dll_wcsnlen]
pop ecx
pop ecx
push eax
push edi
lea ecx, [ebp - 0x44]
call fcn.0043a92d
mov edi, dword [ebp - 0x44]
mov ecx, dword [edi - 0xc]
sub ebx, ecx
dec ebx
cmp ebx, 0x20
jae 0x40397f
push 0x20
pop ebx
push ebx
lea eax, [ebp - 0xc0]
push eax
mov eax, dword [ebp - 0x38]
lea eax, [eax + ecx*2]
add eax, 0xe
push eax
call dword [sym.imp.msvcrt.dll__wcsnicmp]
add esp, 0xc
test eax, eax
jne 0x403a2b
push dword [ebp - 8]
lea ecx, [ebp - 0x3c]
push str._GLOBALROOT
call fcn.0043b487
mov edx, eax
lea ecx, [ebp - 0x48]
call fcn.0043ab55
pop ecx
xor ebx, ebx
push ebx
push 0x2000000
push 3
push ebx
push 7
push 0x80000000
push dword [eax]
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ecx, dword [ebp - 0x48]
add ecx, 0xfffffff0
mov dword [ebp - 8], eax
call fcn.0043c924
mov ecx, dword [ebp - 0x3c]
add ecx, 0xfffffff0
call fcn.0043c924
mov eax, dword [ebp - 8]
cmp eax, 0xffffffff
jne 0x403a02
lea ecx, [edi - 0x10]
call fcn.0043c924
jmp 0x403a35
push ebx
push ebx
push ebx
push ebx
lea ecx, [ebp - 0x40]
push ecx
push ebx
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_GetVolumeInformationByHandleW]
mov ebx, eax
mov eax, dword [ebp - 8]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test ebx, ebx
je 0x403a2b
mov eax, dword [ebp - 0x4c]
cmp eax, dword [ebp - 0x40]
je 0x403a76
lea ecx, [edi - 0x10]
call fcn.0043c924
xor ebx, ebx
mov edi, dword [ebp - 0xc]
mov eax, dword [edi]
test eax, eax
je 0x403ad2
add edi, eax
cmp dword [edi + 4], 1
mov dword [ebp - 0xc], edi
je 0x4038ca
push str.BOOT_ENTRY__Version___1
push 0x48d69c
push 1
call dword [sym.imp.CBSHost.dll_DismWriteLog]
xor eax, eax
inc eax
mov dword [ebp - 4], eax
lea ecx, [esi - 0x10]
call fcn.0043c924
jmp 0x403c1e
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp - 0xc]
cmp eax, dword [ebp - 0x14]
je 0x403a90
mov edx, dword [ecx + 0xc]
cmp edx, dword [eax]
je 0x403ac3
add eax, 4
cmp eax, dword [ebp - 0x14]
jne 0x403a84
lea eax, [ecx + 0xc]
push eax
push dword [ebp - 0x18]
lea eax, [ebp - 0x3c]
push eax
lea ecx, [ebp - 0x18]
call fcn.00430a71
mov eax, dword [ebp - 0x14]
sub eax, dword [ebp - 0x18]
sar eax, 2
push eax
push dword [ebp - 0x18]
call dword [sym.imp.ntdll.dll_ZwSetBootEntryOrder]
test eax, eax
je 0x403ac3
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
jmp 0x403ac5
xor eax, eax
lea ecx, [edi - 0x10]
mov dword [ebp - 4], eax
call fcn.0043c924
jmp 0x403a69
lea ecx, [esi - 0x10]
call fcn.0043c924
mov esi, dword [ebp - 0x20]
push 0xe
push str._GLOBALROOT
push esi
call dword [sym.imp.SHLWAPI.dll_StrCmpNIW]
test eax, eax
jne 0x403c16
add esi, 0x1c
push esi
mov dword [ebp - 0x20], esi
call dword [sym.imp.msvcrt.dll_wcslen]
mov edi, eax
pop ecx
lea esi, [edi*2 + 0x52]
mov eax, esi
call fcn.00484420
mov edx, esp
lea eax, [edi + edi]
push eax
push dword [ebp - 0x20]
lea ecx, [esi - 2]
mov dword [ebp - 8], edx
mov esi, dword [sym.imp.msvcrt.dll_memcpy]
lea eax, [edx + 0xc]
push eax
mov dword [edx], 1
mov dword [edx + 4], ecx
mov dword [edx + 8], 3
call esi
mov eax, dword [ebp - 8]
xor ecx, ecx
push 0x42
mov word [eax + edi*2 + 0xc], cx
lea ecx, [ebp - 0xc0]
lea eax, [eax + edi*2]
push ecx
add eax, 0xe
push eax
call esi
mov edi, dword [ebp - 8]
lea eax, [ebp - 0x24]
add esp, 0x18
mov dword [ebp - 0x24], ebx
push eax
push ebx
push 4
push edi
call dword [sym.imp.ntdll.dll_NtTranslateFilePath]
cmp eax, 0xc0000023
je 0x403b88
test eax, eax
jne 0x403899
mov ebx, 0x65b
jmp 0x403c21
mov eax, dword [ebp - 0x24]
add eax, 0xd0
call fcn.00484420
mov esi, esp
push 0xd0
push ebx
push esi
call sub.msvcrt.dll_memset
add esp, 0xc
mov ecx, esi
call fcn.00403c57
lea eax, [ebp - 0x24]
push eax
lea eax, [esi + 0xd0]
push eax
push 4
push edi
call dword [sym.imp.ntdll.dll_NtTranslateFilePath]
test eax, eax
jne 0x403899
mov eax, dword [ebp - 0x24]
add eax, 0xd0
mov dword [esi + 4], eax
lea eax, [ebp - 0x50]
push eax
push esi
call dword [sym.imp.ntdll.dll_ZwAddBootEntry]
test eax, eax
jne 0x403899
lea eax, [ebp - 0x50]
push eax
push dword [ebp - 0x18]
lea eax, [ebp - 0x40]
push eax
lea ecx, [ebp - 0x18]
call fcn.00430a71
mov eax, dword [ebp - 0x14]
sub eax, dword [ebp - 0x18]
sar eax, 2
push eax
push dword [ebp - 0x18]
call dword [sym.imp.ntdll.dll_ZwSetBootEntryOrder]
test eax, eax
je 0x403c21
jmp 0x403899
mov eax, 0x65b
mov dword [ebp - 4], eax
mov ebx, dword [ebp - 4]
mov ecx, dword [ebp - 0x1c]
lea ecx, [ecx - 0x10]
call fcn.0043c924
jmp 0x403c37
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ebx, eax
lea ecx, [ebp - 0x18]
call fcn.00430403
lea ecx, [ebp - 0xe8]
call fcn.0043aa5e
mov eax, ebx
lea esp, [ebp - 0xf8]
pop edi
pop esi
pop ebx
leave
ret