[SDK] Minor improvements to CRT, RTL, and headers
Signed-off-by: Quinn Stephens <quinn@osmora.org>
This commit is contained in:
@@ -16,9 +16,9 @@ Abstract:
|
||||
#ifndef _NTRTL_H
|
||||
#define _NTRTL_H
|
||||
|
||||
#include <string.h>
|
||||
#include <ntdef.h>
|
||||
#include <ntstatus.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//
|
||||
// Memory operations.
|
||||
@@ -28,7 +28,128 @@ Abstract:
|
||||
#define RtlFillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
|
||||
#define RtlZeroMemory(Destination, Length) memset((Destination), 0, (Length))
|
||||
|
||||
#define ULONG_ERROR 0xFFFFFFFFUL
|
||||
FORCEINLINE
|
||||
VOID
|
||||
InitializeListHead (
|
||||
IN PLIST_ENTRY Head
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Initializes a list head.
|
||||
|
||||
Arguments:
|
||||
|
||||
Head - Pointer to the list's head.
|
||||
|
||||
Return Value:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
Head->Blink = Head;
|
||||
Head->Flink = Head;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
InsertHeadList (
|
||||
IN PLIST_ENTRY Head,
|
||||
IN PLIST_ENTRY Entry
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Inserts an entry at the head of a list.
|
||||
|
||||
Arguments:
|
||||
|
||||
Entry - Pointer to the list entry to insert.
|
||||
|
||||
Return Value:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
Entry->Flink = Head->Flink;
|
||||
Entry->Blink = Head;
|
||||
Head->Flink->Blink = Entry;
|
||||
Head->Flink = Entry;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
VOID
|
||||
InsertTailList (
|
||||
IN PLIST_ENTRY Head,
|
||||
IN PLIST_ENTRY Entry
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Inserts an entry at the tail of a list.
|
||||
|
||||
Arguments:
|
||||
|
||||
Entry - Pointer to the list entry to insert.
|
||||
|
||||
Return Value:
|
||||
|
||||
None.
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
Entry->Blink = Head->Blink;
|
||||
Entry->Flink = Head;
|
||||
Head->Blink->Flink = Entry;
|
||||
Head->Blink = Entry;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
BOOLEAN
|
||||
RemoveEntryList (
|
||||
IN PLIST_ENTRY Entry
|
||||
)
|
||||
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Removes an entry from a list.
|
||||
|
||||
Arguments:
|
||||
|
||||
Entry - Pointer to the entry to remove.
|
||||
|
||||
Return Value:
|
||||
|
||||
TRUE if the list is now empty,
|
||||
FALSE if the list still has at least one entry.
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
PLIST_ENTRY Blink, Flink;
|
||||
|
||||
Blink = Entry->Blink;
|
||||
Flink = Entry->Flink;
|
||||
Blink->Flink = Flink;
|
||||
Flink->Blink = Blink;
|
||||
|
||||
return (BOOLEAN)(Flink == Blink);
|
||||
}
|
||||
|
||||
#define ULONG_ERROR 0xffffffffUL
|
||||
|
||||
FORCEINLINE
|
||||
NTSTATUS
|
||||
@@ -83,4 +204,8 @@ RtlGUIDFromString (
|
||||
OUT GUID *Guid
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_NTRTL_H */
|
||||
|
Reference in New Issue
Block a user