nt.h revision d2394e052635f0af1501629f41b7d2ad5ced47aa
/* $Id$ */
/** @file
* IPRT - Header for code using the Native NT API.
*/
/*
* Copyright (C) 2010-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___iprt_nt_nt_h___
#define ___iprt_nt_nt_h___
/** @def IPRT_NT_MAP_TO_ZW
* Map Nt calls to Zw calls. In ring-0 the Zw calls let you pass kernel memory
* to the APIs (takes care of the previous context checks).
*/
#ifdef DOXYGEN_RUNNING
# define IPRT_NT_MAP_TO_ZW
#endif
#ifdef IPRT_NT_MAP_TO_ZW
# define NtCreateFile ZwCreateFile
# define NtReadFile ZwReadFile
# define NtWriteFile ZwWriteFile
/** @todo this is very incomplete! */
#endif
#include <ntstatus.h>
/*
* Hacks common to both base header sets.
*/
#define _PEB Incomplete__PEB
#define PEB Incomplete_PEB
#define PPEB Incomplete_PPEB
#define _TEB Incomplete__TEB
#define TEB Incomplete_TEB
#define PTEB Incomplete_PTEB
#define PEB_LDR_DATA Incomplete_PEB_LDR_DATA
#ifdef IPRT_NT_USE_WINTERNL
/*
* Use Winternl.h.
*/
# define SystemProcessorPerformanceInformation IncompleteWinternl_SystemProcessorPerformanceInformation
# define WIN32_NO_STATUS
# include <windef.h>
# include <winnt.h>
# include <winternl.h>
# include <ntstatus.h>
#else
/*
*/
# ifdef RT_ARCH_X86
# endif
# include <ntifs.h>
# include <wdm.h>
# ifdef RT_ARCH_X86
# pragma warning(default : 4163)
# endif
# define IPRT_NT_NEED_API_GROUP_NTIFS
#endif
/** @name Useful macros
* @{ */
/** Indicates that we're targetting native NT in the current source. */
#define RTNT_USE_NATIVE_NT 1
/** Initializes a IO_STATUS_BLOCK. */
/** Similar to INVALID_HANDLE_VALUE in the Windows environment. */
/** Constant UNICODE_STRING initializer. */
#define RTNT_CONSTANT_UNISTR(a_String) { sizeof(a_String) - sizeof(WCHAR), sizeof(a_String), (WCHAR *)a_String }
/** @} */
/** @name IPRT helper functions for NT
* @{ */
RTDECL(int) RTNtPathOpen(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fFileAttribs, ULONG fShareAccess,
RTDECL(int) RTNtPathOpenDir(const char *pszPath, ACCESS_MASK fDesiredAccess, ULONG fShareAccess, ULONG fCreateOptions,
/**
* Converts a UTF-16 windows-style path to NT format.
*
* @returns IPRT status code.
* @param pNtName Where to return the NT name. Free using
* RTNtPathFree.
* @param phRootDir Where to return the root handle, if applicable.
* @param pwszPath The UTF-16 windows-style path.
* @param cwcPath The max length of the windows-style path in
* RTUTF16 units. Use RTSTR_MAX if unknown and @a
* pwszPath is correctly terminated.
*/
RTDECL(int) RTNtPathFromWinUtf16Ex(struct _UNICODE_STRING *pNtName, HANDLE *phRootDir, PCRTUTF16 pwszPath, size_t cwcPath);
/**
* Frees the native path and root handle.
*
* @param pNtName The NT path after a successful
* RTNtPathFromWinUtf16Ex call.
* @param phRootDir The root handle variable after a successfull
* RTNtPathFromWinUtf16Ex call.
*/
/** @} */
/** @name NT API delcarations.
* @{ */
/** @name Process access rights missing in ntddk headers
* @{ */
#ifndef PROCESS_TERMINATE
#endif
#ifndef PROCESS_CREATE_THREAD
#endif
#ifndef PROCESS_SET_SESSIONID
#endif
#ifndef PROCESS_VM_OPERATION
#endif
#ifndef PROCESS_VM_READ
#endif
#ifndef PROCESS_VM_WRITE
#endif
#ifndef PROCESS_DUP_HANDLE
#endif
#ifndef PROCESS_CREATE_PROCESS
#endif
#ifndef PROCESS_SET_QUOTA
#endif
#ifndef PROCESS_SET_INFORMATION
#endif
#ifndef PROCESS_QUERY_INFORMATION
#endif
#ifndef PROCESS_SUSPEND_RESUME
#endif
#endif
#ifndef PROCESS_SET_LIMITED_INFORMATION
#endif
#ifndef PROCESS_ALL_ACCESS
#endif
/** @} */
/** @name Thread access rights missing in ntddk headers
* @{ */
#ifndef THREAD_QUERY_INFORMATION
#endif
#ifndef THREAD_SET_THREAD_TOKEN
#endif
#ifndef THREAD_IMPERSONATE
#endif
#ifndef THREAD_DIRECT_IMPERSONATION
#endif
#ifndef THREAD_RESUME
#endif
/** @} */
/** @name Special handle values.
* @{ */
#ifndef NtCurrentProcess
#endif
#ifndef NtCurrentThread
#endif
#ifndef ZwCurrentProcess
# define ZwCurrentProcess() NtCurrentProcess()
#endif
#ifndef ZwCurrentThread
# define ZwCurrentThread() NtCurrentThread()
#endif
/** @} */
/** @name Directory object access rights.
* @{ */
#ifndef DIRECTORY_QUERY
#endif
#ifndef DIRECTORY_TRAVERSE
#endif
#ifndef DIRECTORY_CREATE_OBJECT
#endif
#ifndef DIRECTORY_CREATE_SUBDIRECTORY
#endif
#ifndef DIRECTORY_ALL_ACCESS
#endif
/** @} */
#ifdef IPRT_NT_USE_WINTERNL
typedef struct _CLIENT_ID
{
} CLIENT_ID;
typedef CLIENT_ID *PCLIENT_ID;
#endif
/** @name User Shared Data
* @{ */
#ifdef IPRT_NT_USE_WINTERNL
typedef struct _KSYSTEM_TIME
{
} KSYSTEM_TIME;
typedef KSYSTEM_TIME *PKSYSTEM_TIME;
typedef enum _NT_PRODUCT_TYPE
{
NtProductWinNt = 1,
#define PROCESSOR_FEATURE_MAX 64
typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE
{
StandardDesign = 0,
# if 0
typedef struct _XSTATE_FEATURE
{
typedef XSTATE_FEATURE *PXSTATE_FEATURE;
#define MAXIMUM_XSTATE_FEATURES 64
typedef struct _XSTATE_CONFIGURATION
{
typedef XSTATE_CONFIGURATION *PXSTATE_CONFIGURATION;
# endif
typedef struct _KUSER_SHARED_DATA
{
KSYSTEM_TIME volatile InterruptTime;
KSYSTEM_TIME volatile SystemTime;
KSYSTEM_TIME volatile TimeZoneBias;
LONG volatile TimeZoneBiasStamp;
union
{
struct
{
};
};
ULONG volatile ActiveConsoleId;
ULONG volatile DismountCount;
union
{
struct
{
};
};
union
{
ULONG64 volatile TickCountQuad;
KSYSTEM_TIME volatile TickCount;
struct
{
};
};
ULONGLONG volatile InterruptTimeBias;
ULONG volatile ActiveProcessorCount;
UCHAR volatile ActiveGroupCount;
union
{
struct
{
BOOLEAN volatile QpcBypassEnabled;
};
};
typedef KUSER_SHARED_DATA *PKUSER_SHARED_DATA;
#endif /* IPRT_NT_USE_WINTERNL */
/** @} */
/** @name Process And Thread Environment Blocks
* @{ */
typedef struct _PEB_LDR_DATA
{
/* End NT4 */
} PEB_LDR_DATA;
typedef PEB_LDR_DATA *PPEB_LDR_DATA;
typedef struct _PEB_COMMON
{
union
{
struct
{
} Common;
struct
{
} W81;
struct
{
} W80;
struct
{
uint8_t IsLegacyProcess : 1; /**< 0x003 / 0x003 : Pos 2, 1 Bit - Differs from W81, same as W80 & W6. */
uint8_t IsImageDynamicallyRelocated : 1; /**< 0x003 / 0x003 : Pos 3, 1 Bit - Differs from W81, same as W80 & W6. */
uint8_t SkipPatchingUser32Forwarders : 1; /**< 0x003 / 0x003 : Pos 4, 1 Bit - Added in W7; Differs from W81, same as W80. */
uint8_t SpareBits : 3; /**< 0x003 / 0x003 : Pos 5, 3 Bit - Differs from W81 & W80, more spare bits. */
} W7;
struct
{
uint8_t IsLegacyProcess : 1; /**< 0x003 / 0x003 : Pos 2, 1 Bit - Differs from W81, same as W80 & W7. */
uint8_t IsImageDynamicallyRelocated : 1; /**< 0x003 / 0x003 : Pos 3, 1 Bit - Differs from W81, same as W80 & W7. */
uint8_t SpareBits : 4; /**< 0x003 / 0x003 : Pos 4, 4 Bit - Differs from W81, W80, & W7, more spare bits. */
} W6;
struct
{
uint8_t SpareBits : 7; /**< 0x003 / 0x003 : Pos 1, 7 Bit - Differs from W81, W80, & W7, more spare bits. */
} W52;
struct
{
} W51;
} Diff0;
#if ARCH_BITS == 64
#endif
union
{
struct
{
union
{
struct
{
struct
{
} W6;
};
#if ARCH_BITS == 64
#endif
struct
{
#if ARCH_BITS == 64
#endif
} W52;
struct
{
} W51;
} Diff1;
union
{
};
union
{
struct
{
struct
{
struct
{
} W51;
} Diff2;
union
{
struct
{
struct
{
struct
{
} W51;
} Diff3;
#if ARCH_BITS == 64
#endif
union
{
struct
{
} W81;
struct
{
struct
{
} W52;
} Diff4;
#if ARCH_BITS == 64
#endif
#if ARCH_BITS == 64
#endif
union
{
struct
{
struct
{
} Diff5;
#if ARCH_BITS == 64
#endif
/* End of PEB in W52 (Windows XP (RTM))! */
/* End of PEB in W52 (Windows Server 2003)! */
/* End of PEB in W6 (windows Vista)! */
union
{
struct
{
struct
{
} W7;
} Diff6;
union
{
struct
{
struct
{
} W7;
} Diff7;
#if ARCH_BITS == 64
#endif
} PEB_COMMON;
typedef PEB_COMMON *PPEB_COMMON;
AssertCompileMemberOffset(PEB_COMMON, Diff5.W52.ImageProcessAffinityMask, ARCH_BITS == 64 ? 0x138 : 0xc0);
/** The size of the windows 8.1 PEB structure. */
#define PEB_SIZE_W81 sizeof(PEB_COMMON)
/** The size of the windows 8.0 PEB structure. */
#define PEB_SIZE_W80 sizeof(PEB_COMMON)
/** The size of the windows 7 PEB structure. */
/** The size of the windows vista PEB structure. */
/** The size of the windows server 2003 PEB structure. */
/** The size of the windows XP PEB structure. */
#if 0
typedef struct _NT_TIB
{
union
{
};
} NT_TIB;
#endif
typedef struct _ACTIVATION_CONTEXT_STACK
{
/* Common TEB. */
typedef struct _TEB_COMMON
{
#if ARCH_BITS == 64
#endif
union
{
struct
{
#if ARCH_BITS == 32
struct
{
} W51;
#endif
} Diff0;
union
{
struct
{
struct
{
} W52;
} Diff1;
#if ARCH_BITS == 64
#endif
#if ARCH_BITS == 64
#endif
#if ARCH_BITS == 64
#endif
#if ARCH_BITS == 64
#endif
union
{
struct
{
struct
{
} W52;
} Diff2;
union /**< 0x1728 / 0xf64 */
{
struct
{
struct
{
struct
{
} W52;
struct
{
} W51;
} Diff3;
union
{
struct
{
struct
{
} W51;
} Diff4;
union
{
union
{
struct
{
};
struct
{
} Diff5;
#if ARCH_BITS == 64
#endif
#if ARCH_BITS == 64
#endif
union /**< 0x1770 / 0xf8c */
{
struct
{
struct
{
struct
{
} W52;
#if ARCH_BITS == 32
struct _Wx86ThreadState
{
} W51;
#endif
} Diff6;
#if ARCH_BITS == 64
#endif
union
{
struct
{
struct
{
} W6;
} Diff7;
union /**< 0x17b0 / 0xfa8 */
{
struct
{
struct
{
} W7;
} Diff8;
#if ARCH_BITS == 64
#endif
/* End of TEB in W51 (Windows XP)! */
union
{
struct
{
struct
{
/* End of TEB in W52 (Windows server 2003)! */
} W52;
} Diff9;
union
{
struct
{
};
};
union
{
struct
{
} Common;
struct
{
struct
{
} W7;
struct
{
} W6;
} Diff10;
union
{
struct
{
struct
{
} W6;
} Diff11;
union
{
struct
{
/* End of TEB in W7 (windows 7)! */
/* End of TEB in W8 (windows 8.0 & 8.1)! */
struct
{
} W7;
struct
{
/* End of TEB in W6 (windows Vista)! */
} W6;
} Diff12;
} TEB_COMMON;
typedef TEB_COMMON *PTEB_COMMON;
/** The size of the windows 8.1 PEB structure. */
/** The size of the windows 8.0 PEB structure. */
/** The size of the windows 7 PEB structure. */
/** The size of the windows vista PEB structure. */
#define TEB_SIZE_W6 ( RT_UOFFSETOF(TEB_COMMON, Diff12.W6.WaitReasonBitMap) + sizeof(LARGE_INTEGER) )
/** The size of the windows server 2003 PEB structure. */
/** The size of the windows XP PEB structure. */
#define _PEB _PEB_COMMON
typedef PEB_COMMON PEB;
typedef PPEB_COMMON PPEB;
#define _TEB _TEB_COMMON
typedef TEB_COMMON TEB;
typedef PTEB_COMMON PTEB;
#define NtCurrentPeb() RTNtCurrentPeb()
/** @} */
#ifdef IPRT_NT_USE_WINTERNL
NTSYSAPI NTSTATUS NTAPI NtCreateSection(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PLARGE_INTEGER, ULONG, ULONG, HANDLE);
typedef enum _SECTION_INHERIT
{
ViewShare = 1,
NTSYSAPI NTSTATUS NTAPI NtMapViewOfSection(HANDLE, HANDLE, PVOID *, ULONG, SIZE_T, PLARGE_INTEGER, PSIZE_T, SECTION_INHERIT,
typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
{
typedef enum _FSINFOCLASS
{
typedef FS_INFORMATION_CLASS *PFS_INFORMATION_CLASS;
NTSYSAPI NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FS_INFORMATION_CLASS);
typedef struct _FILE_BOTH_DIR_INFORMATION
{
typedef struct _FILE_BASIC_INFORMATION
{
typedef struct _FILE_STANDARD_INFORMATION
{
typedef struct _FILE_NAME_INFORMATION
{
typedef FILE_NAME_INFORMATION *PFILE_NAME_INFORMATION;
typedef enum _FILE_INFORMATION_CLASS
{
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG, FILE_INFORMATION_CLASS);
NTSYSAPI NTSTATUS NTAPI NtQueryDirectoryFile(HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID, PIO_STATUS_BLOCK, PVOID, ULONG,
typedef struct _MEMORY_SECTION_NAME
{
#ifdef IPRT_NT_USE_WINTERNL
typedef struct _PROCESS_BASIC_INFORMATION
{
#endif
typedef enum _PROCESSINFOCLASS
{
typedef enum _THREADINFOCLASS
{
NTSYSAPI NTSTATUS NTAPI NtQueryInformationToken(HANDLE, TOKEN_INFORMATION_CLASS, PVOID, ULONG, PULONG);
NTSYSAPI NTSTATUS NTAPI NtReadFile(HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID, PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER, PULONG);
NTSYSAPI NTSTATUS NTAPI NtWriteFile(HANDLE, HANDLE, PIO_APC_ROUTINE, void const *, PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER, PULONG);
#endif /* IPRT_NT_USE_WINTERNL */
typedef enum _OBJECT_INFORMATION_CLASS
{
#ifdef IN_RING0
# define NtQueryObject ZwQueryObject
#endif
NTSYSAPI NTSTATUS NTAPI NtDuplicateObject(HANDLE, HANDLE, HANDLE, PHANDLE, ACCESS_MASK, ULONG, ULONG);
typedef struct _OBJECT_DIRECTORY_INFORMATION
{
NTSYSAPI NTSTATUS NTAPI NtQueryDirectoryObject(HANDLE, PVOID, ULONG, BOOLEAN, BOOLEAN, PULONG, PULONG);
/** @name ProcessDefaultHardErrorMode bit definitions.
* @{ */
/** @} */
/** Retured by ProcessImageInformation as well as NtQuerySection. */
typedef struct _SECTION_IMAGE_INFORMATION
{
union
{
struct
{
};
};
union /**< Since Vista, used to be a spare BOOLEAN. */
{
struct
{
};
};
typedef enum _SECTION_INFORMATION_CLASS
{
NTSYSAPI NTSTATUS NTAPI NtCreateSymbolicLinkObject(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PUNICODE_STRING pTarget);
#ifndef SYMBOLIC_LINK_QUERY
#endif
#ifndef SYMBOLIC_LINK_ALL_ACCESS
#endif
#ifndef SEC_FILE
#endif
#ifndef SEC_IMAGE
#endif
#ifndef SEC_PROTECTED_IMAGE
#endif
#ifndef SEC_NOCACHE
#endif
#ifndef MEM_ROTATE
#endif
typedef enum _MEMORY_INFORMATION_CLASS
{
#ifdef IN_RING0
typedef struct _MEMORY_BASIC_INFORMATION
{
# define NtQueryVirtualMemory ZwQueryVirtualMemory
#endif
NTSYSAPI NTSTATUS NTAPI NtQueryVirtualMemory(HANDLE, void const *, MEMORY_INFORMATION_CLASS, PVOID, SIZE_T, PSIZE_T);
#ifdef IPRT_NT_USE_WINTERNL
#endif
typedef enum _SYSTEM_INFORMATION_CLASS
{
SystemLoadGdiDriverInformation, /* 26 */
SystemUnloadGdiDriverInformation, /* 27 */
SystemExtendedHandleInformation, /* 64 */
SystemInformation_HotPatchInfo, /* 69 */
/** @todo fill gap. they've added a whole bunch of things */
SystemPolicyInformation = 134,
#ifdef IPRT_NT_USE_WINTERNL
typedef struct _VM_COUNTERS
{
} VM_COUNTERS;
typedef VM_COUNTERS *PVM_COUNTERS;
#endif
#if 0
typedef struct _IO_COUNTERS
{
} IO_COUNTERS;
typedef IO_COUNTERS *PIO_COUNTERS;
#endif
typedef struct _RTNT_SYSTEM_PROCESS_INFORMATION
{
/* After this follows the threads, then the ProcessName.Buffer. */
#ifndef IPRT_NT_USE_WINTERNL
#endif
typedef struct _SYSTEM_HANDLE_ENTRY_INFO
{
/** Returned by SystemHandleInformation */
typedef struct _SYSTEM_HANDLE_INFORMATION
{
/** Extended handle information entry.
* @remarks 3 x PVOID + 4 x ULONG = 28 bytes on 32-bit / 40 bytes on 64-bit */
typedef struct _SYSTEM_HANDLE_ENTRY_INFO_EX
{
/** Returned by SystemExtendedHandleInformation. */
typedef struct _SYSTEM_HANDLE_INFORMATION_EX
{
/** Input to SystemSessionProcessInformation. */
typedef struct _SYSTEM_SESSION_PROCESS_INFORMATION
{
/** Return buffer, SYSTEM_PROCESS_INFORMATION entries. */
#ifndef IPRT_NT_USE_WINTERNL
#endif
typedef enum _OBJECT_WAIT_TYPE { WaitAllObjects = 0, WaitAnyObject = 1, ObjectWaitTypeHack = 0x7fffffff } OBJECT_WAIT_TYPE;
NTSYSAPI NTSTATUS NTAPI NtWaitForMultipleObjects(ULONG, PHANDLE, OBJECT_WAIT_TYPE, BOOLEAN, PLARGE_INTEGER);
#ifdef IPRT_NT_USE_WINTERNL
typedef enum _EVENT_TYPE
{
/* Manual reset event. */
NotificationEvent = 0,
/* Automaitc reset event. */
} EVENT_TYPE;
#endif
NTSYSAPI NTSTATUS NTAPI NtCreateEvent(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, EVENT_TYPE, BOOLEAN);
typedef enum _EVENT_INFORMATION_CLASS
{
/** Data returned by NtQueryEvent + EventBasicInformation. */
typedef struct EVENT_BASIC_INFORMATION
{
#ifdef IPRT_NT_USE_WINTERNL
/** For NtQueryValueKey. */
typedef enum _KEY_VALUE_INFORMATION_CLASS
{
/** KeyValuePartialInformation and KeyValuePartialInformationAlign64 struct. */
typedef struct _KEY_VALUE_PARTIAL_INFORMATION
{
#endif
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(HANDLE, PUNICODE_STRING, KEY_VALUE_INFORMATION_CLASS, PVOID, ULONG, PULONG);
typedef struct _CURDIR
{
} CURDIR;
typedef struct _RTL_DRIVE_LETTER_CURDIR
{
typedef struct _RTL_USER_PROCESS_PARAMETERS
{
#define RTL_USER_PROCESS_PARAMS_FLAG_NORMALIZED 1
typedef struct _RTL_USER_PROCESS_INFORMATION
{
NTSYSAPI NTSTATUS NTAPI RtlCreateUserProcess(PUNICODE_STRING, ULONG, PRTL_USER_PROCESS_PARAMETERS, PSECURITY_DESCRIPTOR,
NTSYSAPI NTSTATUS NTAPI RtlCreateProcessParameters(PRTL_USER_PROCESS_PARAMETERS *, PUNICODE_STRING ImagePathName,
NTSYSAPI NTSTATUS NTAPI RtlCreateUserThread(HANDLE, PSECURITY_DESCRIPTOR, BOOLEAN, ULONG, SIZE_T, SIZE_T,
/** @} */
#if defined(IN_RING0) || defined(DOXYGEN_RUNNING)
/** @name NT Kernel APIs
* @{ */
NTSYSAPI BOOLEAN NTAPI ObFindHandleForObject(PEPROCESS pProcess, PVOID pvObject, POBJECT_TYPE pObjectType,
NTSYSAPI NTSTATUS NTAPI ObReferenceObjectByName(PUNICODE_STRING pObjectPath, ULONG fAttributes, PACCESS_STATE pAccessState,
extern DECLIMPORT(POBJECT_TYPE *) LpcPortObjectType; /**< In vista+ this is the ALPC port object type. */
extern DECLIMPORT(POBJECT_TYPE *) LpcWaitablePortObjectType; /**< In vista+ this is the ALPC port object type. */
/** @ */
#endif /* IN_RING0 */
#if defined(IN_RING3) || defined(DOXYGEN_RUNNING)
/** @name NT Userland APIs
* @{ */
#if 0 /** @todo figure this out some time... */
typedef struct CSR_MSG_DATA_CREATED_PROCESS
{
#endif
typedef struct _LDR_DLL_LOADED_NOTIFICATION_DATA
{
typedef LDR_DLL_LOADED_NOTIFICATION_DATA *PLDR_DLL_LOADED_NOTIFICATION_DATA, *PLDR_DLL_UNLOADED_NOTIFICATION_DATA;
typedef LDR_DLL_LOADED_NOTIFICATION_DATA const *PCLDR_DLL_LOADED_NOTIFICATION_DATA, *PCLDR_DLL_UNLOADED_NOTIFICATION_DATA;
typedef union _LDR_DLL_NOTIFICATION_DATA
{
typedef LDR_DLL_NOTIFICATION_DATA const *PCLDR_DLL_NOTIFICATION_DATA;
typedef VOID (NTAPI *PLDR_DLL_NOTIFICATION_FUNCTION)(ULONG ulReason, PCLDR_DLL_NOTIFICATION_DATA pData, PVOID pvUser);
NTSYSAPI NTSTATUS NTAPI LdrRegisterDllNotification(ULONG fFlags, PLDR_DLL_NOTIFICATION_FUNCTION pfnCallback, PVOID pvUser,
typedef NTSTATUS (NTAPI *PFNLDRREGISTERDLLNOTIFICATION)(ULONG, PLDR_DLL_NOTIFICATION_FUNCTION, PVOID, PVOID *);
NTSYSAPI NTSTATUS NTAPI RtlExpandEnvironmentStrings_U(PVOID, PUNICODE_STRING, PUNICODE_STRING, PULONG);
# ifdef IPRT_NT_USE_WINTERNL
typedef struct _RTL_HEAP_PARAMETERS
{
typedef RTL_HEAP_PARAMETERS *PRTL_HEAP_PARAMETERS;
NTSYSAPI PVOID NTAPI RtlCreateHeap(ULONG fFlags, PVOID pvHeapBase, SIZE_T cbReserve, SIZE_T cbCommit, PVOID pvLock,
/** @name Heap flags (for RtlCreateHeap).
* @{ */
/*# define HEAP_NO_SERIALIZE UINT32_C(0x00000001)
# define HEAP_GROWABLE UINT32_C(0x00000002)
# define HEAP_GENERATE_EXCEPTIONS UINT32_C(0x00000004)
# define HEAP_ZERO_MEMORY UINT32_C(0x00000008)
# define HEAP_REALLOC_IN_PLACE_ONLY UINT32_C(0x00000010)
# define HEAP_TAIL_CHECKING_ENABLED UINT32_C(0x00000020)
# define HEAP_FREE_CHECKING_ENABLED UINT32_C(0x00000040)
# define HEAP_DISABLE_COALESCE_ON_FREE UINT32_C(0x00000080)*/
# endif
# define HEAP_CLASS_PROCESS HEAP_CLASS_0
# define HEAP_CLASS_PRIVATE HEAP_CLASS_1
# define HEAP_CLASS_KERNEL HEAP_CLASS_2
# define HEAP_CLASS_GDI HEAP_CLASS_3
# define HEAP_CLASS_USER HEAP_CLASS_4
# define HEAP_CLASS_CONSOLE HEAP_CLASS_5
# define HEAP_CLASS_USER_DESKTOP HEAP_CLASS_6
# define HEAP_CLASS_CSRSS_SHARED HEAP_CLASS_7
# define HEAP_CLASS_CSRSS_PORT HEAP_CLASS_8
# ifdef IPRT_NT_USE_WINTERNL
/*# define HEAP_CREATE_ALIGN_16 UINT32_C(0x00010000)
# define HEAP_CREATE_ENABLE_TRACING UINT32_C(0x00020000)
# define HEAP_CREATE_ENABLE_EXECUTE UINT32_C(0x00040000)*/
# endif /* IPRT_NT_USE_WINTERNL */
/** @} */
# ifdef IPRT_NT_USE_WINTERNL
/** @name Heap tagging constants
* @{ */
/*# define HEAP_MAXIMUM_TAG UINT32_C(0x00000fff)
# define HEAP_PSEUDO_TAG_FLAG UINT32_C(0x00008000)
# define HEAP_TAG_SHIFT 18 */
/** @} */
# endif /* IPRT_NT_USE_WINTERNL */
/** @} */
#endif /* IN_RING3 */
#endif