From 303baae9115b579f5be92760c1683f90530b492d Mon Sep 17 00:00:00 2001 From: nifanfa Date: Wed, 1 Feb 2023 01:35:08 +0800 Subject: [PATCH] Update efi.cs --- ConsoleApp1/efi.cs | 241 --------------------------------------------- uefi-cs/efi.cs | 146 ++++++++++++++++++++++++--- 2 files changed, 135 insertions(+), 252 deletions(-) delete mode 100644 ConsoleApp1/efi.cs diff --git a/ConsoleApp1/efi.cs b/ConsoleApp1/efi.cs deleted file mode 100644 index 254cf3b..0000000 --- a/ConsoleApp1/efi.cs +++ /dev/null @@ -1,241 +0,0 @@ -using Internal.Runtime.CompilerHelpers; -using System; -using System.Runtime; - -public unsafe partial class efi -{ - static IntPtr _ST; - static IntPtr _BS; - static IntPtr _RT; - - public static EFI_SYSTEM_TABLE* gST => (EFI_SYSTEM_TABLE*)_ST; - public static EFI_BOOT_SERVICES* gBS => (EFI_BOOT_SERVICES*)_BS; - public static EFI_RUNTIME_SERVICES* gRT => (EFI_RUNTIME_SERVICES*)_RT; - - public static EFI_HANDLE gImageHandle; - - public static void InitializeLib(EFI_HANDLE imageHandle, EFI_SYSTEM_TABLE* systemTable) - { - efi._ST = (IntPtr)systemTable; - efi._BS = (IntPtr)systemTable->BootServices; - efi._RT = (IntPtr)systemTable->RuntimeServices; - efi.gImageHandle = imageHandle; - - InitializeGuid(); - - //C# startup - EFI_LOADED_IMAGE_PROTOCOL* loadedimage = null; - gBS->HandleProtocol(gImageHandle, (EFI_GUID*)EFI_LOADED_IMAGE_PROTOCOL_GUID, (void**)&loadedimage); - long ImageBase = (long)loadedimage->ImageBase; - DOSHeader* doshdr = (DOSHeader*)ImageBase; - NtHeaders64* nthdr = (NtHeaders64*)(ImageBase + doshdr->e_lfanew); - SectionHeader* sections = ((SectionHeader*)(ImageBase + doshdr->e_lfanew + sizeof(NtHeaders64))); - IntPtr moduleSec = IntPtr.Zero; - for (int i = 0; i < nthdr->FileHeader.NumberOfSections; i++) - { - if (*(ulong*)sections[i].Name == 0x73656C75646F6D2E) moduleSec = (IntPtr)(ImageBase + sections[i].VirtualAddress); - } - StartupCodeHelpers.InitializeModules(moduleSec); - } - - public static EFI_GUID EFI_GLOBAL_VARIABLE; - public static EFI_GUID MPS_TABLE_GUID; - public static EFI_GUID ACPI_TABLE_GUID; - public static EFI_GUID ACPI_20_TABLE_GUID; - public static EFI_GUID SMBIOS_TABLE_GUID; - public static EFI_GUID SMBIOS3_TABLE_GUID; - public static EFI_GUID SAL_SYSTEM_TABLE_GUID; - public static EFI_GUID EFI_DTB_TABLE_GUID; - public static EFI_GUID EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID; - public static EFI_GUID EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID; - public static EFI_GUID EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID; - public static EFI_GUID EFI_DEBUG_IMAGE_INFO_TABLE_GUID; - public static EFI_GUID EFI_DEBUG_SUPPORT_PROTOCOL_GUID; - public static EFI_GUID UNKNOWN_DEVICE_GUID; - public static EFI_GUID EFI_PC_ANSI_GUID; - public static EFI_GUID EFI_VT_100_GUID; - public static EFI_GUID EFI_VT_100_PLUS_GUID; - public static EFI_GUID EFI_VT_UTF8_GUID; - public static EFI_GUID EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; - public static EFI_GUID EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; - public static EFI_GUID EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID; - public static EFI_GUID EFI_PART_TYPE_UNUSED_GUID; - public static EFI_GUID EFI_PART_TYPE_EFI_SYSTEM_PART_GUID; - public static EFI_GUID EFI_PART_TYPE_LEGACY_MBR_GUID; - public static EFI_GUID EFI_IP4_SERVICE_BINDING_PROTOCOL; - public static EFI_GUID EFI_IP4_PROTOCOL; - public static EFI_GUID EFI_IP6_SERVICE_BINDING_PROTOCOL; - public static EFI_GUID EFI_IP6_PROTOCOL; - public static EFI_GUID EFI_SIMPLE_NETWORK_PROTOCOL_GUID; - public static EFI_GUID EFI_PCI_IO_PROTOCOL_GUID; - public static EFI_GUID EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID; - public static EFI_GUID EFI_SIMPLE_POINTER_PROTOCOL_GUID; - public static EFI_GUID EFI_ABSOLUTE_POINTER_PROTOCOL_GUID; - public static EFI_GUID EFI_FPSWA_PROTOCOL_GUID; - public static EFI_GUID EFI_DEVICE_PATH_PROTOCOL_GUID; - public static EFI_GUID EFI_BLOCK_IO_PROTOCOL_GUID; - public static EFI_GUID EFI_BLOCK_IO2_PROTOCOL_GUID; - public static EFI_GUID EFI_DISK_IO_PROTOCOL_GUID; - public static EFI_GUID EFI_DISK_IO2_PROTOCOL_GUID; - public static EFI_GUID EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID; - public static EFI_GUID EFI_FILE_INFO_ID; - public static EFI_GUID EFI_FILE_SYSTEM_INFO_ID; - public static EFI_GUID EFI_FILE_SYSTEM_VOLUME_LABEL_ID; - public static EFI_GUID EFI_LOAD_FILE_PROTOCOL_GUID; - public static EFI_GUID EFI_DEVICE_IO_PROTOCOL_GUID; - public static EFI_GUID EFI_UNICODE_COLLATION_PROTOCOL_GUID; - public static EFI_GUID EFI_HASH_PROTOCOL_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_SHA1_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_SHA224_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_SHA256_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_SHA384_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_SHA512_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_MD5_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID; - public static EFI_GUID EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID; - public static EFI_GUID EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; - public static EFI_GUID EFI_EDID_DISCOVERED_PROTOCOL_GUID; - public static EFI_GUID EFI_EDID_ACTIVE_PROTOCOL_GUID; - public static EFI_GUID EFI_EDID_OVERRIDE_PROTOCOL_GUID; - public static EFI_GUID EFI_DRIVER_BINDING_PROTOCOL_GUID; - public static EFI_GUID EFI_COMPONENT_NAME_PROTOCOL_GUID; - public static EFI_GUID EFI_COMPONENT_NAME2_PROTOCOL_GUID; - public static EFI_GUID EFI_LOADED_IMAGE_PROTOCOL_GUID; - public static EFI_GUID EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; - public static EFI_GUID EFI_RNG_PROTOCOL_GUID; - public static EFI_GUID EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID; - public static EFI_GUID EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID; - public static EFI_GUID EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID; - public static EFI_GUID EFI_RNG_ALGORITHM_X9_31_3DES_GUID; - public static EFI_GUID EFI_RNG_ALGORITHM_X9_31_AES_GUID; - public static EFI_GUID EFI_RNG_ALGORITHM_RAW; - public static EFI_GUID EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID; - public static EFI_GUID EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID; - public static EFI_GUID EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID; - public static EFI_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID; - public static EFI_GUID EFI_PXE_BASE_CODE_PROTOCOL_GUID; - public static EFI_GUID EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID; - public static EFI_GUID EFI_SERIAL_IO_PROTOCOL_GUID; - public static EFI_GUID EFI_SHELL_PROTOCOL_GUID; - public static EFI_GUID EFI_SHELL_PARAMETERS_PROTOCOL_GUID; - public static EFI_GUID EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID; - public static EFI_GUID EFI_TCP4_SERVICE_BINDING_PROTOCOL; - public static EFI_GUID EFI_TCP4_PROTOCOL; - public static EFI_GUID EFI_TCP6_SERVICE_BINDING_PROTOCOL; - public static EFI_GUID EFI_TCP6_PROTOCOL; - public static EFI_GUID EFI_UDP4_SERVICE_BINDING_PROTOCOL; - public static EFI_GUID EFI_UDP4_PROTOCOL; - public static EFI_GUID EFI_UDP6_SERVICE_BINDING_PROTOCOL; - public static EFI_GUID EFI_UDP6_PROTOCOL; - public static EFI_GUID EFI_UI_INTERFACE_PROTOCOL_GUID; - public static EFI_GUID EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID; - public static EFI_GUID SHELL_INTERFACE_PROTOCOL_GUID; - - public static void InitializeGuid() - { - EFI_GLOBAL_VARIABLE = new EFI_GUID(0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C); - MPS_TABLE_GUID = new EFI_GUID(0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - ACPI_TABLE_GUID = new EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - ACPI_20_TABLE_GUID = new EFI_GUID(0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81); - SMBIOS_TABLE_GUID = new EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - SMBIOS3_TABLE_GUID = new EFI_GUID(0xf2fd1544, 0x9794, 0x4a2c, 0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94); - SAL_SYSTEM_TABLE_GUID = new EFI_GUID(0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_DTB_TABLE_GUID = new EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0); - EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID = new EFI_GUID(0x387477c2, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID = new EFI_GUID(0x387477c1, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID = new EFI_GUID(0xdd9e7534, 0x7762, 0x4698, 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa); - EFI_DEBUG_IMAGE_INFO_TABLE_GUID = new EFI_GUID(0x49152e77, 0x1ada, 0x4764, 0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b); - EFI_DEBUG_SUPPORT_PROTOCOL_GUID = new EFI_GUID(0x2755590c, 0x6f3c, 0x42fa, 0x9e, 0xa4, 0xa3, 0xba, 0x54, 0x3c, 0xda, 0x25); - UNKNOWN_DEVICE_GUID = new EFI_GUID(0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b); - EFI_PC_ANSI_GUID = new EFI_GUID(0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_VT_100_GUID = new EFI_GUID(0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_VT_100_PLUS_GUID = new EFI_GUID(0x7baec70b, 0x57e0, 0x4c76, 0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43); - EFI_VT_UTF8_GUID = new EFI_GUID(0xad15a0d6, 0x8bec, 0x4acf, 0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88); - EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID = new EFI_GUID(0x8b843e20, 0x8132, 0x4852, 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c); - EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID = new EFI_GUID(0x5c99a21, 0xc70f, 0x4ad2, 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e); - EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID = new EFI_GUID(0x379be4e, 0xd706, 0x437d, 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4); - EFI_PART_TYPE_UNUSED_GUID = new EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); - EFI_PART_TYPE_EFI_SYSTEM_PART_GUID = new EFI_GUID(0xc12a7328, 0xf81f, 0x11d2, 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b); - EFI_PART_TYPE_LEGACY_MBR_GUID = new EFI_GUID(0x024dee41, 0x33e7, 0x11d3, 0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f); - EFI_IP4_SERVICE_BINDING_PROTOCOL = new EFI_GUID(0xc51711e7, 0xb4bf, 0x404a, 0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4); - EFI_IP4_PROTOCOL = new EFI_GUID(0x41d94cd2, 0x35b6, 0x455a, 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd); - EFI_IP6_SERVICE_BINDING_PROTOCOL = new EFI_GUID(0xec835dd3, 0xfe0f, 0x617b, 0xa6, 0x21, 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88); - EFI_IP6_PROTOCOL = new EFI_GUID(0x2c8759d5, 0x5c2d, 0x66ef, 0x92, 0x5f, 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2); - EFI_SIMPLE_NETWORK_PROTOCOL_GUID = new EFI_GUID(0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D); - EFI_PCI_IO_PROTOCOL_GUID = new EFI_GUID(0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a); - EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID = new EFI_GUID(0x2f707ebb, 0x4a1a, 0x11d4, 0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_SIMPLE_POINTER_PROTOCOL_GUID = new EFI_GUID(0x31878c87, 0xb75, 0x11d5, 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_ABSOLUTE_POINTER_PROTOCOL_GUID = new EFI_GUID(0x8D59D32B, 0xC655, 0x4AE9, 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43); - EFI_FPSWA_PROTOCOL_GUID = new EFI_GUID(0xc41b6531, 0x97b9, 0x11d3, 0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_DEVICE_PATH_PROTOCOL_GUID = new EFI_GUID(0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_BLOCK_IO_PROTOCOL_GUID = new EFI_GUID(0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_BLOCK_IO2_PROTOCOL_GUID = new EFI_GUID(0xa77b2472, 0xe282, 0x4e9f, 0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1); - EFI_DISK_IO_PROTOCOL_GUID = new EFI_GUID(0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_DISK_IO2_PROTOCOL_GUID = new EFI_GUID(0x151c8eae, 0x7f2c, 0x472c, 0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88); - EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID = new EFI_GUID(0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_FILE_INFO_ID = new EFI_GUID(0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_FILE_SYSTEM_INFO_ID = new EFI_GUID(0x9576e93, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_FILE_SYSTEM_VOLUME_LABEL_ID = new EFI_GUID(0xDB47D7D3, 0xFE81, 0x11d3, 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D); - EFI_LOAD_FILE_PROTOCOL_GUID = new EFI_GUID(0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B); - EFI_DEVICE_IO_PROTOCOL_GUID = new EFI_GUID(0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_UNICODE_COLLATION_PROTOCOL_GUID = new EFI_GUID(0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_HASH_PROTOCOL_GUID = new EFI_GUID(0xC5184932, 0xDBA5, 0x46DB, 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35); - EFI_HASH_ALGORITHM_SHA1_GUID = new EFI_GUID(0x2AE9D80F, 0x3FB2, 0x4095, 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6); - EFI_HASH_ALGORITHM_SHA224_GUID = new EFI_GUID(0x8DF01A06, 0x9BD5, 0x4BF7, 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B); - EFI_HASH_ALGORITHM_SHA256_GUID = new EFI_GUID(0x51AA59DE, 0xFDF2, 0x4EA3, 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9); - EFI_HASH_ALGORITHM_SHA384_GUID = new EFI_GUID(0xEFA96432, 0xDE33, 0x4DD2, 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A); - EFI_HASH_ALGORITHM_SHA512_GUID = new EFI_GUID(0xCAA4381E, 0x750C, 0x4770, 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30); - EFI_HASH_ALGORITHM_MD5_GUID = new EFI_GUID(0x0AF7C79C, 0x65B5, 0x4319, 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7); - EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID = new EFI_GUID(0x24C5DC2F, 0x53E2, 0x40CA, 0x9E, 0xD6, 0xA5, 0xD9, 0xA4, 0x9F, 0x46, 0x3B); - EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID = new EFI_GUID(0x8628752A, 0x6CB7, 0x4814, 0x96, 0xFC, 0x24, 0xA8, 0x15, 0xAC, 0x22, 0x26); - EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID = new EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a); - EFI_EDID_DISCOVERED_PROTOCOL_GUID = new EFI_GUID(0x1C0C34F6, 0xD380, 0x41FA, 0xA0, 0x49, 0x8a, 0xD0, 0x6C, 0x1A, 0x66, 0xAA); - EFI_EDID_ACTIVE_PROTOCOL_GUID = new EFI_GUID(0xBD8C1056, 0x9F36, 0x44EC, 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86); - EFI_EDID_OVERRIDE_PROTOCOL_GUID = new EFI_GUID(0x48ECB431, 0xFB72, 0x45C0, 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5); - EFI_DRIVER_BINDING_PROTOCOL_GUID = new EFI_GUID(0x18A031AB, 0xB443, 0x4D1A, 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71); - EFI_COMPONENT_NAME_PROTOCOL_GUID = new EFI_GUID(0x107A772C, 0xD5E1, 0x11D4, 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D); - EFI_COMPONENT_NAME2_PROTOCOL_GUID = new EFI_GUID(0x6A7A5CFF, 0xE8D9, 0x4F70, 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14); - EFI_LOADED_IMAGE_PROTOCOL_GUID = new EFI_GUID(0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B); - EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID = new EFI_GUID(0xbc62157e, 0x3e33, 0x4fec, 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf); - EFI_RNG_PROTOCOL_GUID = new EFI_GUID(0x3152bca5, 0xeade, 0x433d, 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44); - EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID = new EFI_GUID(0xa7af67cb, 0x603b, 0x4d42, 0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96); - EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID = new EFI_GUID(0xc5149b43, 0xae85, 0x4f53, 0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7); - EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID = new EFI_GUID(0x44f0de6e, 0x4d8c, 0x4045, 0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e); - EFI_RNG_ALGORITHM_X9_31_3DES_GUID = new EFI_GUID(0x63c4785a, 0xca34, 0x4012, 0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46); - EFI_RNG_ALGORITHM_X9_31_AES_GUID = new EFI_GUID(0xacd03321, 0x777e, 0x4d3d, 0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9); - EFI_RNG_ALGORITHM_RAW = new EFI_GUID(0xe43176d7, 0xb6e8, 0x4827, 0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61); - EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID = new EFI_GUID(0x6b30c738, 0xa391, 0x11d4, 0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID = new EFI_GUID(0x3bc1b285, 0x8a15, 0x4a82, 0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65); - EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID = new EFI_GUID(0xb1ee129e, 0xda36, 0x4181, 0x91, 0xf8, 0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7); - EFI_EBC_INTERPRETER_PROTOCOL_GUID = new EFI_GUID(0x13ac6dd1, 0x73d0, 0x11d4, 0xb0, 0x6b, 0x00, 0xaa, 0x00, 0xbd, 0x6d, 0xe7); - EFI_PXE_BASE_CODE_PROTOCOL_GUID = new EFI_GUID(0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); - EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID = new EFI_GUID(0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - EFI_SERIAL_IO_PROTOCOL_GUID = new EFI_GUID(0xBB25CF6F, 0xF1D4, 0x11D2, 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD); - EFI_SHELL_PROTOCOL_GUID = new EFI_GUID(0x6302d008, 0x7f9b, 0x4f30, 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e); - EFI_SHELL_PARAMETERS_PROTOCOL_GUID = new EFI_GUID(0x752f3136, 0x4e16, 0x4fdc, 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca); - EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID = new EFI_GUID(0x3c7200e9, 0x005f, 0x4ea4, 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3); - EFI_TCP4_SERVICE_BINDING_PROTOCOL = new EFI_GUID(0x00720665, 0x67eb, 0x4a99, 0xba, 0xf7, 0xd3, 0xc3, 0x3a, 0x1c, 0x7c, 0xc9); - EFI_TCP4_PROTOCOL = new EFI_GUID(0x65530bc7, 0xa359, 0x410f, 0xb0, 0x10, 0x5a, 0xad, 0xc7, 0xec, 0x2b, 0x62); - EFI_TCP6_SERVICE_BINDING_PROTOCOL = new EFI_GUID(0xec20eb79, 0x6c1a, 0x4664, 0x9a, 0xd, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64); - EFI_TCP6_PROTOCOL = new EFI_GUID(0x46e44855, 0xbd60, 0x4ab7, 0xab, 0xd, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77); - EFI_UDP4_SERVICE_BINDING_PROTOCOL = new EFI_GUID(0x83f01464, 0x99bd, 0x45e5, 0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6); - EFI_UDP4_PROTOCOL = new EFI_GUID(0x3ad9df29, 0x4501, 0x478d, 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3); - EFI_UDP6_SERVICE_BINDING_PROTOCOL = new EFI_GUID(0x66ed4721, 0x3c98, 0x4d3e, 0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54); - EFI_UDP6_PROTOCOL = new EFI_GUID(0x4f948815, 0xb4b9, 0x43cb, 0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55); - EFI_UI_INTERFACE_PROTOCOL_GUID = new EFI_GUID(0x32dd7981, 0x2d27, 0x11d4, 0xbc, 0x8b, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81); - EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID = new EFI_GUID(0xE18541CD, 0xF755, 0x4f73, 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29); - SHELL_INTERFACE_PROTOCOL_GUID = new EFI_GUID(0x47c7b223, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); - } - - [RuntimeExport("memset")] - public static unsafe void memset(byte* ptr, byte c, ulong count) - { - gBS->SetMem(ptr, count, c); - } - - [RuntimeExport("memcpy")] - public static unsafe void memcpy(byte* dst, byte* src, ulong count) - { - gBS->CopyMem(dst, src, count); - } -} \ No newline at end of file diff --git a/uefi-cs/efi.cs b/uefi-cs/efi.cs index 714dcb2..78ea506 100644 --- a/uefi-cs/efi.cs +++ b/uefi-cs/efi.cs @@ -1,19 +1,143 @@ -/*++ +using Internal.Runtime.CompilerHelpers; +using System; +using System.Runtime; -Copyright (c) 1998 Intel Corporation +public unsafe partial class efi +{ + static IntPtr _ST; + static IntPtr _BS; + static IntPtr _RT; -Module Name: + public static EFI_SYSTEM_TABLE* gST => (EFI_SYSTEM_TABLE*)_ST; + public static EFI_BOOT_SERVICES* gBS => (EFI_BOOT_SERVICES*)_BS; + public static EFI_RUNTIME_SERVICES* gRT => (EFI_RUNTIME_SERVICES*)_RT; - efi.h + public static EFI_HANDLE gImageHandle; -Abstract: + public static void InitializeLib(EFI_HANDLE imageHandle, EFI_SYSTEM_TABLE* systemTable) + { + efi._ST = (IntPtr)systemTable; + efi._BS = (IntPtr)systemTable->BootServices; + efi._RT = (IntPtr)systemTable->RuntimeServices; + efi.gImageHandle = imageHandle; - Public EFI header files + //C# startup + EFI_LOADED_IMAGE_PROTOCOL* loadedimage = null; + gBS->HandleProtocol(gImageHandle, (EFI_GUID*)EFI_LOADED_IMAGE_PROTOCOL_GUID, (void**)&loadedimage); + long ImageBase = (long)loadedimage->ImageBase; + DOSHeader* doshdr = (DOSHeader*)ImageBase; + NtHeaders64* nthdr = (NtHeaders64*)(ImageBase + doshdr->e_lfanew); + SectionHeader* sections = ((SectionHeader*)(ImageBase + doshdr->e_lfanew + sizeof(NtHeaders64))); + IntPtr moduleSec = IntPtr.Zero; + for (int i = 0; i < nthdr->FileHeader.NumberOfSections; i++) + { + if (*(ulong*)sections[i].Name == 0x73656C75646F6D2E) moduleSec = (IntPtr)(ImageBase + sections[i].VirtualAddress); + } + StartupCodeHelpers.InitializeModules(moduleSec); + } + public static EFI_GUID EFI_GLOBAL_VARIABLE => new EFI_GUID(0x8BE4DF61, 0x93CA, 0x11d2, 0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C); + public static EFI_GUID MPS_TABLE_GUID => new EFI_GUID(0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID ACPI_TABLE_GUID => new EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID ACPI_20_TABLE_GUID => new EFI_GUID(0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81); + public static EFI_GUID SMBIOS_TABLE_GUID => new EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID SMBIOS3_TABLE_GUID => new EFI_GUID(0xf2fd1544, 0x9794, 0x4a2c, 0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94); + public static EFI_GUID SAL_SYSTEM_TABLE_GUID => new EFI_GUID(0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_DTB_TABLE_GUID => new EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0); + public static EFI_GUID EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID => new EFI_GUID(0x387477c2, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID => new EFI_GUID(0x387477c1, 0x69c7, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID => new EFI_GUID(0xdd9e7534, 0x7762, 0x4698, 0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa); + public static EFI_GUID EFI_DEBUG_IMAGE_INFO_TABLE_GUID => new EFI_GUID(0x49152e77, 0x1ada, 0x4764, 0xb7, 0xa2, 0x7a, 0xfe, 0xfe, 0xd9, 0x5e, 0x8b); + public static EFI_GUID EFI_DEBUG_SUPPORT_PROTOCOL_GUID => new EFI_GUID(0x2755590c, 0x6f3c, 0x42fa, 0x9e, 0xa4, 0xa3, 0xba, 0x54, 0x3c, 0xda, 0x25); + public static EFI_GUID UNKNOWN_DEVICE_GUID => new EFI_GUID(0xcf31fac5, 0xc24e, 0x11d2, 0x85, 0xf3, 0x0, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b); + public static EFI_GUID EFI_PC_ANSI_GUID => new EFI_GUID(0xe0c14753, 0xf9be, 0x11d2, 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_VT_100_GUID => new EFI_GUID(0xdfa66065, 0xb419, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_VT_100_PLUS_GUID => new EFI_GUID(0x7baec70b, 0x57e0, 0x4c76, 0x8e, 0x87, 0x2f, 0x9e, 0x28, 0x08, 0x83, 0x43); + public static EFI_GUID EFI_VT_UTF8_GUID => new EFI_GUID(0xad15a0d6, 0x8bec, 0x4acf, 0xa0, 0x73, 0xd0, 0x1d, 0xe7, 0x7e, 0x2d, 0x88); + public static EFI_GUID EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID => new EFI_GUID(0x8b843e20, 0x8132, 0x4852, 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c); + public static EFI_GUID EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID => new EFI_GUID(0x5c99a21, 0xc70f, 0x4ad2, 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e); + public static EFI_GUID EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID => new EFI_GUID(0x379be4e, 0xd706, 0x437d, 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4); + public static EFI_GUID EFI_PART_TYPE_UNUSED_GUID => new EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + public static EFI_GUID EFI_PART_TYPE_EFI_SYSTEM_PART_GUID => new EFI_GUID(0xc12a7328, 0xf81f, 0x11d2, 0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b); + public static EFI_GUID EFI_PART_TYPE_LEGACY_MBR_GUID => new EFI_GUID(0x024dee41, 0x33e7, 0x11d3, 0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f); + public static EFI_GUID EFI_IP4_SERVICE_BINDING_PROTOCOL => new EFI_GUID(0xc51711e7, 0xb4bf, 0x404a, 0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4); + public static EFI_GUID EFI_IP4_PROTOCOL => new EFI_GUID(0x41d94cd2, 0x35b6, 0x455a, 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd); + public static EFI_GUID EFI_IP6_SERVICE_BINDING_PROTOCOL => new EFI_GUID(0xec835dd3, 0xfe0f, 0x617b, 0xa6, 0x21, 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88); + public static EFI_GUID EFI_IP6_PROTOCOL => new EFI_GUID(0x2c8759d5, 0x5c2d, 0x66ef, 0x92, 0x5f, 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2); + public static EFI_GUID EFI_SIMPLE_NETWORK_PROTOCOL_GUID => new EFI_GUID(0xA19832B9, 0xAC25, 0x11D3, 0x9A, 0x2D, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D); + public static EFI_GUID EFI_PCI_IO_PROTOCOL_GUID => new EFI_GUID(0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a); + public static EFI_GUID EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID => new EFI_GUID(0x2f707ebb, 0x4a1a, 0x11d4, 0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_SIMPLE_POINTER_PROTOCOL_GUID => new EFI_GUID(0x31878c87, 0xb75, 0x11d5, 0x9a, 0x4f, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_ABSOLUTE_POINTER_PROTOCOL_GUID => new EFI_GUID(0x8D59D32B, 0xC655, 0x4AE9, 0x9B, 0x15, 0xF2, 0x59, 0x04, 0x99, 0x2A, 0x43); + public static EFI_GUID EFI_FPSWA_PROTOCOL_GUID => new EFI_GUID(0xc41b6531, 0x97b9, 0x11d3, 0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_DEVICE_PATH_PROTOCOL_GUID => new EFI_GUID(0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_BLOCK_IO_PROTOCOL_GUID => new EFI_GUID(0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_BLOCK_IO2_PROTOCOL_GUID => new EFI_GUID(0xa77b2472, 0xe282, 0x4e9f, 0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1); + public static EFI_GUID EFI_DISK_IO_PROTOCOL_GUID => new EFI_GUID(0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_DISK_IO2_PROTOCOL_GUID => new EFI_GUID(0x151c8eae, 0x7f2c, 0x472c, 0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88); + public static EFI_GUID EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID => new EFI_GUID(0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_FILE_INFO_ID => new EFI_GUID(0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_FILE_SYSTEM_INFO_ID => new EFI_GUID(0x9576e93, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_FILE_SYSTEM_VOLUME_LABEL_ID => new EFI_GUID(0xDB47D7D3, 0xFE81, 0x11d3, 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D); + public static EFI_GUID EFI_LOAD_FILE_PROTOCOL_GUID => new EFI_GUID(0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B); + public static EFI_GUID EFI_DEVICE_IO_PROTOCOL_GUID => new EFI_GUID(0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_UNICODE_COLLATION_PROTOCOL_GUID => new EFI_GUID(0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_HASH_PROTOCOL_GUID => new EFI_GUID(0xC5184932, 0xDBA5, 0x46DB, 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35); + public static EFI_GUID EFI_HASH_ALGORITHM_SHA1_GUID => new EFI_GUID(0x2AE9D80F, 0x3FB2, 0x4095, 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6); + public static EFI_GUID EFI_HASH_ALGORITHM_SHA224_GUID => new EFI_GUID(0x8DF01A06, 0x9BD5, 0x4BF7, 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B); + public static EFI_GUID EFI_HASH_ALGORITHM_SHA256_GUID => new EFI_GUID(0x51AA59DE, 0xFDF2, 0x4EA3, 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9); + public static EFI_GUID EFI_HASH_ALGORITHM_SHA384_GUID => new EFI_GUID(0xEFA96432, 0xDE33, 0x4DD2, 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A); + public static EFI_GUID EFI_HASH_ALGORITHM_SHA512_GUID => new EFI_GUID(0xCAA4381E, 0x750C, 0x4770, 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30); + public static EFI_GUID EFI_HASH_ALGORITHM_MD5_GUID => new EFI_GUID(0x0AF7C79C, 0x65B5, 0x4319, 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7); + public static EFI_GUID EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID => new EFI_GUID(0x24C5DC2F, 0x53E2, 0x40CA, 0x9E, 0xD6, 0xA5, 0xD9, 0xA4, 0x9F, 0x46, 0x3B); + public static EFI_GUID EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID => new EFI_GUID(0x8628752A, 0x6CB7, 0x4814, 0x96, 0xFC, 0x24, 0xA8, 0x15, 0xAC, 0x22, 0x26); + public static EFI_GUID EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID => new EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a); + public static EFI_GUID EFI_EDID_DISCOVERED_PROTOCOL_GUID => new EFI_GUID(0x1C0C34F6, 0xD380, 0x41FA, 0xA0, 0x49, 0x8a, 0xD0, 0x6C, 0x1A, 0x66, 0xAA); + public static EFI_GUID EFI_EDID_ACTIVE_PROTOCOL_GUID => new EFI_GUID(0xBD8C1056, 0x9F36, 0x44EC, 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86); + public static EFI_GUID EFI_EDID_OVERRIDE_PROTOCOL_GUID => new EFI_GUID(0x48ECB431, 0xFB72, 0x45C0, 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5); + public static EFI_GUID EFI_DRIVER_BINDING_PROTOCOL_GUID => new EFI_GUID(0x18A031AB, 0xB443, 0x4D1A, 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71); + public static EFI_GUID EFI_COMPONENT_NAME_PROTOCOL_GUID => new EFI_GUID(0x107A772C, 0xD5E1, 0x11D4, 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D); + public static EFI_GUID EFI_COMPONENT_NAME2_PROTOCOL_GUID => new EFI_GUID(0x6A7A5CFF, 0xE8D9, 0x4F70, 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14); + public static EFI_GUID EFI_LOADED_IMAGE_PROTOCOL_GUID => new EFI_GUID(0x5B1B31A1, 0x9562, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B); + public static EFI_GUID EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID => new EFI_GUID(0xbc62157e, 0x3e33, 0x4fec, 0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf); + public static EFI_GUID EFI_RNG_PROTOCOL_GUID => new EFI_GUID(0x3152bca5, 0xeade, 0x433d, 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44); + public static EFI_GUID EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID => new EFI_GUID(0xa7af67cb, 0x603b, 0x4d42, 0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96); + public static EFI_GUID EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID => new EFI_GUID(0xc5149b43, 0xae85, 0x4f53, 0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7); + public static EFI_GUID EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID => new EFI_GUID(0x44f0de6e, 0x4d8c, 0x4045, 0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e); + public static EFI_GUID EFI_RNG_ALGORITHM_X9_31_3DES_GUID => new EFI_GUID(0x63c4785a, 0xca34, 0x4012, 0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46); + public static EFI_GUID EFI_RNG_ALGORITHM_X9_31_AES_GUID => new EFI_GUID(0xacd03321, 0x777e, 0x4d3d, 0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9); + public static EFI_GUID EFI_RNG_ALGORITHM_RAW => new EFI_GUID(0xe43176d7, 0xb6e8, 0x4827, 0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61); + public static EFI_GUID EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID => new EFI_GUID(0x6b30c738, 0xa391, 0x11d4, 0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID => new EFI_GUID(0x3bc1b285, 0x8a15, 0x4a82, 0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65); + public static EFI_GUID EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID => new EFI_GUID(0xb1ee129e, 0xda36, 0x4181, 0x91, 0xf8, 0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7); + public static EFI_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID => new EFI_GUID(0x13ac6dd1, 0x73d0, 0x11d4, 0xb0, 0x6b, 0x00, 0xaa, 0x00, 0xbd, 0x6d, 0xe7); + public static EFI_GUID EFI_PXE_BASE_CODE_PROTOCOL_GUID => new EFI_GUID(0x03c4e603, 0xac28, 0x11d3, 0x9a, 0x2d, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d); + public static EFI_GUID EFI_PXE_BASE_CODE_CALLBACK_PROTOCOL_GUID => new EFI_GUID(0x245dca21, 0xfb7b, 0x11d3, 0x8f, 0x01, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + public static EFI_GUID EFI_SERIAL_IO_PROTOCOL_GUID => new EFI_GUID(0xBB25CF6F, 0xF1D4, 0x11D2, 0x9A, 0x0C, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0xFD); + public static EFI_GUID EFI_SHELL_PROTOCOL_GUID => new EFI_GUID(0x6302d008, 0x7f9b, 0x4f30, 0x87, 0xac, 0x60, 0xc9, 0xfe, 0xf5, 0xda, 0x4e); + public static EFI_GUID EFI_SHELL_PARAMETERS_PROTOCOL_GUID => new EFI_GUID(0x752f3136, 0x4e16, 0x4fdc, 0xa2, 0x2a, 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca); + public static EFI_GUID EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL_GUID => new EFI_GUID(0x3c7200e9, 0x005f, 0x4ea4, 0x87, 0xde, 0xa3, 0xdf, 0xac, 0x8a, 0x27, 0xc3); + public static EFI_GUID EFI_TCP4_SERVICE_BINDING_PROTOCOL => new EFI_GUID(0x00720665, 0x67eb, 0x4a99, 0xba, 0xf7, 0xd3, 0xc3, 0x3a, 0x1c, 0x7c, 0xc9); + public static EFI_GUID EFI_TCP4_PROTOCOL => new EFI_GUID(0x65530bc7, 0xa359, 0x410f, 0xb0, 0x10, 0x5a, 0xad, 0xc7, 0xec, 0x2b, 0x62); + public static EFI_GUID EFI_TCP6_SERVICE_BINDING_PROTOCOL => new EFI_GUID(0xec20eb79, 0x6c1a, 0x4664, 0x9a, 0xd, 0xd2, 0xe4, 0xcc, 0x16, 0xd6, 0x64); + public static EFI_GUID EFI_TCP6_PROTOCOL => new EFI_GUID(0x46e44855, 0xbd60, 0x4ab7, 0xab, 0xd, 0xa6, 0x79, 0xb9, 0x44, 0x7d, 0x77); + public static EFI_GUID EFI_UDP4_SERVICE_BINDING_PROTOCOL => new EFI_GUID(0x83f01464, 0x99bd, 0x45e5, 0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6); + public static EFI_GUID EFI_UDP4_PROTOCOL => new EFI_GUID(0x3ad9df29, 0x4501, 0x478d, 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3); + public static EFI_GUID EFI_UDP6_SERVICE_BINDING_PROTOCOL => new EFI_GUID(0x66ed4721, 0x3c98, 0x4d3e, 0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54); + public static EFI_GUID EFI_UDP6_PROTOCOL => new EFI_GUID(0x4f948815, 0xb4b9, 0x43cb, 0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55); + public static EFI_GUID EFI_UI_INTERFACE_PROTOCOL_GUID => new EFI_GUID(0x32dd7981, 0x2d27, 0x11d4, 0xbc, 0x8b, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81); + public static EFI_GUID EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL_GUID => new EFI_GUID(0xE18541CD, 0xF755, 0x4f73, 0x92, 0x8D, 0x64, 0x3C, 0x8A, 0x79, 0xB2, 0x29); + public static EFI_GUID SHELL_INTERFACE_PROTOCOL_GUID => new EFI_GUID(0x47c7b223, 0xc42a, 0x11d2, 0x8e, 0x57, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b); + [RuntimeExport("memset")] + public static unsafe void memset(byte* ptr, byte c, ulong count) + { + gBS->SetMem(ptr, count, c); + } -Revision History - ---*/ - - + [RuntimeExport("memcpy")] + public static unsafe void memcpy(byte* dst, byte* src, ulong count) + { + gBS->CopyMem(dst, src, count); + } +} \ No newline at end of file