From 0be8f445b64ab36e086bd7e3a2913fdd147bd00f Mon Sep 17 00:00:00 2001 From: Mattiwatti Date: Mon, 25 Mar 2019 20:56:43 +0100 Subject: Initial commit --- EfiGuardDxe/ntdef.h | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 EfiGuardDxe/ntdef.h (limited to 'EfiGuardDxe/ntdef.h') diff --git a/EfiGuardDxe/ntdef.h b/EfiGuardDxe/ntdef.h new file mode 100644 index 0000000..62a38b8 --- /dev/null +++ b/EfiGuardDxe/ntdef.h @@ -0,0 +1,80 @@ +#pragma once + +// +// Minimal version of ntdef.h to avoid a dependency on the WDK +// + +// Ignore this file if either ntdef.h or winnt.h has already been included elsewhere +#if !defined(_NTDEF_) && !defined(_WINNT_) + +// DebugLib.h (re)defines _DEBUG without checking if it has already been defined. So get it now +#include + +// Get the correct CPU and (non-)debug defines for NT from UEFI if we don't have them already +#if defined(MDE_CPU_X64) + #if !defined(_WIN64) + #define _WIN64 + #endif + #if !defined(_AMD64_) + #define _AMD64_ + #endif +#elif defined(MDE_CPU_IA32) + #if !defined(_X86_) + #define _X86_ + #endif +#endif +#if defined(EFI_DEBUG) + #if !defined(_DEBUG) + #define _DEBUG + #endif + #if !defined(DBG) + #define DBG 1 + #endif +#endif +#if defined(MDEPKG_NDEBUG) + #if !defined(NDEBUG) + #define NDEBUG + #endif +#endif + +// Defines +#define ANYSIZE_ARRAY 1 +#define FIELD_OFFSET(Type, Field) ((INT32)(INTN)&(((Type *)0)->Field)) +#define MAKELANGID(Primary, Sub) ((((UINT16)(Sub)) << 10) | (UINT16)(Primary)) +#define LANG_NEUTRAL 0x00 +#define SUBLANG_NEUTRAL 0x00 +#define RTL_CONSTANT_STRING(s) \ +{ \ + (sizeof(s) - sizeof((s)[0])), \ + (sizeof(s)), \ + (s) \ +} +#define LOWORD(l) ((UINT16)(((UINTN)(l)) & 0xffff)) +#define HIWORD(l) ((UINT16)((((UINTN)(l)) >> 16) & 0xffff)) +#define LOBYTE(w) ((UINT8)(((UINTN)(w)) & 0xff)) +#define HIBYTE(w) ((UINT8)((((UINTN)(w)) >> 8) & 0xff)) + +// Typedefs +typedef INT32 NTSTATUS; + +typedef union _LARGE_INTEGER { + struct { + UINT32 LowPart; + INT32 HighPart; + } s; + struct { + UINT32 LowPart; + INT32 HighPart; + } u; + INT64 QuadPart; +} LARGE_INTEGER; + +typedef struct _UNICODE_STRING { + UINT16 Length; + UINT16 MaximumLength; + CHAR16* Buffer; +} UNICODE_STRING; +typedef UNICODE_STRING *PUNICODE_STRING; +typedef CONST UNICODE_STRING *PCUNICODE_STRING; + +#endif // !defined(_NTDEF_) && !defined(_WINNT_) -- cgit v1.2.3