Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
6.2 KiB

  1. /*++
  2. Copyright (c) 1998-1999 Microsoft Corporation
  3. Module Name:
  4. rmtest.h
  5. Abstract:
  6. Header file which allows rm.h to compile as a win32 app.
  7. Revision History:
  8. Who When What
  9. -------- -------- ----------------------------------------------
  10. josephj 01-13-99 Created
  11. Notes:
  12. --*/
  13. #include <ccdefs.h>
  14. #include <nt.h>
  15. #include <ntverp.h>
  16. #include <ntrtl.h>
  17. #include <nturtl.h>
  18. #include <windows.h>
  19. #include <wdbgexts.h>
  20. #include <stdio.h>
  21. #ifdef ASSERT
  22. #undef ASSERT
  23. #define ASSERT(cond) ((cond)? 0: DebugBreak())
  24. #endif // ASSERT
  25. #define NDIS_SPIN_LOCK CRITICAL_SECTION
  26. #define NDIS_STATUS UINT
  27. #define NdisZeroMemory(_ptr, _size) ZeroMemory(_ptr, _size)
  28. #define NdisInterlockedIncrement(_ptr) InterlockedIncrement(_ptr)
  29. #define NdisInterlockedDecrement(_ptr) InterlockedDecrement(_ptr)
  30. #define NdisAllocateMemoryWithTag(_pp, _sz, _tag) \
  31. (*((PVOID*)_pp) = LocalAlloc(LPTR, (_sz)))
  32. #define NdisFreeMemory(_p, _x, _y) LocalFree(_p)
  33. #define NdisAcquireSpinLock EnterCriticalSection
  34. #define NdisReleaseSpinLock LeaveCriticalSection
  35. #define NdisDprAcquireSpinLock EnterCriticalSection
  36. #define NdisDprReleaseSpinLock LeaveCriticalSection
  37. #define NDIS_STATUS_SUCCESS ERROR_SUCCESS
  38. #define NDIS_STATUS_FAILURE ERROR_GEN_FAILURE
  39. #define NDIS_STATUS_RESOURCES ERROR_NOT_ENOUGH_MEMORY
  40. #define NDIS_STATUS_PENDING E_PENDING
  41. #define MTAG_TASK 'aTRM'
  42. #define NdisAllocateSpinLock(_plock) InitializeCriticalSection(_plock)
  43. #define NdisFreeSpinLock(_plock) DeleteCriticalSection(_plock)
  44. #define NDIS_EVENT HANDLE
  45. #define NdisInitializeEvent(_pE) (*(_pE) = CreateEvent(NULL,TRUE,FALSE, NULL))
  46. #define NdisWaitEvent(_pE,_T) WaitForSingleObject(*(_pE), INFINITE)
  47. #define NdisSetEvent(_pE) SetEvent(*(_pE))
  48. #define DbgPrint printf
  49. #if DBG
  50. #define KeGetCurrentIrql() (0)
  51. #define ASSERTEX(x, ctxt) \
  52. { \
  53. if (!(x)) \
  54. { \
  55. printf( "A13: !ASSERT( %s ) C:0x%p L:%d,F:%s\n", \
  56. #x, (ctxt), __LINE__, __FILE__ ); \
  57. DebugBreak(); \
  58. } \
  59. }
  60. #define ENTER(_Name, _locid) \
  61. char *dbg_func_name = (_Name); \
  62. UINT dbg_func_locid = (_locid);
  63. #define TR_INFO(str) (printf("TEST: %s:", dbg_func_name), printf str)
  64. #define TR_WARN(str) (printf("TEST: %s:", dbg_func_name), printf str)
  65. #define TR_FATAL(str) (printf("TEST: %s:", dbg_func_name), printf str)
  66. #define TR_VERB(str)
  67. #define TRACE0(ulLevel, Args) (printf Args)
  68. #define EXIT()
  69. #define DBGSTMT(_stmt) _stmt
  70. #else // !DBG
  71. #define ASSERTEX(x, ctxt)
  72. #define ENTER(_Name, _locid)
  73. #define TR_INFO(str)
  74. #define TR_WARN(str)
  75. #define TR_FATAL(str)
  76. #define TR_VERB(str)
  77. #define EXIT()
  78. #define DBGSTMT(_stmt)
  79. #endif // DBG
  80. #define FAIL(_err) ((_err) != NDIS_STATUS_SUCCESS)
  81. #define PEND(_Status) ((_Status) == NDIS_STATUS_PENDING)
  82. //
  83. // Following added just to get ..\priv.h and .\buf.c to build
  84. //
  85. typedef VOID *IP_BIND_COMPLETE;
  86. typedef VOID *IP_DEL_INTERFACE;
  87. typedef VOID *IP_ADD_INTERFACE;
  88. typedef UINT IPAddr;
  89. typedef UINT IPMask;
  90. typedef UINT IPRcvCmpltRtn;
  91. typedef VOID* IPStatusRtn;
  92. typedef VOID* IPTDCmpltRtn;
  93. typedef VOID* IPTxCmpltRtn;
  94. typedef VOID* IPRcvRtn;
  95. typedef UINT NDIS_CLIENT_CHARACTERISTICS;
  96. typedef VOID *NDIS_HANDLE;
  97. typedef NDIS_HANDLE *PNDIS_HANDLE;
  98. typedef UINT NDIS_PROTOCOL_CHARACTERISTICS;
  99. typedef VOID* NDIS_STRING;
  100. typedef UINT NIC1394_FIFO_ADDRESS;
  101. typedef NDIS_STATUS *PNDIS_STATUS;
  102. typedef NDIS_STRING *PNDIS_STRING;
  103. typedef VOID * PNDIS_REQUEST;
  104. typedef VOID * PNDIS_PACKET;
  105. typedef VOID * PCO_ADDRESS_FAMILY;
  106. typedef VOID * PCO_CALL_PARAMETERS;
  107. typedef UINT RouteCacheEntry;
  108. typedef UINT TDIEntityID;
  109. typedef UINT TDIObjectID;
  110. typedef struct _NDIS_BUFFER
  111. {
  112. struct _NDIS_BUFFER *Next;
  113. UINT uData;
  114. } NDIS_BUFFER, *PNDIS_BUFFER;
  115. typedef UINT NIC1394_DESTINATION;
  116. typedef VOID * PDEVICE_OBJECT;
  117. typedef VOID * PIRP;
  118. typedef VOID * PIO_STACK_LOCATION;
  119. typedef struct
  120. {
  121. SINGLE_LIST_ENTRY *pList;
  122. } SLIST_HEADER;
  123. #define NdisAllocateBufferPool(_s, _h, _max) \
  124. { \
  125. *(_s) = NDIS_STATUS_SUCCESS; \
  126. *(_h) = (NDIS_HANDLE) 1; \
  127. }
  128. #define ExInitializeSListHead(_h) ((_h)->pList = NULL)
  129. #define ExInterlockedPopEntrySList(_l, _spinlock) \
  130. (_l)->pList; {if ((_l)->pList) {(_l)->pList = (_l)->pList->Next;}}
  131. #define STRUCT_OF(_t, _p, _f) CONTAINING_RECORD(_p, _t, _f)
  132. #define NDIS_BUFFER_LINKAGE(_pBuf) ((_pBuf)->Next)
  133. #define NdisFreeBuffer(buf) LocalFree(buf)
  134. #define NdisAllocateBuffer(s, ppbuf, handle, mem, len) \
  135. { \
  136. PNDIS_BUFFER X_pBuf; \
  137. ASSERT((len)==sizeof(UINT)); \
  138. X_pBuf = LocalAlloc(LPTR, sizeof(NDIS_BUFFER)); \
  139. if (X_pBuf == NULL) \
  140. { \
  141. *(s) = NDIS_STATUS_RESOURCES; \
  142. *(ppbuf) = NULL; \
  143. } \
  144. else \
  145. { \
  146. X_pBuf->uData = *(UINT*) (mem); \
  147. *(ppbuf) = X_pBuf; \
  148. *(s) = NDIS_STATUS_SUCCESS; \
  149. } \
  150. }
  151. #define ExInterlockedPushEntrySList(_l, _ptr, _spinlock) \
  152. { \
  153. (_ptr)->Next = (_l)->pList; \
  154. (_l)->pList = (_ptr); \
  155. }
  156. typedef
  157. VOID
  158. (*PNDIS_TIMER_FUNCTION) (
  159. IN PVOID SystemSpecific1,
  160. IN PVOID FunctionContext,
  161. IN PVOID SystemSpecific2,
  162. IN PVOID SystemSpecific3
  163. );
  164. typedef VOID (*NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID);
  165. typedef struct _NDIS_WORK_ITEM
  166. {
  167. PVOID Context;
  168. NDIS_PROC Routine;
  169. UCHAR WrapperReserved[8*sizeof(PVOID)];
  170. } NDIS_WORK_ITEM, *PNDIS_WORK_ITEM;
  171. typedef struct
  172. {
  173. HANDLE hTimer;
  174. PNDIS_TIMER_FUNCTION pfnHandler;
  175. PVOID Context;
  176. } NDIS_TIMER, *PNDIS_TIMER;
  177. VOID
  178. NdisInitializeWorkItem(
  179. IN PNDIS_WORK_ITEM WorkItem,
  180. IN NDIS_PROC Routine,
  181. IN PVOID Context
  182. );
  183. NDIS_STATUS
  184. NdisScheduleWorkItem(
  185. IN PNDIS_WORK_ITEM WorkItem
  186. );
  187. VOID
  188. NdisSetTimer(
  189. IN PNDIS_TIMER Timer,
  190. IN UINT MillisecondsToDelay
  191. );
  192. VOID
  193. NdisInitializeTimer(
  194. IN OUT PNDIS_TIMER Timer,
  195. IN PNDIS_TIMER_FUNCTION TimerFunction,
  196. IN PVOID FunctionContext
  197. );
  198. VOID
  199. NdisCancelTimer(
  200. IN PNDIS_TIMER Timer,
  201. OUT PBOOLEAN TimerCancelled
  202. );
  203. #include <rm.h>
  204. // #include <priv.h>