[SDK] Reorganize header files

This commit is contained in:
Quinn Stephens 2024-08-08 15:27:44 -04:00
parent e48262d4d7
commit 120277161c
9 changed files with 90 additions and 58 deletions

View File

@ -20,4 +20,4 @@ Abstract:
#include <ntstatus.h>
#include <ntimage.h>
#endif
#endif /* !_NT_H */

View File

@ -16,42 +16,55 @@ Abstract:
#ifndef _NTDEF_H
#define _NTDEF_H
#include <string.h>
#ifndef IN
#define IN
#endif
#ifndef OUT
#define OUT
#endif
#ifndef OPTIONAL
#define OPTIONAL
#endif
#ifndef FASTCALL
#define FASTCALL
#endif
#ifndef NTAPI
#define NTAPI
#endif
#ifndef VOID
#define VOID void
#define VOID void
#endif
#ifndef CONST
#define CONST const
#endif
#ifndef IN
#define IN
#define OUT
#define OPTIONAL
#define CONST const
#endif
#ifndef ANYSIZE_ARRAY
#define ANYSIZE_ARRAY 1
#define ANYSIZE_ARRAY 1
#endif
#ifndef FORCEINLINE
#if defined(_MSC_EXTENSIONS)
#define FORCEINLINE __inline
#define FORCEINLINE __inline
#else
#define FORCEINLINE static inline
#define FORCEINLINE static inline
#endif
#endif
#ifndef FASTCALL
#define FASTCALL
#endif
#ifndef NTAPI
#define NTAPI
#endif
#undef NULL
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((VOID *)0)
#endif
#endif
//
// Basic types.
@ -64,9 +77,9 @@ typedef unsigned short USHORT;
typedef unsigned long ULONG;
//
// Basic type pointers.
// Basic pointer types.
//
typedef void *PVOID;
typedef VOID *PVOID;
typedef CHAR *PCHAR;
typedef SHORT *PSHORT;
typedef UCHAR *PUCHAR;
@ -74,17 +87,24 @@ typedef USHORT *PUSHORT;
typedef ULONG *PULONG;
//
// Wide characters.
//
typedef USHORT WCHAR;
typedef WCHAR *PWCHAR;
//
// Logical values.
// Logical value types.
//
typedef ULONG LOGICAL;
typedef ULONG *PLOGICAL;
//
// String types.
//
typedef CHAR *LPSTR;
typedef CONST CHAR *LPCSTR;
//
// Wide character/string types.
//
typedef USHORT WCHAR;
typedef WCHAR *PWCHAR, *LPWSTR;
typedef CONST WCHAR *LPCWSTR;
//
// Status codes.
//
@ -103,14 +123,14 @@ typedef NTSTATUS *PNTSTATUS;
// Long long type definitions.
//
#if defined(_MSC_EXTENSIONS)
typedef unsigned __int64 ULONGLONG;
typedef __int64 LONGLONG;
typedef unsigned __int64 ULONGLONG;
typedef __int64 LONGLONG;
#elif defined(UNIX_LP64)
typedef unsigned long ULONGLONG;
typedef long LONGLONG;
typedef unsigned long ULONGLONG;
typedef long LONGLONG;
#else
typedef unsigned long long ULONGLONG;
typedef long long LONGLONG;
typedef unsigned long long ULONGLONG;
typedef long long LONGLONG;
#endif
//
@ -160,21 +180,4 @@ typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *BackLink;
} LIST_ENTRY, *PLIST_ENTRY;
//
// Runtime library definitions.
//
PVOID
RtlCopyMemory (
PVOID Destination,
CONST PVOID Source,
ULONG Length
);
PVOID
RtlZeroMemory (
PVOID Destination,
ULONG Length
);
#endif
#endif /* !_NTDEF_H */

View File

@ -23,4 +23,4 @@ Abstract:
#define IMAGE_FILE_MACHINE_I386 0x014c
#define IMAGE_FILE_MACHINE_AMD64 0x8664
#endif
#endif /* !_NTIMAGE_H */

29
SDK/INC/NT/ntrtl.h Normal file
View File

@ -0,0 +1,29 @@
/*++
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>
//
// 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))
#endif /* !_NTRTL_H */

View File

@ -41,4 +41,4 @@ Abstract:
#define STATUS_DRIVER_UNABLE_TO_LOAD ((NTSTATUS) 0xC000026CL)
#define STATUS_NO_MATCH ((NTSTATUS) 0xC0000272L)
#endif
#endif /* !_NTSTATUS_H */

View File

@ -25,11 +25,11 @@ project("CRT")
kind("StaticLib")
location("SDK/CRT")
includedirs({ "SDK/CRT/INC" })
includedirs({ "SDK/INC/CRT" })
objdir("BUILD/SDK/CRT")
targetdir("BUILD/SDK")
targetname("crt")
files({ "SDK/CRT/INC/**.h", "SDK/CRT/**.c" })
files({ "SDK/INC/CRT/**.h", "SDK/CRT/**.c" })
--[[
project("BOOT")