Add cast to return value of memory allocation functions (prepa c++)

This commit is contained in:
jief 2019-12-21 01:31:49 +01:00
parent 6dc3c956d6
commit 9b01a6fe58
46 changed files with 439 additions and 439 deletions

View File

@ -230,7 +230,7 @@ void AddDropTable(EFI_ACPI_DESCRIPTION_HEADER* Table, UINT32 Index)
CopyMem(&OTID[0], &Table->OemTableId, 8);
//DBG(" Found table: %a %a len=%d\n", sign, OTID, (INT32)Table->Length);
DBG(" - [%02d]: %a %a len=%d\n", Index, sign, OTID, (INT32)Table->Length);
ACPI_DROP_TABLE* DropTable = AllocateZeroPool(sizeof(ACPI_DROP_TABLE));
ACPI_DROP_TABLE* DropTable = (__typeof__(DropTable))AllocateZeroPool(sizeof(ACPI_DROP_TABLE));
DropTable->Signature = Table->Signature;
DropTable->TableId = Table->OemTableId;
DropTable->Length = Table->Length;
@ -782,7 +782,7 @@ VOID MarkTableAsSaved(VOID *TableEntry)
//DBG(" Allocaing mSavedTables");
mSavedTablesEntries = SAVED_TABLES_ALLOC_ENTRIES;
mSavedTablesNum = 0;
mSavedTables = AllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
mSavedTables = (__typeof__(mSavedTables))AllocateZeroPool(sizeof(*mSavedTables) * mSavedTablesEntries);
if (mSavedTables == NULL) {
return;
}
@ -804,7 +804,7 @@ VOID MarkTableAsSaved(VOID *TableEntry)
if (mSavedTablesNum + 1 >= mSavedTablesEntries) {
// not enough space
//DBG(" - extending mSavedTables from %d", mSavedTablesEntries);
mSavedTables = ReallocatePool(
mSavedTables = (__typeof__(mSavedTables))ReallocatePool(
sizeof(*mSavedTables) * mSavedTablesEntries,
sizeof(*mSavedTables) * (mSavedTablesEntries + SAVED_TABLES_ALLOC_ENTRIES),
mSavedTables
@ -2078,7 +2078,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
// XsdtReplaceSizes array is used to keep track of allocations for the merged tables,
// as those tables may need to be freed if patched later.
XsdtReplaceSizes = AllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
XsdtReplaceSizes = (__typeof__(XsdtReplaceSizes))AllocateZeroPool(XsdtTableCount() * sizeof(*XsdtReplaceSizes));
// Load merged ACPI files from ACPI/patched
LoadAllPatchedAML(AcpiOemPath, AUTOMERGE_PASS1);

View File

@ -91,7 +91,7 @@ AML_CHUNK* aml_add_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* buffer, UINT32 si
{
node->Type = AML_CHUNK_NONE;
node->Length = (UINT16)size;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
CopyMem(node->Buffer, buffer, node->Length);
}
@ -107,7 +107,7 @@ AML_CHUNK* aml_add_byte(AML_CHUNK* parent, UINT8 value)
node->Type = AML_CHUNK_BYTE;
node->Length = 1;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value;
}
@ -122,7 +122,7 @@ AML_CHUNK* aml_add_word(AML_CHUNK* parent, UINT16 value)
{
node->Type = AML_CHUNK_WORD;
node->Length = 2;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = value >> 8;
}
@ -138,7 +138,7 @@ AML_CHUNK* aml_add_dword(AML_CHUNK* parent, UINT32 value)
{
node->Type = AML_CHUNK_DWORD;
node->Length = 4;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = (value >> 8) & 0xff;
node->Buffer[2] = (value >> 16) & 0xff;
@ -156,7 +156,7 @@ AML_CHUNK* aml_add_qword(AML_CHUNK* parent, UINT64 value)
{
node->Type = AML_CHUNK_QWORD;
node->Length = 8;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[0] = value & 0xff;
node->Buffer[1] = RShiftU64(value, 8) & 0xff;
node->Buffer[2] = RShiftU64(value, 16) & 0xff;
@ -206,7 +206,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, /* CONST*/ CHAR8* name)
if (count == 1)
{
node->Length = (UINT16)(4 + root);
node->Buffer = AllocateZeroPool (node->Length+4);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length+4);
CopyMem(node->Buffer, name, 4 + root);
offset += 4 + root;
return (UINT32)offset;
@ -215,7 +215,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, /* CONST*/ CHAR8* name)
if (count == 2)
{
node->Length = 2 + 8;
node->Buffer = AllocateZeroPool (node->Length+4);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length+4);
node->Buffer[offset++] = 0x5c; // Root Char
node->Buffer[offset++] = 0x2e; // Double name
CopyMem(node->Buffer+offset, name + root, 8);
@ -224,7 +224,7 @@ UINT32 aml_fill_name(AML_CHUNK* node, /* CONST*/ CHAR8* name)
}
node->Length = (UINT16)(3 + (count << 2));
node->Buffer = AllocateZeroPool (node->Length+4);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length+4);
node->Buffer[offset++] = 0x5c; // Root Char
node->Buffer[offset++] = 0x2f; // Multi name
node->Buffer[offset++] = (CHAR8)count; // Names count
@ -288,7 +288,7 @@ AML_CHUNK* aml_add_package(AML_CHUNK* parent)
node->Type = AML_CHUNK_PACKAGE;
node->Length = 1;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
}
return node;
@ -303,7 +303,7 @@ AML_CHUNK* aml_add_alias(AML_CHUNK* parent, /* CONST*/ CHAR8* name1, /* CONST*/
node->Type = AML_CHUNK_ALIAS;
node->Length = 8;
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
aml_fill_simple_name(node->Buffer, name1);
aml_fill_simple_name(node->Buffer+4, name2);
}
@ -385,7 +385,7 @@ AML_CHUNK* aml_add_byte_buffer(AML_CHUNK* parent, /* CONST*/ UINT8* data, UINT32
INTN offset=0;
node->Type = AML_CHUNK_BUFFER;
node->Length = (UINT8)(size + 2);
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[offset++] = AML_CHUNK_BYTE; //0x0A
node->Buffer[offset++] = (CHAR8)size;
CopyMem(node->Buffer+offset, data, node->Length);
@ -404,7 +404,7 @@ AML_CHUNK* aml_add_string_buffer(AML_CHUNK* parent, /* CONST*/ CHAR8* StringBuf)
UINTN len = AsciiStrLen(StringBuf);
node->Type = AML_CHUNK_BUFFER;
node->Length = (UINT8)(len + 3);
node->Buffer = AllocateZeroPool (node->Length);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (node->Length);
node->Buffer[offset++] = AML_CHUNK_BYTE;
node->Buffer[offset++] = (CHAR8)(len + 1);
CopyMem(node->Buffer+offset, StringBuf, len);
@ -423,7 +423,7 @@ AML_CHUNK* aml_add_string(AML_CHUNK* parent, /* CONST*/ CHAR8* StringBuf)
INTN len = AsciiStrLen(StringBuf);
node->Type = AML_CHUNK_STRING;
node->Length = (UINT8)(len + 1);
node->Buffer = AllocateZeroPool (len + 1);
node->Buffer = (__typeof__(node->Buffer))AllocateZeroPool (len + 1);
CopyMem(node->Buffer, StringBuf, len);
// node->Buffer[len] = '\0';
}

View File

@ -311,7 +311,7 @@ EFI_STATUS ScanDeviceHandles(EFI_HANDLE ControllerHandle,
Status = gBS->LocateHandleBuffer (AllHandles, NULL, NULL, HandleCount, HandleBuffer);
if (EFI_ERROR (Status)) goto Error;
*HandleType = AllocatePool (*HandleCount * sizeof (UINT32));
*HandleType = (__typeof__(*HandleType))AllocatePool (*HandleCount * sizeof (UINT32));
if (*HandleType == NULL) goto Error;
for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) {

View File

@ -413,7 +413,7 @@ AddToBootOrder (
//
// Make new order buffer with space for our option
//
BootOrderNew = AllocateZeroPool ((BootOrderLen + 1) * sizeof(UINT16));
BootOrderNew = (__typeof__(BootOrderNew))AllocateZeroPool ((BootOrderLen + 1) * sizeof(UINT16));
if (BootOrderNew == NULL) {
DBG("AddToBootOrder: EFI_OUT_OF_RESOURCES\n");
if (BootOrder) {
@ -667,7 +667,7 @@ CompileBootOption (
+ BootOption->DescriptionSize
+ BootOption->FilePathListLength
+ BootOption->OptionalDataSize;
BootOption->Variable = AllocateZeroPool (BootOption->VariableSize);
BootOption->Variable = (__typeof__(BootOption->Variable))AllocateZeroPool (BootOption->VariableSize);
if (BootOption->Variable == NULL) {
DBG("CompileBootOption: EFI_OUT_OF_RESOURCES\n");
return EFI_OUT_OF_RESOURCES;

View File

@ -464,10 +464,10 @@ SetupDataForOSX(BOOLEAN Hibernate)
// Locate DataHub Protocol
Status = gBS->LocateProtocol(&gEfiDataHubProtocolGuid, NULL, (VOID**)&gDataHub);
if (!EFI_ERROR(Status)) {
ProductName = AllocateZeroPool(128);
ProductName = (__typeof__(ProductName))AllocateZeroPool(128);
AsciiStrToUnicodeStrS(gSettings.ProductName, ProductName, 64);
SerialNumber = AllocateZeroPool(128);
SerialNumber = (__typeof__(SerialNumber))AllocateZeroPool(128);
AsciiStrToUnicodeStrS(gSettings.SerialNr, SerialNumber, 64);
LogDataHub(&gEfiProcessorSubClassGuid, L"FSBFrequency", &FrontSideBus, sizeof(UINT64));

View File

@ -42,7 +42,7 @@ CatPrint (
VA_LIST Args;
UINTN StringSize;
AppendStr = AllocateZeroPool (0x1000);
AppendStr = (__typeof__(AppendStr))AllocateZeroPool (0x1000);
if (AppendStr == NULL) {
return Str->Str;
}
@ -52,13 +52,13 @@ CatPrint (
VA_END (Args);
if (NULL == Str->Str) {
StringSize = StrSize (AppendStr);
Str->Str = AllocateZeroPool (StringSize);
Str->Str = (__typeof__(Str->Str))AllocateZeroPool (StringSize);
// ASSERT (Str->Str != NULL);
} else {
StringSize = StrSize (AppendStr);
StringSize += (StrSize (Str->Str) - sizeof (UINT16));
Str->Str = ReallocatePool (
Str->Str = (__typeof__(Str->Str))ReallocatePool (
StrSize (Str->Str),
StringSize,
Str->Str
@ -1610,7 +1610,7 @@ DevicePathToStr (
Done:
NewSize = (Str.Len + 1) * sizeof (CHAR16);
Str.Str = ReallocatePool (NewSize, NewSize, Str.Str);
Str.Str = (__typeof__(Str.Str))ReallocatePool (NewSize, NewSize, Str.Str);
// ASSERT (Str.Str != NULL);
if (!Str.Str) {
return NULL;

View File

@ -42,7 +42,7 @@ InitializeEdidOverride ()
EFI_STATUS Status;
EFI_EDID_OVERRIDE_PROTOCOL *EdidOverride;
EdidOverride = AllocateCopyPool(sizeof(EFI_EDID_OVERRIDE_PROTOCOL), &gEdidOverride);
EdidOverride = (__typeof__(EdidOverride))AllocateCopyPool(sizeof(EFI_EDID_OVERRIDE_PROTOCOL), &gEdidOverride);
Status = gBS->InstallMultipleProtocolInterfaces (
&gImageHandle,
@ -69,7 +69,7 @@ UINT8* getCurrentEdid (VOID)
if (!EFI_ERROR (Status)) {
DBG(" size=%d", EdidProtocol->SizeOfEdid);
if (EdidProtocol->SizeOfEdid > 0) {
Edid = AllocateCopyPool (EdidProtocol->SizeOfEdid, EdidProtocol->Edid);
Edid = (__typeof__(Edid))AllocateCopyPool (EdidProtocol->SizeOfEdid, EdidProtocol->Edid);
}
}
DBG(" %a\n", Edid != NULL ? "found" : "not found");
@ -119,7 +119,7 @@ EFI_STATUS GetEdidDiscovered(VOID)
if (N == 0) {
return EFI_NOT_FOUND;
}
gSettings.CustomEDID = AllocateAlignedPages(EFI_SIZE_TO_PAGES(N), 128);
gSettings.CustomEDID = (__typeof__(gSettings.CustomEDID))AllocateAlignedPages(EFI_SIZE_TO_PAGES(N), 128);
CopyMem(gSettings.CustomEDID, EdidDiscovered->Edid, N);
DebugDumpEDID("--- Discovered EDID Table", N);
}

View File

@ -884,7 +884,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
if (acpi_cpu_score) {
FreePool(acpi_cpu_score);
}
acpi_cpu_score = AllocateZeroPool(128);
acpi_cpu_score = (__typeof__(acpi_cpu_score))AllocateZeroPool(128);
acpi_cpu_count = 0;
// 5B 83 41 0C 5C 2E 5F 50 52 5F 43 50 55 30 01 10
// 10 00 00 06
@ -1034,7 +1034,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
}
if (add_name) {
acpi_cpu_name[acpi_cpu_count] = AllocateZeroPool(5);
acpi_cpu_name[acpi_cpu_count] = (__typeof__(acpi_cpu_name[acpi_cpu_count]))AllocateZeroPool(5);
CopyMem(acpi_cpu_name[acpi_cpu_count], dsdt+offset, 4);
acpi_cpu_processor_id[acpi_cpu_count] = dsdt[offset + 4];
i = offset + 5;
@ -1056,7 +1056,7 @@ VOID findCPU(UINT8* dsdt, UINT32 length)
if (!acpi_cpu_count) {
for (i=0; i < acpi_cpu_max; i++) {
acpi_cpu_name[i] = AllocateZeroPool(5);
acpi_cpu_name[i] = (__typeof__(acpi_cpu_name[i]))AllocateZeroPool(5);
AsciiSPrint(acpi_cpu_name[i], 5, "CPU%1x", i);
acpi_cpu_processor_id[i] = (UINT8)(i & 0x7F);
}
@ -2370,7 +2370,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
continue;
}
LPCBSIZE = get_size(dsdt, LPCBADR);
device_name[3] = AllocateZeroPool(5);
device_name[3] = (__typeof__(device_name[3]))AllocateZeroPool(5);
CopyMem(device_name[3], dsdt + j, 4);
MsgLog("found LPCB device NAME(_ADR,0x001F0000) at %x And Name is %a\n", j,
device_name[3]);
@ -2424,7 +2424,7 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
lpcb = AllocateZeroPool(root->Size);
lpcb = (__typeof__(lpcb))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, lpcb, 0);
aml_destroy_node(root);
@ -2683,7 +2683,7 @@ Skip_DSM:
//now insert video
DBG("now inserting Video device\n");
aml_calculate_size(root);
display = AllocateZeroPool(root->Size);
display = (__typeof__(display))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, display, 0);
aml_destroy_node(root);
@ -2791,7 +2791,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
if (!devadr1) {
continue;
}
device_name[11] = AllocateZeroPool(5);
device_name[11] = (__typeof__(device_name[11]))AllocateZeroPool(5);
CopyMem(device_name[11], dsdt+k, 4);
DBG("found HDMI device [0x%08x:%x] at %x and Name is %a\n",
HDMIADR1, HDMIADR2, devadr1, device_name[11]);
@ -2884,7 +2884,7 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
hdmi = AllocateZeroPool(root->Size);
hdmi = (__typeof__(hdmi))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, hdmi, 0);
aml_destroy_node(root);
@ -2966,7 +2966,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
continue;
}
device_name[1] = AllocateZeroPool(5);
device_name[1] = (__typeof__(device_name[1]))AllocateZeroPool(5);
CopyMem(device_name[1], dsdt+k, 4);
DBG("found NetWork device [0x%08x:%x] at %x and Name is %a\n",
NetworkADR1[card], NetworkADR2[card], NetworkADR, device_name[1]);
@ -3083,7 +3083,7 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
}
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
network = AllocateZeroPool(root->Size);
network = (__typeof__(network))AllocateZeroPool(root->Size);
if (!network) {
return len;
}
@ -3166,7 +3166,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
if (!ArptADR) {
continue;
}
device_name[9] = AllocateZeroPool(5);
device_name[9] = (__typeof__(device_name[9]))AllocateZeroPool(5);
CopyMem(device_name[9], dsdt+k, 4);
DBG("found Airport device [%08x:%x] at %x And Name is %a\n",
ArptADR1, ArptADR2, ArptADR, device_name[9]);
@ -3280,7 +3280,7 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
network = AllocateZeroPool(root->Size);
network = (__typeof__(network))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, network, 0);
aml_destroy_node(root);
@ -3466,7 +3466,7 @@ UINT32 AddMCHC (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
*/
aml_calculate_size(root);
mchc = AllocateZeroPool(root->Size);
mchc = (__typeof__(mchc))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, mchc, 0);
aml_destroy_node(root);
@ -3553,7 +3553,7 @@ UINT32 AddIMEI (UINT8 *dsdt, UINT32 len)
}
aml_calculate_size(root);
imei = AllocateZeroPool(root->Size);
imei = (__typeof__(imei))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, imei, 0);
aml_destroy_node(root);
@ -3611,7 +3611,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
continue;
}
device_name[2] = AllocateZeroPool(5);
device_name[2] = (__typeof__(device_name[2]))AllocateZeroPool(5);
CopyMem(device_name[2], dsdt+k, 4);
DBG("found Firewire device NAME(_ADR,0x%08x) at %x And Name is %a\n",
FirewireADR2, k, device_name[2]);
@ -3701,7 +3701,7 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
firewire = AllocateZeroPool(root->Size);
firewire = (__typeof__(firewire))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, firewire, 0);
aml_destroy_node(root);
@ -3754,7 +3754,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, CHAR8* OSVersion)
}
// BridgeSize = get_size(dsdt, HDAADR);
device_name[4] = AllocateZeroPool(5);
device_name[4] = (__typeof__(device_name[4]))AllocateZeroPool(5);
CopyMem(device_name[4], dsdt+i, 4);
DBG("found HDA device NAME(_ADR,0x%08x) And Name is %a\n",
HDAADR1, device_name[4]);
@ -3822,7 +3822,7 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, CHAR8* OSVersion)
*/
}
aml_calculate_size(root);
hdef = AllocateZeroPool(root->Size);
hdef = (__typeof__(hdef))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, hdef, 0);
aml_destroy_node(root);
@ -3895,7 +3895,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
USBDATA1 = AllocateZeroPool(root->Size);
USBDATA1 = (__typeof__(USBDATA1))AllocateZeroPool(root->Size);
size1 = root->Size;
// DBG("USB1 code size = 0x%08x\n", size1);
aml_write_node(root, USBDATA1, 0);
@ -3968,7 +3968,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root1);
USBDATA2 = AllocateZeroPool(root1->Size);
USBDATA2 = (__typeof__(USBDATA2))AllocateZeroPool(root1->Size);
size2 = root1->Size;
// DBG("USB2 code size = 0x%08x\n", size2);
aml_write_node(root1, USBDATA2, 0);
@ -3976,7 +3976,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
//NFORCE_USB_START -- already done Intel or NForce same USBDATA2
/* aml_calculate_size(root1);
USBDATA4 = AllocateZeroPool(root1->Size);
USBDATA4 = (__typeof__(USBDATA4))AllocateZeroPool(root1->Size);
size4 = root1->Size;
DBG("USB OHCI code size = 0x%08x\n", size4);
aml_write_node(root1, USBDATA4, 0);
@ -4017,7 +4017,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root1);
USBDATA3 = AllocateZeroPool(root1->Size);
USBDATA3 = (__typeof__(USBDATA3))AllocateZeroPool(root1->Size);
size3 = root1->Size;
// DBG("USB3 code size = 0x%08x\n", size3);
aml_write_node(root1, USBDATA3, 0);
@ -4032,7 +4032,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
for (j = 0x20; len >= 4 && j < len - 4; j++) {
if (CmpAdr(dsdt, j, USBADR[i])) { //j+4 -> _ADR
XhciName = FALSE;
UsbName[i] = AllocateZeroPool(5);
UsbName[i] = (__typeof__(UsbName[i]))AllocateZeroPool(5);
// DBG("found USB at 0x%x\n", j);
adr1 = devFind(dsdt, j + 2);
if (!adr1) {
@ -4049,7 +4049,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
continue;
}
device_name[10] = AllocateZeroPool(5);
device_name[10] = (__typeof__(device_name[10]))AllocateZeroPool(5);
CopyMem(device_name[10], dsdt+k, 4);
DBG("found USB device [%08x:%x] at %x and Name was %a ->",
USBADR[i], USBADR2[i], k, device_name[10]);
@ -4169,7 +4169,7 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
}
//NFORCE_USB_START
else if (CmpAdr(dsdt, j, USBADR3[i])) {
UsbName[i] = AllocateZeroPool(5);
UsbName[i] = (__typeof__(UsbName[i]))AllocateZeroPool(5);
CopyMem(UsbName[i], dsdt+j, 4);
adr1 = devFind(dsdt, j);
@ -4374,7 +4374,7 @@ UINT32 FIXIDE (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
ide = AllocateZeroPool(root->Size);
ide = (__typeof__(ide))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, ide, 0);
aml_destroy_node(root);
@ -4484,7 +4484,7 @@ UINT32 FIXSATAAHCI (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
sata = AllocateZeroPool(root->Size);
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, sata, 0);
aml_destroy_node(root);
@ -4580,7 +4580,7 @@ UINT32 FIXSATA (UINT8 *dsdt, UINT32 len)
// finish Method(_DSM,4,NotSerialized)
aml_calculate_size(root);
sata = AllocateZeroPool(root->Size);
sata = (__typeof__(sata))AllocateZeroPool(root->Size);
sizeoffset = root->Size;
aml_write_node(root, sata, 0);
aml_destroy_node(root);
@ -4923,7 +4923,7 @@ UINT32 FIXOTHER (UINT8 *dsdt, UINT32 len)
for (i=0; i<len-5; i++) {
if (CmpAdr(dsdt, i, USBADR[j])) {
// get USB name
UsbName[j] = AllocateZeroPool(5);
UsbName[j] = (__typeof__(UsbName[j]))AllocateZeroPool(5);
CopyMem(UsbName[j], dsdt+i, 4);
DBG("found USB device NAME(_ADR,0x%08x) And Name is %a\n",
USBADR[j], UsbName[j]);
@ -5144,7 +5144,7 @@ VOID GetBiosRegions(UINT8 *buffer)
}
}
if (tmp.Address) {
OPER_REGION *newRegion = AllocateZeroPool(sizeof(OPER_REGION));
OPER_REGION *newRegion = (__typeof__(newRegion))AllocateZeroPool(sizeof(OPER_REGION));
MsgLog("Found OperationRegion(%a, SystemMemory, %x, ...)\n", tmp.Name, tmp.Address);
*newRegion = tmp;
newRegion->next = gRegions;
@ -5234,7 +5234,7 @@ BOOLEAN CmpFullName(UINT8* Table, UINTN Len, ACPI_NAME_LIST *Bridge)
if (NameLen < 4) {
return FALSE;
}
Name = AllocateCopyPool(NameLen + 1, Table);
Name = (__typeof__(Name))AllocateCopyPool(NameLen + 1, Table);
Name[NameLen] = '\0';
i = NameLen - 4;
while (Bridge && (i >= 0)) {

View File

@ -420,7 +420,7 @@ EFI_STATUS SaveHdaDumpBin() {
HdaCodec.WidgetCount = AudioFuncGroup->WidgetsCount;
// Allocate space for codec data
HdaCodecData = AllocateZeroPool(HdaCodecDataSize);
HdaCodecData = (__typeof__(HdaCodecData))AllocateZeroPool(HdaCodecDataSize);
HdaCodecDataPtr = HdaCodecData;
if (!HdaCodecData)

View File

@ -423,7 +423,7 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume,
if (VolNameEnd) {
VolNameSize = (VolNameEnd - VolNameStart + 1) * sizeof(CHAR16);
if (VolNameSize > 0) {
VolName = AllocateZeroPool(VolNameSize);
VolName = (__typeof__(VolName))AllocateZeroPool(VolNameSize);
}
}
}
@ -523,7 +523,7 @@ GetSleepImagePosition (IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume)
// We want to read the first 512 bytes from sleepimage
BufferSize = 512;
Buffer = AllocatePool(BufferSize);
Buffer = (__typeof__(Buffer))AllocatePool(BufferSize);
if (Buffer == NULL) {
DBG(" could not allocate buffer for sleepimage\n");
return 0;
@ -611,7 +611,7 @@ IsSleepImageValidBySleepTime (IN REFIT_VOLUME *Volume)
// use 4KB aligned page to avoid possible issues with BlockIo buffer alignment
BlockIo = Volume->BlockIO;
Pages = EFI_SIZE_TO_PAGES(BlockIo->Media->BlockSize);
Buffer = AllocatePages(Pages);
Buffer = (__typeof__(Buffer))AllocatePages(Pages);
if (Buffer == NULL) {
return FALSE;
}

View File

@ -250,7 +250,7 @@ OSInfoOSNameImpl (
// for future developers
// this variable can be used at OnExitBoootServices,
// as it will be set by boot.efi
BootOSName = AllocateCopyPool(AsciiStrLen(OSName) + 1, (VOID*)OSName);
BootOSName = (__typeof__(BootOSName))AllocateCopyPool(AsciiStrLen(OSName) + 1, (VOID*)OSName);
EfiNamedEventSignal (&gAppleOsLoadedNamedEventGuid);
}

View File

@ -310,7 +310,7 @@ EFI_STATUS bootElTorito(REFIT_VOLUME* volume)
IA32_REGISTER_SET Regs;
//UINTN LogSize;
sectorBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (2048), 64);
sectorBuffer = (__typeof__(sectorBuffer))AllocateAlignedPages (EFI_SIZE_TO_PAGES (2048), 64);
krnMemoryTop = addrRealFromSegOfs(0xA000, 0x0000);
addrEnablePaging(0);
@ -650,7 +650,7 @@ EFI_STATUS bootPBRtest(REFIT_VOLUME* volume)
return Status;
}
mBootSector = AllocateAlignedPages(1, 16);
mBootSector = (__typeof__(mBootSector))AllocateAlignedPages(1, 16);
Status = pDisk->ReadBlocks(pDisk, pDisk->Media->MediaId, 0, 2*512, mBootSector);
CopyMem(pBootSector, mBootSector, 1024);
DBG("PBR after readDisk:\n");
@ -900,7 +900,7 @@ EFI_STATUS bootPBR(REFIT_VOLUME* volume, BOOLEAN SataReset)
//
// read partition boot record and copy it to BIOS boot area 0000:07C00
//
mBootSector = AllocatePages(1);
mBootSector = (__typeof__(mBootSector))AllocatePages(1);
Status = pDisk->ReadBlocks(pDisk, pDisk->Media->MediaId, 0, 1*512, mBootSector);
CopyMem(pBootSector, mBootSector, 1*512);
DBG("PBR:\n");

View File

@ -112,7 +112,7 @@ VOID *GetNvramVariable (
//
// Allocate the buffer to return
//
Data = AllocateZeroPool (IntDataSize + 1);
Data = (__typeof__(Data))AllocateZeroPool (IntDataSize + 1);
if (Data != NULL) {
//
// Read variable into the allocated buffer.
@ -285,7 +285,7 @@ ResetNativeNvram ()
//DbgHeader("ResetNativeNvram: cleanup NVRAM variables");
NameSize = sizeof (CHAR16);
Name = AllocateZeroPool (NameSize);
Name = (__typeof__(Name))AllocateZeroPool (NameSize);
if (Name == NULL) {
return Status;
}
@ -300,7 +300,7 @@ ResetNativeNvram ()
NewNameSize = NameSize;
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
if (Status == EFI_BUFFER_TOO_SMALL) {
Name = ReallocatePool (NameSize, NewNameSize, Name);
Name = (__typeof__(Name))ReallocatePool (NameSize, NewNameSize, Name);
if (Name == NULL) {
return Status;
}
@ -414,7 +414,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
NameSize = sizeof (CHAR16);
Name = AllocateZeroPool (NameSize);
Name = (__typeof__(Name))AllocateZeroPool (NameSize);
if (Name == NULL) {
return;
}
@ -431,7 +431,7 @@ GetSmcKeys (BOOLEAN WriteToSMC)
NewNameSize = NameSize;
Status = gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
if (Status == EFI_BUFFER_TOO_SMALL) {
Name = ReallocatePool (NameSize, NewNameSize, Name);
Name = (__typeof__(Name))ReallocatePool (NameSize, NewNameSize, Name);
if (Name == NULL) {
return; //if something wrong then just do nothing
}
@ -782,7 +782,7 @@ GetEfiBootDeviceFromNvram ()
gEfiBootLoaderPath = NULL;
FileDevPath = (FILEPATH_DEVICE_PATH *)FindDevicePathNodeWithType (gEfiBootVolume, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP);
if (FileDevPath != NULL) {
gEfiBootLoaderPath = AllocateCopyPool (StrSize(FileDevPath->PathName), FileDevPath->PathName);
gEfiBootLoaderPath = (__typeof__(gEfiBootLoaderPath))AllocateCopyPool (StrSize(FileDevPath->PathName), FileDevPath->PathName);
// copy DevPath and write end of path node after in place of file path node
gEfiBootVolume = DuplicateDevicePath (gEfiBootVolume);
FileDevPath = (FILEPATH_DEVICE_PATH *)FindDevicePathNodeWithType (gEfiBootVolume, MEDIA_DEVICE_PATH, MEDIA_FILEPATH_DP);
@ -799,7 +799,7 @@ GetEfiBootDeviceFromNvram ()
//
Guid = FindGPTPartitionGuidInDevicePath (gEfiBootVolume);
if (Guid != NULL) {
gEfiBootDeviceGuid = AllocatePool (sizeof(EFI_GUID));
gEfiBootDeviceGuid = (__typeof__(gEfiBootDeviceGuid))AllocatePool (sizeof(EFI_GUID));
if (gEfiBootDeviceGuid != NULL) {
CopyMem (gEfiBootDeviceGuid, Guid, sizeof(EFI_GUID));
DBG (" - Guid = %g\n", gEfiBootDeviceGuid);
@ -1377,7 +1377,7 @@ EFI_STATUS SetStartupDiskVolume (
"</dict></array>";
Size = AsciiStrLen (EfiBootDeviceTmpl) + 36;
EfiBootDevice = AllocateZeroPool(AsciiStrLen (EfiBootDeviceTmpl) + 36);
EfiBootDevice = (__typeof__(EfiBootDevice))AllocateZeroPool(AsciiStrLen (EfiBootDeviceTmpl) + 36);
AsciiSPrint (EfiBootDevice, Size, EfiBootDeviceTmpl, Guid);
Size = AsciiStrLen (EfiBootDevice);
DBG (" * efi-boot-device: %a\n", EfiBootDevice);

View File

@ -309,9 +309,9 @@ ParseACPIName(CHAR8 *String)
//Parse forward but put in stack LIFO "_SB.PCI0.RP02.PXSX" -1,3,8,13,18
pos0 = -1;
while (pos0 < Len) {
List = AllocateZeroPool(sizeof(ACPI_NAME_LIST));
List = (__typeof__(List))AllocateZeroPool(sizeof(ACPI_NAME_LIST));
List->Next = Next;
List->Name = AllocateZeroPool(5);
List->Name = (__typeof__(List->Name))AllocateZeroPool(5);
pos1 = pos0 + 1;
while ((pos1 < Len) && String[pos1] != '.') pos1++; // 3,8,13,18
// if ((pos1 == Len) || (String[pos1] == ',')) { //always
@ -405,10 +405,10 @@ ParseLoadOptions (
return;
}
AsciiConf = AllocateCopyPool (TailSize + 1, Start);
AsciiConf = (__typeof__(AsciiConf))AllocateCopyPool (TailSize + 1, Start);
if (AsciiConf != NULL) {
*(AsciiConf + TailSize) = '\0';
*Conf = AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16));
*Conf = (__typeof__(*Conf))AllocateZeroPool ((TailSize + 1) * sizeof (CHAR16));
AsciiStrToUnicodeStrS (AsciiConf, *Conf, TailSize);
FreePool (AsciiConf);
}
@ -429,12 +429,12 @@ GetBootFromOption(VOID)
NameSize = *(UINT16*)Data;
Data += 2; // pointer to Volume name
gSettings.DefaultVolume = AllocateCopyPool(NameSize, Data);
gSettings.DefaultVolume = (__typeof__(gSettings.DefaultVolume))AllocateCopyPool(NameSize, Data);
Data += NameSize;
Name2Size = Len - NameSize;
if (Name2Size != 0) {
gSettings.DefaultLoader = AllocateCopyPool(Name2Size, Data);
gSettings.DefaultLoader = (__typeof__(gSettings.DefaultLoader))AllocateCopyPool(Name2Size, Data);
}
DBG("Clover started with option to boot %s from %s\n",
@ -525,7 +525,7 @@ SetBootCurrent(REFIT_MENU_ENTRY *LoadedEntry)
}
}
if (BootIndex != 0) {
BootOrderNew = AllocatePool(BootOrderSize);
BootOrderNew = (__typeof__(BootOrderNew))AllocatePool(BootOrderSize);
Ptr = BootOrderNew;
for (Index = 0; Index < (INTN)VarSize - BootIndex; Index++) {
*Ptr++ = BootOrder[Index + BootIndex];
@ -573,7 +573,7 @@ VOID
if (Prop != NULL) {
if (Prop->data != NULL /*&& Prop->dataLen > 0*/) { //rehabman: allow zero length data
// data property
Data = AllocateZeroPool (Prop->dataLen);
Data = (__typeof__(Data))AllocateZeroPool (Prop->dataLen);
CopyMem (Data, Prop->data, Prop->dataLen);
if (DataLen != NULL) {
@ -589,7 +589,7 @@ VOID
} else {
// assume data in hex encoded string property
Len = (UINT32)AsciiStrLen (Prop->string) >> 1; // number of hex digits
Data = AllocateZeroPool(Len); // 2 chars per byte, one more byte for odd number
Data = (__typeof__(Data))AllocateZeroPool(Len); // 2 chars per byte, one more byte for odd number
Len = hex2bin (Prop->string, Data, Len);
if (DataLen != NULL) {
@ -769,13 +769,13 @@ CopyKernelAndKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Dst,
(Src->KPATIConnectorsData != NULL) &&
(Src->KPATIConnectorsPatch != NULL)) {
Dst->KPATIConnectorsDataLen = Src->KPATIConnectorsDataLen;
Dst->KPATIConnectorsData = AllocateCopyPool (Src->KPATIConnectorsDataLen, Src->KPATIConnectorsData);
Dst->KPATIConnectorsPatch = AllocateCopyPool (Src->KPATIConnectorsDataLen, Src->KPATIConnectorsPatch);
Dst->KPATIConnectorsData = (__typeof__(Dst->KPATIConnectorsData))AllocateCopyPool (Src->KPATIConnectorsDataLen, Src->KPATIConnectorsData);
Dst->KPATIConnectorsPatch = (__typeof__(Dst->KPATIConnectorsPatch))AllocateCopyPool (Src->KPATIConnectorsDataLen, Src->KPATIConnectorsPatch);
}
if ((Src->NrForceKexts > 0) && (Src->ForceKexts != NULL)) {
INTN i;
Dst->ForceKexts = AllocatePool (Src->NrForceKexts * sizeof(CHAR16 *));
Dst->ForceKexts = (__typeof__(Dst->ForceKexts))AllocatePool (Src->NrForceKexts * sizeof(CHAR16 *));
for (i = 0; i < Src->NrForceKexts; i++) {
Dst->ForceKexts[Dst->NrForceKexts++] = EfiStrDuplicate (Src->ForceKexts[i]);
@ -784,7 +784,7 @@ CopyKernelAndKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Dst,
if ((Src->NrKexts > 0) && (Src->KextPatches != NULL)) {
INTN i;
Dst->KextPatches = AllocatePool (Src->NrKexts * sizeof(KEXT_PATCH));
Dst->KextPatches = (__typeof__(Dst->KextPatches))AllocatePool (Src->NrKexts * sizeof(KEXT_PATCH));
for (i = 0; i < Src->NrKexts; i++)
{
@ -805,17 +805,17 @@ CopyKernelAndKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Dst,
Dst->KextPatches[Dst->NrKexts].MenuItem.BValue = Src->KextPatches[i].MenuItem.BValue;
Dst->KextPatches[Dst->NrKexts].IsPlistPatch = Src->KextPatches[i].IsPlistPatch;
Dst->KextPatches[Dst->NrKexts].DataLen = Src->KextPatches[i].DataLen;
Dst->KextPatches[Dst->NrKexts].Data = AllocateCopyPool (Src->KextPatches[i].DataLen, Src->KextPatches[i].Data);
Dst->KextPatches[Dst->NrKexts].Patch = AllocateCopyPool (Src->KextPatches[i].DataLen, Src->KextPatches[i].Patch);
Dst->KextPatches[Dst->NrKexts].MatchOS = AllocateCopyPool (AsciiStrSize(Src->KextPatches[i].MatchOS), Src->KextPatches[i].MatchOS);
Dst->KextPatches[Dst->NrKexts].MatchBuild = AllocateCopyPool (AsciiStrSize(Src->KextPatches[i].MatchBuild), Src->KextPatches[i].MatchBuild);
Dst->KextPatches[Dst->NrKexts].Data = (__typeof__(Dst->KextPatches[Dst->NrKexts].Data))AllocateCopyPool (Src->KextPatches[i].DataLen, Src->KextPatches[i].Data);
Dst->KextPatches[Dst->NrKexts].Patch = (__typeof__(Dst->KextPatches[Dst->NrKexts].Patch))AllocateCopyPool (Src->KextPatches[i].DataLen, Src->KextPatches[i].Patch);
Dst->KextPatches[Dst->NrKexts].MatchOS = (__typeof__(Dst->KextPatches[Dst->NrKexts].MatchOS))AllocateCopyPool (AsciiStrSize(Src->KextPatches[i].MatchOS), Src->KextPatches[i].MatchOS);
Dst->KextPatches[Dst->NrKexts].MatchBuild = (__typeof__(Dst->KextPatches[Dst->NrKexts].MatchBuild))AllocateCopyPool (AsciiStrSize(Src->KextPatches[i].MatchBuild), Src->KextPatches[i].MatchBuild);
++(Dst->NrKexts);
}
}
if ((Src->NrKernels > 0) && (Src->KernelPatches != NULL)) {
INTN i;
Dst->KernelPatches = AllocatePool (Src->NrKernels * sizeof(KERNEL_PATCH));
Dst->KernelPatches = (__typeof__(Dst->KernelPatches))AllocatePool (Src->NrKernels * sizeof(KERNEL_PATCH));
for (i = 0; i < Src->NrKernels; i++)
{
@ -831,18 +831,18 @@ CopyKernelAndKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Dst,
Dst->KernelPatches[Dst->NrKernels].MenuItem.BValue = Src->KernelPatches[i].MenuItem.BValue;
Dst->KernelPatches[Dst->NrKernels].DataLen = Src->KernelPatches[i].DataLen;
Dst->KernelPatches[Dst->NrKernels].Data = AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].Data);
Dst->KernelPatches[Dst->NrKernels].Patch = AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].Patch);
Dst->KernelPatches[Dst->NrKernels].Data = (__typeof__(Dst->KernelPatches[Dst->NrKernels].Data))AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].Data);
Dst->KernelPatches[Dst->NrKernels].Patch = (__typeof__(Dst->KernelPatches[Dst->NrKernels].Patch))AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].Patch);
Dst->KernelPatches[Dst->NrKernels].Count = Src->KernelPatches[i].Count;
Dst->KernelPatches[Dst->NrKernels].MatchOS = AllocateCopyPool (AsciiStrSize(Src->KernelPatches[i].MatchOS), Src->KernelPatches[i].MatchOS);
Dst->KernelPatches[Dst->NrKernels].MatchBuild = AllocateCopyPool (AsciiStrSize(Src->KernelPatches[i].MatchBuild), Src->KernelPatches[i].MatchBuild);
Dst->KernelPatches[Dst->NrKernels].MatchOS = (__typeof__(Dst->KernelPatches[Dst->NrKernels].MatchOS))AllocateCopyPool (AsciiStrSize(Src->KernelPatches[i].MatchOS), Src->KernelPatches[i].MatchOS);
Dst->KernelPatches[Dst->NrKernels].MatchBuild = (__typeof__(Dst->KernelPatches[Dst->NrKernels].MatchBuild))AllocateCopyPool (AsciiStrSize(Src->KernelPatches[i].MatchBuild), Src->KernelPatches[i].MatchBuild);
if (Src->KernelPatches[i].MaskFind != NULL) {
Dst->KernelPatches[Dst->NrKernels].MaskFind = AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].MaskFind);
Dst->KernelPatches[Dst->NrKernels].MaskFind = (__typeof__(Dst->KernelPatches[Dst->NrKernels].MaskFind))AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].MaskFind);
} else {
Dst->KernelPatches[Dst->NrKernels].MaskFind = NULL;
}
if (Src->KernelPatches[i].MaskReplace != NULL) {
Dst->KernelPatches[Dst->NrKernels].MaskReplace = AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].MaskReplace);
Dst->KernelPatches[Dst->NrKernels].MaskReplace = (__typeof__(Dst->KernelPatches[Dst->NrKernels].MaskReplace))AllocateCopyPool (Src->KernelPatches[i].DataLen, Src->KernelPatches[i].MaskReplace);
} else {
Dst->KernelPatches[Dst->NrKernels].MaskReplace = NULL;
}
@ -896,7 +896,7 @@ CUSTOM_LOADER_ENTRY
}
if (Entry->BootBgColor) {
DuplicateEntry->BootBgColor = AllocateCopyPool (sizeof(EG_PIXEL), Entry->BootBgColor);
DuplicateEntry->BootBgColor = (__typeof__(DuplicateEntry->BootBgColor))AllocateCopyPool (sizeof(EG_PIXEL), Entry->BootBgColor);
}
DuplicateEntry->Image = Entry->Image;
@ -997,7 +997,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
UINTN len = 0, i=0;
// ATIConnectors patch
Patches->KPATIConnectorsController = AllocateZeroPool (AsciiStrSize(Prop->string) * sizeof(CHAR16));
Patches->KPATIConnectorsController = (__typeof__(Patches->KPATIConnectorsController))AllocateZeroPool (AsciiStrSize(Prop->string) * sizeof(CHAR16));
AsciiStrToUnicodeStrS (Prop->string, Patches->KPATIConnectorsController, AsciiStrSize(Prop->string));
Patches->KPATIConnectorsData = GetDataSetting (DictPointer, "ATIConnectorsData", &len);
@ -1035,7 +1035,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
INTN i, Count = GetTagCount (Prop);
if (Count > 0) {
TagPtr Prop2 = NULL;
CHAR16 **newForceKexts = AllocateZeroPool ((Patches->NrForceKexts + Count) * sizeof(CHAR16 *));
CHAR16 **newForceKexts = (__typeof__(newForceKexts))AllocateZeroPool ((Patches->NrForceKexts + Count) * sizeof(CHAR16 *));
if (Patches->ForceKexts != NULL) {
CopyMem (newForceKexts, Patches->ForceKexts, (Patches->NrForceKexts * sizeof(CHAR16 *)));
@ -1062,7 +1062,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
}
if (AsciiStrSize(Prop2->string) > 1) {
Patches->ForceKexts[Patches->NrForceKexts] = AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16));
Patches->ForceKexts[Patches->NrForceKexts] = (__typeof__(Patches->ForceKexts[Patches->NrForceKexts]))AllocateZeroPool (AsciiStrSize(Prop2->string) * sizeof(CHAR16));
AsciiStrToUnicodeStrS(Prop2->string, Patches->ForceKexts[Patches->NrForceKexts], 255);
DBG (" - [%d]: %s\n", Patches->NrForceKexts, Patches->ForceKexts[Patches->NrForceKexts]);
++Patches->NrForceKexts;
@ -1109,7 +1109,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
}
if (Count > 0) {
TagPtr Prop2 = NULL, Dict = NULL;
KEXT_PATCH *newPatches = AllocateZeroPool (Count * sizeof(KEXT_PATCH));
KEXT_PATCH *newPatches = (__typeof__(newPatches))AllocateZeroPool (Count * sizeof(KEXT_PATCH));
Patches->KextPatches = newPatches;
DBG ("KextsToPatch: %d requested\n", Count);
@ -1134,8 +1134,8 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
continue;
}
KextPatchesName = AllocateCopyPool (255, Dict->string);
KextPatchesLabel = AllocateCopyPool (255, KextPatchesName);
KextPatchesName = (__typeof__(KextPatchesName))AllocateCopyPool (255, Dict->string);
KextPatchesLabel = (__typeof__(KextPatchesLabel))AllocateCopyPool (255, KextPatchesName);
Dict = GetProperty (Prop2, "Comment");
if (Dict != NULL) {
@ -1165,7 +1165,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
continue;
}
Patches->KextPatches[Patches->NrKexts].Data = AllocateCopyPool (FindLen, TmpData);
Patches->KextPatches[Patches->NrKexts].Data = (__typeof__(Patches->KextPatches[Patches->NrKexts].Data))AllocateCopyPool (FindLen, TmpData);
Patches->KextPatches[Patches->NrKexts].DataLen = FindLen;
FreePool(TmpData);
TmpData = GetDataSetting (Prop2, "MaskFind", &MaskLen);
@ -1174,12 +1174,12 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
if (TmpData == NULL || MaskLen == 0) {
Patches->KextPatches[Patches->NrKexts].MaskFind = NULL;
} else {
Patches->KextPatches[Patches->NrKexts].MaskFind = AllocatePool (FindLen);
Patches->KextPatches[Patches->NrKexts].MaskFind = (__typeof__(Patches->KextPatches[Patches->NrKexts].MaskFind))AllocatePool (FindLen);
SetMem(Patches->KextPatches[Patches->NrKexts].MaskFind, FindLen, 0xFF);
CopyMem(Patches->KextPatches[Patches->NrKexts].MaskFind, TmpData, MaskLen);
}
FreePool(TmpData);
Patches->KextPatches[Patches->NrKexts].Patch = AllocateCopyPool (FindLen, TmpPatch);
Patches->KextPatches[Patches->NrKexts].Patch = (__typeof__(Patches->KextPatches[Patches->NrKexts].Patch))AllocateCopyPool (FindLen, TmpPatch);
FreePool(TmpPatch);
MaskLen = 0;
TmpData = GetDataSetting (Prop2, "MaskReplace", &MaskLen);
@ -1188,27 +1188,27 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
if (TmpData == NULL || MaskLen == 0) {
Patches->KextPatches[Patches->NrKexts].MaskReplace = NULL;
} else {
Patches->KextPatches[Patches->NrKexts].MaskReplace = AllocateZeroPool (FindLen);
Patches->KextPatches[Patches->NrKexts].MaskReplace = (__typeof__(Patches->KextPatches[Patches->NrKexts].MaskReplace))AllocateZeroPool (FindLen);
CopyMem(Patches->KextPatches[Patches->NrKexts].MaskReplace, TmpData, MaskLen);
}
FreePool(TmpData);
Patches->KextPatches[Patches->NrKexts].MatchOS = NULL;
Patches->KextPatches[Patches->NrKexts].MatchBuild = NULL;
Patches->KextPatches[Patches->NrKexts].Name = AllocateCopyPool (AsciiStrSize(KextPatchesName), KextPatchesName);
Patches->KextPatches[Patches->NrKexts].Name = (__typeof__(Patches->KextPatches[Patches->NrKexts].Name))AllocateCopyPool (AsciiStrSize(KextPatchesName), KextPatchesName);
FreePool(KextPatchesName);
Patches->KextPatches[Patches->NrKexts].Label = AllocateCopyPool (AsciiStrSize(KextPatchesLabel), KextPatchesLabel);
Patches->KextPatches[Patches->NrKexts].Label = (__typeof__(Patches->KextPatches[Patches->NrKexts].Label))AllocateCopyPool (AsciiStrSize(KextPatchesLabel), KextPatchesLabel);
FreePool(KextPatchesLabel);
// check enable/disabled patch (OS based) by Micky1979
Dict = GetProperty (Prop2, "MatchOS");
if ((Dict != NULL) && (Dict->type == kTagTypeString)) {
Patches->KextPatches[Patches->NrKexts].MatchOS = AllocateCopyPool (AsciiStrSize(Dict->string), Dict->string);
Patches->KextPatches[Patches->NrKexts].MatchOS = (__typeof__(Patches->KextPatches[Patches->NrKexts].MatchOS))AllocateCopyPool (AsciiStrSize(Dict->string), Dict->string);
DBG(" :: MatchOS: %a", Patches->KextPatches[Patches->NrKexts].MatchOS);
}
Dict = GetProperty (Prop2, "MatchBuild");
if ((Dict != NULL) && (Dict->type == kTagTypeString)) {
Patches->KextPatches[Patches->NrKexts].MatchBuild = AllocateCopyPool (AsciiStrSize(Dict->string), Dict->string);
Patches->KextPatches[Patches->NrKexts].MatchBuild = (__typeof__(Patches->KextPatches[Patches->NrKexts].MatchBuild))AllocateCopyPool (AsciiStrSize(Dict->string), Dict->string);
DBG(" :: MatchBuild: %a", Patches->KextPatches[Patches->NrKexts].MatchBuild);
}
@ -1271,7 +1271,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
}
if (Count > 0) {
TagPtr Prop2 = NULL, Dict = NULL;
KERNEL_PATCH *newPatches = AllocateZeroPool (Count * sizeof(KERNEL_PATCH));
KERNEL_PATCH *newPatches = (__typeof__(newPatches))AllocateZeroPool (Count * sizeof(KERNEL_PATCH));
Patches->KernelPatches = newPatches;
DBG ("KernelToPatch: %d requested\n", Count);
@ -1292,9 +1292,9 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Dict = GetProperty (Prop2, "Comment");
if (Dict != NULL) {
KernelPatchesLabel = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
KernelPatchesLabel = (__typeof__(KernelPatchesLabel))AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
} else {
KernelPatchesLabel = AllocateCopyPool (8, "NoLabel");
KernelPatchesLabel = (__typeof__(KernelPatchesLabel))AllocateCopyPool (8, "NoLabel");
}
DBG (" %a", KernelPatchesLabel);
@ -1309,7 +1309,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
continue;
}
Patches->KernelPatches[Patches->NrKernels].Data = AllocateCopyPool (FindLen, TmpData);
Patches->KernelPatches[Patches->NrKernels].Data = (__typeof__(Patches->KernelPatches[Patches->NrKernels].Data))AllocateCopyPool (FindLen, TmpData);
Patches->KernelPatches[Patches->NrKernels].DataLen = FindLen;
FreePool(TmpData);
TmpData = GetDataSetting (Prop2, "MaskFind", &MaskLen);
@ -1317,26 +1317,26 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
if (TmpData == NULL || MaskLen == 0) {
Patches->KernelPatches[Patches->NrKexts].MaskFind = NULL;
} else {
Patches->KernelPatches[Patches->NrKexts].MaskFind = AllocatePool (FindLen);
Patches->KernelPatches[Patches->NrKexts].MaskFind = (__typeof__(Patches->KernelPatches[Patches->NrKexts].MaskFind))AllocatePool (FindLen);
SetMem(Patches->KernelPatches[Patches->NrKexts].MaskFind, FindLen, 0xFF);
CopyMem(Patches->KernelPatches[Patches->NrKexts].MaskFind, TmpData, MaskLen);
}
FreePool(TmpData);
Patches->KernelPatches[Patches->NrKernels].Patch = AllocateCopyPool (FindLen, TmpPatch);
Patches->KernelPatches[Patches->NrKernels].Patch = (__typeof__(Patches->KernelPatches[Patches->NrKernels].Patch))AllocateCopyPool (FindLen, TmpPatch);
FreePool(TmpPatch);
TmpData = GetDataSetting (Prop2, "MaskReplace", &MaskLen);
MaskLen = (MaskLen > FindLen)? FindLen : MaskLen;
if (TmpData == NULL || MaskLen == 0) {
Patches->KernelPatches[Patches->NrKexts].MaskReplace = NULL;
} else {
Patches->KernelPatches[Patches->NrKexts].MaskReplace = AllocateZeroPool (FindLen);
Patches->KernelPatches[Patches->NrKexts].MaskReplace = (__typeof__(Patches->KernelPatches[Patches->NrKexts].MaskReplace))AllocateZeroPool (FindLen);
CopyMem(Patches->KernelPatches[Patches->NrKexts].MaskReplace, TmpData, MaskLen);
}
FreePool(TmpData);
Patches->KernelPatches[Patches->NrKernels].Count = 0;
Patches->KernelPatches[Patches->NrKernels].MatchOS = NULL;
Patches->KernelPatches[Patches->NrKernels].MatchBuild = NULL;
Patches->KernelPatches[Patches->NrKernels].Label = AllocateCopyPool (AsciiStrSize (KernelPatchesLabel), KernelPatchesLabel);
Patches->KernelPatches[Patches->NrKernels].Label = (__typeof__(Patches->KernelPatches[Patches->NrKernels].Label))AllocateCopyPool (AsciiStrSize (KernelPatchesLabel), KernelPatchesLabel);
Dict = GetProperty (Prop2, "Count");
if (Dict != NULL) {
@ -1347,13 +1347,13 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
// check enable/disabled patch (OS based) by Micky1979
Dict = GetProperty (Prop2, "MatchOS");
if ((Dict != NULL) && (Dict->type == kTagTypeString)) {
Patches->KernelPatches[Patches->NrKernels].MatchOS = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
Patches->KernelPatches[Patches->NrKernels].MatchOS = (__typeof__(Patches->KernelPatches[Patches->NrKernels].MatchOS))AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
DBG(" :: MatchOS: %a", Patches->KernelPatches[Patches->NrKernels].MatchOS);
}
Dict = GetProperty (Prop2, "MatchBuild");
if ((Dict != NULL) && (Dict->type == kTagTypeString)) {
Patches->KernelPatches[Patches->NrKernels].MatchBuild = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
Patches->KernelPatches[Patches->NrKernels].MatchBuild = (__typeof__(Patches->KernelPatches[Patches->NrKernels].MatchBuild))AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
DBG(" :: MatchBuild: %a", Patches->KernelPatches[Patches->NrKernels].MatchBuild);
}
DBG (" :: data len: %d\n", Patches->KernelPatches[Patches->NrKernels].DataLen);
@ -1396,7 +1396,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
}
if (Count > 0) {
TagPtr Prop2 = NULL, Dict = NULL;
KERNEL_PATCH *newPatches = AllocateZeroPool (Count * sizeof(KERNEL_PATCH));
KERNEL_PATCH *newPatches = (__typeof__(newPatches))AllocateZeroPool (Count * sizeof(KERNEL_PATCH));
Patches->BootPatches = newPatches;
DBG ("BootPatches: %d requested\n", Count);
@ -1416,9 +1416,9 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Dict = GetProperty (Prop2, "Comment");
if (Dict != NULL) {
BootPatchesLabel = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
BootPatchesLabel = (__typeof__(BootPatchesLabel))AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
} else {
BootPatchesLabel = AllocateCopyPool (8, "NoLabel");
BootPatchesLabel = (__typeof__(BootPatchesLabel))AllocateCopyPool (8, "NoLabel");
}
DBG (" %a", BootPatchesLabel);
@ -1434,7 +1434,7 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
continue;
}
Patches->BootPatches[Patches->NrBoots].Data = AllocateCopyPool (FindLen, TmpData);
Patches->BootPatches[Patches->NrBoots].Data = (__typeof__(Patches->BootPatches[Patches->NrBoots].Data))AllocateCopyPool (FindLen, TmpData);
Patches->BootPatches[Patches->NrBoots].DataLen = FindLen;
FreePool(TmpData);
TmpData = GetDataSetting (Prop2, "MaskFind", &MaskLen);
@ -1442,26 +1442,26 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
if (TmpData == NULL || MaskLen == 0) {
Patches->BootPatches[Patches->NrKexts].MaskFind = NULL;
} else {
Patches->BootPatches[Patches->NrKexts].MaskFind = AllocatePool (FindLen);
Patches->BootPatches[Patches->NrKexts].MaskFind = (__typeof__(Patches->BootPatches[Patches->NrKexts].MaskFind))AllocatePool (FindLen);
SetMem(Patches->BootPatches[Patches->NrKexts].MaskFind, FindLen, 0xFF);
CopyMem(Patches->BootPatches[Patches->NrKexts].MaskFind, TmpData, MaskLen);
}
FreePool(TmpData);
Patches->BootPatches[Patches->NrBoots].Patch = AllocateCopyPool (FindLen, TmpPatch);
Patches->BootPatches[Patches->NrBoots].Patch = (__typeof__(Patches->BootPatches[Patches->NrBoots].Patch))AllocateCopyPool (FindLen, TmpPatch);
FreePool(TmpPatch);
TmpData = GetDataSetting (Prop2, "MaskReplace", &MaskLen);
MaskLen = (MaskLen > FindLen)? FindLen : MaskLen;
if (TmpData == NULL || MaskLen == 0) {
Patches->BootPatches[Patches->NrKexts].MaskReplace = NULL;
} else {
Patches->BootPatches[Patches->NrKexts].MaskReplace = AllocateZeroPool (FindLen);
Patches->BootPatches[Patches->NrKexts].MaskReplace = (__typeof__(Patches->BootPatches[Patches->NrKexts].MaskReplace))AllocateZeroPool (FindLen);
CopyMem(Patches->BootPatches[Patches->NrKexts].MaskReplace, TmpData, MaskLen);
}
FreePool(TmpData);
Patches->BootPatches[Patches->NrBoots].Count = 0;
Patches->BootPatches[Patches->NrBoots].MatchOS = NULL;
Patches->BootPatches[Patches->NrBoots].MatchBuild = NULL;
Patches->BootPatches[Patches->NrBoots].Label = AllocateCopyPool (AsciiStrSize (BootPatchesLabel), BootPatchesLabel);
Patches->BootPatches[Patches->NrBoots].Label = (__typeof__(Patches->BootPatches[Patches->NrBoots].Label))AllocateCopyPool (AsciiStrSize (BootPatchesLabel), BootPatchesLabel);
Dict = GetProperty (Prop2, "Count");
if (Dict != NULL) {
@ -1471,13 +1471,13 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
Dict = GetProperty (Prop2, "MatchOS");
if ((Dict != NULL) && (Dict->type == kTagTypeString)) {
Patches->BootPatches[Patches->NrBoots].MatchOS = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
Patches->BootPatches[Patches->NrBoots].MatchOS = (__typeof__(Patches->BootPatches[Patches->NrBoots].MatchOS))AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
DBG(" :: MatchOS: %a", Patches->BootPatches[Patches->NrBoots].MatchOS);
}
Dict = GetProperty (Prop2, "MatchBuild");
if ((Dict != NULL) && (Dict->type == kTagTypeString)) {
Patches->BootPatches[Patches->NrBoots].MatchBuild = AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
Patches->BootPatches[Patches->NrBoots].MatchBuild = (__typeof__(Patches->BootPatches[Patches->NrBoots].MatchBuild))AllocateCopyPool (AsciiStrSize (Dict->string), Dict->string);
DBG(" :: MatchBuild: %a", Patches->BootPatches[Patches->NrBoots].MatchBuild);
}
@ -1496,7 +1496,7 @@ IsPatchEnabled (CHAR8 *MatchOSEntry, CHAR8 *CurrOS)
{
INTN i;
BOOLEAN ret = FALSE;
struct MatchOSes *mos; // = AllocatePool(sizeof(struct MatchOSes));
struct MatchOSes *mos; // = (__typeof__(mos))AllocatePool(sizeof(struct MatchOSes));
if (!MatchOSEntry || !CurrOS) {
return TRUE; //undefined matched corresponds to old behavior
@ -1536,7 +1536,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep)
// CHAR8 *comp = NULL; //unused
CHAR8 doubleSep[2];
mo = AllocatePool(sizeof(struct MatchOSes));
mo = (__typeof__(mo))AllocatePool(sizeof(struct MatchOSes));
if (!mo) {
return NULL;
}
@ -1588,7 +1588,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep)
/* comp = (CHAR8 *) AllocatePool(newLen);
AsciiStrnCpy(comp, str + startLocation, newLen);
comp[newLen] = '\0'; */
mo->array[i] = AllocateCopyPool(newLen, str + startLocation);
mo->array[i] = (__typeof__(mo->array[i]))AllocateCopyPool(newLen, str + startLocation);
mo->array[i][newLen - 1] = '\0';
}
@ -1596,7 +1596,7 @@ MatchOSes *GetStrArraySeparatedByChar(CHAR8 *str, CHAR8 sep)
}
else {
// DBG("str contains only one component and it is our string %s!\n", str);
mo->array[0] = AllocateCopyPool(AsciiStrLen(str)+1, str);
mo->array[0] = (__typeof__(mo->array[0]))AllocateCopyPool(AsciiStrLen(str)+1, str);
}
return mo;
}
@ -1620,7 +1620,7 @@ TrimString(CHAR8* String)
}
*(End + 1) = '\0';
TrimmedString = AllocateCopyPool(AsciiStrSize(TempString), TempString);
TrimmedString = (__typeof__(TrimmedString))AllocateCopyPool(AsciiStrSize(TempString), TempString);
FreePool(String);
return TrimmedString;
}
@ -1995,7 +1995,7 @@ FillinCustomEntry (
if (Prop != NULL && Prop->type == kTagTypeString) {
UINTN Color;
Color = AsciiStrHexToUintn (Prop->string);
Entry->BootBgColor = AllocateZeroPool (sizeof(EG_PIXEL));
Entry->BootBgColor = (__typeof__(Entry->BootBgColor))AllocateZeroPool (sizeof(EG_PIXEL));
Entry->BootBgColor->r = (Color >> 24) & 0xFF;
Entry->BootBgColor->g = (Color >> 16) & 0xFF;
Entry->BootBgColor->b = (Color >> 8) & 0xFF;
@ -2590,7 +2590,7 @@ GetEarlyUserSettings (
if (AsciiStriCmp (Prop->string, "LastBootedVolume") == 0) {
gSettings.LastBootedVolume = TRUE;
} else {
gSettings.DefaultVolume = AllocateZeroPool (Size * sizeof(CHAR16));
gSettings.DefaultVolume = (__typeof__(gSettings.DefaultVolume))AllocateZeroPool (Size * sizeof(CHAR16));
AsciiStrToUnicodeStrS(Prop->string, gSettings.DefaultVolume, Size);
}
}
@ -2598,7 +2598,7 @@ GetEarlyUserSettings (
Prop = GetProperty (DictPointer, "DefaultLoader");
if (Prop != NULL) {
gSettings.DefaultLoader = AllocateZeroPool (AsciiStrSize (Prop->string) * sizeof(CHAR16));
gSettings.DefaultLoader = (__typeof__(gSettings.DefaultLoader))AllocateZeroPool (AsciiStrSize (Prop->string) * sizeof(CHAR16));
AsciiStrToUnicodeStrS (Prop->string, gSettings.DefaultLoader, AsciiStrSize (Prop->string));
}
@ -2680,7 +2680,7 @@ GetEarlyUserSettings (
INTN i, Count = GetTagCount (Prop);
if (Count > 0) {
gSettings.SecureBootWhiteListCount = 0;
gSettings.SecureBootWhiteList = AllocateZeroPool (Count * sizeof(CHAR16 *));
gSettings.SecureBootWhiteList = (__typeof__(gSettings.SecureBootWhiteList))AllocateZeroPool (Count * sizeof(CHAR16 *));
if (gSettings.SecureBootWhiteList) {
for (i = 0; i < Count; i++) {
if (EFI_ERROR (GetElement (Prop, i, &Dict2))) {
@ -2704,7 +2704,7 @@ GetEarlyUserSettings (
INTN i, Count = GetTagCount (Prop);
if (Count > 0) {
gSettings.SecureBootBlackListCount = 0;
gSettings.SecureBootBlackList = AllocateZeroPool (Count * sizeof(CHAR16 *));
gSettings.SecureBootBlackList = (__typeof__(gSettings.SecureBootBlackList))AllocateZeroPool (Count * sizeof(CHAR16 *));
if (gSettings.SecureBootBlackList) {
for (i = 0; i < Count; i++) {
if (EFI_ERROR (GetElement (Prop, i, &Dict2))) {
@ -3033,7 +3033,7 @@ GetEarlyUserSettings (
INTN i, Count = GetTagCount (Prop);
if (Count > 0) {
gSettings.HVCount = 0;
gSettings.HVHideStrings = AllocateZeroPool (Count * sizeof(CHAR16 *));
gSettings.HVHideStrings = (__typeof__(gSettings.HVHideStrings))AllocateZeroPool (Count * sizeof(CHAR16 *));
if (gSettings.HVHideStrings) {
for (i = 0; i < Count; i++) {
if (EFI_ERROR (GetElement (Prop, i, &Dict2))) {
@ -3214,7 +3214,7 @@ GetEarlyUserSettings (
BOOLEAN Valid;
// alloc space for up to 16 entries
gSettings.PatchVBiosBytes = AllocateZeroPool (Count * sizeof(VBIOS_PATCH_BYTES));
gSettings.PatchVBiosBytes = (__typeof__(gSettings.PatchVBiosBytes))AllocateZeroPool (Count * sizeof(VBIOS_PATCH_BYTES));
// get all entries
for (i = 0; i < Count; i++) {
@ -3281,7 +3281,7 @@ GetEarlyUserSettings (
INTN i, Count = GetTagCount (DictPointer);
if (Count > 0) {
gSettings.BlackListCount = 0;
gSettings.BlackList = AllocateZeroPool (Count * sizeof(CHAR16 *));
gSettings.BlackList = (__typeof__(gSettings.BlackList))AllocateZeroPool (Count * sizeof(CHAR16 *));
for (i = 0; i < Count; i++) {
if (!EFI_ERROR (GetElement (DictPointer, i, &Prop)) &&
@ -3409,7 +3409,7 @@ GetListOfACPI ()
UnicodeSPrint(FullName, 512, L"%s\\%s", AcpiPath, DirEntry->FileName);
if (FileExists(SelfRootDir, FullName)) {
BOOLEAN ACPIDisabled = FALSE;
ACPIPatchedAMLTmp = AllocateZeroPool (sizeof(ACPI_PATCHED_AML));
ACPIPatchedAMLTmp = (__typeof__(ACPIPatchedAMLTmp))AllocateZeroPool (sizeof(ACPI_PATCHED_AML));
ACPIPatchedAMLTmp->FileName = PoolPrint(L"%s", DirEntry->FileName);
for (i = 0; i < Count; i++) {
@ -3492,7 +3492,7 @@ VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
*/
FullName = PoolPrint(L"%s\\%s", FullPath, DirEntry->FileName);
mKext = AllocateZeroPool (sizeof(SIDELOAD_KEXT));
mKext = (__typeof__(mKext))AllocateZeroPool (sizeof(SIDELOAD_KEXT));
mKext->FileName = PoolPrint(L"%s", DirEntry->FileName);
mKext->MenuItem.BValue = Blocked;
mKext->KextDirNameUnderOEMPath = PoolPrint(L"%s", KextDirNameUnderOEMPath);
@ -3511,7 +3511,7 @@ VOID GetListOfInjectKext(CHAR16 *KextDirNameUnderOEMPath)
continue;
}
PlugInsName = PoolPrint(L"%s\\%s", PlugInsPath, PlugInEntry->FileName);
mPlugInKext = AllocateZeroPool(sizeof(SIDELOAD_KEXT));
mPlugInKext = (__typeof__(mPlugInKext))AllocateZeroPool(sizeof(SIDELOAD_KEXT));
mPlugInKext->FileName = PoolPrint(L"%s", PlugInEntry->FileName);
mPlugInKext->MenuItem.BValue = Blocked;
mPlugInKext->KextDirNameUnderOEMPath = PoolPrint(L"%s", KextDirNameUnderOEMPath);
@ -3992,7 +3992,7 @@ GetThemeTagSettings (
break;
}
Anime = AllocateZeroPool (sizeof(GUI_ANIME));
Anime = (__typeof__(Anime))AllocateZeroPool (sizeof(GUI_ANIME));
if (Anime == NULL) {
break;
}
@ -4439,8 +4439,8 @@ ParseSMBIOSSettings(
)
{
CHAR8 *i, *j;
CHAR8 *Res1 = AllocateZeroPool(9);
CHAR8 *Res2 = AllocateZeroPool(11);
CHAR8 *Res1 = (__typeof__(Res1))AllocateZeroPool(9);
CHAR8 *Res2 = (__typeof__(Res2))AllocateZeroPool(11);
CHAR16 UStr[64];
TagPtr Prop, Prop1;
BOOLEAN Default = FALSE;
@ -4997,7 +4997,7 @@ GetUserSettings(
EFI_PHYSICAL_ADDRESS BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
UINTN strlength = AsciiStrLen(Prop->string);
cDeviceProperties = AllocateZeroPool(strlength + 1);
cDeviceProperties = (__typeof__(cDeviceProperties))AllocateZeroPool(strlength + 1);
AsciiStrCpyS(cDeviceProperties, strlength + 1, Prop->string);
//-------
Status = gBS->AllocatePages (
@ -5018,7 +5018,7 @@ GetUserSettings(
else if (Prop->type == kTagTypeDict) {
//analyze dict-array
INTN i, Count = GetTagCount(Prop);
gSettings.AddProperties = AllocateZeroPool(Count * sizeof(DEV_PROPERTY));
gSettings.AddProperties = (__typeof__(gSettings.AddProperties))AllocateZeroPool(Count * sizeof(DEV_PROPERTY));
DEV_PROPERTY *DevPropDevice;
DEV_PROPERTY *DevProps;
DEV_PROPERTY **Child;
@ -5050,12 +5050,12 @@ GetUserSettings(
else continue;
//Create Device node
DevPropDevice = gSettings.ArbProperties;
gSettings.ArbProperties = AllocateZeroPool(sizeof(DEV_PROPERTY));
gSettings.ArbProperties = (__typeof__(gSettings.ArbProperties))AllocateZeroPool(sizeof(DEV_PROPERTY));
gSettings.ArbProperties->Next = DevPropDevice; //next device
gSettings.ArbProperties->Child = NULL;
gSettings.ArbProperties->Device = 0; //to differ from arbitrary
gSettings.ArbProperties->DevicePath = DevicePath; //this is pointer
gSettings.ArbProperties->Label = AllocateCopyPool(AsciiStrSize(Prop2->string), Prop2->string);
gSettings.ArbProperties->Label = (__typeof__(gSettings.ArbProperties->Label))AllocateCopyPool(AsciiStrSize(Prop2->string), Prop2->string);
Child = &(gSettings.ArbProperties->Child);
Prop2 = Prop2->tag; //take a <dict> for this device
@ -5066,7 +5066,7 @@ GetUserSettings(
for (j = 0; j < PropCount; j++) {
Prop3 = NULL;
DevProps = *Child;
*Child = AllocateZeroPool(sizeof(DEV_PROPERTY));
*Child = (__typeof__(*Child))AllocateZeroPool(sizeof(DEV_PROPERTY));
(*Child)->Next = DevProps;
if (EFI_ERROR(GetElement(Prop2, j, &Prop3))) { // Prop3 -> <key>
@ -5077,35 +5077,35 @@ GetUserSettings(
) {
if (Prop3->string[0] != '#') {
(*Child)->MenuItem.BValue = TRUE;
(*Child)->Key = AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
(*Child)->Key = (__typeof__((*Child)->Key))AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
}
else {
(*Child)->MenuItem.BValue = FALSE;
(*Child)->Key = AllocateCopyPool(AsciiStrSize(Prop3->string) - 1, Prop3->string + 1);
(*Child)->Key = (__typeof__((*Child)->Key))AllocateCopyPool(AsciiStrSize(Prop3->string) - 1, Prop3->string + 1);
}
Prop3 = Prop3->tag; //expected value
// DBG("<key>%a\n <value> type %d\n", (*Child)->Key, Prop3->type);
if (Prop3 && (Prop3->type == kTagTypeString) && Prop3->string) {
//first suppose it is Ascii string
(*Child)->Value = AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
(*Child)->Value = (__typeof__((*Child)->Value))AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
(*Child)->ValueLen = AsciiStrLen(Prop3->string) + 1;
(*Child)->ValueType = kTagTypeString;
}
else if (Prop3 && (Prop3->type == kTagTypeInteger)) {
(*Child)->Value = AllocatePool(4);
(*Child)->Value = (__typeof__((*Child)->Value))AllocatePool(4);
CopyMem((*Child)->Value, &(Prop3->string), 4);
(*Child)->ValueLen = 4;
(*Child)->ValueType = kTagTypeInteger;
}
else if (Prop3 && (Prop3->type == kTagTypeTrue)) {
(*Child)->Value = AllocateZeroPool(4);
(*Child)->Value = (__typeof__((*Child)->Value))AllocateZeroPool(4);
(*Child)->Value[0] = TRUE;
(*Child)->ValueLen = 1;
(*Child)->ValueType = kTagTypeTrue;
}
else if (Prop3 && (Prop3->type == kTagTypeFalse)) {
(*Child)->Value = AllocateZeroPool(4);
(*Child)->Value = (__typeof__((*Child)->Value))AllocateZeroPool(4);
//(*Child)->Value[0] = FALSE;
(*Child)->ValueLen = 1;
(*Child)->ValueType = kTagTypeFalse;
@ -5113,7 +5113,7 @@ GetUserSettings(
else if (Prop3 && (Prop3->type == kTagTypeData)) {
UINTN Size = Prop3->dataLen;
// (*Child)->Value = GetDataSetting(Prop3, "Value", &Size); //TODO
UINT8* Data = AllocateZeroPool(Size);
UINT8* Data = (__typeof__(Data))AllocateZeroPool(Size);
CopyMem(Data, Prop3->data, Size);
(*Child)->Value = Data;
(*Child)->ValueLen = Size;
@ -5161,7 +5161,7 @@ GetUserSettings(
DBG(" wrong PciAddr string: %a\n", Str);
continue;
}
Label = AllocatePool(64);
Label = (__typeof__(Label))AllocatePool(64);
Bus = hexstrtouint8(Str);
Dev = hexstrtouint8(&Str[3]);
Func = hexstrtouint8(&Str[6]);
@ -5189,38 +5189,38 @@ GetUserSettings(
if (!EFI_ERROR(GetElement(Dict2, PropIndex, &Dict3))) {
DevProp = gSettings.ArbProperties;
gSettings.ArbProperties = AllocateZeroPool(sizeof(DEV_PROPERTY));
gSettings.ArbProperties = (__typeof__(gSettings.ArbProperties))AllocateZeroPool(sizeof(DEV_PROPERTY));
gSettings.ArbProperties->Next = DevProp;
gSettings.ArbProperties->Device = (UINT32)DeviceAddr;
gSettings.ArbProperties->Label = AllocateCopyPool(AsciiStrSize(Label), Label);
gSettings.ArbProperties->Label = (__typeof__(gSettings.ArbProperties->Label))AllocateCopyPool(AsciiStrSize(Label), Label);
Prop3 = GetProperty (Dict3, "Disabled");
gSettings.ArbProperties->MenuItem.BValue = !IsPropertyTrue(Prop3);
Prop3 = GetProperty (Dict3, "Key");
if (Prop3 && (Prop3->type == kTagTypeString) && Prop3->string) {
gSettings.ArbProperties->Key = AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
gSettings.ArbProperties->Key = (__typeof__(gSettings.ArbProperties->Key))AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
}
Prop3 = GetProperty (Dict3, "Value");
if (Prop3 && (Prop3->type == kTagTypeString) && Prop3->string) {
//first suppose it is Ascii string
gSettings.ArbProperties->Value = AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
gSettings.ArbProperties->Value = (__typeof__(gSettings.ArbProperties->Value))AllocateCopyPool(AsciiStrSize(Prop3->string), Prop3->string);
gSettings.ArbProperties->ValueLen = AsciiStrLen(Prop3->string) + 1;
gSettings.ArbProperties->ValueType = kTagTypeString;
} else if (Prop3 && (Prop3->type == kTagTypeInteger)) {
gSettings.ArbProperties->Value = AllocatePool(4);
gSettings.ArbProperties->Value = (__typeof__(gSettings.ArbProperties->Value))AllocatePool(4);
CopyMem (gSettings.ArbProperties->Value, &(Prop3->string), 4);
gSettings.ArbProperties->ValueLen = 4;
gSettings.ArbProperties->ValueType = kTagTypeInteger;
} else if (Prop3 && (Prop3->type == kTagTypeTrue)) {
gSettings.ArbProperties->Value = AllocateZeroPool(4);
gSettings.ArbProperties->Value = (__typeof__(gSettings.ArbProperties->Value))AllocateZeroPool(4);
gSettings.ArbProperties->Value[0] = TRUE;
gSettings.ArbProperties->ValueLen = 1;
gSettings.ArbProperties->ValueType = kTagTypeTrue;
} else if (Prop3 && (Prop3->type == kTagTypeFalse)) {
gSettings.ArbProperties->Value = AllocateZeroPool(4);
gSettings.ArbProperties->Value = (__typeof__(gSettings.ArbProperties->Value))AllocateZeroPool(4);
//gSettings.ArbProperties->Value[0] = FALSE;
gSettings.ArbProperties->ValueLen = 1;
gSettings.ArbProperties->ValueType = kTagTypeFalse;
@ -5251,7 +5251,7 @@ GetUserSettings(
if (Count > 0) {
DBG ("Add %d properties:\n", Count);
gSettings.AddProperties = AllocateZeroPool (Count * sizeof(DEV_PROPERTY));
gSettings.AddProperties = (__typeof__(gSettings.AddProperties))AllocateZeroPool (Count * sizeof(DEV_PROPERTY));
for (i = 0; i < Count; i++) {
UINTN Size = 0;
@ -5309,16 +5309,16 @@ GetUserSettings(
Prop2 = GetProperty (Dict2, "Key");
if (Prop2 && (Prop2->type == kTagTypeString) && Prop2->string) {
gSettings.AddProperties[Index].Key = AllocateCopyPool (AsciiStrSize (Prop2->string), Prop2->string);
gSettings.AddProperties[Index].Key = (__typeof__(gSettings.AddProperties[Index].Key))AllocateCopyPool (AsciiStrSize (Prop2->string), Prop2->string);
}
Prop2 = GetProperty (Dict2, "Value");
if (Prop2 && (Prop2->type == kTagTypeString) && Prop2->string) {
//first suppose it is Ascii string
gSettings.AddProperties[Index].Value = AllocateCopyPool (AsciiStrSize (Prop2->string), Prop2->string);
gSettings.AddProperties[Index].Value = (__typeof__(gSettings.AddProperties[Index].Value))AllocateCopyPool (AsciiStrSize (Prop2->string), Prop2->string);
gSettings.AddProperties[Index].ValueLen = AsciiStrLen (Prop2->string) + 1;
} else if (Prop2 && (Prop2->type == kTagTypeInteger)) {
gSettings.AddProperties[Index].Value = AllocatePool (4);
gSettings.AddProperties[Index].Value = (__typeof__(gSettings.AddProperties[Index].Value))AllocatePool (4);
CopyMem (gSettings.AddProperties[Index].Value, &(Prop2->string), 4);
gSettings.AddProperties[Index].ValueLen = 4;
} else {
@ -5609,13 +5609,13 @@ GetUserSettings(
INTN i, Count = GetTagCount (Prop);
if (Count > 0) {
gSettings.PatchDsdtNum = (UINT32)Count;
gSettings.PatchDsdtFind = AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.PatchDsdtReplace = AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.PatchDsdtTgt = AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.LenToFind = AllocateZeroPool (Count * sizeof(UINT32));
gSettings.LenToReplace = AllocateZeroPool (Count * sizeof(UINT32));
gSettings.PatchDsdtLabel = AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.PatchDsdtMenuItem = AllocateZeroPool (Count * sizeof(INPUT_ITEM));
gSettings.PatchDsdtFind = (__typeof__(gSettings.PatchDsdtFind))AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.PatchDsdtReplace = (__typeof__(gSettings.PatchDsdtReplace))AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.PatchDsdtTgt = (__typeof__(gSettings.PatchDsdtTgt))AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.LenToFind = (__typeof__(gSettings.LenToFind))AllocateZeroPool (Count * sizeof(UINT32));
gSettings.LenToReplace = (__typeof__(gSettings.LenToReplace))AllocateZeroPool (Count * sizeof(UINT32));
gSettings.PatchDsdtLabel = (__typeof__(gSettings.PatchDsdtLabel))AllocateZeroPool (Count * sizeof(UINT8*));
gSettings.PatchDsdtMenuItem = (__typeof__(gSettings.PatchDsdtMenuItem))AllocateZeroPool (Count * sizeof(INPUT_ITEM));
DBG ("PatchesDSDT: %d requested\n", Count);
for (i = 0; i < Count; i++) {
@ -5632,7 +5632,7 @@ GetUserSettings(
}
DBG(" - [%02d]:", i);
DSDTPatchesLabel = AllocateZeroPool(256);
DSDTPatchesLabel = (__typeof__(DSDTPatchesLabel))AllocateZeroPool(256);
Prop3 = GetProperty (Prop2, "Comment");
if (Prop3 != NULL && (Prop3->type == kTagTypeString) && Prop3->string) {
@ -5640,7 +5640,7 @@ GetUserSettings(
} else {
AsciiSPrint(DSDTPatchesLabel, 255, " (NoLabel)");
}
gSettings.PatchDsdtLabel[i] = AllocateZeroPool(256);
gSettings.PatchDsdtLabel[i] = (__typeof__(gSettings.PatchDsdtLabel[i]))AllocateZeroPool(256);
AsciiSPrint(gSettings.PatchDsdtLabel[i], 255, "%a", DSDTPatchesLabel);
DBG(" (%a)", gSettings.PatchDsdtLabel[i]);
@ -5919,7 +5919,7 @@ GetUserSettings(
Prop2 = NULL;
if (Count > 0) {
gSettings.SortedACPICount = 0;
gSettings.SortedACPI = AllocateZeroPool (Count * sizeof(CHAR16 *));
gSettings.SortedACPI = (__typeof__(gSettings.SortedACPI))AllocateZeroPool (Count * sizeof(CHAR16 *));
for (i = 0; i < Count; i++) {
if (!EFI_ERROR (GetElement (Prop, i, &Prop2)) &&
@ -5939,7 +5939,7 @@ GetUserSettings(
Prop2 = NULL;
if (Count > 0) {
gSettings.DisabledAMLCount = 0;
gSettings.DisabledAML = AllocateZeroPool (Count * sizeof(CHAR16 *));
gSettings.DisabledAML = (__typeof__(gSettings.DisabledAML))AllocateZeroPool (Count * sizeof(CHAR16 *));
if (gSettings.DisabledAML) {
for (i = 0; i < Count; i++) {
@ -5959,7 +5959,7 @@ GetUserSettings(
INTN i, Count = GetTagCount(Prop);
if (Count > 0) {
gSettings.DeviceRenameCount = 0;
gSettings.DeviceRename = AllocateZeroPool(Count * sizeof(ACPI_NAME_LIST));
gSettings.DeviceRename = (__typeof__(gSettings.DeviceRename))AllocateZeroPool(Count * sizeof(ACPI_NAME_LIST));
DBG("Devices to rename %d\n", Count);
for (i = 0; i < Count; i++) {
Prop2 = NULL;
@ -5974,7 +5974,7 @@ GetUserSettings(
}
Prop2 = Prop2->tag;
if (Prop2->type == kTagTypeString) {
gSettings.DeviceRename[gSettings.DeviceRenameCount++].Name = AllocateCopyPool(5, Prop2->string);
gSettings.DeviceRename[gSettings.DeviceRenameCount++].Name = (__typeof__(gSettings.DeviceRename[gSettings.DeviceRenameCount++].Name))AllocateCopyPool(5, Prop2->string);
DBG("->will be renamed to %a\n", Prop2->string);
}
}
@ -6313,7 +6313,7 @@ GetUserSettings(
// MLB: <string>some value</string>
Prop = GetProperty (DictPointer, "MLB");
if (Prop != NULL && AsciiStrLen (Prop->string) > 0) {
gSettings.RtMLB = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
gSettings.RtMLB = (__typeof__(gSettings.RtMLB))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
// CsrActiveConfig
Prop = GetProperty (DictPointer, "CsrActiveConfig");
@ -6333,7 +6333,7 @@ GetUserSettings(
INTN i, Count = GetTagCount (Prop);
CHAR16 UStr[64];
RtVariablesNum = 0;
RtVariables = AllocateZeroPool(Count * sizeof(RT_VARIABLES));
RtVariables = (__typeof__(RtVariables))AllocateZeroPool(Count * sizeof(RT_VARIABLES));
for (i = 0; i < Count; i++) {
Status = GetElement (Prop, i, &Dict);
if (!EFI_ERROR(Status)) {
@ -6361,7 +6361,7 @@ GetUserSettings(
RtVariables[RtVariablesNum].Name = NULL;
if (Prop2 != NULL && AsciiStrLen(Prop2->string) > 0) {
AsciiStrToUnicodeStrS(Prop2->string, (CHAR16*)&UStr[0], 64);
// RtVariables[RtVariablesNum].Name = AllocateCopyPool(128, UStr);
// RtVariables[RtVariablesNum].Name = (__typeof__(RtVariables[RtVariablesNum].Name))AllocateCopyPool(128, UStr);
StrCpyS(RtVariables[RtVariablesNum].Name, 64, UStr);
}
RtVariablesNum++;
@ -6552,11 +6552,11 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (!EFI_ERROR (Status) && PlistBuffer != NULL && ParseXML (PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
Prop = GetProperty (Dict, "ProductVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
OSVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
Prop = GetProperty (Dict, "ProductBuildVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
}
}
@ -6583,11 +6583,11 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (!EFI_ERROR (Status) && PlistBuffer != NULL && ParseXML (PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
Prop = GetProperty (Dict, "ProductVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
OSVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
Prop = GetProperty (Dict, "ProductBuildVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
}
}
@ -6602,23 +6602,23 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
Prop = GetProperty (Dict, "Kernel Flags");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
if (AsciiStrStr (Prop->string, "Install%20OS%20X%20Mavericks.app")) {
OSVersion = AllocateCopyPool (5, "10.9");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (5, "10.9");
} else if (AsciiStrStr (Prop->string, "Install%20macOS%20Catalina") || AsciiStrStr (Prop->string, "Install%20macOS%2010.15")) {
OSVersion = AllocateCopyPool (6, "10.15");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (6, "10.15");
} else if (AsciiStrStr (Prop->string, "Install%20macOS%20Mojave") || AsciiStrStr (Prop->string, "Install%20macOS%2010.14")) {
OSVersion = AllocateCopyPool (6, "10.14");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (6, "10.14");
} else if (AsciiStrStr (Prop->string, "Install%20macOS%20High%20Sierra") || AsciiStrStr (Prop->string, "Install%20macOS%2010.13")) {
OSVersion = AllocateCopyPool (6, "10.13");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (6, "10.13");
} else if (AsciiStrStr (Prop->string, "Install%20macOS%20Sierra") || AsciiStrStr (Prop->string, "Install%20OS%20X%2010.12")) {
OSVersion = AllocateCopyPool (6, "10.12");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (6, "10.12");
} else if (AsciiStrStr (Prop->string, "Install%20OS%20X%20El%20Capitan") || AsciiStrStr (Prop->string, "Install%20OS%20X%2010.11")) {
OSVersion = AllocateCopyPool (6, "10.11");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (6, "10.11");
} else if (AsciiStrStr (Prop->string, "Install%20OS%20X%20Yosemite") || AsciiStrStr (Prop->string, "Install%20OS%20X%2010.10")) {
OSVersion = AllocateCopyPool (6, "10.10");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (6, "10.10");
} else if (AsciiStrStr (Prop->string, "Install%20OS%20X%20Mountain%20Lion")) {
OSVersion = AllocateCopyPool (5, "10.8");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (5, "10.8");
} else if (AsciiStrStr (Prop->string, "Install%20Mac%20OS%20X%20Lion")) {
OSVersion = AllocateCopyPool (5, "10.7");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (5, "10.7");
}
}
}
@ -6652,11 +6652,11 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (!EFI_ERROR (Status) && PlistBuffer != NULL && ParseXML (PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
Prop = GetProperty (Dict, "ProductVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
OSVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
Prop = GetProperty (Dict, "ProductBuildVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
// In InstallInfo.plist, there is no a version key only when updating from AppStore in 10.13+
// If use the startosinstall in 10.13+, this version key exists in InstallInfo.plist
@ -6664,7 +6664,7 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (DictPointer != NULL) {
Prop = GetProperty (DictPointer, "version");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
OSVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
}
}
@ -6676,10 +6676,10 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
// Implemented by Sherlocks
if (OSVersion == NULL) {
CHAR8 *s, *fileBuffer, *targetString;
CHAR8 *Res5 = AllocateZeroPool(5);
CHAR8 *Res6 = AllocateZeroPool(6);
CHAR8 *Res7 = AllocateZeroPool(7);
CHAR8 *Res8 = AllocateZeroPool(8);
CHAR8 *Res5 = (__typeof__(Res5))AllocateZeroPool(5);
CHAR8 *Res6 = (__typeof__(Res6))AllocateZeroPool(6);
CHAR8 *Res7 = (__typeof__(Res7))AllocateZeroPool(7);
CHAR8 *Res8 = (__typeof__(Res8))AllocateZeroPool(8);
UINTN fileLen = 0;
CHAR16 *InstallerLog = L"\\Mac OS X Install Data\\ia.log"; // 10.7
if (!FileExists (Entry->Volume->RootDir, InstallerLog)) {
@ -6696,49 +6696,49 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
s = SearchString(targetString, fileLen, "Running OS Build: Mac OS X ", 27);
if (s[31] == ' ') {
AsciiSPrint (Res5, 5, "%c%c.%c\n", s[27], s[28], s[30]);
OSVersion = AllocateCopyPool (AsciiStrSize (Res5), Res5);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res5), Res5);
if (s[38] == ')') {
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res6), Res6);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
} else if (s[39] == ')') {
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[33], s[34], s[35], s[36], s[37], s[38]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res7), Res7);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
}
} else if (s[31] == '.') {
AsciiSPrint (Res7, 7, "%c%c.%c.%c\n", s[27], s[28], s[30], s[32]);
OSVersion = AllocateCopyPool (AsciiStrSize (Res7), Res7);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
if (s[40] == ')') {
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res6), Res6);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
} else if (s[41] == ')') {
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[35], s[36], s[37], s[38], s[39], s[40]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res7), Res7);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
}
} else if (s[32] == ' ') {
AsciiSPrint (Res6, 6, "%c%c.%c%c\n", s[27], s[28], s[30], s[31]);
OSVersion = AllocateCopyPool (AsciiStrSize (Res6), Res6);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
if (s[39] == ')') {
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res6), Res6);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
} else if (s[40] == ')') {
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res7), Res7);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
} else if (s[41] == ')') {
AsciiSPrint (Res8, 8, "%c%c%c%c%c%c%c\n", s[34], s[35], s[36], s[37], s[38], s[39], s[40]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res8), Res8);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
}
} else if (s[32] == '.') {
AsciiSPrint (Res8, 8, "%c%c.%c%c.%c\n", s[27], s[28], s[30], s[31], s[33]);
OSVersion = AllocateCopyPool (AsciiStrSize (Res8), Res8);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
if (s[41] == ')') {
AsciiSPrint (Res6, 6, "%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res6), Res6);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res6), Res6);
} else if (s[42] == ')') {
AsciiSPrint (Res7, 7, "%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res7), Res7);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res7), Res7);
} else if (s[43] == ')') {
AsciiSPrint (Res8, 8, "%c%c%c%c%c%c%c\n", s[36], s[37], s[38], s[39], s[40], s[41], s[42]);
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Res8), Res8);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Res8), Res8);
}
}
FreePool(fileBuffer);
@ -6760,11 +6760,11 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (!EFI_ERROR (Status) && PlistBuffer != NULL && ParseXML (PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
Prop = GetProperty (Dict, "ProductVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
OSVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
Prop = GetProperty (Dict, "ProductBuildVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
}
}
@ -6783,16 +6783,16 @@ CHAR8 *GetOSVersion(IN LOADER_ENTRY *Entry)
if (!EFI_ERROR (Status) && PlistBuffer != NULL && ParseXML (PlistBuffer, &Dict, 0) == EFI_SUCCESS) {
Prop = GetProperty (Dict, "ProductVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
OSVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
Prop = GetProperty (Dict, "ProductBuildVersion");
if (Prop != NULL && Prop->string != NULL && Prop->string[0] != '\0') {
Entry->BuildVersion = AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
Entry->BuildVersion = (__typeof__(Entry->BuildVersion))AllocateCopyPool (AsciiStrSize (Prop->string), Prop->string);
}
}
} else if (FileExists (Entry->Volume->RootDir, L"\\com.apple.recovery.boot\\boot.efi")) {
// Special case - com.apple.recovery.boot/boot.efi exists but SystemVersion.plist doesn't --> 10.9 recovery
OSVersion = AllocateCopyPool (5, "10.9");
OSVersion = (__typeof__(OSVersion))AllocateCopyPool (5, "10.9");
}
}
@ -8149,7 +8149,7 @@ SetDevices (LOADER_ENTRY *Entry)
EFI_PHYSICAL_ADDRESS BufferPtr = EFI_SYSTEM_TABLE_MAX_ADDRESS; //0xFE000000;
device_inject_stringlength = device_inject_string->length * 2;
DBG ("stringlength = %d\n", device_inject_stringlength);
// gDeviceProperties = AllocateAlignedPages EFI_SIZE_TO_PAGES (device_inject_stringlength + 1), 64);
// gDeviceProperties = (__typeof__(gDeviceProperties))AllocateAlignedPages EFI_SIZE_TO_PAGES (device_inject_stringlength + 1), 64);
Status = gBS->AllocatePages (
AllocateMaxAddress,

View File

@ -165,7 +165,7 @@ StartupSoundPlay(EFI_FILE *Dir, CHAR16* SoundFile)
DBG("not found wave data\n");
goto DONE_ERROR;
}
TempData = AllocateZeroPool(Len * sizeof(INT16));
TempData = (__typeof__(TempData))AllocateZeroPool(Len * sizeof(INT16));
Tmp = *(Ptr++);
for (Ind = 0; Ind < WaveData.SamplesLength / 2 - 1; Ind++) {
Next = *(Ptr++);

View File

@ -1226,7 +1226,7 @@ BOOLEAN get_bootdisplay_val(value_t *val, INTN index, BOOLEAN Sier)
v = 1;
val->type = kCst;
val->size = 4;
val->data = AllocatePool(4);
val->data = (__typeof__(val->data))AllocatePool(4);
*(val->data) = (UINT8)v;
return TRUE;
}
@ -1248,7 +1248,7 @@ BOOLEAN get_dual_link_val(value_t *val, INTN index, BOOLEAN Sier)
val->type = kCst;
val->size = 4;
val->data = AllocatePool(4);
val->data = (__typeof__(val->data))AllocatePool(4);
*(val->data) = (UINT8)v;
return TRUE;
}
@ -1276,7 +1276,7 @@ BOOLEAN get_edid_val(value_t *val, INTN index, BOOLEAN Sier)
v = 1;
val->type = kPtr;
val->size = 128;
val->data = AllocateCopyPool(val->size, gSettings.CustomEDID);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, gSettings.CustomEDID);
return TRUE;
}
@ -1292,7 +1292,7 @@ BOOLEAN get_display_type(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kStr;
val->size = (UINT32)AsciiStrSize(dtyp[dti]);
val->data = AllocateCopyPool(val->size, (UINT8 *)dtyp[dti]);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)dtyp[dti]);
return TRUE;
}
@ -1301,7 +1301,7 @@ BOOLEAN get_name_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->type = aty_name.type;
val->size = aty_name.size;
val->data = AllocateCopyPool(aty_name.size, (UINT8 *)aty_name.data);
val->data = (__typeof__(val->data))AllocateCopyPool(aty_name.size, (UINT8 *)aty_name.data);
return TRUE;
}
@ -1309,14 +1309,14 @@ BOOLEAN get_nameparent_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->type = aty_nameparent.type;
val->size = aty_nameparent.size;
val->data = AllocateCopyPool(aty_nameparent.size, (UINT8 *)aty_nameparent.data);
val->data = (__typeof__(val->data))AllocateCopyPool(aty_nameparent.size, (UINT8 *)aty_nameparent.data);
return TRUE;
}
//static CHAR8 pciName[15];
BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
{
CHAR8* pciName = AllocateZeroPool(15);
CHAR8* pciName = (__typeof__(pciName))AllocateZeroPool(15);
if (!card->info->model_name || !gSettings.FakeATI) {
return FALSE;
@ -1333,14 +1333,14 @@ BOOLEAN get_name_pci_val(value_t *val, INTN index, BOOLEAN Sier)
CONST CHAR8* NamePolaris = "AMD Radeon %a";
BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
{
CHAR8 *ModelName = AllocateZeroPool(35);
CHAR8 *ModelName = (__typeof__(ModelName))AllocateZeroPool(35);
if (!card->info->model_name) {
return FALSE;
}
val->type = kStr;
if (card->pci_dev->device_id != 0x67DF) {
val->size = (UINT32)AsciiStrLen(card->info->model_name);
val->data = AllocateCopyPool(val->size, (UINT8 *)card->info->model_name);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)card->info->model_name);
} else {
switch (card->pci_dev->revision) {
case 0xC4:
@ -1366,7 +1366,7 @@ BOOLEAN get_model_val(value_t *val, INTN index, BOOLEAN Sier)
break;
}
val->size = (UINT32)AsciiStrLen(ModelName);
val->data = AllocateCopyPool(val->size, ModelName);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, ModelName);
}
FreePool(ModelName);
return TRUE;
@ -1403,7 +1403,7 @@ BOOLEAN get_conntype_val(value_t *val, INTN index, BOOLEAN Sier)
val->type = kCst;
val->size = 4;
val->data = AllocateCopyPool(val->size, (UINT8 *)&ct[index * Len]);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&ct[index * Len]);
// cti++;
// if(cti > 3) cti = 0;
@ -1423,7 +1423,7 @@ BOOLEAN get_vrammemsize_val(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kCst;
val->size = 8;
val->data = AllocateCopyPool(val->size, (UINT8 *)&memsize);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&memsize);
return TRUE;
}
@ -1434,7 +1434,7 @@ BOOLEAN get_binimage_val(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kPtr;
val->size = card->rom_size;
val->data = AllocateCopyPool(val->size, (UINT8 *)card->rom);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)card->rom);
return TRUE;
}
@ -1445,7 +1445,7 @@ BOOLEAN get_binimage_owr(value_t *val, INTN index, BOOLEAN Sier)
}
val->type = kCst;
val->size = 4;
val->data = AllocatePool(4);
val->data = (__typeof__(val->data))AllocatePool(4);
*(val->data) = 1;
return TRUE;
}
@ -1457,7 +1457,7 @@ BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier)
if (!card->rom){
val->type = kPtr;
val->size = 13;
val->data = AllocateCopyPool(val->size, cRev);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, cRev);
return TRUE;
}
@ -1469,7 +1469,7 @@ BOOLEAN get_romrevision_val(value_t *val, INTN index, BOOLEAN Sier)
rev = (UINT8 *)cRev;
val->size = 13;
}
val->data = AllocateCopyPool(val->size, rev);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, rev);
return TRUE;
}
@ -1477,7 +1477,7 @@ BOOLEAN get_deviceid_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->type = kCst;
val->size = 2;
val->data = AllocateCopyPool(val->size, (UINT8 *)&card->pci_dev->device_id);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&card->pci_dev->device_id);
return TRUE;
}
@ -1499,13 +1499,13 @@ BOOLEAN get_refclk_val(value_t *val, INTN index, BOOLEAN Sier)
//
val->type = kCst;
val->size = 4;
val->data = AllocateCopyPool(val->size, (UINT8 *)&gSettings.RefCLK);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&gSettings.RefCLK);
return TRUE;
}
BOOLEAN get_platforminfo_val(value_t *val, INTN index, BOOLEAN Sier)
{
val->data = AllocateZeroPool(0x80);
val->data = (__typeof__(val->data))AllocateZeroPool(0x80);
if (!val->data)
return FALSE;
@ -1522,7 +1522,7 @@ BOOLEAN get_vramtotalsize_val(value_t *val, INTN index, BOOLEAN Sier)
val->type = kCst;
val->size = 4;
val->data = AllocateCopyPool(val->size, (UINT8 *)&card->vram_size);
val->data = (__typeof__(val->data))AllocateCopyPool(val->size, (UINT8 *)&card->vram_size);
return TRUE;
}
@ -1548,7 +1548,7 @@ VOID devprop_add_list(AtiDevProp devprop_list[], CHAR8 *OSVersion)
{
INTN i, pnum;
BOOLEAN Sier;
value_t *val = AllocateZeroPool(sizeof(value_t));
value_t *val = (__typeof__(val))AllocateZeroPool(sizeof(value_t));
Sier = (AsciiOSVersionToUint64(OSVersion) >= AsciiOSVersionToUint64("10.12"));
@ -1647,7 +1647,7 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id)
}
DBG("Loaded ROM len=%d\n", bufferLen);
card->rom_size = (UINT32)bufferLen;
card->rom = AllocateZeroPool(bufferLen);
card->rom = (__typeof__(card->rom))AllocateZeroPool(bufferLen);
if (!card->rom) {
return FALSE;
}
@ -1728,7 +1728,7 @@ BOOLEAN read_vbios(BOOLEAN from_pci)
return FALSE;
}
card->rom = AllocateZeroPool(card->rom_size);
card->rom = (__typeof__(card->rom))AllocateZeroPool(card->rom_size);
if (!card->rom) {
return FALSE;
}
@ -1897,7 +1897,7 @@ BOOLEAN devprop_add_pci_config_space(VOID)
{
int offset;
UINT8 *config_space = AllocateZeroPool(0x100);
UINT8 *config_space = (__typeof__(config_space))AllocateZeroPool(0x100);
if (!config_space)
return FALSE;
@ -1924,7 +1924,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
UINTN ExpansionRom = 0;
UINTN Reg1, Reg3, Reg5;
card = AllocateZeroPool(sizeof(card_t));
card = (__typeof__(card))AllocateZeroPool(sizeof(card_t));
if (!card) {
return FALSE;
}
@ -1934,7 +1934,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
if (radeon_cards[i].device_id != pci_dev->device_id) {
continue;
}
card->info = AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
card->info = (__typeof__(card->info))AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
if (!card->info->cfg_name) {
card->info->cfg_name = kRadeon;
}
@ -1957,7 +1957,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
DBG("search for brothers family\n");
for (i = 0; radeon_cards[i].device_id ; i++) {
if ((radeon_cards[i].device_id & ~0xf) == (pci_dev->device_id & ~0xf)) {
card->info = AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
card->info = (__typeof__(card->info))AllocateCopyPool(sizeof(radeon_card_info_t), &radeon_cards[i]);
break;
}
}
@ -2019,7 +2019,7 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
NameLen = StrLen(gSettings.FBName);
if (NameLen > 2) { //fool proof: cfg_name is 3 character or more.
CfgName = AllocateZeroPool(NameLen);
CfgName = (__typeof__(CfgName))AllocateZeroPool(NameLen);
UnicodeStrToAsciiStrS((CHAR16*)&gSettings.FBName[0], CfgName, 16);
DBG("Users config name %a\n", CfgName);
card->cfg_name = CfgName;
@ -2057,13 +2057,13 @@ static BOOLEAN init_card(pci_dt_t *pci_dev)
DBG("Nr of ports set to min: %d\n", card->ports);
}
//
name = AllocateZeroPool(24);
name = (__typeof__(name))AllocateZeroPool(24);
AsciiSPrint(name, 24, "ATY,%a", card->cfg_name);
aty_name.type = kStr;
aty_name.size = (UINT32)AsciiStrLen(name);
aty_name.data = (UINT8 *)name;
name_parent = AllocateZeroPool(24);
name_parent = (__typeof__(name_parent))AllocateZeroPool(24);
AsciiSPrint(name_parent, 24, "ATY,%aParent", card->cfg_name);
aty_nameparent.type = kStr;
aty_nameparent.size = (UINT32)AsciiStrLen(name_parent);

View File

@ -107,7 +107,7 @@ UINT8 *Base64DecodeClover(IN CHAR8 *EncodedData, OUT UINTN *DecodedSize)
return NULL;
}
// to simplify, we'll allocate the same size, although smaller size is needed
DecodedData = AllocateZeroPool(EncodedSize);
DecodedData = (__typeof__(DecodedData))AllocateZeroPool(EncodedSize);
base64_init_decodestate(&state_in);
DecodedSizeInternal = base64_decode_block(EncodedData, (const int)EncodedSize, (char*) DecodedData, &state_in);

View File

@ -70,7 +70,7 @@ LIST_ENTRY gCardList = INITIALIZE_LIST_HEAD_VARIABLE (gCardList);
VOID AddCard(CONST CHAR8* Model, UINT32 Id, UINT32 SubId, UINT64 VideoRam, UINTN VideoPorts, BOOLEAN LoadVBios)
{
CARDLIST* new_card;
new_card = AllocateZeroPool(sizeof(CARDLIST));
new_card = (__typeof__(new_card))AllocateZeroPool(sizeof(CARDLIST));
if (new_card) {
new_card->Signature = CARDLIST_SIGNATURE;
new_card->Id = Id;

View File

@ -74,7 +74,7 @@ CHAR8 *get_pci_dev_path(pci_dt_t *PciDt)
return NULL;
devpathstr = FileDevicePathToStr(DevicePath);
Size = StrLen(devpathstr) + 1;
tmp = AllocateZeroPool(Size);
tmp = (__typeof__(tmp))AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(devpathstr, tmp, Size);
return tmp;
@ -137,7 +137,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
if (!DevicePath)
return NULL;
device = AllocateZeroPool(sizeof(DevPropDevice));
device = (__typeof__(device))AllocateZeroPool(sizeof(DevPropDevice));
if (!device) {
return NULL;
}

View File

@ -194,7 +194,7 @@ EFI_STATUS EFIAPI LoadKext(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR
}
}
bundlePathBufferLength = StrLen(FileName) + 1;
bundlePathBuffer = AllocateZeroPool(bundlePathBufferLength);
bundlePathBuffer = (__typeof__(bundlePathBuffer))AllocateZeroPool(bundlePathBufferLength);
UnicodeStrToAsciiStrS(FileName, bundlePathBuffer, bundlePathBufferLength);
kext->length = (UINT32)(sizeof(_BooterKextFileInfo) + infoDictBufferLength + executableBufferLength + bundlePathBufferLength);
@ -221,7 +221,7 @@ EFI_STATUS EFIAPI AddKext(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR1
EFI_STATUS Status;
KEXT_ENTRY *KextEntry;
KextEntry = AllocatePool (sizeof(KEXT_ENTRY));
KextEntry = (__typeof__(KextEntry))AllocatePool (sizeof(KEXT_ENTRY));
KextEntry->Signature = KEXT_SIGNATURE;
Status = LoadKext(Entry, RootDir, FileName, archCpuType, &KextEntry->kext);
if(EFI_ERROR(Status)) {
@ -540,10 +540,10 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry)
// reserve space in the device tree
if (GetKextCount() > 0) {
mm_extra_size = GetKextCount() * (sizeof(DeviceTreeNodeProperty) + sizeof(_DeviceTreeBuffer));
mm_extra = AllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
mm_extra = (__typeof__(mm_extra))AllocateZeroPool(mm_extra_size - sizeof(DeviceTreeNodeProperty));
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"mm_extra", mm_extra, (UINT32)(mm_extra_size - sizeof(DeviceTreeNodeProperty)));
extra_size = GetKextsSize();
extra = AllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
extra = (__typeof__(extra))AllocateZeroPool(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE);
/*Status = */LogDataHub(&gEfiMiscSubClassGuid, L"extra", extra, (UINT32)(extra_size - sizeof(DeviceTreeNodeProperty) + EFI_PAGE_SIZE));
// MsgLog("count: %d \n", GetKextCount());
// MsgLog("mm_extra_size: %d \n", mm_extra_size);

View File

@ -2289,7 +2289,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
}
if (EFI_ERROR(Status)) {
rom = AllocateZeroPool(NVIDIA_ROM_SIZE+1);
rom = (__typeof__(rom))AllocateZeroPool(NVIDIA_ROM_SIZE+1);
// PRAMIN first
read_nVidia_PRAMIN(nvda_dev, rom, nvCardType);
@ -2316,7 +2316,7 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev)
if (buffer[i] == 0x55 && buffer[i+1] == 0xaa) {
DBG(" header found at: %d\n", i);
bufferLen -= i;
rom = AllocateZeroPool(bufferLen);
rom = (__typeof__(rom))AllocateZeroPool(bufferLen);
for (j = 0; j < bufferLen; j++) {
rom[j] = buffer[i+j];
}

View File

@ -86,7 +86,7 @@ void png_alloc_add_node(void *addr, UINT32 size)
png_alloc_node_t *node;
if (png_alloc_find_node(addr, size))
return;
node = AllocateZeroPool(sizeof (png_alloc_node_t));
node = (__typeof__(node))AllocateZeroPool(sizeof (png_alloc_node_t));
node->addr = addr;
node->size = size;
node->prev = png_alloc_tail;
@ -114,7 +114,7 @@ void png_alloc_remove_node(png_alloc_node_t *node)
void *png_alloc_malloc(UINT32 size)
{
void *addr = AllocateZeroPool(size);
void *addr = (__typeof__(addr))AllocateZeroPool(size);
png_alloc_add_node(addr, size);
return addr;
}
@ -127,7 +127,7 @@ void *png_alloc_realloc(void *addr, UINT32 oldSize, UINT32 newSize)
if ( newSize > oldSize ) {
png_alloc_node_t *old_node = png_alloc_find_node(addr, oldSize);
if (old_node) {
void *new_addr = ReallocatePool(oldSize, newSize, addr);
void *new_addr = (__typeof__(new_addr))ReallocatePool(oldSize, newSize, addr);
old_node->addr = new_addr;
old_node->size = newSize;
return new_addr;

View File

@ -541,8 +541,8 @@ PLATFORMDATA ApplePlatformData[] =
VOID SetDMISettingsForModel(MACHINE_TYPES Model, BOOLEAN Redefine)
{
const CHAR8 *i;
CHAR8 *Res1 = AllocateZeroPool(9);
CHAR8 *Res2 = AllocateZeroPool(11);
CHAR8 *Res1 = (__typeof__(Res1))AllocateZeroPool(9);
CHAR8 *Res2 = (__typeof__(Res2))AllocateZeroPool(11);
AsciiStrCpyS (gSettings.VendorName, 64, BiosVendor);
AsciiStrCpyS (gSettings.RomVersion, 64, ApplePlatformData[Model].firmwareVersion);

View File

@ -94,7 +94,7 @@ XMLDecode(CHAR8* src)
len = AsciiStrLen(src);
#if 0
out = AllocateZeroPool(len+1);
out = (__typeof__(out))AllocateZeroPool(len+1);
if (!out)
return 0;
#else // unsafe
@ -213,7 +213,7 @@ EFI_STATUS ParseXML(const CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
return EFI_INVALID_PARAMETER;
}
configBuffer = AllocateZeroPool(bufferSize+1);
configBuffer = (__typeof__(configBuffer))AllocateZeroPool(bufferSize+1);
if(configBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}

View File

@ -2022,8 +2022,8 @@ EFI_STATUS PrepatchSmbios()
}
//Create space for SPD
//gRAM = AllocateZeroPool(sizeof(MEM_STRUCTURE));
//gDMI = AllocateZeroPool(sizeof(DMI));
//gRAM = (__typeof__(gRAM))AllocateZeroPool(sizeof(MEM_STRUCTURE));
//gDMI = (__typeof__(gDMI))AllocateZeroPool(sizeof(DMI));
//Collect information for use in menu
GetTableType1();

View File

@ -540,7 +540,7 @@ UINT16 getDDRspeedMhz(UINT8 * spd)
CHAR8* getDDRSerial(UINT8* spd)
{
CHAR8* asciiSerial; //[16];
asciiSerial = AllocatePool(17);
asciiSerial = (__typeof__(asciiSerial))AllocatePool(17);
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR4) { // DDR4
AsciiSPrint(asciiSerial, 17, "%2X%2X%2X%2X%2X%2X%2X%2X", SMST(325) /*& 0x7*/, SLST(325), SMST(326), SLST(326), SMST(327), SLST(327), SMST(328), SLST(328));
} else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { // DDR3
@ -560,7 +560,7 @@ CHAR8* getDDRPartNum(UINT8* spd, UINT32 base, UINT8 slot)
{
UINT16 i, start=0, index = 0;
CHAR8 c;
CHAR8* asciiPartNo = AllocatePool(32); //[32];
CHAR8* asciiPartNo = (__typeof__(asciiPartNo))AllocatePool(32); //[32];
if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR4) {
start = 329;
@ -671,7 +671,7 @@ STATIC VOID read_smb(EFI_PCI_IO_PROTOCOL *PciIo, UINT16 vid, UINT16 did)
// needed at least for laptops
//fullBanks = (gDMI->MemoryModules == gDMI->CntMemorySlots);
spdbuf = AllocateZeroPool(MAX_SPD_SIZE);
spdbuf = (__typeof__(spdbuf))AllocateZeroPool(MAX_SPD_SIZE);
// Search MAX_RAM_SLOTS slots
//==>

View File

@ -147,7 +147,7 @@ LOADER_ENTRY * DuplicateLoaderEntry(IN LOADER_ENTRY *Entry)
if(Entry == NULL) {
return NULL;
}
DuplicateEntry = AllocateZeroPool(sizeof(LOADER_ENTRY));
DuplicateEntry = (__typeof__(DuplicateEntry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (DuplicateEntry) {
DuplicateEntry->me.Tag = Entry->me.Tag;
DuplicateEntry->me.AtClick = ActionEnter;
@ -226,7 +226,7 @@ CHAR16 *RemoveLoadOption(IN CHAR16 *LoadOptions, IN CHAR16 *LoadOption)
NewLoadOptions = EfiStrDuplicate(LoadOptions + OptionLength);
} else {
// The rest of LoadOptions is Length - OptionLength, but we may need additional space and ending 0
NewLoadOptions = AllocateZeroPool((Length - OptionLength + 2) * sizeof(CHAR16));
NewLoadOptions = (__typeof__(NewLoadOptions))AllocateZeroPool((Length - OptionLength + 2) * sizeof(CHAR16));
// Copy preceeding substring
CopyMem(NewLoadOptions, LoadOptions, Offset * sizeof(CHAR16));
if ((Offset + OptionLength) < Length) {

View File

@ -115,7 +115,7 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *FullTitle, IN CHAR16 *LoaderTitl
VolDesc = (Volume->DiskKind == DISK_KIND_OPTICAL) ? L"CD" : L"HD";
// prepare the menu entry
Entry = AllocateZeroPool(sizeof(LEGACY_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LEGACY_ENTRY));
if (FullTitle) {
Entry->me.Title = EfiStrDuplicate(FullTitle);
} else {
@ -156,13 +156,13 @@ static LEGACY_ENTRY * AddLegacyEntry(IN CHAR16 *FullTitle, IN CHAR16 *LoaderTitl
((Volume->DiskKind == DISK_KIND_EXTERNAL) ? L"USB" : L"HD");
// create the submenu
SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen->Title = PoolPrint(L"Boot Options for %s on %s", LoaderTitle, VolDesc);
SubScreen->TitleImage = Entry->me.Image;
SubScreen->AnimeRun = GetAnime(SubScreen);
// default entry
SubEntry = AllocateZeroPool(sizeof(LEGACY_ENTRY));
SubEntry = (__typeof__(SubEntry))AllocateZeroPool(sizeof(LEGACY_ENTRY));
SubEntry->me.Title = PoolPrint(L"Boot %s", LoaderTitle);
SubEntry->me.Tag = TAG_LEGACY;
SubEntry->Volume = Entry->Volume;

View File

@ -554,7 +554,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CHAR16 *LoaderPath,
}
// prepare the menu entry
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry->me.Tag = TAG_LOADER;
Entry->me.Row = 0;
Entry->Volume = Volume;
@ -758,7 +758,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
FileName = Basename(Entry->LoaderPath);
// create the submenu
SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen->Title = PoolPrint(L"Options for %s", Entry->me.Title, Entry->VolName);
SubScreen->TitleImage = Entry->me.Image;
SubScreen->ID = Entry->LoaderType + 20;
@ -769,7 +769,7 @@ STATIC VOID AddDefaultMenu(IN LOADER_ENTRY *Entry)
AddMenuInfoLine(SubScreen, FileDevicePathToStr(Entry->DevicePath));
Guid = FindGPTPartitionGuidInDevicePath(Volume->DevicePath);
if (Guid) {
CHAR8 *GuidStr = AllocateZeroPool(50);
CHAR8 *GuidStr = (__typeof__(GuidStr))AllocateZeroPool(50);
AsciiSPrint(GuidStr, 50, "%g", Guid);
AddMenuInfoLine(SubScreen, PoolPrint(L"UUID: %a", GuidStr));
FreePool(GuidStr);
@ -1970,7 +1970,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
} else if (Custom->SubEntries != NULL) {
UINTN CustomSubIndex = 0;
// Add subscreen
REFIT_MENU_SCREEN *SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
REFIT_MENU_SCREEN *SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
if (SubScreen) {
SubScreen->Title = PoolPrint(L"Boot Options for %s on %s", (Custom->Title != NULL) ? Custom->Title : CustomPath, Entry->VolName);
SubScreen->TitleImage = Entry->me.Image;
@ -1980,7 +1980,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex,
AddMenuInfoLine(SubScreen, PoolPrint(L"Volume size: %dMb", VolumeSize));
AddMenuInfoLine(SubScreen, FileDevicePathToStr(Entry->DevicePath));
if (Guid) {
CHAR8 *GuidStr = AllocateZeroPool(50);
CHAR8 *GuidStr = (__typeof__(GuidStr))AllocateZeroPool(50);
AsciiSPrint(GuidStr, 50, "%g", Guid);
AddMenuInfoLine(SubScreen, PoolPrint(L"UUID: %a", GuidStr));
FreePool(GuidStr);

View File

@ -666,7 +666,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
SectionPtr = (EFI_IMAGE_SECTION_HEADER *)(ImageBase + PeHeaderOffset + sizeof(EFI_IMAGE_FILE_HEADER) +
sizeof(UINT32) + PeHeader.Pe32->FileHeader.SizeOfOptionalHeader);
// Allocate a new array for the image section headers
Sections = AllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
Sections = (__typeof__(Sections))AllocateZeroPool(sizeof(EFI_IMAGE_SECTION_HEADER) * PeHeader.Pe32->FileHeader.NumberOfSections);
if (Sections == NULL) {
goto Failed;
}
@ -711,7 +711,7 @@ STATIC VOID *CreateImageSignatureDatabase(IN VOID *FileBuffer,
}
// Create the signature list
Size = (sizeof(EFI_SIGNATURE_LIST) + sizeof(EFI_GUID) + 256);
Database = AllocateZeroPool(Size);
Database = (__typeof__(Database))AllocateZeroPool(Size);
if (Database == NULL) {
goto Failed;
}

View File

@ -64,7 +64,7 @@ VOID AddSecureBootTool(VOID)
if (!gSettings.SecureBoot && !gSettings.SecureBootSetupMode) {
return;
}
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (gSettings.SecureBoot) {
Entry->me.Title = PoolPrint(L"Clover Secure Boot Configuration");
Entry->me.Tag = TAG_SECURE_BOOT_CONFIG;

View File

@ -250,7 +250,7 @@ VOID *GetSignatureDatabase(IN CHAR16 *DatabaseName,
return NULL;
}
// Allocate a buffer large enough to hold the database
Database = AllocateZeroPool(Size);
Database = (__typeof__(Database))AllocateZeroPool(Size);
if (Database == NULL) {
return NULL;
}
@ -453,7 +453,7 @@ EFI_STATUS SetSignedVariable(IN CHAR16 *DatabaseName,
EVP_PKEY_free(PrivateKey);
DataSize = i2d_PKCS7(p7, NULL);
Data = AllocateZeroPool(DataSize);
Data = (__typeof__(Data))AllocateZeroPool(DataSize);
i2d_PKCS7(p7, (unsigned char **)&Data);

View File

@ -81,7 +81,7 @@ STATIC BOOLEAN AddToolEntry(IN CHAR16 *LoaderPath, IN CHAR16 *FullTitle, IN CHAR
return FALSE;
}
// Allocate the entry
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (Entry == NULL) {
return FALSE;
}
@ -117,7 +117,7 @@ STATIC VOID AddCloverEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REF
// EFI_STATUS Status;
// prepare the menu entry
Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry = (__typeof__(Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
Entry->me.Title = LoaderTitle;
Entry->me.Tag = TAG_CLOVER;
Entry->me.Row = 1;
@ -138,7 +138,7 @@ STATIC VOID AddCloverEntry(IN CHAR16 *LoaderPath, IN CHAR16 *LoaderTitle, IN REF
Entry->me.AtRightClick = ActionDetails;
// create the submenu
SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen = (__typeof__(SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
SubScreen->Title = EfiStrDuplicate(LoaderTitle);
SubScreen->TitleImage = Entry->me.Image;
SubScreen->ID = SCREEN_BOOT;

View File

@ -114,7 +114,7 @@ EfiLibFileSystemVolumeLabelInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
VolumeInfo = AllocateZeroPool (Size);
VolumeInfo = (__typeof__(VolumeInfo))AllocateZeroPool (Size);
Status = FHand->GetInfo (FHand, &gEfiFileSystemVolumeLabelInfoIdGuid, &Size, VolumeInfo);
// Check to make sure this isn't actually EFI_FILE_SYSTEM_INFO
if (!EFI_ERROR(Status))
@ -155,7 +155,7 @@ EfiStrDuplicate (
UINTN Size;
Size = StrSize (Src); //at least 2bytes
Dest = AllocatePool (Size);
Dest = (__typeof__(Dest))AllocatePool (Size);
// ASSERT (Dest != NULL);
if (Dest != NULL) {
CopyMem (Dest, Src, Size);
@ -242,7 +242,7 @@ EfiLibFileInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
FileInfo = AllocateZeroPool (Size);
FileInfo = (__typeof__(FileInfo))AllocateZeroPool (Size);
Status = FHand->GetInfo (FHand, &gEfiFileInfoGuid, &Size, FileInfo);
}
@ -262,7 +262,7 @@ EfiLibFileSystemInfo (
if (Status == EFI_BUFFER_TOO_SMALL) {
// inc size by 2 because some drivers (HFSPlus.efi) do not count 0 at the end of file name
Size += 2;
FileSystemInfo = AllocateZeroPool (Size);
FileSystemInfo = (__typeof__(FileSystemInfo))AllocateZeroPool (Size);
Status = FHand->GetInfo (FHand, &gEfiFileSystemInfoGuid, &Size, FileSystemInfo);
}
@ -319,7 +319,7 @@ EfiReallocatePool (
NewPool = NULL;
if (NewSize != 0) {
NewPool = AllocateZeroPool (NewSize);
NewPool = (__typeof__(NewPool))AllocateZeroPool (NewSize);
}
if (OldPool != NULL) {

View File

@ -320,7 +320,7 @@ VOID QuickSort(VOID* Array, INTN Low, INTN High, INTN Size, INTN (*compare)(CONS
INTN i = Low, j = High;
VOID *Med, *Temp;
Med = Array + ((Low + High) / 2) * Size; // Central element, just pointer
Temp = AllocatePool(Size);
Temp = (__typeof__(Temp))AllocatePool(Size);
// Sort around center
while (i <= j)
{

View File

@ -327,7 +327,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
}
// DBG("next icon=%s Len=%d\n", ptr, StrLen(ptr));
UINTN Size = StrLen(ptr)+1;
IconName = AllocateZeroPool(Size);
IconName = (__typeof__(IconName))AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(ptr, IconName, Size);
// DBG("search for icon name %a\n", IconName);
CHAR8 IconNight[64];
@ -396,7 +396,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
}
//banner animation
GUI_ANIME *Anime = AllocateZeroPool (sizeof(GUI_ANIME));
GUI_ANIME *Anime = (__typeof__(Anime))AllocateZeroPool (sizeof(GUI_ANIME));
Anime->ID = 1; //main screen
//there is no Anime->Path in vectors
Anime->Frames = NumFrames;
@ -410,7 +410,7 @@ EFI_STATUS ParseSVGTheme(CONST CHAR8* buffer, TagPtr * dict, UINT32 bufSize)
nsvgDeleteRasterizer(rast);
*dict = AllocateZeroPool(sizeof(TagStruct));
*dict = (__typeof__(*dict))AllocateZeroPool(sizeof(TagStruct));
(*dict)->type = kTagTypeNone;
GlobalConfig.TypeSVG = TRUE;
GlobalConfig.ThemeDesignHeight = (int)SVGimage->height;

View File

@ -564,7 +564,7 @@ EG_IMAGE * egLoadIcon(IN EFI_FILE_HANDLE BaseDir, IN CHAR16 *FileName, IN UINTN
}
CHAR16 *ptr2 = StrStr(ptr, L".");
Size = ptr2 - ptr + 2;
IconName = AllocateZeroPool(Size);
IconName = (__typeof__(IconName))AllocateZeroPool(Size);
UnicodeStrToAsciiStrS(ptr, IconName, Size - 1);
while (OSIconsTable[i].name) {

View File

@ -54,7 +54,7 @@ extern void qsort(void *a, size_t n, size_t es, int (*cmp)(const void *, const v
// rewrite by RehabMan
void* lodepng_malloc(size_t size)
{
size_t* p = AllocateZeroPool(size+sizeof(size_t));
size_t* p = (__typeof__(p))AllocateZeroPool(size+sizeof(size_t));
if (!p) {
return NULL;
}
@ -75,7 +75,7 @@ void* lodepng_realloc(void* ptr, size_t new_size)
return lodepng_malloc(new_size);
}
size_t* old_p = (size_t*)ptr-1;
size_t* new_p = ReallocatePool(*old_p, new_size+sizeof(size_t), old_p);
size_t* new_p = (__typeof__(new_p))ReallocatePool(*old_p, new_size+sizeof(size_t), old_p);
if (!new_p) {
return NULL;
}

View File

@ -2861,7 +2861,7 @@ static void nsvg__parseText(NSVGparser* p, const char** dict)
if (!p1) {
DBG("font %a not parsed\n", text->fontFace->fontFamily);
} else {
fontSVG = AllocateCopyPool(sizeof(NSVGfont), p1->font);
fontSVG = (__typeof__(fontSVG))AllocateCopyPool(sizeof(NSVGfont), p1->font);
// DBG("font family %a parsed\n", fontSVG->fontFamily);
fontSVG->next = fontsDB;
fontsDB = fontSVG;
@ -3202,7 +3202,7 @@ static void parsePattern(NSVGparser* p, const char** dict)
}
}
pt = AllocateZeroPool(sizeof(NSVGpattern));
pt = (__typeof__(pt))AllocateZeroPool(sizeof(NSVGpattern));
AsciiStrCpyS(pt->id, 64, attr->id);
pt->width = w;
pt->height = h;

View File

@ -92,7 +92,7 @@ void nsvg_qsort(NSVGedge* Array, int Low, int High)
int Imed;
Imed = (Low + High) / 2; // Central element, just pointer
float med = Array[Imed].y0;
// Temp = AllocatePool(sizeof(NSVGedge));
// Temp = (__typeof__(Temp))AllocatePool(sizeof(NSVGedge));
// Sort around center
while (i <= j) {
while (Array[i].y0 < med) i++;

View File

@ -775,7 +775,7 @@ Returns:
return EFI_OUT_OF_RESOURCES;
}
Buffer = AllocateZeroPool (sizeof (CHAR16) * PRINT_STRING_LEN);
Buffer = (__typeof__(Buffer))AllocateZeroPool (sizeof (CHAR16) * PRINT_STRING_LEN);
if (NULL == Buffer) {
FreePool (Item.Scratch);
return EFI_OUT_OF_RESOURCES;
@ -1303,7 +1303,7 @@ Returns:
//
newlen += PRINT_STRING_LEN;
spc->Maxlen = newlen;
spc->Str = EfiReallocatePool (
spc->Str = (__typeof__(spc->Str))EfiReallocatePool (
spc->Str,
spc->Len * sizeof (CHAR16),
spc->Maxlen * sizeof (CHAR16)
@ -1926,7 +1926,7 @@ CHAR8* Bytes2HexStr(UINT8 *data, UINTN len)
{
UINTN i, j, b = 0;
CHAR8 *result = (CHAR8*)AllocateZeroPool((len*2)+1);
//CHAR8 *buf = AllocateZeroPool(2);
//CHAR8 *buf = (__typeof__(buf))AllocateZeroPool(2);
for (i = j = 0; i < len; i++) {
b = data[i] >> 4;

View File

@ -198,7 +198,7 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
SelfDeviceHandle = SelfLoadedImage->DeviceHandle;
TmpDevicePath = DevicePathFromHandle (SelfDeviceHandle);
DevicePathSize = GetDevicePathSize (TmpDevicePath);
SelfDevicePath = AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
SelfDevicePath = (__typeof__(SelfDevicePath))AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
CopyMem(SelfDevicePath, TmpDevicePath, DevicePathSize);
DBG("SelfDevicePath=%s @%x\n", FileDevicePathToStr(SelfDevicePath), SelfDeviceHandle);
@ -215,7 +215,7 @@ EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle)
FilePathAsString[1] = 0;
}
} else {
FilePathAsString = AllocateCopyPool(StrSize(L"\\"), L"\\");
FilePathAsString = (__typeof__(FilePathAsString))AllocateCopyPool(StrSize(L"\\"), L"\\");
}
SelfDirPath = FilePathAsString;
@ -342,7 +342,7 @@ VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialEl
*ElementCount = InitialElementCount;
if (*ElementCount > 0) {
AllocateCount = (*ElementCount + 7) & ~7; // next multiple of 8
*ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);
*ListPtr = (__typeof__(*ListPtr))AllocatePool(sizeof(VOID *) * AllocateCount);
} else {
*ListPtr = NULL;
}
@ -355,9 +355,9 @@ VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID
if ((*ElementCount & 7) == 0) {
AllocateCount = *ElementCount + 8;
if (*ElementCount == 0)
*ListPtr = AllocatePool(sizeof(VOID *) * AllocateCount);
*ListPtr = (__typeof__(*ListPtr))AllocatePool(sizeof(VOID *) * AllocateCount);
else
*ListPtr = EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
*ListPtr = (__typeof__(*ListPtr))EfiReallocatePool((VOID *)*ListPtr, sizeof(VOID *) * (*ElementCount), sizeof(VOID *) * AllocateCount);
}
(*ListPtr)[*ElementCount] = NewElement;
(*ElementCount)++;
@ -484,7 +484,7 @@ static VOID ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl
BlockSize = Volume->BlockIO->Media->BlockSize;
if (BlockSize > 2048)
return; // our buffer is too small... the bred of thieve of cable
SectorBuffer = AllocateAlignedPages(EFI_SIZE_TO_PAGES (2048), 16); //align to 16 byte?! Poher
SectorBuffer = (__typeof__(SectorBuffer))AllocateAlignedPages(EFI_SIZE_TO_PAGES (2048), 16); //align to 16 byte?! Poher
ZeroMem((CHAR8*)&SectorBuffer[0], 2048);
// look at the boot sector (this is used for both hard disks and El Torito images!)
Status = Volume->BlockIO->ReadBlocks(Volume->BlockIO, Volume->BlockIO->Media->MediaId,
@ -720,7 +720,7 @@ static VOID ScanVolumeBootcode(IN OUT REFIT_VOLUME *Volume, OUT BOOLEAN *Bootabl
if (MbrTable[i].Flags != 0x00 && MbrTable[i].Flags != 0x80)
MbrTableFound = FALSE;
if (MbrTableFound) {
Volume->MbrPartitionTable = AllocatePool(4 * 16);
Volume->MbrPartitionTable = (__typeof__(Volume->MbrPartitionTable))AllocatePool(4 * 16);
CopyMem(Volume->MbrPartitionTable, MbrTable, 4 * 16);
Volume->BootType = BOOTING_BY_MBR;
}
@ -751,7 +751,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume)
// get device path
DiskDevicePath = DevicePathFromHandle(Volume->DeviceHandle);
DevicePathSize = GetDevicePathSize (DiskDevicePath);
Volume->DevicePath = AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
Volume->DevicePath = (__typeof__(Volume->DevicePath))AllocateAlignedPages(EFI_SIZE_TO_PAGES(DevicePathSize), 64);
CopyMem(Volume->DevicePath, DiskDevicePath, DevicePathSize);
Volume->DevicePathString = FileDevicePathToStr(Volume->DevicePath);
@ -1034,7 +1034,7 @@ static VOID ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_I
MBR_PARTITION_INFO *EMbrTable;
ExtBase = MbrEntry->StartLBA;
SectorBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), WholeDiskVolume->BlockIO->Media->IoAlign);
SectorBuffer = (__typeof__(SectorBuffer))AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), WholeDiskVolume->BlockIO->Media->IoAlign);
for (ExtCurrent = ExtBase; ExtCurrent; ExtCurrent = NextExtCurrent) {
// read current EMBR
@ -1060,7 +1060,7 @@ static VOID ScanExtendedPartition(REFIT_VOLUME *WholeDiskVolume, MBR_PARTITION_I
} else {
// found a logical partition
Volume = AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume = (__typeof__(Volume))AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume->DiskKind = WholeDiskVolume->DiskKind;
Volume->IsMbrPartition = TRUE;
Volume->MbrPartitionIndex = LogicalPartitionIndex++;
@ -1110,8 +1110,8 @@ VOID ScanVolumes(VOID)
// first pass: collect information about all handles
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Volume = AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume->LegacyOS = AllocateZeroPool(sizeof(LEGACY_OS));
Volume = (__typeof__(Volume))AllocateZeroPool(sizeof(REFIT_VOLUME));
Volume->LegacyOS = (__typeof__(Volume->LegacyOS))AllocateZeroPool(sizeof(LEGACY_OS));
Volume->DeviceHandle = Handles[HandleIndex];
if (Volume->DeviceHandle == SelfDeviceHandle) {
SelfVolume = Volume;
@ -1155,7 +1155,7 @@ VOID ScanVolumes(VOID)
// DBG("Found %d volumes\n", VolumesCount);
if (SelfVolume == NULL){
DBG(" WARNING: SelfVolume not found"); //Slice - and what?
SelfVolume = AllocateZeroPool(sizeof(REFIT_VOLUME));
SelfVolume = (__typeof__(SelfVolume))AllocateZeroPool(sizeof(REFIT_VOLUME));
SelfVolume->DeviceHandle = SelfDeviceHandle;
SelfVolume->DevicePath = SelfDevicePath;
SelfVolume->RootDir = SelfRootDir;
@ -1198,8 +1198,8 @@ VOID ScanVolumes(VOID)
if (WholeDiskVolume != NULL && WholeDiskVolume->MbrPartitionTable != NULL) {
// check if this volume is one of the partitions in the table
MbrTable = WholeDiskVolume->MbrPartitionTable;
SectorBuffer1 = AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
SectorBuffer2 = AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
SectorBuffer1 = (__typeof__(SectorBuffer1))AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
SectorBuffer2 = (__typeof__(SectorBuffer2))AllocateAlignedPages (EFI_SIZE_TO_PAGES (512), 16);
for (PartitionIndex = 0; PartitionIndex < 4; PartitionIndex++) {
// check size
@ -1419,7 +1419,7 @@ EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry,
// read next directory entry
LastBufferSize = BufferSize = 256;
Buffer = AllocateZeroPool (BufferSize);
Buffer = (__typeof__(Buffer))AllocateZeroPool (BufferSize);
for (IterCount = 0; ; IterCount++) {
Status = Directory->Read(Directory, &BufferSize, Buffer);
if (Status != EFI_BUFFER_TOO_SMALL || IterCount >= 4)
@ -1432,7 +1432,7 @@ EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry,
DBG("Reallocating buffer from %d to %d\n", LastBufferSize, BufferSize);
#endif
}
Buffer = EfiReallocatePool(Buffer, LastBufferSize, BufferSize);
Buffer = (__typeof__(Buffer))EfiReallocatePool(Buffer, LastBufferSize, BufferSize);
LastBufferSize = BufferSize;
}
if (EFI_ERROR(Status)) {
@ -1693,7 +1693,7 @@ BOOLEAN DumpVariable(CHAR16* Name, EFI_GUID* Guid, INTN DevicePathAt)
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
if (Status == EFI_BUFFER_TOO_SMALL) {
data = AllocateZeroPool(dataSize);
data = (__typeof__(data))AllocateZeroPool(dataSize);
Status = gRT->GetVariable (Name, Guid, NULL, &dataSize, data);
if (EFI_ERROR(Status)) {
DBG("Can't get %s, size=%d\n", Name, dataSize);

View File

@ -146,7 +146,7 @@ Add_ListElement(
//
// Create a new list entry
//
CurrentList = AllocateZeroPool (sizeof (REFIT_LIST));
CurrentList = (__typeof__(CurrentList))AllocateZeroPool (sizeof (REFIT_LIST));
if (!CurrentList) {
return EFI_OUT_OF_RESOURCES;

View File

@ -459,7 +459,7 @@ VOID FilterBootPatches(IN LOADER_ENTRY *Entry)
VOID ReadSIPCfg()
{
UINT32 csrCfg = gSettings.CsrActiveConfig & CSR_VALID_FLAGS;
CHAR16 *csrLog = AllocateZeroPool(SVALUE_MAX_SIZE);
CHAR16 *csrLog = (__typeof__(csrLog))AllocateZeroPool(SVALUE_MAX_SIZE);
if (csrCfg & CSR_ALLOW_UNTRUSTED_KEXTS)
StrCatS(csrLog, SVALUE_MAX_SIZE/2, L"CSR_ALLOW_UNTRUSTED_KEXTS");
@ -648,7 +648,7 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry)
if (Entry->OSVersion != NULL) {
FreePool(Entry->OSVersion);
}
Entry->OSVersion = AllocateCopyPool(AsciiStrLen(InstallerVersion)+1, InstallerVersion);
Entry->OSVersion = (__typeof__(Entry->OSVersion))AllocateCopyPool(AsciiStrLen(InstallerVersion)+1, InstallerVersion);
Entry->OSVersion[AsciiStrLen(InstallerVersion)] = '\0';
// DBG("Corrected OSVersion: %a\n", Entry->OSVersion);
}
@ -1202,10 +1202,10 @@ static VOID ScanDriverDir(IN CHAR16 *Path, OUT EFI_HANDLE **DriversToConnect, OU
if (DriversArrSize == 0) {
// new array
DriversArrSize = 16;
DriversArr = AllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
DriversArr = (__typeof__(DriversArr))AllocateZeroPool(sizeof(EFI_HANDLE) * DriversArrSize);
} else if (DriversArrNum + 1 == DriversArrSize) {
// extend array
DriversArr = ReallocatePool(DriversArrSize, DriversArrSize + 16, DriversArr);
DriversArr = (__typeof__(DriversArr))ReallocatePool(DriversArrSize, DriversArrSize + 16, DriversArr);
DriversArrSize += 16;
}
DriversArr[DriversArrNum] = DriverHandle;
@ -1672,7 +1672,7 @@ VOID SetVariablesFromNvram()
// use and forget old one
// DeleteNvramVariable(L"boot-args", &gEfiAppleBootGuid);
Size = AsciiStrLen(tmpString); // some EFI implementations include '\0' in Size, and others don't, so update Size to string length
arg = AllocatePool(Size+1);
arg = (__typeof__(arg))AllocatePool(Size+1);
/* if (AsciiStrStr(tmpString, "nvda_drv=1")) { //found substring
gSettings.NvidiaWeb = TRUE;
@ -1869,7 +1869,7 @@ UINT8 *APFSContainer_Support(VOID) {
EFI_GUID *TmpUUID = NULL;
//Fill APFSUUIDBank
APFSUUIDBank = AllocateZeroPool(0x10*VolumesCount);
APFSUUIDBank = (__typeof__(APFSUUIDBank))AllocateZeroPool(0x10*VolumesCount);
for (VolumeIndex = 0; VolumeIndex < VolumesCount; VolumeIndex++) {
Volume = Volumes[VolumeIndex];
//Check that current volume - apfs partition
@ -1945,13 +1945,13 @@ VOID SystemVersionInit(VOID)
/*Allocate Memory for systemplists, installplists and recoveryplists********************/
//Check apfs support
if (APFSSupport == TRUE) {
SystemPlists = AllocateZeroPool((2*APFSUUIDBankCounter+3)*sizeof(CHAR16 *));//array of pointers
InstallPlists = AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
RecoveryPlists = AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
SystemPlists = (__typeof__(SystemPlists))AllocateZeroPool((2*APFSUUIDBankCounter+3)*sizeof(CHAR16 *));//array of pointers
InstallPlists = (__typeof__(InstallPlists))AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
RecoveryPlists = (__typeof__(RecoveryPlists))AllocateZeroPool((APFSUUIDBankCounter+2)*sizeof(CHAR16 *));//array of pointers
} else {
SystemPlists = AllocateZeroPool(sizeof(CHAR16 *)*3);
InstallPlists = AllocateZeroPool(sizeof(CHAR16 *)*2);
RecoveryPlists = AllocateZeroPool(sizeof(CHAR16 *)*2);
SystemPlists = (__typeof__(SystemPlists))AllocateZeroPool(sizeof(CHAR16 *)*3);
InstallPlists = (__typeof__(InstallPlists))AllocateZeroPool(sizeof(CHAR16 *)*2);
RecoveryPlists = (__typeof__(RecoveryPlists))AllocateZeroPool(sizeof(CHAR16 *)*2);
}
/* Fill it with standard paths*******************************************/
SystemPlists[0] = SystemVersionPlist;
@ -1967,10 +1967,10 @@ VOID SystemVersionInit(VOID)
//Store UUID from bank
CHAR16 *CurrentUUID = GuidLEToStr((EFI_GUID *)((UINT8 *)APFSUUIDBank+i*0x10));
//Init temp string with system/install/recovery APFS path
CHAR16 *TmpSysPlistPath = AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpServerPlistPath = AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpInsPlistPath = AllocateZeroPool(79*sizeof(CHAR16));
CHAR16 *TmpRecPlistPath = AllocateZeroPool(58*sizeof(CHAR16));
CHAR16 *TmpSysPlistPath = (__typeof__(TmpSysPlistPath))AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpServerPlistPath = (__typeof__(TmpServerPlistPath))AllocateZeroPool(86*sizeof(CHAR16));
CHAR16 *TmpInsPlistPath = (__typeof__(TmpInsPlistPath))AllocateZeroPool(79*sizeof(CHAR16));
CHAR16 *TmpRecPlistPath = (__typeof__(TmpRecPlistPath))AllocateZeroPool(58*sizeof(CHAR16));
StrnCpy(TmpSysPlistPath, APFSSysPlistPath, 85);
StrnCpy(TmpServerPlistPath, APFSServerPlistPath, 85);
StrnCpy(TmpInsPlistPath, APFSInstallPlistPath, 78);
@ -2828,7 +2828,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
Description = PoolPrint(L"Clover start %s at %s", (LoaderName != NULL)?LoaderName:L"legacy", VolName);
OptionalDataSize = NameSize + Name2Size + 4 + 2; //signature + VolNameSize
OptionalData = AllocateZeroPool(OptionalDataSize);
OptionalData = (__typeof__(OptionalData))AllocateZeroPool(OptionalDataSize);
if (OptionalData == NULL) {
break;
}

View File

@ -260,23 +260,23 @@ VOID FillInputs(BOOLEAN New)
InputItemsCount = 0;
if (New) {
InputItems = AllocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
InputItems = (__typeof__(InputItems))AllocateZeroPool(130 * sizeof(INPUT_ITEM)); //XXX
}
InputItems[InputItemsCount].ItemType = ASString; //0
//even though Ascii we will keep value as Unicode to convert later
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(SVALUE_MAX_SIZE);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, L"%a ", gSettings.BootArgs);
InputItems[InputItemsCount].ItemType = UNIString; //1
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(32);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(32);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 32, L"%s", gSettings.DsdtName); // 1-> 2
InputItems[InputItemsCount].ItemType = UNIString; //2
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(63);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(63);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 63, L"%s", gSettings.BlockKexts);
@ -291,12 +291,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.SlpSmiEnable;
InputItems[InputItemsCount].ItemType = Decimal; //7
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.PLimitDict);
InputItems[InputItemsCount].ItemType = Decimal; //8
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.UnderVoltStep);
InputItems[InputItemsCount].ItemType = BoolValue; //9
@ -311,7 +311,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.EnableISS;
InputItems[InputItemsCount].ItemType = Decimal; //14
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.QPI);
InputItems[InputItemsCount].ItemType = BoolValue; //15
@ -320,17 +320,17 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.PatchVBios;
InputItems[InputItemsCount].ItemType = Decimal; //17
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%x", gPlatformFeature);
InputItems[InputItemsCount].ItemType = Hex; //18
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(36);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(36);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 36, L"0x%X", gSettings.BacklightLevel);
InputItems[InputItemsCount].ItemType = Decimal; //19
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
if (gSettings.BusSpeed > 20000) {
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.BusSpeed);
@ -341,7 +341,7 @@ VOID FillInputs(BOOLEAN New)
for (i=0; i<NGFX; i++) {
InputItems[InputItemsCount].ItemType = ASString; //20+i*6
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gGraphics[i].Model);
@ -350,7 +350,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.InjectATI;
InputItems[InputItemsCount].ItemType = ASString; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
if (StrLen(gSettings.FBName) > 2) { //fool proof: cfg_name is 3 character or more.
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 20, L"%s", gSettings.FBName);
@ -365,7 +365,7 @@ VOID FillInputs(BOOLEAN New)
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02x", gSettings.Dcfg[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(40);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(40);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 40, L"%a", tmp);
@ -375,7 +375,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.InjectIntel;
InputItems[InputItemsCount].ItemType = Hex; //22+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.IgPlatform);
// InputItemsCount += 3;
@ -384,7 +384,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //23+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
if (gSettings.VideoPorts > 0) {
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.VideoPorts);
@ -398,13 +398,13 @@ VOID FillInputs(BOOLEAN New)
AsciiSPrint((CHAR8*)&tmp[2*j], 3, "%02x", gSettings.NVCAP[j]);
}
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(84);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(84);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 84, L"%a", tmp);
} else { //ATI and others there will be connectors
InputItems[InputItemsCount].ItemType = Hex; //24+6i
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(20);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 20, L"%08lx", gGraphics[i].Connectors);
}
@ -430,13 +430,13 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //50
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.RefCLK);
InputItems[InputItemsCount].ItemType = ASString; //51 OS version if non-detected
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(SVALUE_MAX_SIZE);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, L"%a ", NonDetected);
@ -446,12 +446,12 @@ VOID FillInputs(BOOLEAN New)
//VendorEDID & ProductEDID 53, 54
InputItems[InputItemsCount].ItemType = Decimal; //53
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.VendorEDID);
InputItems[InputItemsCount].ItemType = Decimal; //54
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.ProductEDID);
@ -468,7 +468,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.HDAInjection;
InputItems[InputItemsCount].ItemType = Decimal; // 60
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.HDALayoutId);
@ -479,13 +479,13 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //62
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(24);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 24, L"0x%08x", gFwFeatures);
InputItems[InputItemsCount].ItemType = Hex; //63
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(24);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 24, L"0x%08x", gFwFeaturesMask);
@ -510,12 +510,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Decimal; //70
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(8);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.PointerSpeed);
InputItems[InputItemsCount].ItemType = Decimal; //71
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%04d", gSettings.DoubleClickTime);
InputItems[InputItemsCount].ItemType = BoolValue; //72
@ -529,68 +529,68 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //75
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.C3Latency);
InputItems[InputItemsCount].ItemType = Decimal; //76
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%02d", gSettings.EnabledCores);
InputItems[InputItemsCount].ItemType = Decimal; //77
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%02d", gSettings.SavingMode);
InputItems[InputItemsCount].ItemType = ASString; //78
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.ProductName);
InputItems[InputItemsCount].ItemType = ASString; //79
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.VersionNr);
InputItems[InputItemsCount].ItemType = ASString; //80
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.SerialNr);
InputItems[InputItemsCount].ItemType = ASString; //81
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardNumber);
InputItems[InputItemsCount].ItemType = ASString; //82
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardSerialNumber);
InputItems[InputItemsCount].ItemType = Decimal; //83
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.BoardType);
InputItems[InputItemsCount].ItemType = ASString; //84
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardVersion);
InputItems[InputItemsCount].ItemType = Decimal; //85
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.ChassisType);
InputItems[InputItemsCount].ItemType = ASString; //86
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.RomVersion);
InputItems[InputItemsCount].ItemType = ASString; //87
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.ReleaseDate);
@ -611,38 +611,38 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //94
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeATI);
InputItems[InputItemsCount].ItemType = Hex; //95
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeNVidia);
InputItems[InputItemsCount].ItemType = Hex; //96
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeIntel);
InputItems[InputItemsCount].ItemType = Hex; //97
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeLAN);
InputItems[InputItemsCount].ItemType = Hex; //98
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeWIFI);
InputItems[InputItemsCount].ItemType = Hex; //99
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeSATA);
InputItems[InputItemsCount].ItemType = Hex; //100
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeXHCI);
InputItems[InputItemsCount].ItemType = CheckBit; //101
@ -652,12 +652,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].BValue = gSettings.DebugDSDT;
InputItems[InputItemsCount].ItemType = Hex; //103
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeIMEI);
InputItems[InputItemsCount].ItemType = Hex; //104
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(26);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.KernelAndKextPatches.FakeCPUID);
@ -674,7 +674,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //109
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%01x", gSettings.DualLink);
@ -685,7 +685,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //112
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.IntelMaxValue);
@ -700,12 +700,12 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = ASString; //117
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.EfiVersion);
InputItems[InputItemsCount].ItemType = ASString; //118
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(64);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BooterCfgStr);
@ -713,7 +713,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount++].IValue = 119;
InputItems[InputItemsCount].ItemType = Decimal; //120
if (New) {
InputItems[InputItemsCount].SValue = AllocateZeroPool(16);
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16);
}
UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%04d", DefaultAudioVolume);
@ -1339,7 +1339,7 @@ VOID AddMenuInfo(REFIT_MENU_SCREEN *SubScreen, CHAR16 *Line)
{
REFIT_INPUT_DIALOG *InputBootArgs;
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", Line);
InputBootArgs->Entry.Tag = TAG_INFO;
InputBootArgs->Item = NULL;
@ -2262,7 +2262,7 @@ static UINTN InputDialog(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Style
(Item->ItemType != RadioSwitch) &&
(Item->ItemType != CheckBit)) {
// Grow Item->SValue to SVALUE_MAX_SIZE if we want to edit a text field
Item->SValue = EfiReallocatePool(Item->SValue, StrSize(Item->SValue), SVALUE_MAX_SIZE);
Item->SValue = (__typeof__(Item->SValue))EfiReallocatePool(Item->SValue, StrSize(Item->SValue), SVALUE_MAX_SIZE);
}
Buffer = Item->SValue;
@ -3098,7 +3098,7 @@ VOID DrawBCSText(IN CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
// if the text exceeds the given limit
if (TextLen > MaxTextLen) {
BCSText = AllocatePool((sizeof(CHAR16) * MaxTextLen) + 1);
BCSText = (__typeof__(BCSText))AllocatePool((sizeof(CHAR16) * MaxTextLen) + 1);
// error check, not enough memory
if (!BCSText) {
@ -4014,8 +4014,8 @@ VOID MainMenuVerticalStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State,
textPosY = TimeoutPosY - (int)(GlobalConfig.TileYSpace * GlobalConfig.Scale) - MessageHeight; //message text
row1PosY = textPosY - row1TileSize - (int)(GlobalConfig.TileYSpace * GlobalConfig.Scale) - LayoutTextOffset;
if (!itemPosX) {
itemPosX = AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosY = AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosX = (__typeof__(itemPosX))AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosY = (__typeof__(itemPosY))AllocatePool(sizeof(UINT64) * Screen->EntryCount);
}
row0PosYRunning = row0PosY;
row1PosXRunning = row1PosX;
@ -4187,7 +4187,7 @@ VOID MainMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, IN UINT
FunctextPosY = row1PosY + row1TileSize + (INTN)((GlobalConfig.TileYSpace + LayoutTextOffset) * GlobalConfig.Scale);
if (!itemPosX) {
itemPosX = AllocatePool(sizeof(UINT64) * Screen->EntryCount);
itemPosX = (__typeof__(itemPosX))AllocatePool(sizeof(UINT64) * Screen->EntryCount);
}
row0PosXRunning = row0PosX;
@ -4356,18 +4356,18 @@ UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_MENU_ENTRY **ChosenEntry)
VOID NewEntry(REFIT_MENU_ENTRY **Entry, REFIT_MENU_SCREEN **SubScreen, ACTION AtClick, UINTN ID, CONST CHAR8 *Title)
{
//create entry
*Entry = AllocateZeroPool(sizeof(LOADER_ENTRY));
*Entry = (__typeof__(*Entry))AllocateZeroPool(sizeof(LOADER_ENTRY));
if (Title) {
(*Entry)->Title = PoolPrint(L"%a", Title);
} else {
(*Entry)->Title = AllocateZeroPool(128);
(*Entry)->Title = (__typeof__((*Entry)->Title))AllocateZeroPool(128);
}
(*Entry)->Image = OptionMenu.TitleImage;
(*Entry)->Tag = TAG_OPTIONS;
(*Entry)->AtClick = AtClick;
// create the submenu
*SubScreen = AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
*SubScreen = (__typeof__(*SubScreen))AllocateZeroPool(sizeof(REFIT_MENU_SCREEN));
(*SubScreen)->Title = (*Entry)->Title;
(*SubScreen)->TitleImage = (*Entry)->Image;
(*SubScreen)->ID = ID;
@ -4379,7 +4379,7 @@ VOID AddMenuCheck(REFIT_MENU_SCREEN *SubScreen, CONST CHAR8 *Text, UINTN Bit, IN
{
REFIT_INPUT_DIALOG *InputBootArgs;
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%a", Text);
InputBootArgs->Entry.Tag = TAG_CHECKBIT;
InputBootArgs->Entry.Row = Bit;
@ -4412,7 +4412,7 @@ VOID ModifyTitles(REFIT_MENU_ENTRY *ChosenEntry)
VOID AddMenuItem(REFIT_MENU_SCREEN *SubScreen, INTN Inx, CONST CHAR8 *Title, UINTN Tag, BOOLEAN Cursor)
{
REFIT_INPUT_DIALOG *InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
REFIT_INPUT_DIALOG *InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%a", Title);
InputBootArgs->Entry.Tag = Tag;
@ -4605,7 +4605,7 @@ REFIT_MENU_ENTRY *SubMenuKextPatches()
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXTS, "Custom kexts patches->");
for (Index = 0; Index < NrKexts; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%30a", KextPatchesMenu[Index].Label);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4645,7 +4645,7 @@ REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CHAR16* UniSysVer)
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KEXT_INJECT, sysVer);
AddMenuInfoLine(SubScreen, PoolPrint(L"Choose/check kext to disable:"));
}
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s, v.%s", Kext->FileName, Kext->Version);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4656,7 +4656,7 @@ REFIT_MENU_ENTRY *SubMenuKextBlockInjection(CHAR16* UniSysVer)
SIDELOAD_KEXT *plugInKext = Kext->PlugInList;
while (plugInKext) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L" |-- %s, v.%s", plugInKext->FileName, plugInKext->Version);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4809,7 +4809,7 @@ REFIT_MENU_ENTRY *SubMenuKernelPatches()
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_KERNELS, "Custom kernel patches->");
for (Index = 0; Index < NrKernels; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%30a", KernelPatchesMenu[Index].Label);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4835,7 +4835,7 @@ REFIT_MENU_ENTRY *SubMenuBootPatches()
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_BOOTER, "Custom booter patches->");
for (Index = 0; Index < NrBoots; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%30a", BootPatchesMenu[Index].Label);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4906,7 +4906,7 @@ REFIT_MENU_ENTRY *SubMenuDropTables()
// sign, DropTable->Signature,
// OTID, DropTable->TableId,
// DropTable->Length, DropTable->Length);
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"Drop \"%4.4a\" \"%8.8a\" %d", sign, OTID, DropTable->Length);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -4926,7 +4926,7 @@ REFIT_MENU_ENTRY *SubMenuDropTables()
if (ACPIPatchedAML) {
ACPI_PATCHED_AML *ACPIPatchedAMLTmp = ACPIPatchedAML;
while (ACPIPatchedAMLTmp) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"Drop \"%s\"", ACPIPatchedAMLTmp->FileName);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -5068,7 +5068,7 @@ REFIT_MENU_ENTRY *SubMenuDSDTPatches() //yyyy
NewEntry(&Entry, &SubScreen, ActionEnter, SCREEN_DSDT_PATCHES, "Custom DSDT patches->");
for (Index = 0; Index < PatchDsdtNum; Index++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%a", gSettings.PatchDsdtLabel[Index]);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -5095,7 +5095,7 @@ REFIT_MENU_ENTRY *SubMenuDsdts()
AddMenuItem(SubScreen, 116, "BIOS.aml", TAG_SWITCH, FALSE);
for (i = 0; i < DsdtsNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", DsdtsList[i]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i + 1;
@ -5147,7 +5147,7 @@ REFIT_MENU_ENTRY *SubMenuAudioPort()
AddMenuItem(SubScreen, 120, "Volume:", TAG_INPUT, TRUE);
for (i = 0; i < AudioNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s_%a", AudioList[i].Name, OutputNames[AudioList[i].Device]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i;
@ -5165,7 +5165,7 @@ VOID CreateMenuProps(REFIT_MENU_SCREEN *SubScreen, DEV_PROPERTY *Prop)
{
REFIT_INPUT_DIALOG *InputBootArgs;
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L" key: %a", Prop->Key);
InputBootArgs->Entry.Tag = TAG_INPUT;
InputBootArgs->Entry.Row = 0xFFFF; //cursor
@ -5277,7 +5277,7 @@ REFIT_MENU_ENTRY *SubMenuThemes()
AddMenuItem(SubScreen, 3, "embedded", TAG_SWITCH, FALSE);
for (i = 0; i < ThemesNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", ThemesList[i]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i + 1;
@ -5412,7 +5412,7 @@ REFIT_MENU_ENTRY *SubMenuConfigs()
AddMenuInfoLine(SubScreen, L"Select a config file:");
for (i = 0; i < ConfigsNum; i++) {
InputBootArgs = AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs = (__typeof__(InputBootArgs))AllocateZeroPool(sizeof(REFIT_INPUT_DIALOG));
InputBootArgs->Entry.Title = PoolPrint(L"%s", ConfigsList[i]);
InputBootArgs->Entry.Tag = TAG_SWITCH;
InputBootArgs->Entry.Row = i;

View File

@ -229,7 +229,7 @@ VOID TerminateScreen(VOID)
static VOID DrawScreenHeader(IN CHAR16 *Title)
{
UINTN i;
CHAR16* BannerLine = AllocatePool((ConWidth + 1) * sizeof(CHAR16));
CHAR16* BannerLine = (__typeof__(BannerLine))AllocatePool((ConWidth + 1) * sizeof(CHAR16));
BannerLine[ConWidth] = 0;
// clear to black background
@ -1051,7 +1051,7 @@ VOID InitAnime(REFIT_MENU_SCREEN *Screen)
// Copy some settings from Anime into Screen
Screen->FrameTime = Anime->FrameTime;
Screen->Once = Anime->Once;
Screen->Theme = AllocateCopyPool(StrSize(GlobalConfig.Theme), GlobalConfig.Theme);
Screen->Theme = (__typeof__(Screen->Theme))AllocateCopyPool(StrSize(GlobalConfig.Theme), GlobalConfig.Theme);
} /*else {
DBG("Film[0] == NULL\n");
} */
@ -1146,7 +1146,7 @@ static VOID UpdateConsoleVars()
}
// make a buffer for a whole text line
BlankLine = AllocatePool((ConWidth + 1) * sizeof(CHAR16));
BlankLine = (__typeof__(BlankLine))AllocatePool((ConWidth + 1) * sizeof(CHAR16));
for (i = 0; i < ConWidth; i++) {
BlankLine[i] = ' ';