|
RDFU
1.0
|
Main include file. More...
#include <Library/BaseLib.h>#include <Library/BaseMemoryLib.h>#include <Library/DebugLib.h>#include <Library/UefiBootServicesTableLib.h>#include <Library/UefiRuntimeServicesTableLib.h>#include <Library/UefiLib.h>#include <Library/PrintLib.h>#include <Library/DevicePathLib.h>#include <Protocol/LoadedImage.h>#include <Protocol/SimpleFileSystem.h>#include <Protocol/BlockIo.h>#include <Protocol/DevicePathToText.h>#include <Protocol/PciRootBridgeIo.h>#include "PeImage.h"#include "TeImage.h"#include "EfiScannerLib.h"#include "Images.h"#include "Events.h"#include "Arch.h"#include "Memory.h"

Go to the source code of this file.
Macros | |
| #define | DEBUG_ON 1 |
| #define | CHECK_BAD_ADDRS 1 |
| #define | USE_DXE_SERVICES 0 |
| #define | LOG_FILE L"log.txt" |
| #define | LOG_INIT_LINE ": Initializing scanner ... \r\n" |
| #define | LOG_EXIT_LINE ": Everything done, quiting. \r\n" |
| #define | CONF_FILE_PATH L"conf.txt" |
| #define | PAGE_SIZE EFI_PAGE_SIZE |
| #define | MAX_VALID_IMAGES 512 |
| #define | MAX_MEM_DUMP_SIZE 1024*1024*10 |
| #define | TICKS_PER_MS 10000U |
| #define | SAMPLE_INTERVAL (10 * 10 * TICKS_PER_MS) |
| #define | EFI_EVENT_NOTIFY_WAIT 0x00000100 |
| #define | EFI_TPL_NOTIFY 16 |
| #define | PRINT_FUNC if (gEfiScannerPolicy.OpUsePrint) Print |
| #define | PRINT_FUNC_ASCII if (gEfiScannerPolicy.OpUsePrint) AsciiPrint |
Typedefs | |
| typedef VOID(* | CALLBACK_IMAGESNIFFER_NEW )(image_entry_list *OrgImageList, image_entry *NewImage) |
| typedef VOID(* | CALLBACK_IMAGESNIFFER_MOD )(image_entry_list *OrgImageList, image_entry *ModifiedImage) |
| typedef VOID(* | CALLBACK_EVENTSCANNER )(event_entry_list *OrgEventList, event_entry *NewEvent) |
Variables | |
| C_PTR | gEventSignalQueueAddr |
| policy | gEfiScannerPolicy |
| #define CHECK_BAD_ADDRS 1 |
Definition at line 38 of file EfiScannerHeaders.h.
| #define CONF_FILE_PATH L"conf.txt" |
Definition at line 50 of file EfiScannerHeaders.h.
Referenced by EfiScannerEntryPoint().
| #define DEBUG_ON 1 |
Definition at line 37 of file EfiScannerHeaders.h.
| #define EFI_EVENT_NOTIFY_WAIT 0x00000100 |
Definition at line 67 of file EfiScannerHeaders.h.
| #define EFI_TPL_NOTIFY 16 |
Definition at line 68 of file EfiScannerHeaders.h.
Referenced by InstallEFITableScanner(), and InstallEventScanner().
| #define LOG_EXIT_LINE ": Everything done, quiting. \r\n" |
Definition at line 48 of file EfiScannerHeaders.h.
Referenced by CloseLogFile().
| #define LOG_FILE L"log.txt" |
Definition at line 46 of file EfiScannerHeaders.h.
Referenced by InitializeLogFile().
| #define LOG_INIT_LINE ": Initializing scanner ... \r\n" |
Definition at line 47 of file EfiScannerHeaders.h.
Referenced by InitializeLogFile().
| #define MAX_MEM_DUMP_SIZE 1024*1024*10 |
Definition at line 58 of file EfiScannerHeaders.h.
| #define MAX_VALID_IMAGES 512 |
Definition at line 57 of file EfiScannerHeaders.h.
| #define PAGE_SIZE EFI_PAGE_SIZE |
Definition at line 54 of file EfiScannerHeaders.h.
Referenced by GetMemoryMapList().
| #define PRINT_FUNC if (gEfiScannerPolicy.OpUsePrint) Print |
Definition at line 330 of file EfiScannerHeaders.h.
Referenced by EfiScannerInitialize(), InitializeLogFile(), LogFullUnicode(), and TestDumpHandles().
| #define PRINT_FUNC_ASCII if (gEfiScannerPolicy.OpUsePrint) AsciiPrint |
Definition at line 331 of file EfiScannerHeaders.h.
Referenced by DumpEFITables(), and LogFullAscii().
| #define SAMPLE_INTERVAL (10 * 10 * TICKS_PER_MS) |
Definition at line 64 of file EfiScannerHeaders.h.
Referenced by InstallEFITableScanner(), and InstallEventScanner().
| #define TICKS_PER_MS 10000U |
Definition at line 62 of file EfiScannerHeaders.h.
Referenced by ScreenShowSplashLogo().
| #define USE_DXE_SERVICES 0 |
Definition at line 39 of file EfiScannerHeaders.h.
| typedef VOID(* CALLBACK_EVENTSCANNER)(event_entry_list *OrgEventList, event_entry *NewEvent) |
Definition at line 191 of file EfiScannerHeaders.h.
| typedef VOID(* CALLBACK_IMAGESNIFFER_MOD)(image_entry_list *OrgImageList, image_entry *ModifiedImage) |
Definition at line 165 of file EfiScannerHeaders.h.
| typedef VOID(* CALLBACK_IMAGESNIFFER_NEW)(image_entry_list *OrgImageList, image_entry *NewImage) |
Definition at line 164 of file EfiScannerHeaders.h.
| image_entry* AddImageToList | ( | image_entry_list * | ImageList, |
| EFI_HANDLE | Handle, | ||
| EFI_LOADED_IMAGE_PROTOCOL * | LoadedImageProt, | ||
| BOOLEAN | CalculateCrc | ||
| ) |
Function creates the new ImageEntry list (based on the old one) it also adds one new image entry to it.
| ImageList | Pointer to selected ImageEntry |
| Handle | Image handle |
| LoadedImageProt | Pointer to openned LOADED_IMAGE_PROTOCOL |
| CalculateCrc | Indicates whether function should calculate the crc32 value of the image code. |
| image_entry* | On success a pointer to newly created image_entry is returned |
| NULL | On error |
Definition at line 642 of file Images.c.
References _image_entry::Crc32, GetImagePathAndName(), GetPECodeChecksum(), _image_entry::Handle, _image_entry::ImageBase, _image_entry_list::ImageEntry, _image_entry::ImageSize, _image_entry::LoadedImageProtocol, MemAllocate(), MemCopy(), MemFree(), and _image_entry_list::NumOfEntries.
Referenced by hooked_LoadImage().


| VOID ASMEnterLock | ( | ULONG * | Lock | ) |
Referenced by LogFileAscii(), LogFullAscii(), and LogFullUnicode().

| VOID ASMInitLock | ( | ULONG * | Lock | ) |
| VOID ASMLeaveLock | ( | ULONG * | Lock | ) |
Referenced by LogFileAscii(), LogFullAscii(), and LogFullUnicode().

| EFI_STATUS CheckImagesFunctionPointers | ( | image_entry_list * | ImageList | ) |
Function enumerates the entire image list and it checks whether pointers to RuntimeServices, BootServices and SystemTables are different across different images. Everything is reported to the screen, log file or serial port depending on the framework policy.
| ImageList | Pointer to image list |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 961 of file Images.c.
References check_modification, _image_entry::Crc32, _image_entry::FilePath, _image_entry::Handle, _image_entry::ImageBase, _image_entry_list::ImageEntry, _image_entry::ImageSize, _image_entry::LoadedImageProtocol, LogFullAscii(), _image_entry::Name, and _image_entry_list::NumOfEntries.
Referenced by DrawBoxAndMenu(), and TestDumpHandles().


| EFI_STATUS CloseLogFile | ( | VOID | ) |
Function closes the log file.
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 197 of file FileSystemWrap.c.
References gEfiScannerPolicy, gLogFile, LOG_EXIT_LINE, and _policy::OpUseLog.
Referenced by EfiScannerEntryPoint().

| EFI_STATUS ComConsoleStart | ( | VOID | ) |
main com console loop, function reads keys from COM port, writes them back (echo) and picks necessary action
Definition at line 433 of file ComConsole.c.
References ComGetChar(), CommandHelp(), ComPutChar(), KEY_BACKSPACE, KEY_ENTER, KEY_ESCAPE, LogFullAscii(), MemZero(), and ProcessCommand().
Referenced by DrawBoxAndMenu().


| VOID ComInitialize | ( | ULONG | ComPortAddr | ) |
| VOID ComPutString | ( | CHAR8 * | String | ) |
Function writes selected string to the selected com port.
| String | Pointer to null-terminated string to send. |
| NONE |
Definition at line 78 of file ComPort.c.
References ComPutChar().
Referenced by LogFileAscii(), and LogFullAscii().


| VOID ContextX64Test | ( | VOID | ) |
Definition at line 227 of file Context.c.
References DisplayLogX64Context(), DisplayLogX86Context(), GetX64Context(), and GetX86Context().
Referenced by ProcessCommand(), and TestDumpHandles().


| EFI_STATUS DisplayLogX64Context | ( | x64_context * | Context | ) |
Function displays the X64 context structure.
| Context | Pointer to x64_context structure |
| EFI_SUCCESS |
Definition at line 123 of file Context.c.
References _x64_context::_Cr0, _x64_context::_Cr2, _x64_context::_Cr3, _x64_context::_Cr4, _x64_context::_Cr8, _x64_context::_Cs, _x64_context::_Dr0, _x64_context::_Dr2, _x64_context::_Dr3, _x64_context::_Dr6, _x64_context::_Dr7, _x64_context::_Ds, _x64_context::_Es, _x64_context::_Fs, _x64_context::_Gs, _x64_context::_Rax, _x64_context::_Rbp, _x64_context::_Rbx, _x64_context::_Rcx, _x64_context::_Rdi, _x64_context::_Rdx, _x64_context::_Rflags, _x64_context::_Rsi, _x64_context::_Rsp, _x64_context::_Ss, LOG_VALUE, and LogFullAscii().
Referenced by ContextX64Test(), and DrawBoxAndMenu().


| EFI_STATUS DisplayLogX86Context | ( | x86_context * | Context | ) |
Function displays the X86 context structure.
| Context | Pointer to x86_context structure |
| EFI_SUCCESS |
Definition at line 180 of file Context.c.
References _x86_context::_Cr0, _x86_context::_Cr2, _x86_context::_Cr3, _x86_context::_Cr4, _x86_context::_Cs, _x86_context::_Dr0, _x86_context::_Dr2, _x86_context::_Dr3, _x86_context::_Dr6, _x86_context::_Dr7, _x86_context::_Ds, _x86_context::_Eax, _x86_context::_Ebp, _x86_context::_Ebx, _x86_context::_Ecx, _x86_context::_Edi, _x86_context::_Edx, _x86_context::_Eflags, _x86_context::_Es, _x86_context::_Esi, _x86_context::_Esp, _x86_context::_Fs, _x86_context::_Gs, _x86_context::_Ss, LOG_VALUE, and LogFullAscii().
Referenced by ContextX64Test(), and DrawBoxAndMenu().


| 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().


| EFI_STATUS DumpAllHandles | ( | handle_entry_list * | HandleList | ) |
Function enumarates and dumps all handles found in the handle list. The output is shown on the screen, written to the log file or serial port depending on the current library policy.
| HandleList | Pointer to the handle list gathered from GetAllHandlesWithDescription function |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 530 of file Images.c.
References _handle_entry::Flags, GetHandleTypeStringAscii(), _handle_entry::Handle, _handle_entry_list::HandleEntry, LogFullAscii(), and _handle_entry_list::NumOfEntries.
Referenced by DrawBoxAndMenu(), and TestDumpHandles().


| EFI_STATUS DumpAllImages | ( | image_entry_list * | ImageList, |
| BOOLEAN | DumpToDisk | ||
| ) |
Function dumps all image on the ImageList either just to screen or to disk also (to "dump\ImageBase.dmp")
| ImageList | Pointer to image list |
| DumpToDisk | Indicates whether images will be dumped to disk or not |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 906 of file Images.c.
References _image_entry::Crc32, DumpImageToDisk(), _image_entry::FilePath, _image_entry::Handle, _image_entry::ImageBase, _image_entry_list::ImageEntry, _image_entry::ImageSize, LogFullAscii(), _image_entry::Name, and _image_entry_list::NumOfEntries.
Referenced by CommandDriverInfo(), DrawBoxAndMenu(), and TestDumpHandles().


| EFI_STATUS DumpEFITables | ( | BOOLEAN | SilentMode | ) |
Definition at line 208 of file TableMonitor.c.
References FindImageByAddr(), GetAllImagesWithDescription(), _image_entry::ImageBase, _image_entry::ImageSize, IsFunctionHooked(), _func_table::last_addr, LogFileAscii(), LogFullAscii(), _func_table::name, and PRINT_FUNC_ASCII.
Referenced by CommandFunction(), DrawBoxAndMenu(), and NotifyScannerTimer().


| EFI_STATUS DumpEvents | ( | BOOLEAN | WriteToTable, |
| BOOLEAN | SilentMode | ||
| ) |
| EFI_STATUS DumpFirmwareFromROM | ( | VOID | ) |
Function dumps firmware from ROM to file (mdump\firmware.dmp). The ROM address is constant and it is described by BIOS_ROM_BASE. Typically the size of firmware is smaller than (BIOS_ROM_END-BIOS_ROM_BASE) but in this case we have just decided to dump more.
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 259 of file DumpMem.c.
References BIOS_ROM_BASE, BIOS_ROM_END, DumpMemoryToFile(), EFI_STATUS(), and LogFullAscii().
Referenced by DrawBoxAndMenu().


| EFI_STATUS DumpGDT | ( | VOID | ) |
Functions dump the GDT. (even on x64 efi platform the GDT entries are not extended - meaning the GDT format stays the same)
| EFI_SUCCESS |
Definition at line 56 of file IdtGdt.c.
References ASMGetGdtBase(), ASMGetGdtLimit(), _gdt_entry::Base0, _gdt_entry::Base1, _gdt_entry::Base2, _gdt_entry::DPL, _gdt_entry::LimitHigh, _gdt_entry::LimitLow, LogFullAscii(), _gdt_entry::Present, _gdt_entry::s, _gdt_entry::System, and _gdt_entry::Type.
Referenced by DrawBoxAndMenu(), ProcessCommand(), and TestDumpHandles().


| EFI_STATUS DumpIDT | ( | VOID | ) |
Functions dump the IDT. This function works with both x86 and x64. (on x64 the idt base calulation algo changes)
| EFI_SUCCESS |
Definition at line 191 of file IdtGdt.c.
References ASMGetIdtBase(), ASMGetIdtLimit(), idt_entry::Dpl, IDT_GET_BASE, LogFullAscii(), idt_entry::Present, idt_entry::SegmentSelector, and idt_entry::Type.
Referenced by DrawBoxAndMenu(), ProcessCommand(), and TestDumpHandles().


| EFI_STATUS DumpImageToDisk | ( | image_entry * | ImageEntry | ) |
Function dumps selected image to disk (to "dump\ImageBase.dmp")
| ImageEntry | Pointer to the image entry which will be dumped |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 869 of file Images.c.
References DumpMemoryToFile(), _image_entry::ImageBase, _image_entry::ImageSize, and LogFullAscii().
Referenced by DumpAllImages().


| EFI_STATUS DumpMemoryMap | ( | memory_map_entry_list * | MemMap, |
| BOOLEAN | DumpToDisk, | ||
| UINT32 | SkipType | ||
| ) |
Function displays and dump the memory map.
| MemMap | Pointer to memory map obtained from GetMemoryMapList |
| DumpToDisk | Inidicates whether the data will be dumped to disk |
| SkipType | Types of memory that will be not included in the disk dump |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 381 of file MemoryMap.c.
References _memory_map_entry::Attributes, DumpGcdMemoryMap(), DumpMemoryToFile(), GetMemAttributesStringAscii(), LogFullAscii(), _memory_map_entry_list::MapKey, memory_types, _memory_map_entry_list::MemoryMapEntry, _memory_map_entry::NumberOfPages, _memory_map_entry_list::NumOfEntries, _memory_map_entry::PhysicalStart, _memory_map_entry::Type, and _memory_map_entry::VirtualStart.
Referenced by CommandMemInfo(), and DrawBoxAndMenu().


| EFI_STATUS DumpMemoryToFile | ( | C_PTR | Address, |
| UINTN | Size, | ||
| CHAR16 * | FilePath, | ||
| BOOLEAN | UseProxy | ||
| ) |
Function dumps memory from Address to (Address + Size) to file.
If UseProxy is set to TRUE then before we will execute File->Write the source memory will be copied to our newly allocated buffer. This decreases the performance but on the other hand it increases the stability. On real systems for example when you are trying to dump images from memory and you want to do this directly (without the memory proxy) your machine will often freeze. Obviously in some cases this method will not work due to the gigantic Size parameter. Additionally maybe we should disable this option when doing a full memory dump (just to keep the memory layout intact).
| Address | Address inidicating memory to dump |
| Size | Size of memory to dump |
| FilePath | Pointer to file path (unicode) |
| UseProxy | Should we copy the source to our memory firstly |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 174 of file Memory.c.
References EFI_STATUS(), LogFullAscii(), MemAllocate(), MemCopy(), MemFree(), and OpenFile().
Referenced by CommandDumpMem(), DumpFirmwareFromROM(), DumpImageToDisk(), DumpMemoryMap(), DumpPEFile(), DumpTEFile(), and hooked_LoadImage().


| EFI_STATUS DumpPEFile | ( | C_PTR | BaseAddr | ) |
Function dumps Portable Executable file to file. (by default "bdump\ADDR.dmp")
| BaseAddr | Address to the located Portable Executable file in memory. |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 30 of file DumpMem.c.
References DumpMemoryToFile(), EFI_IMAGE_DOS_HEADER::e_lfanew, EFI_IMAGE_NT_SIGNATURE, LogFullAscii(), MAX_PE_MEM, EFI_IMAGE_NT_HEADERS64::OptionalHeader, EFI_IMAGE_NT_HEADERS64::Signature, and EFI_IMAGE_OPTIONAL_HEADER64::SizeOfImage.
Referenced by ScanMemoryForExecutables().


| EFI_STATUS DumpTEFile | ( | C_PTR | BaseAddr | ) |
Function dumps TE file to file. (by default "bdump\ADDR.dmp")
| BaseAddr | Address to the located TE file in memory. |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 29 of file Te.c.
References DumpMemoryToFile(), EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER, EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER, LogFullAscii(), TE_IMAGE_HEADER::NumberOfSections, TE_IMAGE_HEADER::Signature, EFI_IMAGE_SECTION_HEADER::SizeOfRawData, TE_IMAGE_HEADER::Subsystem, and TE_SIGNATURE.
Referenced by ScanMemoryForExecutables().


| EFI_STATUS EFIAPI EfiScannerInitialize | ( | EFI_HANDLE | ImageHandle, |
| BOOLEAN | OpUsePrint, | ||
| BOOLEAN | OpUseLog, | ||
| BOOLEAN | OpUseComPort | ||
| ) |
Initializes the gEfiScannerPolicy. This function must be executed before any other function of RDFU framework.
| ImageHandle | Image handle |
| OpUsePrint | Print output to screen |
| OpUseLog | Print output to log file (log.txt) |
| OpUseComPort | Print output to com port (COM1 by default) |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 42 of file EfiScannerLib.c.
References ASMInitLock(), EFI_STATUS(), gLogLock, gSelfLoadedImage, InitializeLogFile(), LogFullAscii(), _policy::NumOfBadAddrs, _policy::OpUseComPort, _policy::OpUseLog, _policy::OpUsePrint, and PRINT_FUNC.
Referenced by EfiScannerEntryPoint().


| C_PTR EFITableGetAddr | ( | CHAR8 * | FuncName | ) |
Function gets addr of selected function (search is done by function name case sensitive);
| Addr | On success |
| NULL | On error |
Definition at line 398 of file TableMonitor.c.
References _func_table::last_addr, and _func_table::name.
Referenced by CommandFunction().

| 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().

| image_entry* FindImageByAddr | ( | image_entry_list * | ImageList, |
| C_PTR | Address | ||
| ) |
Function finds image entry in the image list by address. Function checks if the selected address points somewhere inside the image body.
| ImageList | Pointer to the image list gathered from GetAllImagesWithDescription function |
| Address | Address of wanted image (doesn't have to be exact image base) |
| Pointer | On success function returns pointer to the located image_entry |
| NULL | On error |
Definition at line 804 of file Images.c.
References _image_entry::ImageBase, _image_entry_list::ImageEntry, _image_entry::ImageSize, and _image_entry_list::NumOfEntries.
Referenced by BruteFind_gEventSignalQueueAddr(), CommandDriverInfo(), DumpAllEvents(), DumpEFITables(), and ScanMemoryForExecutables().

| image_entry* FindImageByHandle | ( | image_entry_list * | ImageList, |
| EFI_HANDLE | Handle | ||
| ) |
Function finds image entry in the image list by handle value
| ImageList | Pointer to the image list gathered from GetAllImagesWithDescription function |
| Handle | Value of wanted handle |
| Pointer | On success function returns pointer to the located image_entry |
| NULL | On error |
Definition at line 838 of file Images.c.
References _image_entry::Handle, _image_entry_list::ImageEntry, and _image_entry_list::NumOfEntries.
Referenced by NotifyExitBootServices().

| memory_map_entry* FindMapEntryByAddr | ( | memory_map_entry_list * | MemMap, |
| EFI_PHYSICAL_ADDRESS | Address | ||
| ) |
Function finds memory map entry in the memory map list by address. Function checks if the selected address points somewhere inside the map memory entry range.
| MemMap | Pointer to the memory map |
| Address | Memory address |
| Pointer | On success function returns pointer to the located image_entry |
| NULL | On error |
Definition at line 343 of file MemoryMap.c.
References _memory_map_entry_list::MemoryMapEntry, _memory_map_entry::NumberOfPages, _memory_map_entry_list::NumOfEntries, and _memory_map_entry::PhysicalStart.
Referenced by CommandMemInfo().

| 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().


| VOID FreeHandles | ( | handle_entry_list * | HandleList | ) |
Function frees the handle list
| HandleList | Pointer to the handle list gathered from GetAllHandlesWithDescription function |
| NONE |
Definition at line 400 of file Images.c.
References _handle_entry_list::HandleEntry, and MemFree().
Referenced by DrawBoxAndMenu(), GetAllImagesWithDescription(), and TestDumpHandles().


| VOID FreeImages | ( | image_entry_list * | ImageList | ) |
Function frees the image list
| ImageList | Pointer to the image list gathered from GetAllImagesWithDescription function |
| NONE |
Definition at line 1051 of file Images.c.
References CloseLoadedImageProtocol(), _image_entry::Handle, _image_entry_list::ImageEntry, _image_entry::LoadedImageProtocol, MemFree(), and _image_entry_list::NumOfEntries.
Referenced by BruteFind_gEventSignalQueueAddr(), CommandDriverInfo(), DrawBoxAndMenu(), DumpAllEvents(), InstallSniffImage(), NotifyExitBootServices(), ScanMemoryForExecutables(), TestDumpHandles(), and UnInstallSniffImage().


| VOID FreeMemMap | ( | memory_map_entry_list * | MemMap | ) |
Function displays the GCD memory map obtained through GetMemorySpaceMap. This function is only available in DXE drivers due to DxeServicesTableLib requirements.
| MemMap | Pointer to memory map obtained from GetMemoryMapList |
Definition at line 270 of file MemoryMap.c.
References MemFree(), and _memory_map_entry_list::MemoryMapEntry.
Referenced by CommandMemInfo(), and DrawBoxAndMenu().


| 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().


| handle_entry_list* GetAllHandlesWithDescription | ( | VOID | ) |
Function is responsible for gathering all system handles. Requestor is responsible for deallocating the memory through FreeHandles function.
| Pointer | On success pointer to handle_entry_list |
| NULL | On error |
Definition at line 419 of file Images.c.
References EFI_STATUS(), GetAllHandles(), _handle_entry::Handle, _handle_entry_list::HandleEntry, LogFullAscii(), MemAllocate(), MemFree(), _handle_entry_list::NumOfEntries, setHANDLE_TYPE_COMPONENT_NAME_HANDLE(), setHANDLE_TYPE_DEVICE_HANDLE(), setHANDLE_TYPE_DRIVER_BINDING_HANDLE(), setHANDLE_TYPE_DRIVER_CONFIGURATION_HANDLE(), setHANDLE_TYPE_DRIVER_DIAGNOSTICS_HANDLE(), and setHANDLE_TYPE_IMAGE_HANDLE().
Referenced by DrawBoxAndMenu(), GetAllImagesWithDescription(), and TestDumpHandles().


| image_entry_list* GetAllImagesWithDescription | ( | handle_entry_list * | HandleList, |
| BOOLEAN | CalculateCrc | ||
| ) |
Function creates the image list based on the system handles. Requestor is responsible for deallocating the memory through FreeImages function.
| HandleList | Pointer to handle list (can be null) |
| CalculateCrc | Indicates whether function should calculate the crc32 value of the image code. |
| image_entry_list* | On success a pointer to created image_entry_list |
| NULL | On error |
Definition at line 701 of file Images.c.
References _image_entry::Crc32, EFI_STATUS(), FreeHandles(), GetAllHandlesWithDescription(), GetImagePathAndName(), GetLoadedImageProtocol(), GetPECodeChecksum(), _handle_entry::Handle, _image_entry::Handle, _handle_entry_list::HandleEntry, _image_entry::ImageBase, _image_entry_list::ImageEntry, _image_entry::ImageSize, _image_entry::LoadedImageProtocol, MAX_IMAGE_TEXTBUFF_LEN, MemAllocate(), MemFree(), _handle_entry_list::NumOfEntries, and _image_entry_list::NumOfEntries.
Referenced by BruteFind_gEventSignalQueueAddr(), CommandDriverInfo(), DrawBoxAndMenu(), DumpAllEvents(), DumpEFITables(), InstallSniffImage(), NotifyExitBootServices(), ScanMemoryForExecutables(), 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().


| VOID GetHandleTypeStringAscii | ( | CHAR8 * | HandleTypeBuff, |
| UINTN | HandleTypeBuffSize, | ||
| UINT16 | Flags | ||
| ) |
Function converts HandleType to text representation.
| HandleTypeBuff | Pointer to output buffer |
| HandleTypeBuffSize | Size of the output buffer |
| Flags | Value of the selected handle type |
| NONE |
Definition at line 39 of file Images.c.
References isHANDLE_TYPE_BUS_DRIVER(), isHANDLE_TYPE_CHILD_HANDLE(), isHANDLE_TYPE_COMPONENT_NAME_HANDLE(), isHANDLE_TYPE_CONTROLLER_HANDLE(), isHANDLE_TYPE_DEVICE_DRIVER(), isHANDLE_TYPE_DEVICE_HANDLE(), isHANDLE_TYPE_DRIVER_BINDING_HANDLE(), isHANDLE_TYPE_DRIVER_CONFIGURATION_HANDLE(), isHANDLE_TYPE_DRIVER_DIAGNOSTICS_HANDLE(), isHANDLE_TYPE_IMAGE_HANDLE(), isHANDLE_TYPE_PARENT_HANDLE(), and isHANDLE_TYPE_UNKNOWN().
Referenced by DumpAllHandles().


Returns IDT entry for selected entry.
| IdtVectorNum | index of wanted entry |
| ptr | to idt_entry |
Definition at line 106 of file IdtGdt.c.
References ASMGetIdtBase().
Referenced by IdtHookInterrupt().


| EFI_STATUS GetLoadedImageProtocol | ( | EFI_HANDLE | Handle, |
| EFI_LOADED_IMAGE_PROTOCOL ** | OutLoadedImage | ||
| ) |
Function returns pointer to EFI_LOADED_IMAGE_PROTOCOL for specified Handle. HandleProtocol queries a handle to determine if it supports a specified protocol.
| Handle | Specified handle |
| OutLoadedImage | Pointer to variable that will hold the EFI_LOADED_IMAGE_PROTOCOL |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 151 of file Images.c.
References EFI_STATUS(), GetDevicePathTextForHandle(), and LogFullAscii().
Referenced by GetAllImagesWithDescription(), and hooked_LoadImage().


| VOID GetMemAttributesStringAscii | ( | CHAR8 * | MemAttributesBuff, |
| UINTN | MemAttributesBuffSize, | ||
| UINT64 | Attributes | ||
| ) |
Function converts memory Attributes to text representation.
| MemAttributesBuff | Pointer to output buffer |
| MemAttributesBuffSize | Size of the output buffer |
| Attributes | Value of memory attributes |
| NONE |
Definition at line 42 of file MemoryMap.c.
References isMEM_ATTR_MEMORY_RP(), isMEM_ATTR_MEMORY_RUNTIME(), isMEM_ATTR_MEMORY_UC(), isMEM_ATTR_MEMORY_UCE(), isMEM_ATTR_MEMORY_WB(), isMEM_ATTR_MEMORY_WC(), isMEM_ATTR_MEMORY_WP(), isMEM_ATTR_MEMORY_WT(), and isMEM_ATTR_MEMORY_XP().
Referenced by CommandMemInfo(), and DumpMemoryMap().


| memory_map_entry_list* GetMemoryMapList | ( | VOID | ) |
Function generates current memory map. Caller is responsible for deallocating the memory.
| Pointer | On success pointer to memory_map_entry_list |
| NULL | On error |
Definition at line 114 of file MemoryMap.c.
References _memory_map_entry::Attributes, EFI_STATUS(), GetMemoryEntryGcdInformation(), LogFullAscii(), _memory_map_entry_list::MapKey, MemAllocate(), MemFree(), _memory_map_entry_list::MemoryMapEntry, NUM_OF_MAP_ENTRIES, _memory_map_entry::NumberOfPages, _memory_map_entry_list::NumOfEntries, PAGE_SIZE, _memory_map_entry::PhysicalStart, _memory_map_entry::Type, and _memory_map_entry::VirtualStart.
Referenced by CommandMemInfo(), and DrawBoxAndMenu().


Function computes the checksum from code section of the selected PE file. Code sections that are writable are not included in the checksum.
| Base | Base of PE file in memory |
| Checksum | On success |
| NULL | On error |
Definition at line 144 of file Pe.c.
References EFI_IMAGE_SECTION_HEADER::Characteristics, EFI_IMAGE_SCN_MEM_EXECUTE, EFI_IMAGE_SCN_MEM_WRITE, EFI_IMAGE_NT_HEADERS32::FileHeader, GetPEHeaders(), EFI_IMAGE_FILE_HEADER::NumberOfSections, EFI_IMAGE_SECTION_HEADER::SizeOfRawData, and EFI_IMAGE_SECTION_HEADER::VirtualAddress.
Referenced by AddImageToList(), and GetAllImagesWithDescription().


| BOOLEAN GetPEHeaders | ( | C_PTR | Base, |
| EFI_IMAGE_DOS_HEADER ** | pMZ, | ||
| EFI_IMAGE_NT_HEADERS32 ** | pPE, | ||
| EFI_IMAGE_SECTION_HEADER ** | pSH | ||
| ) |
Function initializes the IMAGE_DOS_HEADER, IMAGE_NT_HEADERS and IMAGE_SECTION_HEADER.
| Base | Base of PE file in memory |
| pMZ | Pointer to variable which receives the EFI_IMAGE_DOS_HEADER pointer |
| pPE | Pointer to variable which receives the EFI_IMAGE_NT_HEADERS pointer |
| pSH | Pointer to variable which receives the EFI_IMAGE_SECTION_HEADER pointer |
| TRUE | On success |
| FALSE | On error |
Definition at line 76 of file Pe.c.
References EFI_IMAGE_DOS_HEADER::e_lfanew, EFI_IMAGE_DOS_HEADER::e_magic, EFI_IMAGE_DOS_SIGNATURE, EFI_IMAGE_NT_SIGNATURE, EFI_IMAGE_NT_HEADERS32::FileHeader, IMAGE_FILE_MACHINE_X64, IMAGE_FIRST_SECTION32, IMAGE_FIRST_SECTION64, LogFullAscii(), EFI_IMAGE_FILE_HEADER::Machine, and EFI_IMAGE_NT_HEADERS32::Signature.
Referenced by BruteFind_gEventSignalQueueAddr(), and GetPECodeChecksum().


| EFI_STATUS GetX64Context | ( | x64_context * | Context | ) |
Function fills the X64 Context structure.
| Context | Pointer to x64_context structure |
| EFI_SUCCESS |
Definition at line 24 of file Context.c.
References _x64_context::_Cr0, _x64_context::_Cr2, _x64_context::_Cr3, _x64_context::_Cr4, _x64_context::_Cr8, _x64_context::_Cs, _x64_context::_Dr0, _x64_context::_Dr2, _x64_context::_Dr3, _x64_context::_Dr6, _x64_context::_Dr7, _x64_context::_Ds, _x64_context::_Es, _x64_context::_Fs, _x64_context::_Gs, _x64_context::_Rax, _x64_context::_Rbp, _x64_context::_Rbx, _x64_context::_Rcx, _x64_context::_Rdi, _x64_context::_Rdx, _x64_context::_Rflags, _x64_context::_Rsi, _x64_context::_Rsp, _x64_context::_Ss, ASMGetRegCr0(), ASMGetRegCr2(), ASMGetRegCr3(), ASMGetRegCr4(), ASMGetRegCr8(), ASMGetRegCs(), ASMGetRegDr0(), ASMGetRegDr2(), ASMGetRegDr3(), ASMGetRegDr6(), ASMGetRegDr7(), ASMGetRegDs(), ASMGetRegEs(), ASMGetRegFs(), ASMGetRegGs(), ASMGetRegRax(), ASMGetRegRbp(), ASMGetRegRbx(), ASMGetRegRcx(), ASMGetRegRdi(), ASMGetRegRdx(), ASMGetRegRflags(), ASMGetRegRsi(), ASMGetRegRsp(), and ASMGetRegSs().
Referenced by ContextX64Test(), and DrawBoxAndMenu().


| EFI_STATUS GetX86Context | ( | x86_context * | Context | ) |
Function fills the X86 Context structure.
| Context | Pointer to x86_context structure |
| EFI_SUCCESS |
Definition at line 73 of file Context.c.
References _x86_context::_Cr0, _x86_context::_Cr2, _x86_context::_Cr3, _x86_context::_Cr4, _x86_context::_Cs, _x86_context::_Dr0, _x86_context::_Dr2, _x86_context::_Dr3, _x86_context::_Dr6, _x86_context::_Dr7, _x86_context::_Ds, _x86_context::_Eax, _x86_context::_Ebp, _x86_context::_Ebx, _x86_context::_Ecx, _x86_context::_Edi, _x86_context::_Edx, _x86_context::_Eflags, _x86_context::_Es, _x86_context::_Esi, _x86_context::_Esp, _x86_context::_Fs, _x86_context::_Gs, _x86_context::_Ss, ASMGetRegCr0(), ASMGetRegCr2(), ASMGetRegCr3(), ASMGetRegCr4(), ASMGetRegCs(), ASMGetRegDr0(), ASMGetRegDr2(), ASMGetRegDr3(), ASMGetRegDr6(), ASMGetRegDr7(), ASMGetRegDs(), ASMGetRegEs(), ASMGetRegFs(), ASMGetRegGs(), ASMGetRegRax(), ASMGetRegRbp(), ASMGetRegRbx(), ASMGetRegRcx(), ASMGetRegRdi(), ASMGetRegRdx(), ASMGetRegRflags(), ASMGetRegRsi(), ASMGetRegRsp(), and ASMGetRegSs().
Referenced by ContextX64Test(), and DrawBoxAndMenu().


| EFI_STATUS IdtHookInterrupt | ( | C_PTR | NewIntHandlerAddr, |
| ULONG | IdtVectorNum, | ||
| C_PTR * | OutOldIntAddr | ||
| ) |
Function hooks selected IDT entry (vector) and points it to the NewIntHandlerAddr (supplied by the requestor).
| NewIntHandlerAddr | New interrupt vector handler |
| IdtVectorNum | Specified vector number |
| OutOldIntAddr | Pointer to variable which will hold the old interrupt vector handler |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 137 of file IdtGdt.c.
References GetIdtEntry(), IDT_GET_BASE, LogFullAscii(), idt_entry::OffsetHigh, and idt_entry::OffsetLow.
Referenced by IdtHookTest().


| EFI_STATUS IdtHookTest | ( | VOID | ) |
Definition at line 171 of file IdtGdt.c.
References ASMDbgBreak(), IdtHookInterrupt(), and Int03Handler().

| EFI_STATUS InitializeEFITables | ( | VOID | ) |
Function initializes wanted offsets and values to the EFITables.
Definition at line 103 of file TableMonitor.c.
References write_entry.
Referenced by CommandFunction(), and DrawBoxAndMenu().

| EFI_STATUS InitializeLogFile | ( | VOID | ) |
Function initializes the log file
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 137 of file FileSystemWrap.c.
References EFI_STATUS(), gEfiScannerPolicy, gImageHandle, gLogFile, gRoot, gSelfLoadedImage, gVolFileSystemProto, LOG_FILE, LOG_INIT_LINE, OpenFile(), OpenVolume(), _policy::OpUseLog, and PRINT_FUNC.
Referenced by EfiScannerInitialize().


| EFI_STATUS InstallEFITableScanner | ( | VOID | ) |
Function installs EFI timer which checks runtime/boottime functions periodically - it also logs every change to file.
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 426 of file TableMonitor.c.
References EFI_STATUS(), EFI_TPL_NOTIFY, gScannerEvent, LogFullAscii(), NotifyScannerTimer(), and SAMPLE_INTERVAL.
Referenced by DrawBoxAndMenu().


| EFI_STATUS InstallEventScanner | ( | CALLBACK_EVENTSCANNER | UserCallback | ) |
Function installs EFI timer which checks the events for changes
| UserCallback | Optional address to user function which will be executed when new event will be found. |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 125 of file EventsScanner.c.
References EFI_STATUS(), EFI_TPL_NOTIFY, GetAllEvents(), gEventScannerEvent, gUserEventScannerCallback, LogFullAscii(), MemZero(), NewEventNotifyFunctions, NotifyEventScannerTimer(), NumOfNewEventNotifyFunctions, and SAMPLE_INTERVAL.
Referenced by DrawBoxAndMenu(), and TestDumpHandles().


| EFI_STATUS InstallSniffImage | ( | CALLBACK_IMAGESNIFFER_NEW | UserNewImageCallback, |
| CALLBACK_IMAGESNIFFER_MOD | UserModImageCallback | ||
| ) |
Function installs hook for BootServices->LoadImage. At this point it is able to monitor which images are being loaded by the system.
| UserNewImageCallback | User callback which will be executed when new image is detected |
| UserModImageCallback | User callback which will be executed when a modified image will be detected |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 243 of file SniffImage.c.
References EFI_STATUS(), FreeImages(), GetAllImagesWithDescription(), gOrg_ExitBootServices, gOrg_LoadImage, gSetExitBootServicesEvent, gUserImageSnifferModImageCallback, gUserImageSnifferNewImageCallback, hooked_LoadImage(), LogFullAscii(), and NotifyExitBootServices().
Referenced by DrawBoxAndMenu(), and TestDumpHandles().


Functions tests if Address equals to StartAddr from bad addrs list (from the policy). If so it returns the EndAddr from the policy. This is done to filter the memory areas which cause machine freeze. Otherwise it returns 0.
Definition at line 295 of file DumpMem.c.
References _policy::BadAddrs, _bad_addr_entry::EndAddr, gEfiScannerPolicy, _policy::NumOfBadAddrs, and _bad_addr_entry::StartAddr.
Referenced by ScanMemoryForExecutables().

| VOID LogFileAscii | ( | CHAR8 * | FormatString, |
| ... | |||
| ) |
Depending on the policy function writes the provided text data to log file or serial port.
| FormatString | Format string (printf style) |
| ... | Additional arguments |
| NONE |
Definition at line 40 of file Logs.c.
References ASMEnterLock(), ASMLeaveLock(), ComPutString(), gEfiScannerPolicy, gLogLock, _policy::OpUseComPort, and WriteLogFile().
Referenced by DumpEFITables(), hooked_LoadImage(), MyModImageNotify(), MyNewEventCallback(), MyNewImageNotify(), NotifyEventScannerTimer(), NotifyExitBootServices(), and ReadConfiguration().


| VOID LogFullAscii | ( | CHAR8 * | FormatString, |
| ... | |||
| ) |
Depending on the policy function writes the provided text data to screen, log file or serial port.
| FormatString | Format string (printf style) |
| ... | Additional arguments |
| NONE |
Definition at line 73 of file Logs.c.
References ASMEnterLock(), ASMLeaveLock(), ComPutString(), gEfiScannerPolicy, gLogLock, _policy::OpUseComPort, PRINT_FUNC_ASCII, and WriteLogFile().
Referenced by BruteFind_gEventSignalQueueAddr(), BruteFind_gEventSignalQueueAddr2(), CheckImagesFunctionPointers(), ComConsoleStart(), CommandDriverInfo(), CommandDumpMem(), CommandEventInfo(), CommandFunction(), CommandHelp(), CommandMemInfo(), DisplayLogX64Context(), DisplayLogX86Context(), DumpAllEvents(), DumpAllHandles(), DumpAllImages(), DumpEFITables(), DumpFirmwareFromROM(), DumpGcdMemoryMap(), DumpGDT(), DumpIDT(), DumpImageToDisk(), DumpMemoryMap(), DumpMemoryToFile(), DumpPEFile(), DumpTEFile(), EfiScannerEntryPoint(), EfiScannerInitialize(), GetAllEvents(), GetAllHandles(), GetAllHandlesWithDescription(), GetgEventSignalQueueMacMini(), GetLoadedImageProtocol(), GetMemoryEntryGcdInformation(), GetMemoryMapList(), GetPEHeaders(), GetStringFromHandle(), GetStringFromHandle2(), IdtHookInterrupt(), InstallEFITableScanner(), InstallEventScanner(), InstallSniffImage(), IsEventSignalQueueAddrResolved(), MemAllocate(), ParseConfiguration(), PickBestTextMode(), ProcessCommand(), ReadConfiguration(), ScanMemoryForExecutables(), ScreenGetResolution(), ScreenInit(), ScreenShowSplashLogo(), UnInstallEFITableScanner(), UnInstallEventScanner(), and UnInstallSniffImage().

| VOID LogFullUnicode | ( | CHAR16 * | FormatString, |
| ... | |||
| ) |
Depending on the policy function writes the provided text data to screen, log file or serial port. (unicode version)
| FormatString | Format string (printf style) |
| ... | Additional arguments |
| NONE |
Definition at line 108 of file Logs.c.
References ASMEnterLock(), ASMLeaveLock(), gLogLock, PRINT_FUNC, and WriteLogFile16().

| BOOLEAN MainLoop | ( | VOID | ) |
Definition at line 336 of file Menu.c.
References ConOut, DrawBoxAndMenu(), OPTION_FORCE_EXIT, OPTION_STAY_RESIDENT, and ScreenShowSplashLogo().
Referenced by EfiScannerEntryPoint().


| VOID* MemAllocate | ( | UINTN | Size | ) |
Function allocates memory and fills it with zeros.
| Size | Requested size |
| Pointer | On success function returns pointer to the newly allocated memory |
| NULL | On error |
Definition at line 25 of file Memory.c.
References EFI_STATUS(), and LogFullAscii().
Referenced by AddImageToList(), DumpMemoryToFile(), GetAllEvents(), GetAllHandles(), GetAllHandlesWithDescription(), GetAllImagesWithDescription(), GetMemoryMapList(), ImageAllocateStruct(), and ReadConfiguration().


| VOID MemCopy | ( | VOID * | Dest, |
| VOID * | Src, | ||
| UINTN | Size | ||
| ) |
Function copies source memory to destination memory.
| Dest | Pointer to destination memory |
| Src | Pointer to source memory |
| Size | Size of data to copy |
| NONE |
Definition at line 77 of file Memory.c.
Referenced by AddImageToList(), DumpMemoryToFile(), GetAllEvents(), GetArguments(), MemRead(), and ParseConfiguration().

| VOID MemFree | ( | VOID * | Mem | ) |
Function frees allocated memory.
| Mem | Pointer to the allocated memory |
| NONE |
Definition at line 58 of file Memory.c.
Referenced by AddImageToList(), DumpMemoryToFile(), FreeEvents(), FreeHandles(), FreeImages(), FreeMemMap(), GetAllEvents(), GetAllHandles(), GetAllHandlesWithDescription(), GetAllImagesWithDescription(), GetImagePathAndName(), GetMemoryMapList(), ImageAllocateStruct(), ImageFree(), and ReadConfiguration().

| EFI_STATUS MemRead | ( | VOID * | Dest, |
| VOID * | Src, | ||
| UINTN | Size | ||
| ) |
Function reads selected portion (Size) of memory (Src) to Dest. In current states it uses CopyMem from BootServices but it can be freely changed to other "memcpy" implementation. Due to EFI memory characteristics you can probe all available memory without a page fault (at least in theory).
| Dest | Pointer to destination memory |
| Src | Pointer to source memory |
| Size | Size of data to copy |
| EFI_SUCCESS |
Definition at line 117 of file Memory.c.
References MemCopy().
Referenced by ScanMemoryForExecutables().


| VOID MemZero | ( | VOID * | Mem, |
| UINTN | Size | ||
| ) |
Function zeros memory.
| Mem | Pointer to destination memory |
| Size | Size of data to nullify |
| NONE |
Definition at line 94 of file Memory.c.
Referenced by ComConsoleStart(), InstallEventScanner(), and ProcessCommand().

| EFI_STATUS OpenFile | ( | IN CHAR16 * | FilePathName, |
| IN UINT64 | OpenMode, | ||
| OUT EFI_FILE_PROTOCOL ** | File | ||
| ) |
Referenced by DumpMemoryToFile(), InitializeLogFile(), and ReadConfiguration().

| EFI_STATUS ReadConfiguration | ( | CHAR16 * | ConfPath | ) |
Function reads the configuration file. Currently the configuration file is only used for the bad addr filtering (not needed by vmware).
| ConfPath | Path to the configuration path (unicode) |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 102 of file Conf.c.
References EFI_STATUS(), LogFileAscii(), LogFullAscii(), MAX_CONF_DATA, MemAllocate(), MemFree(), OpenFile(), and ParseConfiguration().
Referenced by EfiScannerEntryPoint().


| EFI_STATUS RedirectConsole | ( | VOID | ) |
| EFI_STATUS ResetConsole | ( | VOID | ) |
| EFI_STATUS ScanMemoryForExecutables | ( | VOID | ) |
Function scans memory for Portable Executable files and dumps them to file. It can cause machine freeze on custom mobos.
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 121 of file DumpMem.c.
References DumpPEFile(), DumpTEFile(), EFI_STATUS(), FindImageByAddr(), FreeImages(), GetAllImagesWithDescription(), IsBadAddress(), LogFullAscii(), MEM_END_PROBE, MEM_START_PROBE, MemRead(), and TE_SIGNATURE.
Referenced by DrawBoxAndMenu(), and TestDumpHandles().


| EFI_STATUS ScreenShowSplashLogo | ( | VOID | ) |
Function shows the main logo on the screen (for 5 seconds) and then switches back to console mode.
Definition at line 295 of file Screen.c.
References _GIMAGE::Data, EFI_STATUS(), _GIMAGE::Height, ImageLoadBMPFromMem(), LogFullAscii(), logo, ScreenClearToColor(), ScreenDrawImage(), ScreenEnableGraphicsMode(), ScreenHeightProbed, ScreenInit(), ScreenWidthProbed, TICKS_PER_MS, and _GIMAGE::Width.
Referenced by MainLoop(), and TestDumpHandles().


| EFI_STATUS ScreenTest | ( | VOID | ) |
| VOID test_write | ( | VOID | ) |
| VOID TestDumpHandles | ( | VOID | ) |
Definition at line 1097 of file Images.c.
References CheckImagesFunctionPointers(), ContextX64Test(), DumpAllEvents(), DumpAllHandles(), DumpAllImages(), DumpGDT(), DumpIDT(), FreeHandles(), FreeImages(), GetAllEvents(), GetAllHandlesWithDescription(), GetAllImagesWithDescription(), InstallEventScanner(), InstallSniffImage(), MyModImageNotify(), MyNewEventCallback(), MyNewImageNotify(), PRINT_FUNC, ScanMemoryForExecutables(), and ScreenShowSplashLogo().

| EFI_STATUS UnInstallEFITableScanner | ( | VOID | ) |
function uninstalls the scanner event
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 471 of file TableMonitor.c.
References gScannerEvent, and LogFullAscii().

| EFI_STATUS UnInstallEventScanner | ( | VOID | ) |
Function uninstalls EFI timer which checks the events for changes
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 188 of file EventsScanner.c.
References FreeEvents(), gEventScannerEvent, and LogFullAscii().

| EFI_STATUS UnInstallSniffImage | ( | VOID | ) |
Function uninstalls the image sniffer.
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 305 of file SniffImage.c.
References FreeImages(), gOrg_LoadImage, gSetExitBootServicesEvent, and LogFullAscii().

| EFI_STATUS WriteLogFile | ( | CHAR8 * | Data | ) |
Function writes ascii null-terminated string to the log file.
| Data | Ascii string to write. |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 256 of file FileSystemWrap.c.
References gEfiScannerPolicy, gLogFile, and _policy::OpUseLog.
Referenced by LogFileAscii(), and LogFullAscii().

| EFI_STATUS WriteLogFile16 | ( | CHAR16 * | Data | ) |
Function writes unicode string to the log file.
| Data | Unicode string to write. |
| EFI_SUCCESS | On success |
| EFI_ERROR* | On error |
Definition at line 225 of file FileSystemWrap.c.
References gEfiScannerPolicy, gLogFile, and _policy::OpUseLog.
Referenced by LogFullUnicode().

| policy gEfiScannerPolicy |
Definition at line 18 of file EfiScannerLib.c.
Referenced by CloseLogFile(), InitializeLogFile(), IsBadAddress(), LogFileAscii(), LogFullAscii(), ParseConfiguration(), WriteLogFile(), and WriteLogFile16().
| C_PTR gEventSignalQueueAddr |
Definition at line 21 of file Events.c.
Referenced by BruteFind_gEventSignalQueueAddr(), BruteFind_gEventSignalQueueAddr2(), GetAllEvents(), GetgEventSignalQueueMacMini(), IsEventSignalQueueAddrResolved(), and NotifyEventScannerTimer().