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.

191 lines
4.3 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name :
  4. pointer.h
  5. Abstract :
  6. This file contains the routines for handling pointers and pointer
  7. layouts.
  8. Author :
  9. Mike Zoran mzoran January 2000.
  10. Revision History :
  11. ---------------------------------------------------------------------*/
  12. #include "ndrp.h"
  13. #if !defined(__POINTER_H__)
  14. #define __POINTER_H__
  15. void
  16. Ndr64pPointerLayoutMarshall(
  17. PMIDL_STUB_MESSAGE pStubMsg,
  18. PNDR64_FORMAT pFormat,
  19. NDR64_UINT32 ArrayIterations,
  20. uchar * pMemory,
  21. uchar * pBuffer );
  22. void
  23. Ndr64pPointerLayoutMarshallInternal(
  24. PMIDL_STUB_MESSAGE pStubMsg,
  25. PNDR64_FORMAT pFormat,
  26. NDR64_UINT32 ArrayIterations,
  27. uchar * pMemory,
  28. uchar * pBuffer );
  29. void
  30. Ndr64pPointerLayoutUnmarshall(
  31. PMIDL_STUB_MESSAGE pStubMsg,
  32. PNDR64_FORMAT pFormat,
  33. NDR64_UINT32 ArrayIterations,
  34. uchar * pMemory,
  35. uchar * pBuffer );
  36. void
  37. Ndr64pPointerLayoutMemorySize (
  38. PMIDL_STUB_MESSAGE pStubMsg,
  39. PNDR64_FORMAT pFormat,
  40. NDR64_UINT32 ArrayIterations,
  41. uchar * pBuffer );
  42. void
  43. Ndr64pPointerLayoutBufferSize (
  44. PMIDL_STUB_MESSAGE pStubMsg,
  45. PNDR64_FORMAT pFormat,
  46. NDR64_UINT32 ArrayIterations,
  47. uchar * pMemory );
  48. void
  49. Ndr64pPointerLayoutFree(
  50. PMIDL_STUB_MESSAGE pStubMsg,
  51. PNDR64_FORMAT pFormat,
  52. NDR64_UINT32 ArrayIterations,
  53. uchar * pMemory );
  54. void
  55. Ndr64pPointerMarshall(
  56. PMIDL_STUB_MESSAGE pStubMsg,
  57. NDR64_PTR_WIRE_TYPE *pBufferMark,
  58. uchar * pMemory,
  59. PNDR64_FORMAT pFormat
  60. );
  61. void
  62. Ndr64pPointerMemorySize(
  63. PMIDL_STUB_MESSAGE pStubMsg,
  64. NDR64_PTR_WIRE_TYPE *pBufferMark,
  65. PNDR64_FORMAT pFormat
  66. );
  67. void
  68. Ndr64pPointerUnmarshall(
  69. PMIDL_STUB_MESSAGE pStubMsg,
  70. NDR64_PTR_WIRE_TYPE WirePtr,
  71. uchar ** ppMemory,
  72. uchar * pMemory,
  73. PNDR64_FORMAT pFormat
  74. );
  75. void
  76. Ndr64pPointerBufferSize (
  77. PMIDL_STUB_MESSAGE pStubMsg,
  78. uchar * pMemory,
  79. PNDR64_FORMAT pFormat
  80. );
  81. __forceinline ulong
  82. Ndr64pWirePtrToRefId(
  83. NDR64_PTR_WIRE_TYPE WireRef )
  84. {
  85. if ( WireRef > 0x7FFFFFFF )
  86. {
  87. RpcRaiseException( RPC_X_BAD_STUB_DATA );
  88. return 0;
  89. }
  90. return (ulong)WireRef;
  91. }
  92. __forceinline NDR64_PTR_WIRE_TYPE
  93. Ndr64pRefIdToWirePtr(
  94. ulong RefId )
  95. {
  96. // Check if wire ref will fit in a 2GB number.
  97. if ( RefId > 0x7FFFFFFF )
  98. {
  99. RpcRaiseException( RPC_X_BAD_STUB_DATA );
  100. return 0;
  101. }
  102. return (NDR64_PTR_WIRE_TYPE)RefId;
  103. }
  104. __forceinline BOOL
  105. Ndr64pFullPointerQueryPointer(
  106. PMIDL_STUB_MESSAGE pStubMsg,
  107. void * pPointer,
  108. uchar QueryType,
  109. ulong * pRefId )
  110. {
  111. return (BOOL)
  112. NdrFullPointerQueryPointer( pStubMsg->FullPtrXlatTables,
  113. pPointer,
  114. QueryType,
  115. pRefId );
  116. }
  117. __forceinline BOOL
  118. Ndr64pFullPointerQueryRefId(
  119. PMIDL_STUB_MESSAGE pStubMsg,
  120. ulong RefId,
  121. uchar QueryType,
  122. void ** ppPointer )
  123. {
  124. return (BOOL)
  125. NdrFullPointerQueryRefId( pStubMsg->FullPtrXlatTables,
  126. RefId,
  127. QueryType,
  128. ppPointer );
  129. }
  130. __forceinline void
  131. Ndr64pFullPointerInsertRefId(
  132. PMIDL_STUB_MESSAGE pStubMsg,
  133. ulong RefId,
  134. void * pPointer )
  135. {
  136. NdrFullPointerInsertRefId( pStubMsg->FullPtrXlatTables,
  137. RefId,
  138. pPointer );
  139. }
  140. #define FULL_POINTER_INSERT( pStubMsg, Pointer ) \
  141. { \
  142. Ndr64pFullPointerInsertRefId( pStubMsg, \
  143. pStubMsg->FullPtrRefId, \
  144. Pointer ); \
  145. \
  146. pStubMsg->FullPtrRefId = 0; \
  147. }
  148. #endif // __POINTER_H__