ReactOS  0.4.15-dev-3181-g4acf100
wdfcore.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (c) Microsoft Corporation. All rights reserved.
4 
5 _WdfVersionBuild_
6 
7 Module Name:
8 
9  wdfcore.h
10 
11 Abstract:
12 
13  This is the main driver framework.
14 
15 Environment:
16 
17  kernel mode only
18 
19 Revision History:
20 
21 --*/
22 
23 //
24 // NOTE: This header is generated by stubwork. Please make any
25 // modifications to the corresponding template files
26 // (.x or .y) and use stubwork to regenerate the header
27 //
28 
29 #ifndef _WDFCORE_H_
30 #define _WDFCORE_H_
31 
32 #ifndef WDF_EXTERN_C
33  #ifdef __cplusplus
34  #define WDF_EXTERN_C extern "C"
35  #define WDF_EXTERN_C_START extern "C" {
36  #define WDF_EXTERN_C_END }
37  #else
38  #define WDF_EXTERN_C
39  #define WDF_EXTERN_C_START
40  #define WDF_EXTERN_C_END
41  #endif
42 #endif
43 
45 
46 
47 
48 #if (NTDDI_VERSION >= NTDDI_WIN2K)
49 
50 
51 
52 //
53 // Time conversion related macros
54 //
55 // to to to
56 // us ms sec
57 #define WDF_TIMEOUT_TO_SEC ((LONGLONG) 1 * 10 * 1000 * 1000)
58 #define WDF_TIMEOUT_TO_MS ((LONGLONG) 1 * 10 * 1000)
59 #define WDF_TIMEOUT_TO_US ((LONGLONG) 1 * 10)
64  )
65 {
66  return Time * -1 * WDF_TIMEOUT_TO_SEC;
67 }
68 
73  )
74 {
75  return Time * 1 * WDF_TIMEOUT_TO_SEC;
76 }
77 
82  )
83 {
84  return Time * -1 * WDF_TIMEOUT_TO_MS;
85 }
86 
91  )
92 {
93  return Time * 1 * WDF_TIMEOUT_TO_MS;
94 }
95 
100  )
101 {
102  return Time * -1 * WDF_TIMEOUT_TO_US;
103 }
104 
106 LONGLONG
109  )
110 {
111  return Time * 1 * WDF_TIMEOUT_TO_US;
112 }
113 
114 //
115 // Rounding functions
116 //
118 size_t
120  _In_ size_t Length,
121  _In_ size_t AlignTo
122  )
123 {
124  return Length & ~(AlignTo - 1);
125 }
126 
128 size_t
130  _In_ size_t Length,
131  _In_ size_t AlignTo
132  )
133 {
134  return WDF_ALIGN_SIZE_DOWN(Length + AlignTo - 1, AlignTo);
135 }
136 
137 
138 //
139 // Pointer math
140 //
141 #define WDF_PTR_ADD_OFFSET_TYPE(_ptr, _offset, _type) \
142  ((_type) (((PUCHAR) (_ptr)) + (_offset)))
143 
144 #define WDF_PTR_ADD_OFFSET(_ptr, _offset) \
145  WDF_PTR_ADD_OFFSET_TYPE(_ptr, _offset, PVOID)
146 
147 #define WDF_PTR_GET_OFFSET(_base, _addr) \
148  (size_t) (((PUCHAR) _addr) - ((PUCHAR) _base))
149 
150 #if (OSVER(NTDDI_VERSION) == NTDDI_WIN2K)
151 //
152 // These definitions are necessary for building under a Win2K Environment.
153 //
154 #ifndef DECLARE_UNICODE_STRING_SIZE
155 #define DECLARE_UNICODE_STRING_SIZE(_var, _size) \
156 WCHAR _var ## _buffer[_size]; \
157 UNICODE_STRING _var = { 0, _size * sizeof(WCHAR) , _var ## _buffer }
158 #endif
159 
160 #undef DECLARE_CONST_UNICODE_STRING
161 #define DECLARE_CONST_UNICODE_STRING(_variablename, _string) \
162 const WCHAR _variablename ## _buffer[] = _string; \
163 __pragma(warning(suppress:4204)) __pragma(warning(suppress:4221)) \
164 const UNICODE_STRING _variablename = { sizeof(_string) - sizeof(WCHAR), sizeof(_string), (PWSTR) _variablename ## _buffer }
165 
166 #endif // (OSVER(NTDDI_VERSION) == NTDDI_WIN2K)
167 
168 
169 
170 #endif // (NTDDI_VERSION >= NTDDI_WIN2K)
171 
172 
174 
175 #endif // _WDFCORE_H_
176 
FORCEINLINE size_t WDF_ALIGN_SIZE_DOWN(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:119
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define WDF_EXTERN_C_END
Definition: wdfcore.h:40
FORCEINLINE LONGLONG WDF_REL_TIMEOUT_IN_MS(_In_ ULONGLONG Time)
Definition: wdfcore.h:80
FORCEINLINE LONGLONG WDF_ABS_TIMEOUT_IN_MS(_In_ ULONGLONG Time)
Definition: wdfcore.h:89
FORCEINLINE LONGLONG WDF_ABS_TIMEOUT_IN_SEC(_In_ ULONGLONG Time)
Definition: wdfcore.h:71
FORCEINLINE LONGLONG WDF_ABS_TIMEOUT_IN_US(_In_ ULONGLONG Time)
Definition: wdfcore.h:107
FORCEINLINE size_t WDF_ALIGN_SIZE_UP(_In_ size_t Length, _In_ size_t AlignTo)
Definition: wdfcore.h:129
#define WDF_TIMEOUT_TO_MS
Definition: wdfcore.h:58
#define _In_
Definition: ms_sal.h:308
#define WDF_EXTERN_C_START
Definition: wdfcore.h:39
int64_t LONGLONG
Definition: typedefs.h:68
uint64_t ULONGLONG
Definition: typedefs.h:67
#define WDF_TIMEOUT_TO_SEC
Definition: wdfcore.h:57
FORCEINLINE LONGLONG WDF_REL_TIMEOUT_IN_SEC(_In_ ULONGLONG Time)
Definition: wdfcore.h:62
#define WDF_TIMEOUT_TO_US
Definition: wdfcore.h:59
#define FORCEINLINE
Definition: wdftypes.h:67
FORCEINLINE LONGLONG WDF_REL_TIMEOUT_IN_US(_In_ ULONGLONG Time)
Definition: wdfcore.h:98
static PLARGE_INTEGER Time
Definition: time.c:105