alcyone/SDK/INC/NT/ntrtl.h
Kaimakan71 874d95ae4c [BOOT:LIB] Implement EfiInitpConvertEfiFilePath()
Also implemented RtlULongSub() and EfiInitpAppendPathString()
2024-08-24 12:39:16 -04:00

87 lines
1.6 KiB
C

/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
ntrtl.h
Abstract:
Provides NT RTL (Run-Time Library) definitions.
--*/
#ifndef _NTRTL_H
#define _NTRTL_H
#include <string.h>
#include <ntdef.h>
#include <ntstatus.h>
//
// Memory operations.
//
#define RtlMoveMemory(Destination, Source, Length) memmove((Destination), (Source), (Length))
#define RtlCopyMemory(Destination, Source, Length) memcpy((Destination), (Source), (Length))
#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 (
OUT PUNICODE_STRING Destination,
IN PCWSTR Source
);
NTSTATUS
NTAPI
RtlGUIDFromString (
IN PUNICODE_STRING String,
OUT GUID *Guid
);
#endif /* !_NTRTL_H */