Fixed Implicit Casting

This commit is contained in:
SmokelessCPU 2022-08-04 12:27:44 +02:00
parent aae6b7c55c
commit b5deb50112
4 changed files with 18 additions and 18 deletions

View file

@ -2,7 +2,7 @@
#include "Utility.h" #include "Utility.h"
EFI_STATUS LoadFS(EFI_HANDLE ImageHandle, CHAR8 *FileName, EFI_LOADED_IMAGE_PROTOCOL **ImageInfo, EFI_HANDLE *AppImageHandle) EFI_STATUS LoadFS(EFI_HANDLE ImageHandle, CHAR8 *FileName, EFI_LOADED_IMAGE_PROTOCOL **ImageInfo, EFI_HANDLE *AppImageHandle)
{ {
UINTN ExitDataSize; //UINTN ExitDataSize;
UINTN NumHandles; UINTN NumHandles;
UINTN Index; UINTN Index;
EFI_HANDLE *SFS_Handles; EFI_HANDLE *SFS_Handles;
@ -108,7 +108,7 @@ EFI_STATUS FindLoadedImageFromName(EFI_HANDLE ImageHandle, CHAR8 *FileName, EFI_
for (UINTN i = 0; i < HandleSize; i++) for (UINTN i = 0; i < HandleSize; i++)
{ {
Status = gBS->HandleProtocol(Handles[i], &gEfiLoadedImageProtocolGuid, ImageInfo); Status = gBS->HandleProtocol(Handles[i], &gEfiLoadedImageProtocolGuid, (VOID **)ImageInfo);
if (Status == EFI_SUCCESS) if (Status == EFI_SUCCESS)
{ {
CHAR16 *String = FindLoadedImageFileName(*ImageInfo); CHAR16 *String = FindLoadedImageFileName(*ImageInfo);

View file

@ -301,8 +301,8 @@ EFI_STATUS EFIAPI SREPEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *Syst
Prev_OP->ARG3 = 0xFFFFFFFF; Prev_OP->ARG3 = 0xFFFFFFFF;
Prev_OP->ARG6 = AsciiStrLen(&ConfigData[curr_pos]) / 2; Prev_OP->ARG6 = AsciiStrLen(&ConfigData[curr_pos]) / 2;
Print(L"Found %d Bytes\n\r", Prev_OP->ARG6); Print(L"Found %d Bytes\n\r", Prev_OP->ARG6);
Prev_OP->ARG7 = AllocateZeroPool(Prev_OP->ARG6); Prev_OP->ARG7 = (UINT64)AllocateZeroPool(Prev_OP->ARG6);
AsciiStrHexToBytes(&ConfigData[curr_pos], Prev_OP->ARG6 * 2, Prev_OP->ARG7, Prev_OP->ARG6); AsciiStrHexToBytes(&ConfigData[curr_pos], Prev_OP->ARG6 * 2, (UINT8 *)Prev_OP->ARG7, Prev_OP->ARG6);
} }
continue; continue;
} }
@ -313,10 +313,10 @@ EFI_STATUS EFIAPI SREPEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *Syst
Prev_OP->ARG4 = AsciiStrLen(&ConfigData[curr_pos]) / 2; Prev_OP->ARG4 = AsciiStrLen(&ConfigData[curr_pos]) / 2;
Print(L"Found %d Bytes\n\r", Prev_OP->ARG4); Print(L"Found %d Bytes\n\r", Prev_OP->ARG4);
Prev_OP->ARG5_Dyn_Alloc = TRUE; Prev_OP->ARG5_Dyn_Alloc = TRUE;
Prev_OP->ARG5 = AllocateZeroPool(Prev_OP->ARG4); Prev_OP->ARG5 = (UINT64)AllocateZeroPool(Prev_OP->ARG4);
AsciiStrHexToBytes(&ConfigData[curr_pos], Prev_OP->ARG4 * 2, Prev_OP->ARG5, Prev_OP->ARG4); AsciiStrHexToBytes(&ConfigData[curr_pos], Prev_OP->ARG4 * 2, (UINT8 *)Prev_OP->ARG5, Prev_OP->ARG4);
Print(L"Patch Byte\n\r"); Print(L"Patch Byte\n\r");
PrintDump(Prev_OP->ARG4, Prev_OP->ARG5); PrintDump(Prev_OP->ARG4, (UINT8 *)Prev_OP->ARG5);
continue; continue;
} }
} }
@ -350,7 +350,7 @@ EFI_STATUS EFIAPI SREPEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *Syst
break; break;
case PATCH: case PATCH:
Print(L"Patching Image Size %x: \n\r", ImageInfo->ImageSize); Print(L"Patching Image Size %x: \n\r", ImageInfo->ImageSize);
PrintDump(next->ARG6, next->ARG7); PrintDump(next->ARG6, (UINT8 *)next->ARG7);
PrintDump(next->ARG6, ((UINT8 *)ImageInfo->ImageBase) + 0x1A383); PrintDump(next->ARG6, ((UINT8 *)ImageInfo->ImageBase) + 0x1A383);
// PrintDump(0x200, (UINT8 *)(LoadedImage->ImageBase)); // PrintDump(0x200, (UINT8 *)(LoadedImage->ImageBase));
@ -360,7 +360,7 @@ EFI_STATUS EFIAPI SREPEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *Syst
Print(L"Finding Offset\n\r"); Print(L"Finding Offset\n\r");
for (UINTN i = 0; i < ImageInfo->ImageSize - next->ARG6; i += 1) for (UINTN i = 0; i < ImageInfo->ImageSize - next->ARG6; i += 1)
{ {
if (CompareMem(((UINT8 *)ImageInfo->ImageBase) + i, next->ARG7, next->ARG6) == 0) if (CompareMem(((UINT8 *)ImageInfo->ImageBase) + i, (UINT8 *)next->ARG7, next->ARG6) == 0)
{ {
next->ARG3 = i; next->ARG3 = i;
Print(L"Found at %x\n\r", i); Print(L"Found at %x\n\r", i);
@ -384,7 +384,7 @@ EFI_STATUS EFIAPI SREPEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *Syst
BaseOffset = next->ARG3; BaseOffset = next->ARG3;
Print(L"Offset %x\n\r", next->ARG3); Print(L"Offset %x\n\r", next->ARG3);
// PrintDump(next->ARG4+10,ImageInfo->ImageBase + next->ARG3 -5 ); // PrintDump(next->ARG4+10,ImageInfo->ImageBase + next->ARG3 -5 );
CopyMem(ImageInfo->ImageBase + next->ARG3, next->ARG5, next->ARG4); CopyMem(ImageInfo->ImageBase + next->ARG3, (UINT8 *)next->ARG5, next->ARG4);
Print(L"Patched\n\r"); Print(L"Patched\n\r");
// PrintDump(next->ARG4+10,ImageInfo->ImageBase + next->ARG3 -5 ); // PrintDump(next->ARG4+10,ImageInfo->ImageBase + next->ARG3 -5 );
break; break;

View file

@ -53,7 +53,7 @@ FindLoadedImageFileName(
return Buffer; return Buffer;
} }
UINT8 *FindBaseAddressFromName(CHAR16 **Name) UINT8 *FindBaseAddressFromName(const CHAR16 *Name)
{ {
EFI_STATUS Status; EFI_STATUS Status;
UINTN HandleSize = 0; UINTN HandleSize = 0;
@ -70,7 +70,7 @@ UINT8 *FindBaseAddressFromName(CHAR16 **Name)
EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocol; EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocol;
for (UINTN i = 0; i < HandleSize; i++) for (UINTN i = 0; i < HandleSize; i++)
{ {
Status = gBS->HandleProtocol(Handles[i], &gEfiLoadedImageProtocolGuid, &LoadedImageProtocol); Status = gBS->HandleProtocol(Handles[i], &gEfiLoadedImageProtocolGuid, (VOID **)&LoadedImageProtocol);
if (Status == EFI_SUCCESS) if (Status == EFI_SUCCESS)
{ {
CHAR16 *String = FindLoadedImageFileName(LoadedImageProtocol); CHAR16 *String = FindLoadedImageFileName(LoadedImageProtocol);
@ -152,13 +152,13 @@ LocateAndLoadFvFromName(CHAR16 *Name, EFI_SECTION_TYPE Section_Type, UINT8 **Buf
EFI_STATUS Status; EFI_STATUS Status;
EFI_HANDLE *HandleBuffer; EFI_HANDLE *HandleBuffer;
UINTN NumberOfHandles; UINTN NumberOfHandles;
UINT32 FvStatus; //UINT32 FvStatus;
EFI_FV_FILE_ATTRIBUTES Attributes; //EFI_FV_FILE_ATTRIBUTES Attributes;
UINTN Size; // UINTN Size;
UINTN Index; UINTN Index;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance; EFI_FIRMWARE_VOLUME2_PROTOCOL *FvInstance;
FvStatus = 0; // FvStatus = 0;
// //
// Locate protocol. // Locate protocol.
@ -219,7 +219,7 @@ LocateAndLoadFvFromName(CHAR16 *Name, EFI_SECTION_TYPE Section_Type, UINT8 **Buf
Print(L"Guid :%g, FileSize %d, Name : %s, Type %d \n\r", NameGuid, FileSize, String, FileType); Print(L"Guid :%g, FileSize %d, Name : %s, Type %d \n\r", NameGuid, FileSize, String, FileType);
Status = FvInstance->ReadSection(FvInstance, &NameGuid, Section_Type, 0, Buffer, BufferSize, &AuthenticationStatus); Status = FvInstance->ReadSection(FvInstance, &NameGuid, Section_Type, 0,(VOID **) Buffer, BufferSize, &AuthenticationStatus);
Print(L"Result Cause %r\n\r", Status); Print(L"Result Cause %r\n\r", Status);
FreePool(String); FreePool(String);
return EFI_SUCCESS; return EFI_SUCCESS;

View file

@ -32,6 +32,6 @@ EFI_STATUS LoadandRunImage(EFI_HANDLE ImageHandle,
CHAR16 *FileName, CHAR16 *FileName,
EFI_HANDLE *AppImageHandle); EFI_HANDLE *AppImageHandle);
UINT8 * FindBaseAddressFromName(CHAR16 **Name); UINT8 *FindBaseAddressFromName(const CHAR16 *Name);
EFI_STATUS LocateAndLoadFvFromName(CHAR16 *Name, EFI_SECTION_TYPE Section_Type,UINT8 **Buffer,UINTN *BufferSize); EFI_STATUS LocateAndLoadFvFromName(CHAR16 *Name, EFI_SECTION_TYPE Section_Type,UINT8 **Buffer,UINTN *BufferSize);