OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
TestExt4Dxe.c File Reference
#include <Ext4Dxe.h>
#include <UserFile.h>
#include <UserGlobalVar.h>
#include <UserMemory.h>
#include <UserUnicodeCollation.h>
#include <string.h>

Go to the source code of this file.

Macros

#define OPEN_FILE_MODES_COUNT   3
 

Functions

EFI_STATUS Ext4InitialiseUnicodeCollation (EFI_HANDLE DriverHandle)
 
INTN Ext4StrCmpInsensitive (IN CHAR16 *Str1, IN CHAR16 *Str2)
 
EFI_STATUS EFIAPI EfiLibInstallAllDriverProtocols2 (IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL)
 
EFI_STATUS EFIAPI EfiLibUninstallAllDriverProtocols2 (IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName, OPTIONAL IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2, OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration, OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL *DriverConfiguration2, OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL *DriverDiagnostics, OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL)
 
EFI_STATUS EFIAPI WrapInstallMultipleProtocolInterfaces (IN OUT EFI_HANDLE *Handle,...)
 
VOID FreeAll (IN CHAR16 *FileName, IN EXT4_PARTITION *Part)
 
EFI_STATUS EFIAPI FuzzReadDisk (IN EFI_DISK_IO_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, OUT VOID *Buffer)
 
STATIC INT32 TestExt4Dxe (CONST UINT8 *FuzzData, UINTN FuzzSize)
 
INT32 LLVMFuzzerTestOneInput (CONST UINT8 *FuzzData, UINTN FuzzSize)
 
int ENTRY_POINT (int argc, char **argv)
 

Variables

STATIC UINTN mFuzzOffset
 
STATIC UINTN mFuzzSize
 
STATIC CONST UINT8 * mFuzzPointer
 
STATIC EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * mEfiSfsInterface
 
STATIC UINT64 mOpenFileModes [OPEN_FILE_MODES_COUNT] = { EFI_FILE_MODE_READ, EFI_FILE_MODE_WRITE, EFI_FILE_MODE_CREATE }
 

Detailed Description

Copyright (c) 2022, Mikhail Krichanov. All rights reserved. SPDX-License-Identifier: BSD-3-Clause

Definition in file TestExt4Dxe.c.

Macro Definition Documentation

◆ OPEN_FILE_MODES_COUNT

#define OPEN_FILE_MODES_COUNT   3

Definition at line 13 of file TestExt4Dxe.c.

Function Documentation

◆ EfiLibInstallAllDriverProtocols2()

EFI_STATUS EFIAPI EfiLibInstallAllDriverProtocols2 ( IN CONST EFI_HANDLE ImageHandle,
IN CONST EFI_SYSTEM_TABLE * SystemTable,
IN EFI_DRIVER_BINDING_PROTOCOL * DriverBinding,
IN EFI_HANDLE DriverBindingHandle,
IN CONST EFI_COMPONENT_NAME_PROTOCOL * ComponentName,
OPTIONAL IN CONST EFI_COMPONENT_NAME2_PROTOCOL * ComponentName2,
OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL * DriverConfiguration,
OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL * DriverConfiguration2,
OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL * DriverDiagnostics,
OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL )

Definition at line 63 of file TestExt4Dxe.c.

◆ EfiLibUninstallAllDriverProtocols2()

EFI_STATUS EFIAPI EfiLibUninstallAllDriverProtocols2 ( IN EFI_DRIVER_BINDING_PROTOCOL * DriverBinding,
IN CONST EFI_COMPONENT_NAME_PROTOCOL * ComponentName,
OPTIONAL IN CONST EFI_COMPONENT_NAME2_PROTOCOL * ComponentName2,
OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION_PROTOCOL * DriverConfiguration,
OPTIONAL IN CONST EFI_DRIVER_CONFIGURATION2_PROTOCOL * DriverConfiguration2,
OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS_PROTOCOL * DriverDiagnostics,
OPTIONAL IN CONST EFI_DRIVER_DIAGNOSTICS2_PROTOCOL *DriverDiagnostics2 OPTIONAL )

Definition at line 82 of file TestExt4Dxe.c.

◆ ENTRY_POINT()

int ENTRY_POINT ( int argc,
char ** argv )

Definition at line 496 of file TestExt4Dxe.c.

◆ Ext4InitialiseUnicodeCollation()

EFI_STATUS Ext4InitialiseUnicodeCollation ( EFI_HANDLE DriverHandle)

Initialises Unicode collation, which is needed for case-insensitive string comparisons within the driver (a good example of an application of this is filename comparison).

Parameters
[in]DriverHandleHandle to the driver image.
Return values
EFI_SUCCESSUnicode collation was successfully initialised.
!EFI_SUCCESSFailure.

Definition at line 33 of file TestExt4Dxe.c.

◆ Ext4StrCmpInsensitive()

INTN Ext4StrCmpInsensitive ( IN CHAR16 * Str1,
IN CHAR16 * Str2 )

Does a case-insensitive string comparison. Refer to EFI_UNICODE_COLLATION_PROTOCOL's StriColl for more details.

Parameters
[in]Str1Pointer to a null terminated string.
[in]Str2Pointer to a null terminated string.
Return values
0Str1 is equivalent to Str2.
>0Str1 is lexically greater than Str2.
<0Str1 is lexically less than Str2.

Definition at line 53 of file TestExt4Dxe.c.

◆ FreeAll()

VOID FreeAll ( IN CHAR16 * FileName,
IN EXT4_PARTITION * Part )

Definition at line 138 of file TestExt4Dxe.c.

◆ FuzzReadDisk()

EFI_STATUS EFIAPI FuzzReadDisk ( IN EFI_DISK_IO_PROTOCOL * This,
IN UINT32 MediaId,
IN UINT64 Offset,
IN UINTN BufferSize,
OUT VOID * Buffer )

Definition at line 168 of file TestExt4Dxe.c.

◆ LLVMFuzzerTestOneInput()

INT32 LLVMFuzzerTestOneInput ( CONST UINT8 * FuzzData,
UINTN FuzzSize )

Definition at line 457 of file TestExt4Dxe.c.

◆ TestExt4Dxe()

STATIC INT32 TestExt4Dxe ( CONST UINT8 * FuzzData,
UINTN FuzzSize )

Definition at line 193 of file TestExt4Dxe.c.

◆ WrapInstallMultipleProtocolInterfaces()

EFI_STATUS EFIAPI WrapInstallMultipleProtocolInterfaces ( IN OUT EFI_HANDLE * Handle,
... )

Definition at line 98 of file TestExt4Dxe.c.

Variable Documentation

◆ mEfiSfsInterface

STATIC EFI_SIMPLE_FILE_SYSTEM_PROTOCOL* mEfiSfsInterface

Definition at line 19 of file TestExt4Dxe.c.

◆ mFuzzOffset

STATIC UINTN mFuzzOffset

Definition at line 15 of file TestExt4Dxe.c.

◆ mFuzzPointer

STATIC CONST UINT8* mFuzzPointer

Definition at line 17 of file TestExt4Dxe.c.

◆ mFuzzSize

STATIC UINTN mFuzzSize

Definition at line 16 of file TestExt4Dxe.c.

◆ mOpenFileModes

STATIC UINT64 mOpenFileModes[OPEN_FILE_MODES_COUNT] = { EFI_FILE_MODE_READ, EFI_FILE_MODE_WRITE, EFI_FILE_MODE_CREATE }

Definition at line 21 of file TestExt4Dxe.c.