- Build AFD, TCPIP and TDI with w32api headers.
[reactos.git] / reactos / drivers / net / ndis / include / ndissys.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
4 * FILE: ndissys.h
5 * PURPOSE: NDIS library definitions
6 * NOTES: Spin lock acquire order:
7 * - Miniport list lock
8 * - Adapter list lock
9 */
10 #ifndef __NDISSYS_H
11 #define __NDISSYS_H
12
13 #define NDIS50 1 /* Use NDIS 5.0 structures by default */
14
15 #ifdef _MSC_VER
16 #include <basetsd.h>
17 #include <ntddk.h>
18 #include <windef.h>
19 #include <ndis.h>
20 #else /* _MSC_VER */
21 #include <ddk/ntddk.h>
22 #include <ddk/xfilter.h>
23 #include <net/ndis.h>
24 #endif /* _MSC_VER */
25
26 #include <debug.h>
27
28 /* Exported functions */
29 #ifdef _MSC_VER
30 #define EXPORT __declspec(dllexport)
31 #else
32 #define EXPORT STDCALL
33 #endif
34
35
36 #ifdef DBG
37
38 #define DEBUG_REFCHECK(Object) { \
39 if ((Object)->RefCount <= 0) { \
40 NDIS_DbgPrint(MIN_TRACE, ("Object at (0x%X) has invalid reference count (%d).\n", \
41 (Object), (Object)->RefCount)); \
42 } \
43 }
44
45 #else
46
47 #define DEBUG_REFCHECK(Object)
48
49 #endif
50
51
52 /*
53 * VOID ReferenceObject(
54 * PVOID Object)
55 */
56 #define ReferenceObject(Object) \
57 { \
58 DEBUG_REFCHECK(Object); \
59 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Referencing object at (0x%X). RefCount (%d).\n", \
60 (Object), (Object)->RefCount)); \
61 \
62 InterlockedIncrement(&((Object)->RefCount)); \
63 }
64
65 /*
66 * VOID DereferenceObject(
67 * PVOID Object)
68 */
69 #define DereferenceObject(Object) \
70 { \
71 DEBUG_REFCHECK(Object); \
72 NDIS_DbgPrint(DEBUG_REFCOUNT, ("Dereferencing object at (0x%X). RefCount (%d).\n", \
73 (Object), (Object)->RefCount)); \
74 \
75 if (InterlockedDecrement(&((Object)->RefCount)) == 0) \
76 PoolFreeBuffer(Object); \
77 }
78
79
80 #define MIN(value1, value2) \
81 ((value1 < value2)? value1 : value2)
82
83 #define MAX(value1, value2) \
84 ((value1 > value2)? value1 : value2)
85
86 #endif /* __NDISSYS_H */
87
88 /* EOF */