Windows NT 4.0 source code leak
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.

179 lines
3.9 KiB

4 years ago
  1. /************************************************************************
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name :
  4. newintrp.h
  5. Abstract :
  6. NDR Pipe related definitions.
  7. Author :
  8. RyszardK December 1995
  9. Revision History :
  10. ***********************************************************************/
  11. #ifndef _PIPENDR_H_
  12. #define _PIPENDR_H_
  13. #include "interp2.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #if defined( WIN32 )
  18. #define NDR_PIPE_SUPPORT 1
  19. #endif
  20. //
  21. // The maximum number of pipes handled without an allocation
  22. //
  23. #define PIPE_MESSAGE_MAX 3
  24. #define PIPE_PARTIAL_BUFFER_SIZE 5000
  25. #define PIPE_ELEM_BUFFER_SIZE 5000
  26. //
  27. // Signature and version
  28. //
  29. #define NDR_PIPE_SIGNATURE (ushort) 0x5667
  30. #define NDR_PIPE_VERSION (short) 0x3031
  31. //
  32. // Flags helping with the buffer management at the server.
  33. // [in] pipes need to be processed within a separate in buffer.
  34. // This buffer needs to be freed after last [in] pipe.
  35. // [out] pipe processing has to start with a partial RpcGetBuffer.
  36. // Nothing needs to be done with that buffer before return to runtime.
  37. //
  38. #define NDR_PIPE_AUX_IN_BUFFER_NEEDED 0x01
  39. #define NDR_PIPE_AUX_OUT_BUFFER_ALLOCATED 0x02
  40. //
  41. // Directional flags
  42. //
  43. #define NDR_IN_PIPE 0x01
  44. #define NDR_OUT_PIPE 0x02
  45. #define NDR_LAST_IN_PIPE 0x04
  46. #define NDR_LAST_OUT_PIPE 0x08
  47. #define NDR_OUT_ALLOCED 0x10
  48. //
  49. // Pipe Status
  50. //
  51. #define NDR_PIPE_NOT_OPENED 0
  52. #define NDR_PIPE_ACTIVE_IN 1
  53. #define NDR_PIPE_ACTIVE_OUT 2
  54. #define NDR_PIPE_DRAINED 3
  55. #define PLONG_LV_CAST *(long __RPC_FAR * __RPC_FAR *)&
  56. #define PULONG_LV_CAST *(ulong __RPC_FAR * __RPC_FAR *)&
  57. #define WIRE_PAD(size, al) ((((ulong)size)&al) ? ((ulong)(al+1)-(((ulong)size)&al)) : 0)
  58. #define REMAINING_BYTES() ((long)pStubMsg->RpcMsg->BufferLength - \
  59. (long)(pStubMsg->Buffer - (uchar*)pStubMsg->RpcMsg->Buffer))
  60. typedef enum {
  61. START,
  62. COPY_PIPE_ELEM,
  63. RETURN_PARTIAL_ELEM,
  64. READ_PARTIAL_ELEM
  65. } RECEIVE_STATES;
  66. typedef struct _FC_PIPE_DEF
  67. {
  68. unsigned char Fc;
  69. #if defined(__RPC_MAC__)
  70. unsigned char BigPipe: 1;
  71. unsigned char Unused : 3;
  72. unsigned char Align : 4;
  73. #else
  74. unsigned char Align : 4; //
  75. unsigned char Unused : 3; // Flag and alignment byte
  76. unsigned char BigPipe: 1; //
  77. #endif
  78. short TypeOffset;
  79. union
  80. {
  81. struct
  82. {
  83. unsigned short MemSize;
  84. unsigned short WireSize;
  85. } s;
  86. struct
  87. {
  88. unsigned long MemSize;
  89. unsigned long WireSize;
  90. } Big;
  91. };
  92. } FC_PIPE_DEF;
  93. void
  94. NdrpPipeElementBufferSize(
  95. NDR_PIPE_DESC * pPipeDesc,
  96. PMIDL_STUB_MESSAGE pStubMsg,
  97. uchar * pMemory,
  98. PFORMAT_STRING pFormat,
  99. ulong ElemCount
  100. );
  101. void
  102. NdrpPipeElementConvert(
  103. PMIDL_STUB_MESSAGE pStubMsg,
  104. PFORMAT_STRING pFormat,
  105. ulong ElemCount
  106. );
  107. void
  108. NdrpPipeElementConvertAndUnmarshal(
  109. NDR_PIPE_DESC * pPipeDesc,
  110. PMIDL_STUB_MESSAGE pStubMsg,
  111. uchar * * ppMemory,
  112. PFORMAT_STRING pFormat,
  113. long ElemMemCount,
  114. long * pActCount
  115. );
  116. BOOL
  117. NdrReadPipeElements(
  118. NDR_PIPE_DESC * pPipeDesc,
  119. PMIDL_STUB_MESSAGE pStubMsg,
  120. unsigned char * pTargetBuffer,
  121. PFORMAT_STRING pElemFormat,
  122. long * pElementsRead
  123. );
  124. void
  125. NdrpReadPipeElementsFromBuffer (
  126. NDR_PIPE_DESC * pPipeDesc,
  127. PMIDL_STUB_MESSAGE pStubMsg,
  128. uchar ** TargetBuffer,
  129. PFORMAT_STRING pElemFormat,
  130. long TargetBufferCount,
  131. long * NumCopied
  132. );
  133. #ifdef __cplusplus
  134. }
  135. #endif
  136. #endif // PIPENDR