OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
Helper.h File Reference
#include "Driver.h"

Go to the source code of this file.

Data Structures

struct  _STACK_ELEMENT
 
struct  FSHELP_CTX
 
struct  FSHELP_ITER_CTX
 

Macros

#define FSHELP_TYPE_MASK   0xff
 
#define FSHELP_CASE_INSENSITIVE   0x100
 
#define LEAP_YEAR   ((Year % 400U == 0) || ((Year % 4U == 0) && (Year % 100U != 0)))
 
#define YEAR_IN_100NS   (365ULL * DAY_IN_100NS)
 
#define DAY_IN_100NS   (24ULL * HOUR_IN_100NS)
 
#define HOUR_IN_100NS   (60ULL * MINUTE_IN_100NS)
 
#define MINUTE_IN_100NS   (60U * SECOND_IN_100NS)
 
#define SECOND_IN_100NS   10000000U
 
#define UNIT_IN_NS   100U
 
#define GREGORIAN_START   1601U
 

Typedefs

typedef struct _STACK_ELEMENT STACK_ELEMENT
 

Enumerations

enum  FSHELP_FILETYPE { FSHELP_UNKNOWN , FSHELP_REG , FSHELP_DIR , FSHELP_SYMLINK }
 
enum  FUNCTION_TYPE { INFO_HOOK , DIR_HOOK , FILE_ITER }
 

Functions

VOID FreeAttr (IN NTFS_ATTR *Attr)
 
VOID FreeFile (IN NTFS_FILE *File)
 
EFI_STATUS EFIAPI DiskRead (IN EFI_FS *FileSystem, IN UINT64 Offset, IN UINTN Size, IN OUT VOID *Buffer)
 
EFI_STATUS EFIAPI ReadMftRecord (IN EFI_NTFS_FILE *File, OUT UINT8 *Buffer, IN UINT64 RecordNumber)
 
EFI_STATUS EFIAPI ReadAttr (IN NTFS_ATTR *NtfsAttr, OUT UINT8 *Dest, IN UINT64 Offset, IN UINTN Length)
 
EFI_STATUS EFIAPI ReadData (IN NTFS_ATTR *NtfsAttr, IN UINT8 *pa, OUT UINT8 *Dest, IN UINT64 Offset, IN UINTN Length)
 
EFI_STATUS EFIAPI ReadRunListElement (IN OUT RUNLIST *Runlist)
 
EFI_STATUS NtfsDir (IN EFI_FS *FileSystem, IN CONST CHAR16 *Path, OUT EFI_NTFS_FILE *File, IN FUNCTION_TYPE FunctionType)
 
EFI_STATUS NtfsOpen (IN EFI_NTFS_FILE *File)
 
EFI_STATUS NtfsMount (IN EFI_FS *FileSystem)
 
EFI_STATUS EFIAPI Fixup (IN UINT8 *Buffer, IN UINT64 Length, IN UINT32 Magic, IN UINTN SectorSize)
 
EFI_STATUS InitAttr (OUT NTFS_ATTR *Attr, IN NTFS_FILE *File)
 
UINT8 * LocateAttr (IN NTFS_ATTR *Attr, IN NTFS_FILE *Mft, IN UINT32 Type)
 
UINT8 * FindAttr (IN NTFS_ATTR *Attr, IN UINT32 Type)
 
EFI_STATUS EFIAPI InitFile (IN OUT NTFS_FILE *File, IN UINT64 RecordNumber)
 
EFI_STATUS FsHelpFindFile (IN CONST CHAR16 *Path, IN NTFS_FILE *RootNode, OUT NTFS_FILE **FoundNode, IN FSHELP_FILETYPE Type)
 
EFI_STATUS IterateDir (IN NTFS_FILE *dir, IN VOID *FileOrCtx, IN FUNCTION_TYPE FunctionType)
 
EFI_STATUS RelativeToAbsolute (OUT CHAR16 *Dest, IN CHAR16 *Source)
 
CHAR16 * ReadSymlink (IN NTFS_FILE *Node)
 
EFI_STATUS Decompress (IN RUNLIST *Runlist, IN UINT64 Offset, IN UINTN Length, OUT UINT8 *Dest)
 
VOID NtfsToEfiTime (EFI_TIME *EfiTime, UINT64 NtfsTime)
 

Detailed Description

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

Functional and structural descriptions follow NTFS Documentation by Richard Russon and Yuval Fledel

Definition in file Helper.h.

Macro Definition Documentation

◆ DAY_IN_100NS

#define DAY_IN_100NS   (24ULL * HOUR_IN_100NS)

Definition at line 21 of file Helper.h.

◆ FSHELP_CASE_INSENSITIVE

#define FSHELP_CASE_INSENSITIVE   0x100

Definition at line 15 of file Helper.h.

◆ FSHELP_TYPE_MASK

#define FSHELP_TYPE_MASK   0xff

Definition at line 14 of file Helper.h.

◆ GREGORIAN_START

#define GREGORIAN_START   1601U

Definition at line 26 of file Helper.h.

◆ HOUR_IN_100NS

#define HOUR_IN_100NS   (60ULL * MINUTE_IN_100NS)

Definition at line 22 of file Helper.h.

◆ LEAP_YEAR

#define LEAP_YEAR   ((Year % 400U == 0) || ((Year % 4U == 0) && (Year % 100U != 0)))

Definition at line 19 of file Helper.h.

◆ MINUTE_IN_100NS

#define MINUTE_IN_100NS   (60U * SECOND_IN_100NS)

Definition at line 23 of file Helper.h.

◆ SECOND_IN_100NS

#define SECOND_IN_100NS   10000000U

Definition at line 24 of file Helper.h.

◆ UNIT_IN_NS

#define UNIT_IN_NS   100U

Definition at line 25 of file Helper.h.

◆ YEAR_IN_100NS

#define YEAR_IN_100NS   (365ULL * DAY_IN_100NS)

Definition at line 20 of file Helper.h.

Typedef Documentation

◆ STACK_ELEMENT

typedef struct _STACK_ELEMENT STACK_ELEMENT

Enumeration Type Documentation

◆ FSHELP_FILETYPE

Enumerator
FSHELP_UNKNOWN 
FSHELP_REG 
FSHELP_DIR 
FSHELP_SYMLINK 

Definition at line 28 of file Helper.h.

◆ FUNCTION_TYPE

Enumerator
INFO_HOOK 
DIR_HOOK 
FILE_ITER 

Definition at line 54 of file Helper.h.

Function Documentation

◆ Decompress()

EFI_STATUS Decompress ( IN RUNLIST * Runlist,
IN UINT64 Offset,
IN UINTN Length,
OUT UINT8 * Dest )

Definition at line 549 of file Compression.c.

◆ DiskRead()

EFI_STATUS EFIAPI DiskRead ( IN EFI_FS * FileSystem,
IN UINT64 Offset,
IN UINTN Size,
IN OUT VOID * Buffer )

Definition at line 116 of file Data.c.

◆ FindAttr()

UINT8 * FindAttr ( IN NTFS_ATTR * Attr,
IN UINT32 Type )

Definition at line 400 of file Disc.c.

◆ Fixup()

EFI_STATUS EFIAPI Fixup ( IN UINT8 * Buffer,
IN UINT64 Length,
IN UINT32 Magic,
IN UINTN SectorSize )

Table 4.21. Layout of a File Record


Offset | Size | Description

0x00 | 4 | Magic number 'FILE' 0x04 | 2 | Offset to the update sequence 0x06 | 2 | Size in words of Update Sequence Number & Array (S) ... | 2 | Update Sequence Number (a)

| 2S-2 | Update Sequence Array (a)

Definition at line 242 of file Disc.c.

◆ FreeAttr()

VOID FreeAttr ( IN NTFS_ATTR * Attr)

Definition at line 792 of file Disc.c.

◆ FreeFile()

VOID FreeFile ( IN NTFS_FILE * File)

Definition at line 810 of file Disc.c.

◆ FsHelpFindFile()

EFI_STATUS FsHelpFindFile ( IN CONST CHAR16 * Path,
IN NTFS_FILE * RootNode,
OUT NTFS_FILE ** FoundNode,
IN FSHELP_FILETYPE Type )

Definition at line 471 of file Index.c.

◆ InitAttr()

EFI_STATUS InitAttr ( OUT NTFS_ATTR * Attr,
IN NTFS_FILE * File )

Definition at line 313 of file Disc.c.

◆ InitFile()

EFI_STATUS EFIAPI InitFile ( IN OUT NTFS_FILE * File,
IN UINT64 RecordNumber )

Definition at line 727 of file Disc.c.

◆ IterateDir()

EFI_STATUS IterateDir ( IN NTFS_FILE * dir,
IN VOID * FileOrCtx,
IN FUNCTION_TYPE FunctionType )

Definition at line 534 of file Index.c.

◆ LocateAttr()

UINT8 * LocateAttr ( IN NTFS_ATTR * Attr,
IN NTFS_FILE * Mft,
IN UINT32 Type )

Definition at line 347 of file Disc.c.

◆ NtfsDir()

EFI_STATUS NtfsDir ( IN EFI_FS * FileSystem,
IN CONST CHAR16 * Path,
OUT EFI_NTFS_FILE * File,
IN FUNCTION_TYPE FunctionType )

Definition at line 13 of file Disc.c.

◆ NtfsMount()

EFI_STATUS NtfsMount ( IN EFI_FS * FileSystem)

Definition at line 94 of file Disc.c.

◆ NtfsOpen()

EFI_STATUS NtfsOpen ( IN EFI_NTFS_FILE * File)

Definition at line 53 of file Disc.c.

◆ NtfsToEfiTime()

VOID NtfsToEfiTime ( EFI_TIME * EfiTime,
UINT64 NtfsTime )

NTFS Time is the number of 100ns units since Jan 1, 1601. The signifigance of this date is that it is the beginning of the first full century of the Gregorian Calendar. The time displayed in Shell will only match the time displayed in Windows if the Windows time zone is set to Coordinated Universal Time (UTC). Otherwise, it will be skewed by the time zone setting.

Definition at line 928 of file Index.c.

◆ ReadAttr()

EFI_STATUS EFIAPI ReadAttr ( IN NTFS_ATTR * NtfsAttr,
OUT UINT8 * Dest,
IN UINT64 Offset,
IN UINTN Length )

Definition at line 184 of file Data.c.

◆ ReadData()

EFI_STATUS EFIAPI ReadData ( IN NTFS_ATTR * NtfsAttr,
IN UINT8 * pa,
OUT UINT8 * Dest,
IN UINT64 Offset,
IN UINTN Length )

Definition at line 258 of file Data.c.

◆ ReadMftRecord()

EFI_STATUS EFIAPI ReadMftRecord ( IN EFI_NTFS_FILE * File,
OUT UINT8 * Buffer,
IN UINT64 RecordNumber )

Definition at line 148 of file Data.c.

◆ ReadRunListElement()

EFI_STATUS EFIAPI ReadRunListElement ( IN OUT RUNLIST * Runlist)

Table 4.10. Layout of a Data Run


Offset | Size | Description

0 | 0.5 | F=Size of the Offset field 0.5 | 0.5 | L=Size of the Length field 1 | L | Length of the run

1+L | F | Offset to the starting LCN of the previous element (signed)

Definition at line 468 of file Data.c.

◆ ReadSymlink()

CHAR16 * ReadSymlink ( IN NTFS_FILE * Node)

Definition at line 565 of file Data.c.

◆ RelativeToAbsolute()

EFI_STATUS RelativeToAbsolute ( OUT CHAR16 * Dest,
IN CHAR16 * Source )

Definition at line 826 of file Index.c.