Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static EFI_SYSTEM_TABLE ST; /*0x10009cb8 */
- static EFI_RUNTIME_SERIVCES RTS; /*0x10009cc8 */
- static EFI_BOOT_SERVICES BS; /*0x10009cc0 */
- static uint64_t global1 = 0xb60; /*0x10000ba0 */
- static uint64_t global2 = 0xa82e620d; /*0x10000d10 */
- static uint64_t global3 = 0; /*0x10009ce8 */
- typedef struct
- {
- uint64_t num;
- uint64_t b;
- uint64_t v[0]; /*num of these */
- } THING;
- EFI_GUID guid_d2b2b828 = { 0xd2b2b828, 0x0826, 0x48a7, 0xb3, 0xdf, 0x98, 0x3c, 0x00, 0x60, 0x24, 0xf0 }; /* 0x10009b68 */
- struct _proto_d2b2b828
- {
- EFI_STATUS (*fn0) (uint32_t, uint32_t, uint32_t, uint32_t);
- } PROTO_d2b2b828;
- static PROTO_d2b2b828 *iface_d2b2b828; /*0x10009cd0 */
- static EFI_GUID guid_ea816d2c = { 0xea816d2c, 0xcee5, 0x4f02, 0x99, 0xb5, 0xd3, 0x90, 0x5c, 0xbb, 0xd0, 0x77 }; /*0x10009b58 */
- typedef struct _proto_ea816d2c
- {
- void (*fn0) (struct _proto_ea816d2c *, THING *, void *);
- } PROTO_ea816d2c;
- static PROTO_ea816d2c *iface_ea816d2c; /*0x10009cf0 */
- static EFI_GUID guid_cec2f4f9 = { 0xcec2f4f9, 0xc82d, 0x49ea, 0x81, 0xca, 0xe6, 0xbc, 0x87, 0x57, 0xde, 0x4c }; /*0x10009c20 */
- typedef struct _proto_cec2f4f9
- {
- uint8_t (*fn0) (uint64_t, uint64_t);
- } PROTO_cec2f4f9;
- static PROTO_cec2f4f9 iface_cec2f4f9; /*0x10009ce0 */
- static EFI_STATUS
- save_pointers (EFI_SYSTEM_TABLE * table) /*0x1000067b */
- {
- ST = table;
- RTS = table->RunTimeServices;
- BS = table->BootServices;
- retrun EFI_SUCCESS;
- }
- static EFI_STATUS
- call_d2b2b828 (uint32_t arg0, uint32_T arg1, uint32_t arg2, uint32_t arg3) /*0x1000069a */
- {
- if (!iface_d2b2b828)
- {
- if ((BS->LocateProtocol (&guid_d2b2b828, 0, &iface_d2b2b828) !=
- EFI_SUCCESS) || !iface_d2b2b828)
- return EFI_UNSUPPORTED;
- }
- return iface_d2b2b828->fn0 (arg0, arg1, arg2, arg3);
- }
- void *
- allocate (uint64_t size) /*0x1000079c */
- {
- void *ret;
- BS->AllocatePool (EfiBootServicesData, size, &ret);
- return ret;
- }
- static void *
- allocate_zeroed (uint64_t size) /*0x100007cc */
- {
- void *ret = allocate (size);
- if (ret)
- BS->SetMem (ret, size, 0);
- return ret;
- }
- static void
- allocate_and_populate (uint64_t n, void *b, ...) /*0x10000a18 */
- {
- THING *ret;
- void **ptr;
- va_list ap;
- va_start (ap, v);
- ret = allocate_zeroed (n * sizeof (void *) + sizeof (THING));
- ret->n = n;
- ret->b = b;
- ptr = ret->v;
- /* It's this loop your patch disables, leaving the rest of the structure unpopulated */
- while (n--)
- *(ptr++) = va_arg (ap, void *);
- va_end (ap);
- return ret;
- }
- static uint8_t
- fn0 (uint64_t a0, uint64_t a1) /*0x100005f4 */
- {
- return ...;
- }
- EFI_STATUS entry_point (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE * table) /*entry 0x1000066c */
- {
- EFI_HANDLE handle;
- THING *thing;
- save_pointers (table);
- call_d2b2b828 (1, 0x80008020, 0, 0);
- (void) malloc_zeroed (0x64);
- BS->LocateProtocol (&guid_ea816d2c, 0, &iface_ea816d2c);
- thing = allocate_and_populate (1, &global1, &global2);
- iface_ea816d2c (iface_ea816d2c, thing, &global3);
- BS->FreePool (thing);
- iface_cec2f4f9.fn0 = fn0;
- BS->InstallProtocolInterface (&handle, &guid_cec2f4f9, EFI_NATIVE_INTERFACE,
- &iface_cec2f4f9);
- return EFI_SUCCESS;
- }
Add Comment
Please, Sign In to add comment