OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
KextInject.c File Reference
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcTemplateLib.h>
#include <Library/OcSerializeLib.h>
#include <Library/OcMiscLib.h>
#include <Library/OcAppleKernelLib.h>
#include <string.h>
#include <sys/time.h>
#include <UserFile.h>

Go to the source code of this file.

Functions

STATIC VOID ApplyKextPatches (IN OUT PRELINKED_CONTEXT *Context)
 
VOID ApplyKernelPatches (IN OUT UINT8 *Kernel, IN UINT32 Size)
 
EFI_STATUS OcGetFileData (IN EFI_FILE_PROTOCOL *File, IN UINT32 Position, IN UINT32 Size, OUT UINT8 *Buffer)
 
EFI_STATUS OcGetFileSize (IN EFI_FILE_PROTOCOL *File, OUT UINT32 *Size)
 
int WrapMain (int argc, char *argv[])
 
int LLVMFuzzerTestOneInput (const uint8_t *Data, size_t Size)
 
int ENTRY_POINT (int argc, char *argv[])
 

Variables

STATIC BOOLEAN FailedToProcess = FALSE
 
STATIC UINT32 KernelVersion = 0
 
STATIC EFI_FILE_PROTOCOL NilFileProtocol
 
STATIC UINT8 * mPrelinked = NULL
 
STATIC UINT32 mPrelinkedSize = 0
 
STATIC CONST CHAR8 KextInfoPlistData []
 
STATIC CONST UINT8 DisableIOAHCIPatchReplace []
 
STATIC PATCHER_GENERIC_PATCH DisableIOAHCIPatch
 
STATIC CONST UINT8 DisableKernelLog []
 
STATIC PATCHER_GENERIC_PATCH DisableIoLogPatch
 

Detailed Description

Copyright (C) 2018, vit9696. All rights reserved.

All rights reserved.

This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

Definition in file KextInject.c.

Function Documentation

◆ ApplyKernelPatches()

VOID ApplyKernelPatches ( IN OUT UINT8 * Kernel,
IN UINT32 Size )

Definition at line 427 of file KextInject.c.

◆ ApplyKextPatches()

STATIC VOID ApplyKextPatches ( IN OUT PRELINKED_CONTEXT * Context)

Definition at line 228 of file KextInject.c.

◆ ENTRY_POINT()

int ENTRY_POINT ( int argc,
char * argv[] )

Definition at line 919 of file KextInject.c.

◆ LLVMFuzzerTestOneInput()

int LLVMFuzzerTestOneInput ( const uint8_t * Data,
size_t Size )

< FIXME: has no executable

Definition at line 859 of file KextInject.c.

◆ OcGetFileData()

EFI_STATUS OcGetFileData ( IN EFI_FILE_PROTOCOL * File,
IN UINT32 Position,
IN UINT32 Size,
OUT UINT8 * Buffer )

Read exact amount of bytes from EFI_FILE_PROTOCOL at specified position.

Parameters
[in]FileA pointer to the file protocol.
[in]PositionPosition to read data from.
[in]SizeThe size of the data read.
[out]BufferA pointer to previously allocated buffer to read data to.
Return values
EFI_SUCCESSon success.

Definition at line 556 of file KextInject.c.

◆ OcGetFileSize()

EFI_STATUS OcGetFileSize ( IN EFI_FILE_PROTOCOL * File,
OUT UINT32 * Size )

Determine file size if it is less than 4 GB.

Parameters
[in]FileA pointer to the file protocol.
[out]Size32-bit file size.
Return values
EFI_SUCCESSon success.

Definition at line 574 of file KextInject.c.

◆ WrapMain()

int WrapMain ( int argc,
char * argv[] )

Definition at line 585 of file KextInject.c.

Variable Documentation

◆ DisableIOAHCIPatch

STATIC PATCHER_GENERIC_PATCH DisableIOAHCIPatch
Initial value:
= {
.Base = "__ZN10IOAHCIPort5startEP9IOService",
.Find = NULL,
.Mask = NULL,
.ReplaceMask = NULL,
.Size = sizeof (DisableIOAHCIPatchReplace),
.Count = 1,
.Skip = 0
}
STATIC CONST UINT8 DisableIOAHCIPatchReplace[]
Definition KextInject.c:191

Definition at line 197 of file KextInject.c.

◆ DisableIOAHCIPatchReplace

STATIC CONST UINT8 DisableIOAHCIPatchReplace[]
Initial value:
= {
0x31, 0xC0, 0xC3
}

Definition at line 191 of file KextInject.c.

◆ DisableIoLogPatch

STATIC PATCHER_GENERIC_PATCH DisableIoLogPatch
Initial value:
= {
.Base = "_IOLog",
.Find = NULL,
.Mask = NULL,
.Replace = DisableKernelLog,
.Size = sizeof (DisableKernelLog),
.Count = 1,
.Skip = 0
}
STATIC CONST UINT8 DisableKernelLog[]
Definition KextInject.c:210

Definition at line 216 of file KextInject.c.

◆ DisableKernelLog

STATIC CONST UINT8 DisableKernelLog[]
Initial value:
= {
0xC3
}

Definition at line 210 of file KextInject.c.

◆ FailedToProcess

STATIC BOOLEAN FailedToProcess = FALSE

Definition at line 27 of file KextInject.c.

◆ KernelVersion

STATIC UINT32 KernelVersion = 0

Definition at line 28 of file KextInject.c.

◆ KextInfoPlistData

STATIC CONST CHAR8 KextInfoPlistData[]

Definition at line 37 of file KextInject.c.

◆ mPrelinked

STATIC UINT8* mPrelinked = NULL

Definition at line 32 of file KextInject.c.

◆ mPrelinkedSize

STATIC UINT32 mPrelinkedSize = 0

Definition at line 33 of file KextInject.c.

◆ NilFileProtocol

STATIC EFI_FILE_PROTOCOL NilFileProtocol

Definition at line 30 of file KextInject.c.