MCPcopy Create free account
hub / github.com/Mattiwatti/EfiGuard / GetBootLoadedModule

Function GetBootLoadedModule

EfiGuardDxe/PatchWinload.c:62–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60STATIC
61PKLDR_DATA_TABLE_ENTRY
62EFIAPI
63GetBootLoadedModule(
64 IN CONST LIST_ENTRY* LoadOrderListHead,
65 IN CONST CHAR16* ModuleName
66 )
67{
68 if (ModuleName == NULL || LoadOrderListHead == NULL)
69 return NULL;
70
71 for (LIST_ENTRY* ListEntry = LoadOrderListHead->ForwardLink; ListEntry != LoadOrderListHead; ListEntry = ListEntry->ForwardLink)
72 {
73 // This is fairly heavy abuse of CR(), but legal C because (only) the first field of a struct is guaranteed to be at offset 0 (C99 6.7.2.1, point 13)
74 CONST PBLDR_DATA_TABLE_ENTRY Entry = (PBLDR_DATA_TABLE_ENTRY)BASE_CR(ListEntry, KLDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
75 if (Entry != NULL && StrniCmp(Entry->KldrEntry.BaseDllName.Buffer, ModuleName, (Entry->KldrEntry.BaseDllName.Length / sizeof(CHAR16))) == 0)
76 return &Entry->KldrEntry;
77 }
78 return NULL;
79}
80
81//
82// Disables VBS for this boot

Callers 1

Calls 1

StrniCmpFunction · 0.85

Tested by

no test coverage detected