1 | /* $Id: the-nt-kernel.h 56290 2015-06-09 14:01:31Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Include all necessary headers for the NT kernel.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2015 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #ifndef ___the_nt_kernel_h
|
---|
28 | #define ___the_nt_kernel_h
|
---|
29 |
|
---|
30 | #include <iprt/cdefs.h>
|
---|
31 |
|
---|
32 | #if defined(RT_ARCH_X86) && !defined(NO_INTERLOCKED_INTRINSICS)
|
---|
33 | # define NO_INTERLOCKED_INTRINSICS /* avoid trouble */
|
---|
34 | #endif
|
---|
35 | #if (_MSC_VER >= 1400) && !defined(VBOX_WITH_PATCHED_DDK)
|
---|
36 | # include <iprt/asm.h>
|
---|
37 | # define _InterlockedExchange _InterlockedExchange_StupidDDKVsCompilerCrap
|
---|
38 | # define _InterlockedExchangeAdd _InterlockedExchangeAdd_StupidDDKVsCompilerCrap
|
---|
39 | # define _InterlockedCompareExchange _InterlockedCompareExchange_StupidDDKVsCompilerCrap
|
---|
40 | # define _InterlockedAddLargeStatistic _InterlockedAddLargeStatistic_StupidDDKVsCompilerCrap
|
---|
41 | # pragma warning(disable : 4163)
|
---|
42 | RT_C_DECLS_BEGIN
|
---|
43 | # include <iprt/nt/nt.h>
|
---|
44 | RT_C_DECLS_END
|
---|
45 | # pragma warning(default : 4163)
|
---|
46 | # undef _InterlockedExchange
|
---|
47 | # undef _InterlockedExchangeAdd
|
---|
48 | # undef _InterlockedCompareExchange
|
---|
49 | # undef _InterlockedAddLargeStatistic
|
---|
50 | #else
|
---|
51 | RT_C_DECLS_BEGIN
|
---|
52 | # include <iprt/nt/nt.h>
|
---|
53 | RT_C_DECLS_END
|
---|
54 | #endif
|
---|
55 |
|
---|
56 | #include <memory.h>
|
---|
57 | #if !defined(RT_OS_WINDOWS)
|
---|
58 | # error "RT_OS_WINDOWS must be defined!"
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | #include <iprt/param.h>
|
---|
62 | #ifndef PAGE_OFFSET_MASK
|
---|
63 | # define PAGE_OFFSET_MASK (PAGE_SIZE - 1)
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | /*
|
---|
67 | * When targeting NT4 we have to undo some of the nice macros
|
---|
68 | * installed by the later DDKs.
|
---|
69 | */
|
---|
70 | #ifdef IPRT_TARGET_NT4
|
---|
71 | # undef ExAllocatePoolWithTag
|
---|
72 | # define ExAllocatePoolWithTag(a,b,c) ExAllocatePool(a,b)
|
---|
73 | # undef ExAllocatePoolWithQuotaTag
|
---|
74 | # define ExAllocatePoolWithQuotaTag(a,b,c) ExAllocatePoolWithQuota(a,b)
|
---|
75 | # undef ExAllocatePool
|
---|
76 | NTKERNELAPI PVOID NTAPI ExAllocatePool(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes);
|
---|
77 | # undef ExFreePool
|
---|
78 | NTKERNELAPI VOID NTAPI ExFreePool(IN PVOID P);
|
---|
79 | #endif /* IPRT_TARGET_NT4 */
|
---|
80 |
|
---|
81 | /** @def IPRT_NT_POOL_TAG
|
---|
82 | * Tag to use with the NT Pool APIs.
|
---|
83 | * In memory and in the various windbg tool it appears in the reverse order of
|
---|
84 | * what it is given as here, so it'll read "IPRT".
|
---|
85 | */
|
---|
86 | #define IPRT_NT_POOL_TAG 'TRPI'
|
---|
87 |
|
---|
88 | #endif
|
---|
89 |
|
---|