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.

182 lines
3.7 KiB

  1. #ifndef _UTIL_H
  2. #define _UTIL_H
  3. NDIS_STATUS
  4. epvcAllocateTask(
  5. IN PRM_OBJECT_HEADER pParentObject,
  6. IN PFN_RM_TASK_HANDLER pfnHandler,
  7. IN UINT Timeout,
  8. IN const char * szDescription, OPTIONAL
  9. OUT PRM_TASK *ppTask,
  10. IN PRM_STACK_RECORD pSR
  11. );
  12. VOID
  13. epvcSetPrimaryAdapterTask(
  14. PEPVC_ADAPTER pAdapter, // LOCKIN LOCKOUT
  15. PRM_TASK pTask,
  16. ULONG PrimaryState,
  17. PRM_STACK_RECORD pSR
  18. );
  19. VOID
  20. epvcClearPrimaryAdapterTask(
  21. PEPVC_ADAPTER pAdapter, // LOCKIN LOCKOUT
  22. PRM_TASK pTask,
  23. ULONG PrimaryState,
  24. PRM_STACK_RECORD pSR
  25. );
  26. VOID
  27. epvcSetSecondaryAdapterTask(
  28. PEPVC_ADAPTER pAdapter, // LOCKIN LOCKOUT
  29. PRM_TASK pTask,
  30. ULONG SecondaryState,
  31. PRM_STACK_RECORD pSR
  32. );
  33. VOID
  34. epvcClearSecondaryAdapterTask(
  35. PEPVC_ADAPTER pAdapter, // LOCKIN LOCKOUT
  36. PRM_TASK pTask,
  37. ULONG SecondaryState,
  38. PRM_STACK_RECORD pSR
  39. );
  40. VOID
  41. epvcTaskDelete (
  42. PRM_OBJECT_HEADER pObj,
  43. PRM_STACK_RECORD psr
  44. );
  45. NDIS_STATUS
  46. epvcCopyUnicodeString(
  47. OUT PNDIS_STRING pDest,
  48. IN PNDIS_STRING pSrc,
  49. BOOLEAN fUpCase
  50. );
  51. VOID
  52. epvcSetFlags(
  53. IN OUT ULONG* pulFlags,
  54. IN ULONG ulMask );
  55. VOID
  56. epvcClearFlags(
  57. IN OUT ULONG* pulFlags,
  58. IN ULONG ulMask );
  59. ULONG
  60. epvcReadFlags(
  61. IN ULONG* pulFlags );
  62. BOOLEAN
  63. epvcIsThisTaskPrimary (
  64. PRM_TASK pTask,
  65. PRM_TASK* ppLocation
  66. );
  67. VOID
  68. epvcClearPrimaryTask (
  69. PRM_TASK* ppLocation
  70. );
  71. #if DBG
  72. VOID
  73. Dump(
  74. IN CHAR* p,
  75. IN ULONG cb,
  76. IN BOOLEAN fAddress,
  77. IN ULONG ulGroup );
  78. #else
  79. #define Dump(p,cb,fAddress,ulGroup )
  80. #endif
  81. #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || ((defined(_M_AMD64) || defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
  82. #define net_short(_x) _byteswap_ushort((USHORT)(_x))
  83. #define net_long(_x) _byteswap_ulong(_x)
  84. #else
  85. __inline
  86. USHORT
  87. FASTCALL
  88. net_short(
  89. UINT NaturalData)
  90. {
  91. USHORT ShortData = (USHORT)NaturalData;
  92. return (ShortData << 8) | (ShortData >> 8);
  93. }
  94. // if x is aabbccdd (where aa, bb, cc, dd are hex bytes)
  95. // we want net_long(x) to be ddccbbaa. A small and fast way to do this is
  96. // to first byteswap it to get bbaaddcc and then swap high and low words.
  97. //
  98. __inline
  99. ULONG
  100. FASTCALL
  101. net_long(
  102. ULONG NaturalData)
  103. {
  104. ULONG ByteSwapped;
  105. ByteSwapped = ((NaturalData & 0x00ff00ff) << 8) |
  106. ((NaturalData & 0xff00ff00) >> 8);
  107. return (ByteSwapped << 16) | (ByteSwapped >> 16);
  108. }
  109. #endif
  110. NDIS_STATUS
  111. epvcAllocateTaskUsingLookasideList(
  112. IN PRM_OBJECT_HEADER pParentObject,
  113. IN PEPVC_NPAGED_LOOKASIDE_LIST pList,
  114. IN PFN_RM_TASK_HANDLER pfnHandler,
  115. IN UINT Timeout,
  116. IN const char * szDescription, OPTIONAL
  117. OUT PRM_TASK *ppTask,
  118. IN PRM_STACK_RECORD pSR
  119. );
  120. VOID
  121. epvcInitializeLookasideList(
  122. IN OUT PEPVC_NPAGED_LOOKASIDE_LIST pLookasideList,
  123. ULONG Size,
  124. ULONG Tag,
  125. USHORT Depth
  126. );
  127. VOID
  128. epvcDeleteLookasideList (
  129. IN OUT PEPVC_NPAGED_LOOKASIDE_LIST pLookasideList
  130. );
  131. PVOID
  132. epvcGetLookasideBuffer(
  133. IN PEPVC_NPAGED_LOOKASIDE_LIST pLookasideList
  134. );
  135. VOID
  136. epvcFreeToNPagedLookasideList (
  137. IN PEPVC_NPAGED_LOOKASIDE_LIST pLookasideList,
  138. IN PVOID pBuffer
  139. );
  140. #endif