[BOOT:LIB] Implement EfiInitpConvertEfiFilePath()

Also implemented RtlULongSub() and EfiInitpAppendPathString()
This commit is contained in:
2024-08-24 12:39:16 -04:00
parent 8f56881d02
commit 874d95ae4c
3 changed files with 207 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ Abstract:
#include <string.h>
#include <ntdef.h>
#include <ntstatus.h>
//
// Memory operations.
@@ -27,6 +28,47 @@ Abstract:
#define RtlFillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
#define RtlZeroMemory(Destination, Length) memset((Destination), 0, (Length))
#define ULONG_ERROR 0xFFFFFFFFUL
FORCEINLINE
NTSTATUS
RtlULongSub (
IN ULONG ulMinuend,
IN ULONG ulSubtrahend,
IN OUT PULONG pulResult
)
/*++
Routine Description:
Calculates the difference of two ULONG values.
Arguments:
ulMinuend - The value to subtract ulSubtrahend from.
ulSubtrahend - The value to subtract from ulMinuend.
pulResult - Pointer to a ULONG to store the difference in.
Return Value:
STATUS_SUCCESS if successful.
STATUS_INTEGER_OVERFLOW if unsuccessful.
--*/
{
if (ulMinuend >= ulSubtrahend) {
*pulResult = ulMinuend - ulSubtrahend;
return STATUS_SUCCESS;
}
*pulResult = ULONG_ERROR;
return STATUS_INTEGER_OVERFLOW;
}
VOID
NTAPI
RtlInitUnicodeString (

View File

@@ -29,6 +29,7 @@ Abstract:
#define STATUS_DISK_CORRUPT_ERROR ((NTSTATUS) 0xC0000032L)
#define STATUS_DEVICE_ALREADY_ATTACHED ((NTSTATUS) 0xC0000038L)
#define STATUS_DISK_FULL ((NTSTATUS) 0xC000007FL)
#define STATUS_INTEGER_OVERFLOW ((NTSTATUS) 0xC0000095L)
#define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS) 0xC000009AL)
#define STATUS_MEDIA_WRITE_PROTECTED ((NTSTATUS) 0xC00000A2L)
#define STATUS_DEVICE_NOT_READY ((NTSTATUS) 0xC00000A3L)