2739{
2743 PGUID AppIdentifier;
2744 HANDLE BcdHandle, ResumeBcdHandle;
2747 BOOLEAN XmlLoaded, DisableIntegrity, TestSigning, PersistBootSequence;
2748 BOOLEAN RebootOnError, CustomActions;
2752 ULONG SequenceListCount;
2758 ULONG SequenceCount;
2760 EfiPrintf(
L"ReactOS UEFI Boot Manager Initializing...\r\n");
2761
2762
2763 RebootOnError =
FALSE;
2764
2765
2766#if defined(_M_IX86) || defined(_M_X64)
2768#else
2769 EfiPrintf(
L"No time source defined for this platform\r\n");
2771#endif
2773
2774
2780
2781
2784 {
2785
2787 {
2788
2790 }
2791
2792
2793 goto Quickie;
2794 }
2795
2796
2798 if (!AppIdentifier)
2799 {
2800
2801 AppIdentifier = (
PGUID)&GUID_WINDOWS_BOOTMGR;
2802 }
2803
2804
2806
2807
2809
2810
2813 {
2814
2817 {
2818
2821 {
2822
2826 0,
2827 0);
2828 }
2829 }
2830 }
2831
2832#ifdef _SECURE_BOOT
2833
2834 Status = BmSecureBootInitializeMachinePolicy();
2836 {
2838 }
2839#endif
2840
2841
2844 sizeof(LibraryParameters));
2847
2848
2851 {
2853 }
2854
2855
2857
2858
2860
2861
2863 if (!Stylesheet)
2864 {
2865
2868 goto Quickie;
2869 }
2870
2871
2874 {
2876 goto Failure;
2877 }
2879
2880
2882 {
2883
2885 {
2886
2888 }
2889 }
2890
2891#ifdef _BIT_LOCKER_
2892
2893 FveDisplayScreen = BmFveDisplayScreen;
2894#endif
2895
2896
2898 &DisableIntegrity,
2899 &TestSigning);
2900 if (!DisableIntegrity)
2901 {
2902
2905 {
2906
2907 goto Failure;
2908 }
2909 }
2910
2911
2912
2913 EfiPrintf(
L"Performing memory allocator tests...\r\n");
2914 {
2917
2918
2922 {
2925 }
2926
2927
2929
2930
2933 {
2936 }
2937
2938
2942 {
2945 }
2946
2947
2949 {
2952 }
2953
2954
2956 {
2959 }
2960
2961
2964 {
2967 }
2968 }
2969
2970
2972
2973
2975
2976
2979 {
2980 goto Failure;
2981 }
2982
2983
2985
2986
2988
2989
2992 {
2993 goto Failure;
2994 }
2995
2996#ifdef BL_NET_SUPPORT
2997
2998 BlUtlRegisterMulticastRoutine();
2999#endif
3000
3001
3004 &RebootOnError);
3005
3006
3009 &PersistBootSequence);
3011 {
3012
3013 PersistBootSequence =
TRUE;
3014 }
3015
3016
3019 &CustomActions);
3021 {
3022
3025 goto Failure;
3026 }
3027
3028
3029
3030
3031 SequenceId = 0;
3034 SequenceList =
NULL;
3035 BootSequence =
NULL;
3036 SequenceCount = 0;
3037 while (1)
3038 {
3039
3042
3043
3044 if (!(BootSequence) && !(GetEntry))
3045 {
3046
3049 &SequenceList,
3050 &SequenceListCount);
3052 {
3053
3055 SequenceList,
3056 SequenceListCount,
3058 &BootSequence,
3059 &SequenceCount);
3061 {
3062
3065
3066
3067 if (PersistBootSequence)
3068 {
3069
3071 }
3072 else
3073 {
3074
3079 {
3080
3081 goto LoopQuickie;
3082 }
3083 }
3084 }
3085 }
3086 else
3087 {
3088
3089 BootSequence =
NULL;
3090 }
3091 }
3092
3093
3094 if ((BootSequence) && ((GetEntry) || (SequenceId < SequenceCount)))
3095 {
3096
3097 BootEntry = BootSequence[SequenceId];
3098 BootSequence[SequenceId] =
NULL;
3099
3100
3101 SequenceId++;
3102
3103
3104 if (SequenceId == SequenceCount)
3105 {
3106
3108 BootSequence =
NULL;
3109 }
3110 }
3111 else
3112 {
3113
3114 ExitBootManager =
FALSE;
3116 &BootEntry,
3117 &BootIndex,
3118 &ExitBootManager);
3120 {
3121
3122 goto LoopQuickie;
3123 }
3124 }
3125
3126
3127 if (BcdHandle)
3128 {
3129
3132 }
3133
3134
3137 {
3138
3141 }
3142 else
3143 {
3144
3146 {
3147
3149 goto LoopQuickie;
3150 }
3151
3152
3154 }
3155
3156
3159 {
3160 break;
3161 }
3162
3163
3165
3166
3169 {
3170
3172 }
3173
3174LoopQuickie:
3175
3176 if (BootEntry)
3177 {
3178
3180 }
3181
3182
3184 {
3185
3186 if (!BootOk)
3187 {
3188
3189 break;
3190 }
3191 }
3192
3193
3194 if (RebootOnError)
3195 {
3196 break;
3197 }
3198 };
3199
3200Failure:
3201 if (!BootFailed)
3202 {
3203
3205 {
3206
3207 if (XmlLoaded)
3208 {
3209
3210
3211 }
3212
3213
3214 goto Quickie;
3215 }
3216 }
3217
3218
3220
3221Quickie:
3222
3223 if ((RebootOnError) ||
3225 {
3226
3229 }
3230 else
3231 {
3232
3233 ReturnArguments = (
PVOID)((
ULONG_PTR)BootParameters + BootParameters->ReturnArgumentsOffset);
3236
3237
3239 }
3240
3241
3243}
@ BcdBootMgrBoolean_ProcessCustomActionsFirst
@ BcdBootMgrBoolean_PersistBootSequence
@ BcdBootMgrObjectList_BootSequence
@ BcdLibraryBoolean_RestartOnFailure
NTSTATUS BlGetBootOptionBoolean(_In_ PBL_BCD_OPTION List, _In_ ULONG Type, _Out_ PBOOLEAN Value)
#define BL_APPLICATION_ENTRY_FIXED_SEQUENCE
NTSTATUS BlMmAllocatePhysicalPages(_Inout_ PPHYSICAL_ADDRESS Address, _In_ BL_MEMORY_TYPE MemoryType, _In_ ULONGLONG PageCount, _In_ ULONG Attributes, _In_ ULONG Alignment)
VOID BlImgQueryCodeIntegrityBootOptions(_In_ PBL_LOADED_APPLICATION_ENTRY ApplicationEntry, _Out_ PBOOLEAN IntegrityChecksDisabled, _Out_ PBOOLEAN TestSigning)
VOID BlDestroyBootEntry(_In_ PBL_LOADED_APPLICATION_ENTRY AppEntry)
NTSTATUS BlInitializeLibrary(_In_ PBOOT_APPLICATION_PARAMETER_BLOCK BootAppParameters, _In_ PBL_LIBRARY_PARAMETERS LibraryParameters)
VOID EfiPrintf(_In_ PWCHAR Format,...)
NTSTATUS BlUtlRegisterProgressRoutine(VOID)
NTSTATUS BlGetBootOptionGuidList(_In_ PBL_BCD_OPTION List, _In_ ULONG Type, _Out_ PGUID *Value, _In_ PULONG Count)
NTSTATUS BlReplaceBootOptions(_In_ PBL_LOADED_APPLICATION_ENTRY AppEntry, _In_ PBL_BCD_OPTION NewOptions)
NTSTATUS BlMmFreePhysicalPages(_In_ PHYSICAL_ADDRESS Address)
#define BL_LIBRARY_FLAG_REINITIALIZE
PWCHAR BlResourceFindHtml(VOID)
NTSTATUS BlSecureBootCheckForFactoryReset(VOID)
NTSTATUS EfiStall(_In_ ULONG StallTime)
VOID BlRemoveBootOption(_In_ PBL_BCD_OPTION List, _In_ ULONG Type)
PGUID BlGetApplicationIdentifier(VOID)
FORCEINLINE VOID BlSetupDefaultParameters(_Out_ PBL_LIBRARY_PARAMETERS LibraryParameters)
BL_LIBRARY_PARAMETERS BlpLibraryParameters
VOID BlDestroyLibrary(VOID)
BOOLEAN BlDisplayValidOemBitmap(VOID)
#define BL_LIBRARY_FLAG_REINITIALIZE_ALL
NTSTATUS BlCopyBootOptions(_In_ PBL_BCD_OPTION OptionList, _Out_ PBL_BCD_OPTION *CopiedOptions)
BL_LOADED_APPLICATION_ENTRY BlpApplicationEntry
NTSTATUS BlMmFreeHeap(_In_ PVOID Buffer)
NTSTATUS BlDisplayClearScreen(VOID)
#define BL_RETURN_ARGUMENTS_VERSION
#define BL_APPLICATION_ENTRY_REBOOT_ON_ERROR
#define BL_FATAL_ERROR_GENERIC
#define BL_FATAL_ERROR_BCD_PARSE
#define NT_SUCCESS(StatCode)
VOID BmpInitializeBootStatusDataLog(VOID)
NTSTATUS BmpProcessBadMemory(VOID)
NTSTATUS BmpBgDisplayClearScreen(_In_ ULONG Color)
NTSTATUS BlXmiWrite(_In_ PWCHAR XmlTag)
NTSTATUS BmGetBootSequence(_In_ HANDLE BcdHandle, _In_ PGUID SequenceList, _In_ ULONG SequenceListCount, _In_ ULONG Flags, _Out_ PBL_LOADED_APPLICATION_ENTRY **BootSequence, _Out_ PULONG SequenceCount)
NTSTATUS BmFwVerifySelfIntegrity(VOID)
NTSTATUS BmFwInitializeBootDirectoryPath(VOID)
VOID BmCloseDataStore(_In_ HANDLE Handle)
NTSTATUS BlXmiInitialize(_In_ PWCHAR Stylesheet)
VOID BmFatalErrorEx(_In_ ULONG ErrorCode, _In_ ULONG_PTR Parameter1, _In_ ULONG_PTR Parameter2, _In_ ULONG_PTR Parameter3, _In_ ULONG_PTR Parameter4)
NTSTATUS BmpLaunchBootEntry(_In_ PBL_LOADED_APPLICATION_ENTRY BootEntry, _Out_ PULONG EntryIndex, _In_ ULONG LaunchCode, _In_ BOOLEAN LaunchWinRe)
NTSTATUS BmOpenDataStore(_Out_ PHANDLE Handle)
NTSTATUS BmFwRegisterRevocationList(VOID)
BOOLEAN BmDisplayStateCached
NTSTATUS BmPurgeOption(_In_ HANDLE BcdHandle, _In_ PGUID ObjectId, _In_ ULONG Type)
ULONGLONG ApplicationStartTime
NTSTATUS BmpUpdateApplicationOptions(_In_ HANDLE BcdHandle)
NTSTATUS BmResumeFromHibernate(_Out_ PHANDLE BcdResumeHandle)
GUID BmApplicationIdentifier
VOID BmFwMemoryInitialize(VOID)
NTSTATUS BmpGetSelectedBootEntry(_In_ HANDLE BcdHandle, _Out_ PBL_LOADED_APPLICATION_ENTRY *SelectedBootEntry, _Out_ PULONG EntryIndex, _Out_ PBOOLEAN ExitBootManager)
PBL_BOOT_ERROR BmpInternalBootError
PPC_QUAL unsigned long long __rdtsc(void)
#define STATUS_INVALID_PARAMETER_9
#define STATUS_NOT_IMPLEMENTED
ULONG MinimumAllocationCount
#define RtlCopyMemory(Destination, Source, Length)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress