the-nt-kernel.h revision 3a11c660d37a68f1ba83d8f08ee6516ebc5aaa05
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/* $Id$ */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/** @file
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * IPRT - Include all necessary headers for the NT kernel.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/*
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Copyright (C) 2006-2012 Oracle Corporation
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync *
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * available from http://www.virtualbox.org. This file is free software;
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * General Public License (GPL) as published by the Free Software
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync *
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * The contents of this file may alternatively be used under the terms
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * of the Common Development and Distribution License Version 1.0
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * CDDL are applicable instead of those of the GPL.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync *
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * You may elect to license modified versions of this file under the
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * terms and conditions of either the GPL or the CDDL or both.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#ifndef ___the_nt_kernel_h
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#define ___the_nt_kernel_h
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#include <iprt/cdefs.h>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#if defined(RT_ARCH_X86) && !defined(NO_INTERLOCKED_INTRINSICS)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define NO_INTERLOCKED_INTRINSICS /* avoid trouble */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#endif
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# include <iprt/asm.h>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# pragma warning(disable : 4163)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncRT_C_DECLS_BEGIN
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# include <iprt/nt/nt.h>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncRT_C_DECLS_END
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# pragma warning(default : 4163)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef _InterlockedExchange
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef _InterlockedExchangeAdd
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef _InterlockedCompareExchange
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef _InterlockedAddLargeStatistic
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#else
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncRT_C_DECLS_BEGIN
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# include <iprt/nt/nt.h>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsyncRT_C_DECLS_END
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#endif
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#include <memory.h>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#if !defined(RT_OS_WINDOWS)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# error "RT_OS_WINDOWS must be defined!"
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#endif
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#include <iprt/param.h>
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#ifndef PAGE_OFFSET_MASK
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define PAGE_OFFSET_MASK (PAGE_SIZE - 1)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#endif
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/*
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * When targeting NT4 we have to undo some of the nice macros
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * installed by the later DDKs.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#ifdef IPRT_TARGET_NT4
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef ExAllocatePoolWithTag
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define ExAllocatePoolWithTag(a,b,c) ExAllocatePool(a,b)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef ExAllocatePoolWithQuotaTag
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# define ExAllocatePoolWithQuotaTag(a,b,c) ExAllocatePoolWithQuota(a,b)
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef ExAllocatePool
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync NTKERNELAPI PVOID NTAPI ExAllocatePool(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes);
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync# undef ExFreePool
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync NTKERNELAPI VOID NTAPI ExFreePool(IN PVOID P);
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#endif /* IPRT_TARGET_NT4 */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync/** @def IPRT_NT_POOL_TAG
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * Tag to use with the NT Pool APIs.
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * In memory and in the various windbg tool it appears in the reverse order of
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync * what it is given as here, so it'll read "IPRT".
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync */
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#define IPRT_NT_POOL_TAG 'TRPI'
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync#endif
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync
3194da424708abdd288b28d96892b3a5f3f7df0bvboxsync