31 { 0, 0,
"GetWakeupTime"},
32 { 0, 0,
"SetWakeupTime"},
33 { 0, 0,
"SetVirtualAddressMap"},
34 { 0, 0,
"ConvertPointer"},
35 { 0, 0,
"GetVariable"},
36 { 0, 0,
"GetNextVariableName"},
37 { 0, 0,
"SetVariable"},
38 { 0, 0,
"GetNextHighMonotonicCount"},
39 { 0, 0,
"ResetSystem"},
40 { 0, 0,
"UpdateCapsule"},
41 { 0, 0,
"QueryCapsuleCapabilities"},
42 { 0, 0,
"QueryVariableInfo"},
46 { 0, 0,
"RestoreTPL"},
47 { 0, 0,
"AllocatePages"},
49 { 0, 0,
"GetMemoryMap"},
50 { 0, 0,
"AllocatePool"},
52 { 0, 0,
"CreateEvent"},
54 { 0, 0,
"WaitForEvent"},
55 { 0, 0,
"SignalEvent"},
56 { 0, 0,
"CloseEvent"},
57 { 0, 0,
"CheckEvent"},
58 { 0, 0,
"InstallProtocolInterface"},
59 { 0, 0,
"ReinstallProtocolInterface"},
60 { 0, 0,
"UninstallProtocolInterface"},
61 { 0, 0,
"HandleProtocol"},
62 { 0, 0,
"RegisterProtocolNotify"},
63 { 0, 0,
"LocateHandle"},
64 { 0, 0,
"LocateDevicePath"},
65 { 0, 0,
"InstallConfigurationTable"},
67 { 0, 0,
"StartImage"},
69 { 0, 0,
"UnloadImage"},
70 { 0, 0,
"ExitBootServices"},
71 { 0, 0,
"GetNextMonotonicCount"},
73 { 0, 0,
"SetWatchdogTimer"},
74 { 0, 0,
"ConnectController"},
75 { 0, 0,
"DisconnectController"},
76 { 0, 0,
"OpenProtocol"},
77 { 0, 0,
"CloseProtocol"},
78 { 0, 0,
"OpenProtocolInformation"},
79 { 0, 0,
"ProtocolsPerHandle"},
80 { 0, 0,
"LocateHandleBuffer"},
81 { 0, 0,
"LocateProtocol"},
82 { 0, 0,
"InstallMultipleProtocolInterfaces"},
83 { 0, 0,
"UninstallMultipleProtocolInterfaces"},
84 { 0, 0,
"CalculateCrc32"},
87 { 0, 0,
"CreateEventEx"},
105 #define write_entry(index, api) { gEFITables[index].ptr_va = (UINT64)&api; gEFITables[index].last_addr = (UINT64)api; }
162 write_entry(51, gBS->InstallMultipleProtocolInterfaces);
163 write_entry(52, gBS->UninstallMultipleProtocolInterfaces);
187 if ((p[0] == 0xE9) || (p[0] == 0xE8))
232 LogFullAscii(
"%a: Error executing GetAllImagesWithDescription failed\r\n", __FUNCTION__);
233 return EFI_NOT_FOUND;
238 for (i = 0; gEFITables[i].
name[0] !=
'?'; i++)
244 TempAddr = *(
C_PTR*)gEFITables[i].ptr_va;
245 p = (CHAR8*)&gEFITables[i].name;
257 if (TempAddr != gEFITables[i].last_addr)
261 LogFileAscii(
"[%04d] Modification detected OldAddr=%016lx NewAddr=%016lx Function Name: %a\r\n",
263 (
MAX_PTR)gEFITables[i].last_addr,
270 PRINT_FUNC_ASCII(
"[%04d] Modification detected OldAddr=%016lx NewAddr=%016lx Function Name: %a\r\n",
272 (
MAX_PTR)gEFITables[i].last_addr,
288 if ((
ULONG32)(gEFITables[i].last_addr >> 32))
289 LogFullAscii(
"Addr: %016lx is probably invalid!\r\n", gEFITables[i].last_addr);
296 LogFullAscii(
"[%04d] Addr: %016lx M: %d InImage: %016lx-%016lx Function Name: %a \r\n",
301 MAX_PTR)(ImageBase + ImageSize),
310 HookDest = (
ULONG32)(*(INT32*)(gEFITables[i].
last_addr + 1) + gEFITables[i].last_addr + 5);
315 if (!HookDestImageEntry)
316 LogFullAscii(
"Function %016lx is hooked to %016lx (not in image)\r\n",
317 (
MAX_PTR)gEFITables[i].last_addr,
319 else if (HookDestImageEntry != ImageEntry)
320 LogFullAscii(
"Function %016lx is hooked to %016lx (image base=%016lx)\r\n",
321 (
MAX_PTR)gEFITables[i].last_addr,
326 else if (change == 1)
330 LogFileAscii(
"[%04d] Addr: %016lx M: %d InImage: %016lx-%016lx Function Name: %a \r\n",
335 (
MAX_PTR)(ImageBase + ImageSize),
349 LogFullAscii(
": Dumping EFI Functions tables done.\r\n");
371 for (i = 0; gEFITables[i].
name[0] !=
'?'; i++)
373 TempAddr = *(
C_PTR*)gEFITables[i].ptr_va;
374 if (TempAddr != gEFITables[i].last_addr)
405 for (i = 0; gEFITables[i].
name[0] !=
'?'; i++)
407 if (strcmp(gEFITables[i].name, FuncName) == 0)
432 Status = gBS->CreateEvent(EVT_NOTIFY_SIGNAL | EVT_TIMER,
437 if (EFI_ERROR(Status))
439 LogFullAscii(
"%a: Unable to install the table scanner, status = %08x\r\n",
440 __FUNCTION__, Status);
450 if (EFI_ERROR(Status))
454 LogFullAscii(
"%a: Unable to install the timer for table scanner, status = %08x\r\n",
455 __FUNCTION__, Status);
473 LogFullAscii(
": UnInstalling the EFI table scanner\r\n");