|
RDFU
1.0
|
Functions for gathering and parsing EFI EVENTS. More...
#include "EfiScannerHeaders.h"
Go to the source code of this file.
Macros | |
| #define | MAX_EVENT_TABLE_SIZE 1024 |
| #define | MAX_EVENT_SCAN_SIZE 0x1000 |
Functions | |
| VOID | GetEventTypeStringAscii (CHAR8 *EventTypeBuff, UINTN EventTypeBuffSize, UINT32 EventType) |
| EFI_STATUS | GetgEventSignalQueueMacMini (VOID) |
| EFI_STATUS | BruteFind_gEventSignalQueueAddr2 (VOID) |
| EFI_STATUS | BruteFind_gEventSignalQueueAddr (VOID) |
| BOOLEAN | IsEventSignalQueueAddrResolved (VOID) |
| event_entry_list * | GetAllEvents (VOID) |
| event_entry * | FindEventByAddr (event_entry_list *EventList, C_PTR Address) |
| VOID | FreeEvents (event_entry_list *EventList) |
| EFI_STATUS | DumpAllEvents (event_entry_list *EventList) |
Variables | |
| C_PTR | gEventSignalQueueAddr = 0 |
Functions for gathering and parsing EFI EVENTS.
Definition in file Events.c.
| #define MAX_EVENT_SCAN_SIZE 0x1000 |
Definition at line 15 of file Events.c.
Referenced by GetgEventSignalQueueMacMini().
| EFI_STATUS BruteFind_gEventSignalQueueAddr | ( | VOID | ) |
Function tries to find gEventSignalQueueAddr using signature approach. This version works by scanning the .data section of the original EFI firmware driver and looking for specified set of bytes (signature). Function is working with both x86 and x64 firmware.
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 214 of file Events.c.
References FindImageByAddr(), FreeImages(), GetAllImagesWithDescription(), GetPEHeaders(), gEventSignalQueueAddr, _image_entry::ImageBase, LogFullAscii(), EFI_IMAGE_SECTION_HEADER::Name, EFI_IMAGE_SECTION_HEADER::SizeOfRawData, and EFI_IMAGE_SECTION_HEADER::VirtualAddress.
Referenced by IsEventSignalQueueAddrResolved().


| EFI_STATUS BruteFind_gEventSignalQueueAddr2 | ( | VOID | ) |
Function tries to find gEventSignalQueueAddr using signature approach. This version of the function was done especially to handle Asrock mobo. But it also works with vmware and x64 firmware. Use it only on x64 firmware. (just an alternative method)
asrock x64 firmware: .text:00000000CE393EE0 mov rdx, [rsp+38h+arg_28] .text:00000000CE393EE5 lea rcx, gEventSignalQueue .text:00000000CE393EEC add rdx, 10h .text:00000000CE393EF0 call sub_CE3B3D24
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 136 of file Events.c.
References gEventSignalQueueAddr, and LogFullAscii().
Referenced by IsEventSignalQueueAddrResolved().


| EFI_STATUS DumpAllEvents | ( | event_entry_list * | EventList | ) |
Function enumarates and dumps all events found in the event list. The output is shown on the screen, written to the log file or serial port depending on the current library policy.
| EventList | Pointer to the event list gathered from GetAllEvents function |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 584 of file Events.c.
References EVENT_TYPE_BUFF_SIZE, _event_entry_list::EventEntry, _image_entry::FilePath, FindImageByAddr(), FreeImages(), GetAllImagesWithDescription(), GetEventTypeStringAscii(), _image_entry::ImageBase, _image_entry::ImageSize, LogFullAscii(), _image_entry::Name, IEVENT::NotifyFunction, _event_entry_list::NumOfEntries, and IEVENT::Type.
Referenced by CommandEventInfo(), DrawBoxAndMenu(), and TestDumpHandles().


| event_entry* FindEventByAddr | ( | event_entry_list * | EventList, |
| C_PTR | Address | ||
| ) |
Function finds event entry in the events list by address of the notify function.
| EventList | Pointer to the event list gathered from GetAllEvents function |
| Address | Address of wanted notify function |
| Pointer | On success function returns pointer to the located event_entry |
| NULL | On error |
Definition at line 531 of file Events.c.
References _event_entry_list::EventEntry, IEVENT::NotifyFunction, and _event_entry_list::NumOfEntries.
Referenced by CommandEventInfo(), and NotifyEventScannerTimer().

| VOID FreeEvents | ( | event_entry_list * | EventList | ) |
Function frees the event list
| EventList | Pointer to the event list gathered from GetAllEvents function |
| NONE |
Definition at line 563 of file Events.c.
References _event_entry_list::EventEntry, and MemFree().
Referenced by CommandEventInfo(), DrawBoxAndMenu(), and UnInstallEventScanner().


| event_entry_list* GetAllEvents | ( | VOID | ) |
Function is responsible for gathering all events from the queue. Unfortunatelly it may be vulnerable to the race condition since we haven't takedovered the original spinlock. In other words we are forced to use the gEventSignalQueueAddr without synchronization.
EFI events are constructs that are used to provide communication between EFI modules.
The event_entry_list returned by this function must be freed by the FreeEvents function.
| Pointer | On success pointer to event_entry_list |
| NULL | On error |
Definition at line 448 of file Events.c.
References EVENT_SIGNATURE, _event_entry_list::EventEntry, gEventSignalQueueAddr, IsEventSignalQueueAddrResolved(), LogFullAscii(), MemAllocate(), MemCopy(), MemFree(), _event_entry_list::NumOfEntries, and IEVENT::Signature.
Referenced by CommandEventInfo(), DrawBoxAndMenu(), InstallEventScanner(), and TestDumpHandles().


| VOID GetEventTypeStringAscii | ( | CHAR8 * | EventTypeBuff, |
| UINTN | EventTypeBuffSize, | ||
| UINT32 | EventType | ||
| ) |
Function converts EventType to text representation.
| EventTypeBuff | Pointer to output buffer |
| EventTypeBuffSize | Size of the output buffer |
| EventType | Value of the selected event type |
| NONE |
Definition at line 36 of file Events.c.
References isEVENT_TYPE_EXIT_BOOT_SERVICES(), isEVENT_TYPE_NOTIFY_SIGNAL(), isEVENT_TYPE_NOTIFY_WAIT(), isEVENT_TYPE_RUNTIME(), isEVENT_TYPE_TIMER(), and isEVENT_TYPE_VIRTUAL_ADDRESS_CHANGE().
Referenced by CommandEventInfo(), DumpAllEvents(), and NotifyEventScannerTimer().


| EFI_STATUS GetgEventSignalQueueMacMini | ( | VOID | ) |
Function tries to find gEventSignalQueueAddr using signature approach. This version of the function was done especially to handle Apple Mac Mini firmware.
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 77 of file Events.c.
References gEventSignalQueueAddr, LogFullAscii(), and MAX_EVENT_SCAN_SIZE.
Referenced by IsEventSignalQueueAddrResolved().


| BOOLEAN IsEventSignalQueueAddrResolved | ( | VOID | ) |
Function tries to find gEventSignalQueueAddr using different set of functions.
| TRUE | On success (gEventSignalQueueAddr was found) |
| FALSE | On error (gEventSignalQueueAddr was not found) |
Definition at line 401 of file Events.c.
References BruteFind_gEventSignalQueueAddr(), BruteFind_gEventSignalQueueAddr2(), GetgEventSignalQueueMacMini(), gEventSignalQueueAddr, and LogFullAscii().
Referenced by GetAllEvents().


| C_PTR gEventSignalQueueAddr = 0 |
Definition at line 21 of file Events.c.
Referenced by BruteFind_gEventSignalQueueAddr(), BruteFind_gEventSignalQueueAddr2(), GetAllEvents(), GetgEventSignalQueueMacMini(), IsEventSignalQueueAddrResolved(), and NotifyEventScannerTimer().