|
RDFU
1.0
|
Image sniffer. More...
#include "EfiScannerHeaders.h"
Go to the source code of this file.
Functions | |
| VOID EFIAPI | NotifyExitBootServices (EFI_EVENT Event, VOID *Context) |
| EFI_STATUS | hooked_ExitBootServices (IN EFI_HANDLE ImageHandle, IN UINTN MapKey) |
| EFI_STATUS | hooked_LoadImage (IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle) |
| EFI_STATUS | InstallSniffImage (CALLBACK_IMAGESNIFFER_NEW UserNewImageCallback, CALLBACK_IMAGESNIFFER_MOD UserModImageCallback) |
| EFI_STATUS | UnInstallSniffImage (VOID) |
Variables | |
| EFI_IMAGE_LOAD | gOrg_LoadImage = 0 |
| EFI_EXIT_BOOT_SERVICES | gOrg_ExitBootServices = 0 |
| EFI_EVENT | gSetExitBootServicesEvent = 0 |
| image_entry_list * | gImageList = 0 |
| CALLBACK_IMAGESNIFFER_NEW | gUserImageSnifferNewImageCallback = 0 |
| CALLBACK_IMAGESNIFFER_MOD | gUserImageSnifferModImageCallback = 0 |
Image sniffer.
Definition in file SniffImage.c.
| EFI_STATUS hooked_ExitBootServices | ( | IN EFI_HANDLE | ImageHandle, |
| IN UINTN | MapKey | ||
| ) |
reserved for future: may be it would be also good to put the upper procedure in ExitBootServices direct hook it is important to note that ExitBootServices may be called multiple times (unlike the event itself).
Definition at line 128 of file SniffImage.c.
References EFI_STATUS(), and gOrg_ExitBootServices.

| EFI_STATUS hooked_LoadImage | ( | IN BOOLEAN | BootPolicy, |
| IN EFI_HANDLE | ParentImageHandle, | ||
| IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, | ||
| IN VOID *SourceBuffer | OPTIONAL, | ||
| IN UINTN | SourceSize, | ||
| OUT EFI_HANDLE * | ImageHandle | ||
| ) |
original LoadImage function is redirected here. Function writes to the log if any image is being loaded. It also dumps it to the "sdump" directory.
Function also executes the user mode callback if there is any.
Definition at line 151 of file SniffImage.c.
References AddImageToList(), DumpMemoryToFile(), EFI_STATUS(), GetLoadedImageProtocol(), gOrg_LoadImage, gUserImageSnifferNewImageCallback, and LogFileAscii().
Referenced by InstallSniffImage().


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


| VOID EFIAPI NotifyExitBootServices | ( | EFI_EVENT | Event, |
| VOID * | Context | ||
| ) |
This function is executed when the ExitBootServices function is executed correctly by the system loader or other EFI application.
Function enumarates all loaded images and checks whether their checksum was changed. It also executes user callback if there is any.
Definition at line 51 of file SniffImage.c.
References _image_entry::Crc32, _image_entry::FilePath, FindImageByHandle(), FreeImages(), GetAllImagesWithDescription(), gUserImageSnifferModImageCallback, _image_entry::Handle, _image_entry::ImageBase, _image_entry_list::ImageEntry, _image_entry::ImageSize, LogFileAscii(), _image_entry::Name, and _image_entry_list::NumOfEntries.
Referenced by InstallSniffImage().


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

| image_entry_list* gImageList = 0 |
Definition at line 29 of file SniffImage.c.
| EFI_EXIT_BOOT_SERVICES gOrg_ExitBootServices = 0 |
Definition at line 25 of file SniffImage.c.
Referenced by hooked_ExitBootServices(), and InstallSniffImage().
| EFI_IMAGE_LOAD gOrg_LoadImage = 0 |
original EFI functions
Definition at line 24 of file SniffImage.c.
Referenced by hooked_LoadImage(), InstallSniffImage(), and UnInstallSniffImage().
| EFI_EVENT gSetExitBootServicesEvent = 0 |
Definition at line 28 of file SniffImage.c.
Referenced by InstallSniffImage(), and UnInstallSniffImage().
| CALLBACK_IMAGESNIFFER_MOD gUserImageSnifferModImageCallback = 0 |
Definition at line 36 of file SniffImage.c.
Referenced by InstallSniffImage(), and NotifyExitBootServices().
| CALLBACK_IMAGESNIFFER_NEW gUserImageSnifferNewImageCallback = 0 |
user callbacks (optional)
Definition at line 35 of file SniffImage.c.
Referenced by hooked_LoadImage(), and InstallSniffImage().