[SDK] Minor improvements to CRT, RTL, and headers
Signed-off-by: Quinn Stephens <quinn@osmora.org>
This commit is contained in:
parent
e81100b2e5
commit
e3f81a4c08
@ -5,7 +5,7 @@ Provided under the BSD 3-Clause license.
|
|||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
|
|
||||||
printf.c
|
wprintf.c
|
||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
|
@ -64,13 +64,10 @@ memmove (
|
|||||||
|
|
||||||
/* Check for overlap */
|
/* Check for overlap */
|
||||||
if (src > dest || ((char *)src + count) < (char *)dest) {
|
if (src > dest || ((char *)src + count) < (char *)dest) {
|
||||||
/* Low-to-high copy, like memcpy() */
|
/* Low-to-high copy, use memcpy() */
|
||||||
while (count--) {
|
return memcpy(dest, src, count);
|
||||||
*(char *)dest = *(char *)src;
|
|
||||||
dest = (char *)dest + 1;
|
|
||||||
src = (char *)src + 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* High-to-low copy */
|
/* High-to-low copy */
|
||||||
dest = (char *)dest + count - 1;
|
dest = (char *)dest + count - 1;
|
||||||
src = (char *)src + count - 1;
|
src = (char *)src + count - 1;
|
||||||
@ -79,7 +76,6 @@ memmove (
|
|||||||
dest = (char *)dest - 1;
|
dest = (char *)dest - 1;
|
||||||
src = (char *)src - 1;
|
src = (char *)src - 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,11 @@ strlen (
|
|||||||
const char *ptr;
|
const char *ptr;
|
||||||
|
|
||||||
ptr = str;
|
ptr = str;
|
||||||
while (*ptr++);
|
while (*ptr) {
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
return ptr - str - sizeof(char);
|
return ptr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
@ -36,12 +38,14 @@ strnlen (
|
|||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t len;
|
const char *ptr;
|
||||||
|
|
||||||
len = 0;
|
ptr = str;
|
||||||
while (len < maxlen && str[len++]);
|
while (maxlen-- && *ptr) {
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
return len - sizeof(char);
|
return ptr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -26,8 +26,7 @@ wmemset (
|
|||||||
wchar_t *ptr = dest;
|
wchar_t *ptr = dest;
|
||||||
|
|
||||||
while (count--) {
|
while (count--) {
|
||||||
*(wchar_t *)dest = c;
|
*dest++ = c;
|
||||||
dest = (wchar_t *)dest + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
@ -44,9 +43,7 @@ wmemcpy (
|
|||||||
wchar_t *ptr = dest;
|
wchar_t *ptr = dest;
|
||||||
|
|
||||||
while (count--) {
|
while (count--) {
|
||||||
*(wchar_t *)dest = *(wchar_t *)src;
|
*dest++ = *src++;
|
||||||
dest = (wchar_t *)dest + 1;
|
|
||||||
src = (wchar_t *)src + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
@ -64,13 +61,10 @@ wmemmove (
|
|||||||
|
|
||||||
/* Check for overlap */
|
/* Check for overlap */
|
||||||
if (src > dest || ((wchar_t *)src + count) < (wchar_t *)dest) {
|
if (src > dest || ((wchar_t *)src + count) < (wchar_t *)dest) {
|
||||||
/* Low-to-high copy, like memcpy() */
|
/* Low-to-high copy, use wmemcpy() */
|
||||||
while (count--) {
|
return wmemcpy(dest, src, count);
|
||||||
*(wchar_t *)dest = *(wchar_t *)src;
|
|
||||||
dest = (wchar_t *)dest + 1;
|
|
||||||
src = (wchar_t *)src + 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* High-to-low copy */
|
/* High-to-low copy */
|
||||||
dest = (wchar_t *)dest + count - 1;
|
dest = (wchar_t *)dest + count - 1;
|
||||||
src = (wchar_t *)src + count - 1;
|
src = (wchar_t *)src + count - 1;
|
||||||
@ -79,7 +73,6 @@ wmemmove (
|
|||||||
dest = (wchar_t *)dest - 1;
|
dest = (wchar_t *)dest - 1;
|
||||||
src = (wchar_t *)src - 1;
|
src = (wchar_t *)src - 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,9 @@ wcslen (
|
|||||||
const wchar_t *ptr;
|
const wchar_t *ptr;
|
||||||
|
|
||||||
ptr = str;
|
ptr = str;
|
||||||
while (*ptr++);
|
while (*ptr) {
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
return ptr - str;
|
return ptr - str;
|
||||||
}
|
}
|
||||||
@ -36,15 +38,14 @@ wcsnlen (
|
|||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
size_t len;
|
const wchar_t *ptr;
|
||||||
|
|
||||||
len = 0;
|
ptr = str;
|
||||||
while (len < maxlen && *str) {
|
while (maxlen-- && *ptr) {
|
||||||
len++;
|
ptr++;
|
||||||
str++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return ptr - str;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -53,6 +53,8 @@ typedef long int ptrdiff_t;
|
|||||||
typedef unsigned short wchar_t;
|
typedef unsigned short wchar_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,11 +18,15 @@ Abstract:
|
|||||||
#ifndef _STRING_H
|
#ifndef _STRING_H
|
||||||
#define _STRING_H
|
#define _STRING_H
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stddef.h>
|
void *memset(void *dest, int c, size_t count);
|
||||||
|
void *memcpy(void *dest, const void *src, size_t count);
|
||||||
|
void *memmove(void *dest, const void *src, size_t count);
|
||||||
|
|
||||||
size_t strlen(const char *str);
|
size_t strlen(const char *str);
|
||||||
size_t strnlen(const char *str, size_t maxlen);
|
size_t strnlen(const char *str, size_t maxlen);
|
||||||
@ -31,10 +35,6 @@ int strncmp(const char* s1, const char* s2, size_t n);
|
|||||||
char *strchr(const char *s, int c);
|
char *strchr(const char *s, int c);
|
||||||
char *strstr(const char *haystack, const char *needle);
|
char *strstr(const char *haystack, const char *needle);
|
||||||
|
|
||||||
void *memset(void *dest, int c, size_t count);
|
|
||||||
void *memcpy(void *dest, const void *src, size_t count);
|
|
||||||
void *memmove(void *dest, const void *src, size_t count);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -18,12 +18,16 @@ Abstract:
|
|||||||
#ifndef _WCHAR_H
|
#ifndef _WCHAR_H
|
||||||
#define _WCHAR_H
|
#define _WCHAR_H
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
wchar_t *wmemset(wchar_t *dest, wchar_t c, size_t count);
|
||||||
#include <string.h>
|
wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t count);
|
||||||
|
wchar_t *wmemmove(wchar_t *dest, const wchar_t *src, size_t count);
|
||||||
|
|
||||||
size_t wcslen(const wchar_t *str);
|
size_t wcslen(const wchar_t *str);
|
||||||
size_t wcsnlen(const wchar_t *str, size_t maxlen);
|
size_t wcsnlen(const wchar_t *str, size_t maxlen);
|
||||||
@ -34,10 +38,6 @@ wchar_t *wcsstr(const wchar_t *haystack, const wchar_t *needle);
|
|||||||
wchar_t *wcscpy_s(wchar_t *dest, size_t maxlen, const wchar_t *src);
|
wchar_t *wcscpy_s(wchar_t *dest, size_t maxlen, const wchar_t *src);
|
||||||
wchar_t *wcscat_s(wchar_t *dest, size_t maxlen, const wchar_t *src);
|
wchar_t *wcscat_s(wchar_t *dest, size_t maxlen, const wchar_t *src);
|
||||||
|
|
||||||
wchar_t *wmemset(wchar_t *dest, wchar_t c, size_t count);
|
|
||||||
wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t count);
|
|
||||||
wchar_t *wmemmove(wchar_t *dest, const wchar_t *src, size_t count);
|
|
||||||
|
|
||||||
int vswprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, va_list args);
|
int vswprintf(wchar_t *wcs, size_t maxlen, const wchar_t *format, va_list args);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -111,44 +111,19 @@ typedef long long LONGLONG;
|
|||||||
typedef unsigned long long ULONGLONG;
|
typedef unsigned long long ULONGLONG;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef LONGLONG *PLONGLONG;
|
|
||||||
typedef ULONGLONG *PULONGLONG;
|
|
||||||
|
|
||||||
#define MAXLONGLONG 0x7fffffffffffffff
|
#define MAXLONGLONG 0x7fffffffffffffff
|
||||||
#define MAXULONGLONG 0xffffffffffffffff
|
#define MAXULONGLONG 0xffffffffffffffff
|
||||||
|
|
||||||
#define LODWORD(x) ((ULONG)(x))
|
|
||||||
#define HIDWORD(x) ((ULONG)((x) >> 32))
|
|
||||||
|
|
||||||
#define LOWORD(x) ((USHORT)(x))
|
|
||||||
#define HIWORD(x) ((USHORT)((x) >> 16))
|
|
||||||
|
|
||||||
#define LOBYTE(x) ((UCHAR)(x))
|
|
||||||
#define HIBYTE(x) ((UCHAR)((x) >> 8))
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Logical/boolean value types.
|
// Logical/boolean value types.
|
||||||
//
|
//
|
||||||
typedef ULONG LOGICAL;
|
typedef ULONG LOGICAL;
|
||||||
typedef ULONG *PLOGICAL;
|
|
||||||
typedef int BOOL;
|
typedef int BOOL;
|
||||||
typedef BOOL *PBOOL;
|
|
||||||
typedef UCHAR BOOLEAN;
|
typedef UCHAR BOOLEAN;
|
||||||
typedef BOOLEAN *PBOOLEAN;
|
|
||||||
|
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
||||||
//
|
|
||||||
// Basic pointer types.
|
|
||||||
//
|
|
||||||
typedef VOID *PVOID;
|
|
||||||
typedef CHAR *PCHAR;
|
|
||||||
typedef SHORT *PSHORT;
|
|
||||||
typedef UCHAR *PUCHAR;
|
|
||||||
typedef USHORT *PUSHORT;
|
|
||||||
typedef ULONG *PULONG;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Numeric pointer types.
|
// Numeric pointer types.
|
||||||
//
|
//
|
||||||
@ -160,6 +135,29 @@ typedef LONG LONG_PTR;
|
|||||||
typedef ULONG ULONG_PTR;
|
typedef ULONG ULONG_PTR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Basic type pointers.
|
||||||
|
//
|
||||||
|
typedef VOID *PVOID;
|
||||||
|
typedef CHAR *PCHAR;
|
||||||
|
typedef SHORT *PSHORT;
|
||||||
|
typedef UCHAR *PUCHAR;
|
||||||
|
typedef USHORT *PUSHORT;
|
||||||
|
typedef ULONG *PULONG;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Long long type pointers.
|
||||||
|
//
|
||||||
|
typedef LONGLONG *PLONGLONG;
|
||||||
|
typedef ULONGLONG *PULONGLONG;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Logical/boolean type pointers.
|
||||||
|
//
|
||||||
|
typedef ULONG *PLOGICAL;
|
||||||
|
typedef BOOL *PBOOL;
|
||||||
|
typedef BOOLEAN *PBOOLEAN;
|
||||||
|
|
||||||
//
|
//
|
||||||
// String types.
|
// String types.
|
||||||
//
|
//
|
||||||
@ -210,6 +208,16 @@ typedef NTSTATUS *PNTSTATUS;
|
|||||||
#define ALIGN_DOWN(x, a) ((x) & ~((a) - 1))
|
#define ALIGN_DOWN(x, a) ((x) & ~((a) - 1))
|
||||||
#define ALIGN_UP(x, a) ALIGN_DOWN((x) + (a) - 1, a)
|
#define ALIGN_UP(x, a) ALIGN_DOWN((x) + (a) - 1, a)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bit extraction helpers.
|
||||||
|
//
|
||||||
|
#define LODWORD(x) ((ULONG)(x))
|
||||||
|
#define HIDWORD(x) ((ULONG)((x) >> 32))
|
||||||
|
#define LOWORD(x) ((USHORT)(x))
|
||||||
|
#define HIWORD(x) ((USHORT)((x) >> 16))
|
||||||
|
#define LOBYTE(x) ((UCHAR)(x))
|
||||||
|
#define HIBYTE(x) ((UCHAR)((x) >> 8))
|
||||||
|
|
||||||
//
|
//
|
||||||
// Large (64-bit) integer value.
|
// Large (64-bit) integer value.
|
||||||
//
|
//
|
||||||
@ -234,135 +242,6 @@ typedef union ULARGE_INTEGER {
|
|||||||
ULONGLONG QuadPart;
|
ULONGLONG QuadPart;
|
||||||
} ULARGE_INTEGER, *PULARGE_INTEGER;
|
} ULARGE_INTEGER, *PULARGE_INTEGER;
|
||||||
|
|
||||||
//
|
|
||||||
// Doubly-linked list entry.
|
|
||||||
//
|
|
||||||
typedef struct _LIST_ENTRY {
|
|
||||||
struct _LIST_ENTRY *Flink;
|
|
||||||
struct _LIST_ENTRY *Blink;
|
|
||||||
} LIST_ENTRY, *PLIST_ENTRY;
|
|
||||||
|
|
||||||
FORCEINLINE
|
|
||||||
VOID
|
|
||||||
InitializeListHead (
|
|
||||||
IN PLIST_ENTRY Head
|
|
||||||
)
|
|
||||||
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Initializes a list head.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Head - the list head.
|
|
||||||
|
|
||||||
Return Value:
|
|
||||||
|
|
||||||
None.
|
|
||||||
|
|
||||||
--*/
|
|
||||||
|
|
||||||
{
|
|
||||||
Head->Blink = Head;
|
|
||||||
Head->Flink = Head;
|
|
||||||
}
|
|
||||||
|
|
||||||
FORCEINLINE
|
|
||||||
VOID
|
|
||||||
InsertHeadList (
|
|
||||||
IN PLIST_ENTRY Head,
|
|
||||||
IN PLIST_ENTRY Entry
|
|
||||||
)
|
|
||||||
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Inserts a list entry at the head of a list.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Entry - The list entry.
|
|
||||||
|
|
||||||
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 a list entry at the tail of a list.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Entry - The list entry.
|
|
||||||
|
|
||||||
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 a list entry from a list.
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
Entry - 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Unicode string.
|
// Unicode string.
|
||||||
//
|
//
|
||||||
@ -377,6 +256,14 @@ typedef CONST UNICODE_STRING *PCUNICODE_STRING;
|
|||||||
|
|
||||||
#define MAX_USTRING ALIGN_DOWN(MAXUSHORT, sizeof(WCHAR))
|
#define MAX_USTRING ALIGN_DOWN(MAXUSHORT, sizeof(WCHAR))
|
||||||
|
|
||||||
|
//
|
||||||
|
// Doubly-linked list entry.
|
||||||
|
//
|
||||||
|
typedef struct _LIST_ENTRY {
|
||||||
|
struct _LIST_ENTRY *Flink;
|
||||||
|
struct _LIST_ENTRY *Blink;
|
||||||
|
} LIST_ENTRY, *PLIST_ENTRY;
|
||||||
|
|
||||||
#include <guiddef.h>
|
#include <guiddef.h>
|
||||||
|
|
||||||
#endif /* !_NTDEF_H */
|
#endif /* !_NTDEF_H */
|
||||||
|
@ -19,7 +19,7 @@ Abstract:
|
|||||||
//
|
//
|
||||||
// Machine type values.
|
// Machine type values.
|
||||||
//
|
//
|
||||||
#define IMAGE_FILE_MACHINE_UNKNOWN 0
|
#define IMAGE_FILE_MACHINE_UNKNOWN 0x0000
|
||||||
#define IMAGE_FILE_MACHINE_I386 0x014c
|
#define IMAGE_FILE_MACHINE_I386 0x014c
|
||||||
#define IMAGE_FILE_MACHINE_AMD64 0x8664
|
#define IMAGE_FILE_MACHINE_AMD64 0x8664
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ Abstract:
|
|||||||
#ifndef _NTRTL_H
|
#ifndef _NTRTL_H
|
||||||
#define _NTRTL_H
|
#define _NTRTL_H
|
||||||
|
|
||||||
#include <string.h>
|
#ifdef __cplusplus
|
||||||
#include <ntdef.h>
|
extern "C" {
|
||||||
#include <ntstatus.h>
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Memory operations.
|
// Memory operations.
|
||||||
@ -28,7 +28,128 @@ Abstract:
|
|||||||
#define RtlFillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
|
#define RtlFillMemory(Destination, Length, Fill) memset((Destination), (Fill), (Length))
|
||||||
#define RtlZeroMemory(Destination, Length) memset((Destination), 0, (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
|
FORCEINLINE
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
@ -83,4 +204,8 @@ RtlGUIDFromString (
|
|||||||
OUT GUID *Guid
|
OUT GUID *Guid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* !_NTRTL_H */
|
#endif /* !_NTRTL_H */
|
||||||
|
@ -13,8 +13,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include <ntrtl.h>
|
#include <nt.h>
|
||||||
#include <ntstatus.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -13,7 +13,7 @@ Abstract:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
|
|
||||||
#include <ntrtl.h>
|
#include <nt.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
@ -32,9 +32,9 @@ Routine Description:
|
|||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
|
|
||||||
Destination - A pointer to the unicode string structure.
|
Destination - Pointer to the unicode string structure.
|
||||||
|
|
||||||
Source - Optionally, a pointer to a null-terminated string to initialize
|
Source - Optionally, a pointer to a NULL-terminated string to initialize
|
||||||
the unicode string structure with.
|
the unicode string structure with.
|
||||||
|
|
||||||
Return Value:
|
Return Value:
|
||||||
|
Loading…
Reference in New Issue
Block a user