Leaked source code of windows server 2003
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.

611 lines
24 KiB

  1. /*++
  2. Copyright (c) 2000-2000 Microsoft Corporation
  3. Module Name:
  4. Macroes.h
  5. Abstract:
  6. This module contains definitions of commonly used macroes
  7. Author:
  8. Mohammad Shabbir Alam (MAlam) 3-30-2000
  9. Revision History:
  10. --*/
  11. #ifndef _MACROES_H_
  12. #define _MACROES_H_
  13. #ifdef OLD_LOGGING
  14. #define MAX_DEBUG_MESSAGE_LENGTH 300
  15. //
  16. // Debug Flags
  17. //
  18. #define DBG_ENABLE_DBGPRINT 0x00000001
  19. #define DBG_DRIVER_ENTRY 0x00000002
  20. #define DBG_INIT_PGM 0x00000004
  21. #define DBG_DEBUG_REF 0x00000008
  22. #define DBG_PNP 0x00000010
  23. #define DBG_TDI 0x00000020
  24. #define DBG_ADDRESS 0x00000040
  25. #define DBG_CONNECT 0x00000080
  26. #define DBG_QUERY 0x00000100
  27. #define DBG_SEND 0x00000200
  28. #define DBG_RECEIVE 0x00000400
  29. #define DBG_FILEIO 0x00000800
  30. #define DBG_FEC 0x00001000
  31. //
  32. // DbgPrint macroes
  33. //
  34. enum eSEVERITY_LEVEL
  35. {
  36. PGM_LOG_DISABLED, // No logging!
  37. PGM_LOG_CRITICAL_ERROR, // Major errors which can seriously affect functionality
  38. PGM_LOG_ERROR, // Common errors which do not affect the system as a whole
  39. PGM_LOG_INFORM_STATUS, // Mostly to verify major functionality was executed
  40. PGM_LOG_INFORM_ALL_FUNCS, // 1 per function to allow path tracking (not req if printing all code paths)
  41. PGM_LOG_INFORM_PATH, // Interspersed throughout function to trace If paths
  42. PGM_LOG_INFORM_DETAIL, // while loops, etc
  43. PGM_LOG_INFORM_REFERENCES, //
  44. PGM_LOG_EVERYTHING
  45. };
  46. #endif // OLD_LOGGING
  47. #ifdef FILE_LOGGING
  48. #define WPP_CONTROL_GUIDS WPP_DEFINE_CONTROL_GUID(CtlGuid,(681507e2,356e,4e18,8d5a,a8eddedadf5d), \
  49. WPP_DEFINE_BIT(LogCriticalError) \
  50. WPP_DEFINE_BIT(LogError) \
  51. WPP_DEFINE_BIT(LogStatus) \
  52. WPP_DEFINE_BIT(LogFec) \
  53. WPP_DEFINE_BIT(LogAllFuncs) \
  54. WPP_DEFINE_BIT(LogPath) \
  55. WPP_DEFINE_BIT(LogReferences) \
  56. WPP_DEFINE_BIT(LogEverything) \
  57. )
  58. #else
  59. #if DBG
  60. enum eLOGGING_LEVEL
  61. {
  62. LogDisabled, // No logging!
  63. LogCriticalError, // Major errors which can seriously affect functionality
  64. LogError, // Common errors which do not affect the system as a whole
  65. LogStatus, // Mostly to verify major functionality was executed
  66. LogFec, // FEC
  67. LogAllFuncs, // 1 per function to allow path tracking (not req if printing all code paths)
  68. LogPath, // Interspersed throughout function to trace If paths
  69. LogReferences, //
  70. LogEverything
  71. };
  72. #define PgmTrace(X,Y) \
  73. if (X <= PgmLoggingLevel) \
  74. { \
  75. DbgPrint ("RMCast."); \
  76. DbgPrint Y; \
  77. }
  78. #else
  79. #define PgmTrace(X,Y)
  80. #endif // DBG
  81. #endif // FILE_LOGGING
  82. #if DBG
  83. //
  84. // ASSERT
  85. //
  86. #undef ASSERT
  87. #define ASSERT(exp) \
  88. if (!(exp)) \
  89. { \
  90. DbgPrint("Assertion \"%s\" failed at file %s, line %d\n", #exp, __FILE__, __LINE__ ); \
  91. if (!PgmDynamicConfig.DoNotBreakOnAssert) \
  92. { \
  93. DbgBreakPoint(); \
  94. } \
  95. }
  96. #endif // DBG
  97. //
  98. // Data/pointer verification
  99. //
  100. #define PGM_VERIFY_HANDLE(p, V) \
  101. ((p) && (p->Verify == V))
  102. #define PGM_VERIFY_HANDLE2(p, V1, V2) \
  103. ((p) && ((p->Verify == V1) || (p->Verify == V2)))
  104. #define PGM_VERIFY_HANDLE3(p, V1, V2, V3) \
  105. ((p) && ((p->Verify == V1) || (p->Verify == V2) || (p->Verify == V3)))
  106. //----------------------------------------------------------------------------
  107. //
  108. // Sequence number macroes
  109. //
  110. #define SEQ_LT(a,b) ((SIGNED_SEQ_TYPE)((a)-(b)) < 0)
  111. #define SEQ_LEQ(a,b) ((SIGNED_SEQ_TYPE)((a)-(b)) <= 0)
  112. #define SEQ_GT(a,b) ((SIGNED_SEQ_TYPE)((a)-(b)) > 0)
  113. #define SEQ_GEQ(a,b) ((SIGNED_SEQ_TYPE)((a)-(b)) >= 0)
  114. //----------------------------------------------------------------------------
  115. //
  116. // Definitions:
  117. //
  118. #define IS_MCAST_ADDRESS(IpAddress) ((((PUCHAR)(&IpAddress))[3]) >= ((UCHAR)0xe0))
  119. #define CLASSD_ADDR(a) (( (*((uchar *)&(a))) & 0xf0) == 0xe0)
  120. //
  121. // Alloc and Free macroes
  122. //
  123. #define PGM_TAG(x) (((x)<<24)|'\0mgP')
  124. #define PgmAllocMem(_Size, _Tag) \
  125. ExAllocatePoolWithTag(NonPagedPool, (_Size),(_Tag))
  126. #define PgmFreeMem(_Ptr) ExFreePool(_Ptr)
  127. //
  128. // Misc Ke + Ex macroes
  129. //
  130. #define PgmGetCurrentIrql KeGetCurrentIrql
  131. #define PgmInterlockedInsertTailList(_pHead, _pEntry, _pStruct) \
  132. ExInterlockedInsertTailList(_pHead, _pEntry, &(_pStruct)->LockInfo.SpinLock);
  133. //----------------------------------------------------------------------------
  134. //
  135. // PgmAcquireResourceExclusive (Resource, Wait)
  136. //
  137. /*++
  138. Routine Description:
  139. Acquires the Resource by calling an executive support routine.
  140. Arguments:
  141. Return Value:
  142. None
  143. --*/
  144. //
  145. // Resource Macros
  146. //
  147. #define PgmAcquireResourceExclusive( _Resource, _Wait ) \
  148. KeEnterCriticalRegion(); \
  149. ExAcquireResourceExclusiveLite(_Resource,_Wait);
  150. //----------------------------------------------------------------------------
  151. //
  152. // PgmReleaseResource (Resource)
  153. //
  154. /*++
  155. Routine Description:
  156. Releases the Resource by calling an excutive support routine.
  157. Arguments:
  158. Return Value:
  159. None
  160. --*/
  161. #define PgmReleaseResource( _Resource ) \
  162. ExReleaseResourceLite(_Resource); \
  163. KeLeaveCriticalRegion();
  164. //----------------------------------------------------------------------------
  165. //++
  166. //
  167. // LARGE_INTEGER
  168. // PgmConvert100nsToMilliseconds(
  169. // IN LARGE_INTEGER HnsTime
  170. // );
  171. //
  172. // Routine Description:
  173. //
  174. // Converts time expressed in hundreds of nanoseconds to milliseconds.
  175. //
  176. // Arguments:
  177. //
  178. // HnsTime - Time in hundreds of nanoseconds.
  179. //
  180. // Return Value:
  181. //
  182. // Time in milliseconds.
  183. //
  184. //--
  185. #define SHIFT10000 13
  186. static LARGE_INTEGER Magic10000 = {0xe219652c, 0xd1b71758};
  187. #define PgmConvert100nsToMilliseconds(HnsTime) \
  188. RtlExtendedMagicDivide((HnsTime), Magic10000, SHIFT10000)
  189. //----------------------------------------------------------------------------
  190. //
  191. // Lock Macroes
  192. //
  193. #if DBG
  194. #define PgmInitLock(_Struct, _N) \
  195. KeInitializeSpinLock (&(_Struct)->LockInfo.SpinLock); \
  196. (_Struct)->LockInfo.LockNumber = _N;
  197. #else
  198. #define PgmInitLock(_Struct, _N) \
  199. KeInitializeSpinLock (&(_Struct)->LockInfo.SpinLock);
  200. #endif // DBG
  201. typedef KIRQL PGMLockHandle;
  202. #if DBG
  203. #define PgmLock(_Struct, _OldIrqLevel) \
  204. { \
  205. ULONG CurrProc; \
  206. ExAcquireSpinLock (&(_Struct)->LockInfo.SpinLock, &(_OldIrqLevel)); \
  207. CurrProc = KeGetCurrentProcessorNumber(); \
  208. ASSERT ((_Struct)->LockInfo.LockNumber > PgmDynamicConfig.CurrentLockNumber[CurrProc]); \
  209. PgmDynamicConfig.CurrentLockNumber[CurrProc] |= (_Struct)->LockInfo.LockNumber; \
  210. (_Struct)->LockInfo.LastLockLine = __LINE__; \
  211. }
  212. #define PgmLockAtDpc(_Struct) \
  213. { \
  214. ULONG CurrProc; \
  215. ExAcquireSpinLockAtDpcLevel (&(_Struct)->LockInfo.SpinLock); \
  216. CurrProc = KeGetCurrentProcessorNumber(); \
  217. ASSERT ((_Struct)->LockInfo.LockNumber > PgmDynamicConfig.CurrentLockNumber[CurrProc]); \
  218. PgmDynamicConfig.CurrentLockNumber[CurrProc] |= (_Struct)->LockInfo.LockNumber; \
  219. (_Struct)->LockInfo.LastLockLine = __LINE__; \
  220. }
  221. #define PgmUnlock(_Struct, _OldIrqLevel) \
  222. { \
  223. ULONG CurrProc = KeGetCurrentProcessorNumber(); \
  224. ASSERT (PgmDynamicConfig.CurrentLockNumber[CurrProc] & (_Struct)->LockInfo.LockNumber); \
  225. PgmDynamicConfig.CurrentLockNumber[CurrProc] &= ~((_Struct)->LockInfo.LockNumber); \
  226. (_Struct)->LockInfo.LastUnlockLine = __LINE__; \
  227. ExReleaseSpinLock (&(_Struct)->LockInfo.SpinLock, _OldIrqLevel); \
  228. }
  229. // ASSERT ((_Struct)->LockInfo.LockNumber > PgmDynamicConfig.CurrentLockNumber[CurrProc]);
  230. #define PgmUnlockAtDpc(_Struct) \
  231. { \
  232. ULONG CurrProc = KeGetCurrentProcessorNumber(); \
  233. ASSERT (PgmDynamicConfig.CurrentLockNumber[CurrProc] & (_Struct)->LockInfo.LockNumber); \
  234. PgmDynamicConfig.CurrentLockNumber[CurrProc] &= ~((_Struct)->LockInfo.LockNumber); \
  235. (_Struct)->LockInfo.LastUnlockLine = __LINE__; \
  236. ExReleaseSpinLockFromDpcLevel (&(_Struct)->LockInfo.SpinLock); \
  237. }
  238. // ASSERT ((_Struct)->LockInfo.LockNumber > PgmDynamicConfig.CurrentLockNumber[CurrProc]); \
  239. #else
  240. #define PgmLock(_Struct, _OldIrqLevel) \
  241. ExAcquireSpinLock (&(_Struct)->LockInfo.SpinLock, &(_OldIrqLevel));
  242. #define PgmLockAtDpc(_Struct) \
  243. ExAcquireSpinLockAtDpcLevel (&(_Struct)->LockInfo.SpinLock);
  244. #define PgmUnlock(_Struct, _OldIrqLevel) \
  245. ExReleaseSpinLock (&(_Struct)->LockInfo.SpinLock, _OldIrqLevel); \
  246. #define PgmUnlockAtDpc(_Struct) \
  247. ExReleaseSpinLockFromDpcLevel (&(_Struct)->LockInfo.SpinLock); \
  248. #endif // DBG
  249. //
  250. // Memory management macroes
  251. //
  252. #define PgmZeroMemory RtlZeroMemory
  253. #define PgmMoveMemory RtlMoveMemory
  254. #define PgmCopyMemory RtlCopyMemory
  255. #define PgmEqualMemory(_a, _b, _n) memcmp(_a,_b,_n)
  256. //
  257. // Timer Macroes
  258. //
  259. #define MILLISEC_TO_100NS 10000
  260. #define PgmInitTimer(_PgmTimer) \
  261. KeInitializeTimer (&((_PgmTimer)->t_timer));
  262. #define PgmStartTimer(_PgmTimer, _DeltaTimeInMilliSecs, _TimerExpiryRoutine, _Context) \
  263. { \
  264. LARGE_INTEGER Time; \
  265. Time.QuadPart = UInt32x32To64 (_DeltaTimeInMilliSecs, MILLISEC_TO_100NS); \
  266. Time.QuadPart = -(Time.QuadPart); \
  267. KeInitializeDpc (&((_PgmTimer)->t_dpc), (PVOID)_TimerExpiryRoutine, _Context); \
  268. KeSetTimer (&((_PgmTimer)->t_timer), Time, &((_PgmTimer))->t_dpc); \
  269. }
  270. #define PgmStopTimer(_PgmTimer) \
  271. ((int) KeCancelTimer(&((_PgmTimer)->t_timer)))
  272. //
  273. // Referencing and dereferencing macroes
  274. //
  275. #define PGM_REFERENCE_DEVICE( _pPgmDevice, _RefContext, _fLocked) \
  276. { \
  277. PGMLockHandle OldIrq; \
  278. if (!_fLocked) \
  279. { \
  280. PgmLock (_pPgmDevice, OldIrq); \
  281. } \
  282. ASSERT (PGM_VERIFY_HANDLE (_pPgmDevice, PGM_VERIFY_DEVICE)); \
  283. ASSERT (++_pPgmDevice->ReferenceContexts[_RefContext]); \
  284. ++_pPgmDevice->RefCount; \
  285. if (!_fLocked) \
  286. { \
  287. PgmUnlock (_pPgmDevice, OldIrq); \
  288. } \
  289. }
  290. /*
  291. PgmTrace (LogPath, ( \
  292. "\t++pPgmDevice[%x]=<%x:%d->%d>, <%d:%s>\n", \
  293. _RefContext, _pPgmDevice,_pPgmDevice->RefCount,(_pPgmDevice->RefCount+1),__LINE__,__FILE__)); \
  294. */
  295. #define PGM_REFERENCE_CONTROL( _pControl, _RefContext, _fLocked) \
  296. { \
  297. PGMLockHandle OldIrq; \
  298. if (!_fLocked) \
  299. { \
  300. PgmLock (_pControl, OldIrq); \
  301. } \
  302. ASSERT (PGM_VERIFY_HANDLE (_pControl, PGM_VERIFY_CONTROL)); \
  303. ASSERT (++_pControl->ReferenceContexts[_RefContext]); \
  304. ++_pControl->RefCount; \
  305. if (!_fLocked) \
  306. { \
  307. PgmUnlock (_pControl, OldIrq); \
  308. } \
  309. }
  310. /*
  311. PgmTrace (LogPath, ( \
  312. "\t++pControl[%x]=<%x:%d->%d>, <%d:%s>\n", \
  313. _RefContext, _pControl,_pControl->RefCount,(_pControl->RefCount+1),__LINE__,__FILE__)); \
  314. */
  315. #define PGM_REFERENCE_ADDRESS( _pAddress, _RefContext, _fLocked) \
  316. { \
  317. PGMLockHandle OldIrq; \
  318. if (!_fLocked) \
  319. { \
  320. PgmLock (_pAddress, OldIrq); \
  321. } \
  322. ASSERT (PGM_VERIFY_HANDLE (_pAddress, PGM_VERIFY_ADDRESS)); \
  323. ASSERT (++_pAddress->ReferenceContexts[_RefContext]); \
  324. ++_pAddress->RefCount; \
  325. if (!_fLocked) \
  326. { \
  327. PgmUnlock (_pAddress, OldIrq); \
  328. } \
  329. }
  330. /*
  331. PgmTrace (LogPath, ( \
  332. "\t++pAddress[%x]=<%x:%d->%d>, <%d:%s>\n", \
  333. _RefContext, _pAddress,_pAddress->RefCount,(_pAddress->RefCount+1),__LINE__,__FILE__)); \
  334. */
  335. #define PGM_REFERENCE_SEND_DATA_CONTEXT( _pSendDC, _fLocked) \
  336. { \
  337. PGMLockHandle OldIrq; \
  338. if (!_fLocked) \
  339. { \
  340. PgmLock (_pSendDC->pSend, OldIrq); \
  341. } \
  342. ASSERT (PGM_VERIFY_HANDLE (_pSendDC, PGM_VERIFY_SEND_DATA_CONTEXT)); \
  343. ++_pSendDC->RefCount; \
  344. if (!_fLocked) \
  345. { \
  346. PgmUnlock (_pSendDC, OldIrq); \
  347. } \
  348. }
  349. /*
  350. PgmTrace (LogPath, ( \
  351. "\t++pSendDataContext[%x]=<%x:%d->%d>, <%d:%s>\n", \
  352. _RefContext, _pSendDC,_pSendDC->RefCount,(_pSendDC->RefCount+1),__LINE__,__FILE__)); \
  353. */
  354. #define PGM_REFERENCE_SESSION( _pSession, _Verify, _RefContext, _fLocked) \
  355. { \
  356. PGMLockHandle OldIrq; \
  357. if (!_fLocked) \
  358. { \
  359. PgmLock (_pSession, OldIrq); \
  360. } \
  361. ASSERT (PGM_VERIFY_HANDLE2 (_pSession, _Verify, PGM_VERIFY_SESSION_DOWN)); \
  362. ASSERT (++_pSession->ReferenceContexts[_RefContext]); \
  363. ++_pSession->RefCount; \
  364. if (!_fLocked) \
  365. { \
  366. PgmUnlock (_pSession, OldIrq); \
  367. } \
  368. }
  369. /*
  370. PgmTrace (LogPath, ( \
  371. "\t++pSession[%x]=<%x:%d->%d>, <%d:%s>\n", \
  372. _RefContext, _pSession,_pSession->RefCount,(_pSession->RefCount+1),__LINE__,__FILE__)); \
  373. */
  374. #define PGM_REFERENCE_SESSION_SEND( _pSend, _RefContext, _fLocked) \
  375. PGM_REFERENCE_SESSION (_pSend, PGM_VERIFY_SESSION_SEND, _RefContext, _fLocked)
  376. #define PGM_REFERENCE_SESSION_RECEIVE( _pRcv, _RefContext, _fLocked)\
  377. PGM_REFERENCE_SESSION (_pRcv, PGM_VERIFY_SESSION_RECEIVE, _RefContext, _fLocked)
  378. #define PGM_REFERENCE_SESSION_UNASSOCIATED( _pRcv, _RefContext, _fLocked)\
  379. PGM_REFERENCE_SESSION (_pRcv, PGM_VERIFY_SESSION_UNASSOCIATED, _RefContext, _fLocked)
  380. //
  381. // Dereferencing ...
  382. //
  383. #define PGM_DEREFERENCE_DEVICE( _pDevice, _RefContext) \
  384. { \
  385. PgmDereferenceDevice (_pDevice, _RefContext); \
  386. }
  387. /*
  388. PgmTrace (LogPath, ( \
  389. "\t--pDevice[%x]=<%x:%d->%d>, <%d:%s>\n", \
  390. _RefContext, _pDevice,_pDevice->RefCount,(_pDevice->RefCount-1),__LINE__,__FILE__)); \
  391. */
  392. #define PGM_DEREFERENCE_CONTROL( _pControl, _RefContext) \
  393. { \
  394. PgmDereferenceControl (_pControl, _RefContext); \
  395. }
  396. /*
  397. PgmTrace (LogPath, ( \
  398. "\t--pControl[%x]=<%x:%d->%d>, <%d:%s>\n", \
  399. _RefContext, _pControl,_pControl->RefCount,(_pControl->RefCount-1),__LINE__,__FILE__)); \
  400. */
  401. #define PGM_DEREFERENCE_ADDRESS( _pAddress, _RefContext) \
  402. { \
  403. PgmDereferenceAddress (_pAddress, _RefContext); \
  404. }
  405. /*
  406. PgmTrace (LogPath, ( \
  407. "\t--pAddress[%x]=<%x:%d->%d>, <%d:%s>\n", \
  408. _RefContext, _pAddress,_pAddress->RefCount,(_pAddress->RefCount-1),__LINE__,__FILE__)); \
  409. */
  410. #define PGM_DEREFERENCE_SEND_CONTEXT( _pSendDC) \
  411. { \
  412. PgmDereferenceSendContext (_pSendDC); \
  413. }
  414. /*
  415. PgmTrace (LogPath, ( \
  416. "\t--pSendDC=<%x:%d->%d>, <%d:%s>\n", \
  417. _pSendDC,_pSendDC->RefCount,(_pSendDC->RefCount-1),__LINE__,__FILE__)); \
  418. */
  419. #define PGM_DEREFERENCE_SESSION( _pSession, _Verify, _RefContext) \
  420. { \
  421. PgmDereferenceSessionCommon (_pSession, _Verify, _RefContext); \
  422. }
  423. /*
  424. PgmTrace (LogPath, ( \
  425. "\t--pSession[%x]=<%x:%d->%d>, Verify=<%x>, <%d:%s>\n", \
  426. _RefContext, _pSession,_pSession->RefCount,(_pSession->RefCount-1),_Verify,__LINE__,__FILE__)); \
  427. */
  428. #define PGM_DEREFERENCE_SESSION_SEND( _pSession, _RefContext) \
  429. PGM_DEREFERENCE_SESSION (_pSession, PGM_VERIFY_SESSION_SEND, _RefContext)
  430. #define PGM_DEREFERENCE_SESSION_RECEIVE( _pSession, _RefContext) \
  431. PGM_DEREFERENCE_SESSION (_pSession, PGM_VERIFY_SESSION_RECEIVE, _RefContext)
  432. #define PGM_DEREFERENCE_SESSION_UNASSOCIATED( _pSession, _RefContext) \
  433. PGM_DEREFERENCE_SESSION (_pSession, PGM_VERIFY_SESSION_UNASSOCIATED, _RefContext)
  434. //----------------------------------------------------------------------------
  435. //
  436. // PgmAttachFsp()
  437. //
  438. /*++
  439. Routine Description:
  440. This macro attaches a process to the File System Process to be sure
  441. that handles are created and released in the same process
  442. Arguments:
  443. Return Value:
  444. none
  445. --*/
  446. #if(WINVER > 0x0500)
  447. #define PgmAttachProcess(_pEProcess, _pApcState, _pAttached, _Context)\
  448. { \
  449. if (PsGetCurrentProcess() != _pEProcess) \
  450. { \
  451. KeStackAttachProcess(PsGetProcessPcb(_pEProcess), _pApcState); \
  452. *_pAttached = TRUE; \
  453. } \
  454. else \
  455. { \
  456. *_pAttached = FALSE; \
  457. } \
  458. }
  459. #else
  460. #define PgmAttachProcess(_pEProcess, _pApcState, _pAttached, _Context)\
  461. { \
  462. if (PsGetCurrentProcess() != _pEProcess) \
  463. { \
  464. KeStackAttachProcess(&_pEProcess->Pcb, _pApcState); \
  465. *_pAttached = TRUE; \
  466. } \
  467. else \
  468. { \
  469. *_pAttached = FALSE; \
  470. } \
  471. }
  472. #endif // WINVER
  473. #define PgmAttachFsp(_pApcState, _pAttached, _Context) \
  474. PgmAttachProcess (PgmStaticConfig.FspProcess, _pApcState, _pAttached, _Context)
  475. #define PgmAttachToProcessForVMAccess(_pSend, _pApcState, _pAttached, _Context) \
  476. PgmAttachProcess (PgmStaticConfig.FspProcess, _pApcState, _pAttached, _Context)
  477. // PgmAttachProcess ((_pSend)->Process, _pAttached, _Context)
  478. //
  479. // PgmDetachFsp()
  480. //
  481. /*++
  482. Routine Description:
  483. This macro detaches a process from the File System Process
  484. if it was ever attached
  485. Arguments:
  486. Return Value:
  487. --*/
  488. #define PgmDetachProcess(_pApcState, _pAttached, _Context) \
  489. { \
  490. if (*_pAttached) \
  491. { \
  492. KeUnstackDetachProcess(_pApcState); \
  493. } \
  494. }
  495. #define PgmDetachFsp PgmDetachProcess
  496. //----------------------------------------------------------------------------
  497. #endif _MACROES_H_