X-Git-Url: https://code.delx.au/refind/blobdiff_plain/8e261d06ab599ac8eb4d0108a88c30a0a1b8f814..e3d2b4a15b8e4a6e7d6e3a6421270fccfb06c4f0:/refind/lib.h diff --git a/refind/lib.h b/refind/lib.h index d888b98..bc3454c 100644 --- a/refind/lib.h +++ b/refind/lib.h @@ -35,18 +35,53 @@ */ /* * Modifications copyright (c) 2012 Roderick W. Smith - * + * * Modifications distributed under the terms of the GNU General Public * License (GPL) version 3 (GPLv3), a copy of which must be distributed * with this source code or binaries made from it. - * + * */ #ifndef __LIB_H_ #define __LIB_H_ +#ifdef __MAKEWITH_GNUEFI #include "efi.h" #include "efilib.h" +#pragma pack(1) + +/** + This protocol can be used on any device handle to obtain generic path/location + information concerning the physical device or logical device. If the handle does + not logically map to a physical device, the handle may not necessarily support + the device path protocol. The device path describes the location of the device + the handle is for. The size of the Device Path can be determined from the structures + that make up the Device Path. +**/ +typedef struct { + UINT8 Type; ///< 0x01 Hardware Device Path. + ///< 0x02 ACPI Device Path. + ///< 0x03 Messaging Device Path. + ///< 0x04 Media Device Path. + ///< 0x05 BIOS Boot Specification Device Path. + ///< 0x7F End of Hardware Device Path. + + UINT8 SubType; ///< Varies by Type + ///< 0xFF End Entire Device Path, or + ///< 0x01 End This Instance of a Device Path and start a new + ///< Device Path. + + UINT8 Length[2]; ///< Specific Device Path data. Type and Sub-Type define + ///< type of data. Size of data is included in Length. + +} EFI_DEVICE_PATH_PROTOCOL; + +#pragma pack() +#else +#include "../include/tiano_includes.h" +#endif + +#include "global.h" #include "libeg.h" @@ -67,6 +102,8 @@ typedef struct { #define DISK_KIND_EXTERNAL (1) #define DISK_KIND_OPTICAL (2) +#define VOL_UNREADABLE 999 + #define IS_EXTENDED_PART_TYPE(type) ((type) == 0x05 || (type) == 0x0f || (type) == 0x85) EFI_STATUS InitRefitLib(IN EFI_HANDLE ImageHandle); @@ -76,13 +113,14 @@ EFI_STATUS ReinitRefitLib(VOID); VOID CleanUpPathNameSlashes(IN OUT CHAR16 *PathName); VOID CreateList(OUT VOID ***ListPtr, OUT UINTN *ElementCount, IN UINTN InitialElementCount); VOID AddListElement(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount, IN VOID *NewElement); -VOID FreeList(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount /*, IN Callback*/); +VOID FreeList(IN OUT VOID ***ListPtr, IN OUT UINTN *ElementCount); VOID ExtractLegacyLoaderPaths(EFI_DEVICE_PATH **PathList, UINTN MaxPaths, EFI_DEVICE_PATH **HardcodedPathList); VOID ScanVolumes(VOID); BOOLEAN FileExists(IN EFI_FILE *BaseDir, IN CHAR16 *RelativePath); +BOOLEAN DirectoryExists(IN EFI_FILE *BaseDir, IN CHAR16 *RelativePath); EFI_STATUS DirNextEntry(IN EFI_FILE *Directory, IN OUT EFI_FILE_INFO **DirEntry, IN UINTN FilterMode); @@ -91,16 +129,33 @@ BOOLEAN DirIterNext(IN OUT REFIT_DIR_ITER *DirIter, IN UINTN FilterMode, IN CHAR EFI_STATUS DirIterClose(IN OUT REFIT_DIR_ITER *DirIter); CHAR16 * Basename(IN CHAR16 *Path); -VOID ReplaceExtension(IN OUT CHAR16 *Path, IN CHAR16 *Extension); +CHAR16 * StripEfiExtension(CHAR16 *FileName); INTN FindMem(IN VOID *Buffer, IN UINTN BufferLength, IN VOID *SearchString, IN UINTN SearchStringLength); VOID ReinitVolumes(VOID); BOOLEAN StriSubCmp(IN CHAR16 *TargetStr, IN CHAR16 *BigStr); VOID MergeStrings(IN OUT CHAR16 **First, IN CHAR16 *Second, CHAR16 AddChar); +CHAR16 *FindExtension(IN CHAR16 *Path); CHAR16 *FindLastDirName(IN CHAR16 *Path); CHAR16 *FindPath(IN CHAR16* FullPath); +VOID FindVolumeAndFilename(IN EFI_DEVICE_PATH *loadpath, OUT REFIT_VOLUME **DeviceVolume, OUT CHAR16 **loader); +BOOLEAN SplitVolumeAndFilename(IN OUT CHAR16 **Path, OUT CHAR16 **VolName); CHAR16 *FindNumbers(IN CHAR16 *InString); CHAR16 *FindCommaDelimited(IN CHAR16 *InString, IN UINTN Index); +INTN FindSubString(IN CHAR16 *SmallString, IN CHAR16 *BigString); +VOID SplitPathName(CHAR16 *InPath, CHAR16 **VolName, CHAR16 **Path, CHAR16 **Filename); +BOOLEAN IsIn(IN CHAR16 *Filename, IN CHAR16 *List); +BOOLEAN FilenameIn(IN REFIT_VOLUME *Volume, IN CHAR16 *Directory, IN CHAR16 *Filename, IN CHAR16 *List); +BOOLEAN VolumeNumberToName(REFIT_VOLUME *Volume, CHAR16 **VolName); +VOID MyFreePool(IN OUT VOID *Pointer); + +BOOLEAN EjectMedia(VOID); + +UINT64 StrToHex(CHAR16 *Input, UINTN Position, UINTN NumChars); +BOOLEAN IsGuid(CHAR16 *UnknownString); +CHAR16 * GuidAsString(EFI_GUID *GuidData); +EFI_GUID StringAsGuid(CHAR16 * InString); +BOOLEAN GuidsAreEqual(EFI_GUID *Guid1, EFI_GUID *Guid2); #endif \ No newline at end of file