[SDK] Reorganize header files

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

View File

@@ -1,23 +0,0 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
nt.h
Abstract:
Provides NT header files.
--*/
#ifndef _NT_H
#define _NT_H
#include <ntdef.h>
#include <ntstatus.h>
#include <ntimage.h>
#endif

View File

@@ -1,180 +0,0 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
ntdef.h
Abstract:
Provides basic NT definitions.
--*/
#ifndef _NTDEF_H
#define _NTDEF_H
#ifndef VOID
#define VOID void
#endif
#ifndef CONST
#define CONST const
#endif
#ifndef IN
#define IN
#define OUT
#define OPTIONAL
#endif
#ifndef ANYSIZE_ARRAY
#define ANYSIZE_ARRAY 1
#endif
#ifndef FORCEINLINE
#if defined(_MSC_EXTENSIONS)
#define FORCEINLINE __inline
#else
#define FORCEINLINE static inline
#endif
#endif
#ifndef FASTCALL
#define FASTCALL
#endif
#ifndef NTAPI
#define NTAPI
#endif
#undef NULL
#define NULL ((VOID *)0)
//
// Basic types.
//
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned long ULONG;
//
// Basic type pointers.
//
typedef void *PVOID;
typedef CHAR *PCHAR;
typedef SHORT *PSHORT;
typedef UCHAR *PUCHAR;
typedef USHORT *PUSHORT;
typedef ULONG *PULONG;
//
// Wide characters.
//
typedef USHORT WCHAR;
typedef WCHAR *PWCHAR;
//
// Logical values.
//
typedef ULONG LOGICAL;
typedef ULONG *PLOGICAL;
//
// Status codes.
//
typedef LONG NTSTATUS;
typedef NTSTATUS *PNTSTATUS;
//
// Status code utilities.
//
#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0)
#define NT_INFORMATION(Status) ((ULONG)(Status) >> 30 == 1)
#define NT_WARNING(Status) ((ULONG)(Status) >> 30 == 2)
#define NT_ERROR(Status) ((ULONG)(Status) >> 30 == 3)
//
// Long long type definitions.
//
#if defined(_MSC_EXTENSIONS)
typedef unsigned __int64 ULONGLONG;
typedef __int64 LONGLONG;
#elif defined(UNIX_LP64)
typedef unsigned long ULONGLONG;
typedef long LONGLONG;
#else
typedef unsigned long long ULONGLONG;
typedef long long LONGLONG;
#endif
//
// Large (64-bit) integer value.
//
typedef union LARGE_INTEGER {
struct {
ULONG LowPart;
LONG HighPart;
};
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
//
// Large (64-bit) unsigned integer value.
//
typedef union ULARGE_INTEGER {
struct {
ULONG LowPart;
ULONG HighPart;
};
ULONGLONG QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;
//
// Struct field offset helper.
//
#if !defined(__GNUC__) && !defined(__clang__)
#define FIELD_OFFSET(type, field) ((ULONG)&(((type *)0)->field))
#else
#define FIELD_OFFSET(type, field) ((ULONG)__builtin_offsetof(type, field))
#endif
//
// Alignment helpers.
//
#define ALIGN_DOWN(x, a) ((x) & ~((a) - 1))
#define ALIGN_UP(x, a) ALIGN_DOWN((x) + (a) - 1, a)
//
// Doubly-linked list entry.
//
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *ForwardLink;
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

View File

@@ -1,26 +0,0 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
ntimage.h
Abstract:
Provides NT image file definitions.
--*/
#ifndef _NTIMAGE_H
#define _NTIMAGE_H
//
// Machine type values.
//
#define IMAGE_FILE_MACHINE_UNKNOWN 0
#define IMAGE_FILE_MACHINE_I386 0x014c
#define IMAGE_FILE_MACHINE_AMD64 0x8664
#endif

View File

@@ -1,44 +0,0 @@
/*++
Copyright (c) 2024, Quinn Stephens.
Provided under the BSD 3-Clause license.
Module Name:
ntstatus.h
Abstract:
Provides NT status code values.
--*/
#ifndef _NTSTATUS_H
#define _NTSTATUS_H
#define STATUS_SUCCESS ((NTSTATUS) 0x00000000L)
//
// TODO: There are an insane amount of status values.
//
#define STATUS_MEDIA_CHANGED ((NTSTATUS) 0x8000001CL)
#define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xC000000DL)
#define STATUS_ACCESS_DENIED ((NTSTATUS) 0xC0000022L)
#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xC0000023L)
#define STATUS_DISK_CORRUPT_ERROR ((NTSTATUS) 0xC0000032L)
#define STATUS_DEVICE_ALREADY_ATTACHED ((NTSTATUS) 0xC0000038L)
#define STATUS_DISK_FULL ((NTSTATUS) 0xC000007FL)
#define STATUS_INSUFFICIENT_RESOURCES ((NTSTATUS) 0xC000009AL)
#define STATUS_MEDIA_WRITE_PROTECTED ((NTSTATUS) 0xC00000A2L)
#define STATUS_DEVICE_NOT_READY ((NTSTATUS) 0xC00000A3L)
#define STATUS_NOT_SUPPORTED ((NTSTATUS) 0xC00000BBL)
#define STATUS_TIMEOUT ((NTSTATUS) 0x00000102L)
#define STATUS_NO_MEDIA ((NTSTATUS) 0xC0000178L)
#define STATUS_IO_DEVICE_ERROR ((NTSTATUS) 0xC0000185L)
#define STATUS_INVALID_BUFFER_SIZE ((NTSTATUS) 0xC0000206L)
#define STATUS_NOT_FOUND ((NTSTATUS) 0xC0000225L)
#define STATUS_REQUEST_ABORTED ((NTSTATUS) 0xC0000240L)
#define STATUS_DRIVER_UNABLE_TO_LOAD ((NTSTATUS) 0xC000026CL)
#define STATUS_NO_MATCH ((NTSTATUS) 0xC0000272L)
#endif