Function at 0x40376a
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 0x4037b3
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x403cdf
mov eax, 0x65b
jmp 0x403cdf
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.0044cca7
push esi
mov edi, eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
test edi, edi
je 0x4037df
mov eax, edi
jmp 0x403cdf
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.0043c2b8
mov edx, eax
lea ecx, [ebp - 8]
call fcn.0043baed
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.0043d912
mov ecx, dword [ebp - 0x1c]
add ecx, 0xfffffff0
call fcn.0043d912
test esi, esi
jne 0x40384c
push str.bootmgfw.efi
push 0x48f880
push 1
call dword [sym.imp.CBSHost.dll_DismWriteLog]
push 2
pop eax
jmp 0x403cdf
push 2
call dword [sym.imp.ADVAPI32.dll_ImpersonateSelf]
test eax, eax
je 0x40379b
lea eax, [ebp - 0x78]
mov dword [ebp - 0x78], 0x4952d0
push eax
lea ecx, [ebp - 0xe8]
mov dword [ebp - 0x54], eax
call fcn.0043ba54
lea ecx, [ebp - 0x78]
call fcn.0043ba36
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 0x4038b3
push str.SE_SYSTEM_ENVIRONMENT_PRIVILEGE
push 0x48f880
push 1
call dword [sym.imp.CBSHost.dll_DismWriteLog]
push esi
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ebx, eax
jmp 0x403cd2
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.0043178e
lea eax, [ebp - 0x2c]
push eax
push dword [ebp - 0x18]
call dword [sym.imp.ntdll.dll_ZwQueryBootEntryOrder]
cmp eax, esi
jne 0x4038e6
mov eax, dword [ebp - 0x2c]
jmp 0x4038c7
test eax, eax
jne 0x403cc1
push dword [ebp - 0x2c]
lea ecx, [ebp - 0x18]
call fcn.0043178e
mov dword [ebp - 0x30], 0x400
call fcn.0043d5bb
push eax
lea ecx, [ebp - 0x1c]
call fcn.0043bbe8
push dword [ebp - 0x30]
lea ecx, [ebp - 0x1c]
call fcn.0043b9dd
lea ecx, [ebp - 0x30]
push ecx
push eax
call dword [sym.imp.ntdll.dll_ZwEnumerateBootEntries]
cmp eax, esi
je 0x40390e
test eax, eax
jns 0x40393a
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ebx, eax
jmp 0x403cb4
cmp dword [ebp - 0x30], 4
jbe 0x403b6d
call fcn.0043d5bb
push eax
lea ecx, [ebp - 4]
call fcn.0043bbe8
mov edi, dword [ebp - 0x1c]
mov esi, dword [ebp - 4]
jmp 0x403ad7
mov ecx, dword [edi + 0x18]
test ecx, ecx
je 0x403acb
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 0x40398a
push dword [esi - 0xc]
lea ecx, [ebp - 4]
call fcn.0043bb69
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 0x4039d4
mov ebx, dword [ebp - 8]
push dword [ebp - 0x34]
lea ecx, [ebp - 4]
call fcn.0043b9dd
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 0x4039a7
mov edi, dword [ebp - 0xc]
xor ebx, ebx
mov esi, dword [ebp - 4]
test eax, eax
js 0x403acb
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.0043b8e8
mov edi, dword [ebp - 0x44]
mov ecx, dword [edi - 0xc]
sub ebx, ecx
dec ebx
cmp ebx, 0x20
jae 0x403a12
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 0x403abe
push dword [ebp - 8]
lea ecx, [ebp - 0x3c]
push str._GLOBALROOT
call fcn.0043c2b8
mov edx, eax
lea ecx, [ebp - 0x48]
call fcn.0043baed
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.0043d912
mov ecx, dword [ebp - 0x3c]
add ecx, 0xfffffff0
call fcn.0043d912
mov eax, dword [ebp - 8]
cmp eax, 0xffffffff
jne 0x403a95
lea ecx, [edi - 0x10]
call fcn.0043d912
jmp 0x403ac8
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 0x403abe
mov eax, dword [ebp - 0x4c]
cmp eax, dword [ebp - 0x40]
je 0x403b09
lea ecx, [edi - 0x10]
call fcn.0043d912
xor ebx, ebx
mov edi, dword [ebp - 0xc]
mov eax, dword [edi]
test eax, eax
je 0x403b65
add edi, eax
cmp dword [edi + 4], 1
mov dword [ebp - 0xc], edi
je 0x40395d
push str.BOOT_ENTRY__Version___1
push 0x48f880
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.0043d912
jmp 0x403cb1
mov eax, dword [ebp - 0x18]
mov ecx, dword [ebp - 0xc]
cmp eax, dword [ebp - 0x14]
je 0x403b23
mov edx, dword [ecx + 0xc]
cmp edx, dword [eax]
je 0x403b56
add eax, 4
cmp eax, dword [ebp - 0x14]
jne 0x403b17
lea eax, [ecx + 0xc]
push eax
push dword [ebp - 0x18]
lea eax, [ebp - 0x3c]
push eax
lea ecx, [ebp - 0x18]
call fcn.004317e6
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 0x403b56
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
jmp 0x403b58
xor eax, eax
lea ecx, [edi - 0x10]
mov dword [ebp - 4], eax
call fcn.0043d912
jmp 0x403afc
lea ecx, [esi - 0x10]
call fcn.0043d912
mov esi, dword [ebp - 0x20]
push 0xe
push str._GLOBALROOT
push esi
call dword [sym.imp.SHLWAPI.dll_StrCmpNIW]
test eax, eax
jne 0x403ca9
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.00485b60
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 0x403c1b
test eax, eax
jne 0x40392c
mov ebx, 0x65b
jmp 0x403cb4
mov eax, dword [ebp - 0x24]
add eax, 0xd0
call fcn.00485b60
mov esi, esp
push 0xd0
push ebx
push esi
call sub.msvcrt.dll_memset
add esp, 0xc
mov ecx, esi
call fcn.00403cea
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 0x40392c
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 0x40392c
lea eax, [ebp - 0x50]
push eax
push dword [ebp - 0x18]
lea eax, [ebp - 0x40]
push eax
lea ecx, [ebp - 0x18]
call fcn.004317e6
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 0x403cb4
jmp 0x40392c
mov eax, 0x65b
mov dword [ebp - 4], eax
mov ebx, dword [ebp - 4]
mov ecx, dword [ebp - 0x1c]
lea ecx, [ecx - 0x10]
call fcn.0043d912
jmp 0x403cca
push eax
call dword [sym.imp.ntdll.dll_RtlNtStatusToDosError]
mov ebx, eax
lea ecx, [ebp - 0x18]
call fcn.004303a3
lea ecx, [ebp - 0xe8]
call fcn.0043ba19
invalid