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.

168 lines
3.8 KiB

  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1999-1999 Microsoft Corporation
  3. Module Name :
  4. cssup.h
  5. Abstract :
  6. Declarations of private international (cs) support stuff
  7. Author :
  8. Mike Warning MikeW August 1999.
  9. Revision History :
  10. ---------------------------------------------------------------------*/
  11. #ifndef _CSSUP_H_
  12. #define _CSSUP_H_
  13. #define CP_UNICODE 1200
  14. BOOL GetThreadACP(
  15. unsigned long *cp,
  16. error_status_t *pStatus);
  17. ulong TranslateCodeset(ulong Codeset);
  18. __inline
  19. void InitializeStubCSInfo(PMIDL_STUB_MESSAGE pStubMsg)
  20. {
  21. if ( NULL == pStubMsg->pCSInfo )
  22. {
  23. pStubMsg->pCSInfo = (CS_STUB_INFO *)
  24. I_RpcAllocate( sizeof(CS_STUB_INFO) );
  25. if ( NULL == pStubMsg->pCSInfo )
  26. RpcRaiseException( RPC_S_OUT_OF_MEMORY );
  27. ZeroMemory( pStubMsg->pCSInfo, sizeof(CS_STUB_INFO) );
  28. }
  29. }
  30. __inline
  31. void UninitializeStubCSInfo(PMIDL_STUB_MESSAGE pStubMsg)
  32. {
  33. I_RpcFree( pStubMsg->pCSInfo );
  34. }
  35. ulong
  36. NdrpGetSetCSTagMarshall(
  37. PMIDL_STUB_MESSAGE pStubMsg,
  38. uchar * pMemory,
  39. NDR_CS_TAG_FORMAT * pTagFormat);
  40. ulong
  41. NdrpGetSetCSTagUnmarshall(
  42. PMIDL_STUB_MESSAGE pStubMsg,
  43. NDR_CS_TAG_FORMAT * pTagFormat);
  44. void
  45. NdrpGetArraySizeLength (
  46. PMIDL_STUB_MESSAGE pStubMsg,
  47. uchar * pMemory,
  48. PFORMAT_STRING pFormat,
  49. long ElementSize,
  50. long * pSize,
  51. long * pLength,
  52. long * pWireSize );
  53. // Note: The flag value is also the length of the prolog for the array on
  54. // the wire. Bogus arrays being the exception of course.
  55. #define MARSHALL_CONFORMANCE 0x01
  56. #define MARSHALL_VARIANCE 0x02
  57. #define MARSHALL_BOGUS 0x04
  58. extern const byte NdrpArrayMarshallFlags[];
  59. __inline
  60. int
  61. NdrpArrayPrologLength(
  62. PFORMAT_STRING pFormat )
  63. {
  64. int PrologLength;
  65. NDR_ASSERT( *pFormat >= FC_CARRAY, "Invalid array descriptor" );
  66. NDR_ASSERT( *pFormat <= FC_WSTRING, "Invalid array descriptor" );
  67. // We don't support bogus arrays for now
  68. NDR_ASSERT( *pFormat != FC_BOGUS_ARRAY, "Bogus arrays are not supported" );
  69. PrologLength = NdrpArrayMarshallFlags[ *pFormat - FC_CARRAY ];
  70. // The PrologLength (actually the array type flags) are equal to the number
  71. // of DWORDs in the prolog
  72. return PrologLength * 4;
  73. }
  74. __inline
  75. BOOL
  76. NdrpIsConformantArray(
  77. PFORMAT_STRING pFormat )
  78. {
  79. int flags;
  80. NDR_ASSERT( *pFormat >= FC_CARRAY, "Invalid array descriptor" );
  81. NDR_ASSERT( *pFormat <= FC_WSTRING, "Invalid array descriptor" );
  82. // We don't support bogus arrays for now
  83. NDR_ASSERT( *pFormat != FC_BOGUS_ARRAY, "Bogus arrays are not supported" );
  84. flags = NdrpArrayMarshallFlags[ *pFormat - FC_CARRAY ];
  85. return flags & MARSHALL_CONFORMANCE;
  86. }
  87. __inline
  88. BOOL
  89. NdrpIsVaryingArray(
  90. PFORMAT_STRING pFormat )
  91. {
  92. int flags;
  93. NDR_ASSERT( *pFormat >= FC_CARRAY, "Invalid array descriptor" );
  94. NDR_ASSERT( *pFormat <= FC_WSTRING, "Invalid array descriptor" );
  95. // We don't support bogus arrays for now
  96. NDR_ASSERT( *pFormat != FC_BOGUS_ARRAY, "Bogus arrays are not supported" );
  97. flags = NdrpArrayMarshallFlags[ *pFormat - FC_CARRAY ];
  98. return flags & MARSHALL_VARIANCE;
  99. }
  100. __inline
  101. BOOL
  102. NdrpIsFixedArray(
  103. PFORMAT_STRING pFormat )
  104. {
  105. int flags;
  106. NDR_ASSERT( *pFormat >= FC_CARRAY, "Invalid array descriptor" );
  107. NDR_ASSERT( *pFormat <= FC_WSTRING, "Invalid array descriptor" );
  108. // We don't support bogus arrays for now
  109. NDR_ASSERT( *pFormat != FC_BOGUS_ARRAY, "Bogus arrays are not supported" );
  110. flags = NdrpArrayMarshallFlags[ *pFormat - FC_CARRAY ];
  111. return ( 0 == flags );
  112. }
  113. #endif // !_CSSUP_H_