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.

181 lines
2.9 KiB

  1. //***************************************************************************
  2. //
  3. // hbaapip.h
  4. //
  5. // Module: HBA API private header
  6. //
  7. // Purpose: Private header
  8. //
  9. // Copyright (c) 2000 Microsoft Corporation
  10. //
  11. //***************************************************************************
  12. #ifndef _HBAAPIP_
  13. #define _HBAAPIP_
  14. #include <nt.h>
  15. #include <ntrtl.h>
  16. #include <nturtl.h>
  17. #include <windows.h>
  18. #include <wmistr.h>
  19. #include <wmium.h>
  20. #include "hbaapi.h"
  21. #include "hbadata.h"
  22. #if DBG
  23. #define HbaapiAssert(x) if (! (x) ) { \
  24. DebugPrint(( "HBAAPI Assertion: "#x" at %s %d\n", __FILE__, __LINE__)); \
  25. DebugBreak(); }
  26. #else
  27. #define HbaapiAssert(x)
  28. #endif
  29. //
  30. // Debug support
  31. //
  32. #ifdef DebugPrint
  33. #undef DebugPrint
  34. #endif
  35. #if DBG
  36. ULONG
  37. _cdecl
  38. DbgPrint(
  39. PCH Format,
  40. ...
  41. );
  42. #define DEBUG_BUFFER_LENGTH 256
  43. #define DebugPrint(x) HbaapiDebugPrint x
  44. #else
  45. #define DebugPrint(x)
  46. #endif // DBG
  47. VOID
  48. HbaapiDebugPrint(
  49. PCHAR DebugMessage,
  50. ...
  51. );
  52. #define OffsetToPtr(Base, Offset) ((PBYTE)((PBYTE)(Base) + (Offset)))
  53. extern ULONG HbaHandleCounter;
  54. extern LIST_ENTRY HbaHandleList;
  55. typedef struct _ADAPTER_HANDLE
  56. {
  57. LIST_ENTRY List;
  58. ULONG HbaHandle;
  59. PWCHAR InstanceName;
  60. } ADAPTER_HANDLE, *PADAPTER_HANDLE;
  61. extern HANDLE Mutex;
  62. #define EnterCritSection() WaitForSingleObject(Mutex, INFINITE)
  63. #define LeaveCritSection() ReleaseMutex(Mutex)
  64. #define GetDataFromDataBlock(struct, field, type, data) \
  65. { \
  66. struct->field = *(type *)data; \
  67. data += sizeof(type); \
  68. }
  69. #define SetDataInDataBlock(struct, field, type, data) \
  70. { \
  71. *(type *)data = struct->field; \
  72. data += sizeof(type); \
  73. }
  74. PVOID AllocMemory(
  75. ULONG SizeNeeded
  76. );
  77. void FreeMemory(
  78. PVOID Pointer
  79. );
  80. PADAPTER_HANDLE GetDataByHandle(
  81. HBA_HANDLE HbaHandle
  82. );
  83. ULONG QueryAllData(
  84. HANDLE Handle,
  85. PWNODE_ALL_DATA *Wnode
  86. );
  87. ULONG QuerySingleInstance(
  88. HANDLE Handle,
  89. PWCHAR InstanceName,
  90. PWNODE_SINGLE_INSTANCE *Wnode
  91. );
  92. ULONG ExecuteMethod(
  93. HANDLE Handle,
  94. PWCHAR InstanceName,
  95. ULONG MethodId,
  96. ULONG InBufferSize,
  97. PUCHAR InBuffer,
  98. ULONG *OutBufferSize,
  99. PUCHAR *OutBuffer
  100. );
  101. ULONG ParseAllData(
  102. PWNODE_ALL_DATA Wnode,
  103. ULONG *CountPtr,
  104. PUSHORT **InstanceNamesPtr,
  105. PUCHAR **DataBlocksPtr,
  106. PULONG *DataLengths
  107. );
  108. ULONG ParseSingleInstance(
  109. PWNODE_SINGLE_INSTANCE SingleInstance,
  110. PUSHORT *InstanceNamePtr,
  111. PUCHAR *DataPtr,
  112. ULONG *DataLenPtr
  113. );
  114. PWCHAR CreatePortInstanceNameW(
  115. PWCHAR AdapterInstanceName,
  116. ULONG PortIndex
  117. );
  118. void CopyString(
  119. PVOID Destination,
  120. PUCHAR *CountedString,
  121. ULONG MaxLenInChar,
  122. BOOLEAN IsAnsi);
  123. ULONG AnsiToUnicode(
  124. LPCSTR pszA,
  125. LPWSTR pszW,
  126. ULONG MaxLen
  127. );
  128. ULONG UnicodeToAnsi(
  129. LPCWSTR pszW,
  130. LPSTR pszA,
  131. ULONG MaxLen
  132. );
  133. void CopyPortAttributes(
  134. PHBA_PORTATTRIBUTES HbaPortAttributes,
  135. PUCHAR Data,
  136. BOOLEAN IsAnsi
  137. );
  138. #endif _HBAAPIP_