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.

189 lines
4.6 KiB

  1. /*****************************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright(c) Microsoft Corp., 1987-1999 **/
  4. /*****************************************************************************/
  5. /*****************************************************************************
  6. File : usectxt.hxx
  7. Title : use context information manager.
  8. History :
  9. 24-Aug-1991 VibhasC Created
  10. *****************************************************************************/
  11. #ifndef __BADUSE_HXX__
  12. #define __BADUSE_HXX__
  13. /**
  14. ** enumeration of all reasons why a construct could be bad.
  15. **/
  16. enum _badconstruct
  17. {
  18. BC_NONE
  19. ,BC_DERIVES_FROM_VOID
  20. ,BC_DERIVES_FROM_PTR_TO_VOID
  21. ,BC_DERIVES_FROM_INT
  22. ,BC_DERIVES_FROM_PTR_TO_INT
  23. ,BC_DERIVES_FROM_HANDLE_T
  24. ,BC_DERIVES_FROM_ELIPSIS
  25. ,BC_DERIVES_FROM_CONF
  26. ,BC_DERIVES_FROM_VARY
  27. ,BC_DERIVES_FROM_UNSIZED_ARRAY
  28. ,BC_DERIVES_FROM_FUNC
  29. ,BC_DERIVES_FROM_CONF_STRUCT
  30. ,BC_DERIVES_FROM_VARY_STRUCT
  31. ,BC_DERIVES_FROM_CDECL
  32. ,BC_DERIVES_FROM_E_STAT_T
  33. ,BC_MAY_DERIVE_ARRAY_OF_UNIONS
  34. ,BC_DERIVES_FROM_IGNORE
  35. ,BC_DERIVES_FROM_RECURSIVE_REF
  36. ,BC_DERIVES_FROM_UNNAMED_FIELD
  37. ,BC_DERIVES_FROM_CONF_UNION
  38. ,BC_DERIVES_FROM_UNSIZED_STRING
  39. ,BC_REF_PTR_BAD_RT
  40. ,BC_DERIVES_FROM_RECURSIVE_UNION
  41. ,BC_BAD_RT_NE_UNION
  42. ,BC_DERIVES_FROM_CONF_PTR
  43. ,BC_DERIVES_FROM_VARY_PTR
  44. ,BC_CV_PTR_STRUCT_BAD_IN_XMIT_AS
  45. };
  46. /**
  47. ** enumeration of all reasons why a construct could be non-rpcable and should
  48. ** be checked at use time.
  49. **/
  50. enum _nonrpcable
  51. {
  52. NR_NONE
  53. ,NR_DERIVES_FROM_INT
  54. ,NR_DERIVES_FROM_PTR_TO_INT
  55. ,NR_DERIVES_FROM_VOID
  56. ,NR_DERIVES_FROM_PTR_TO_VOID
  57. ,NR_DERIVES_FROM_CONST
  58. ,NR_DERIVES_FROM_PTR_TO_CONST
  59. ,NR_DERIVES_FROM_FUNC
  60. ,NR_DERIVES_FROM_PTR_TO_FUNC
  61. ,NR_DERIVES_FROM_UNSIZED_STRING
  62. ,NR_DERIVES_FROM_P_TO_U_STRING
  63. ,NR_DERIVES_FROM_PTR_TO_CONF
  64. ,NR_DERIVES_FROM_BIT_FIELDS
  65. ,NR_DERIVES_FROM_NON_RPC_UNION
  66. ,NR_DERIVES_FROM_CONF_STRUCT
  67. ,NR_DERIVES_FROM_P_TO_C_STRUCT
  68. ,NR_DERIVES_FROM_TRANSMIT_AS
  69. ,NR_DERIVES_FROM_NE_UNIQUE_PTR
  70. ,NR_DERIVES_FROM_NE_FULL_PTR
  71. ,NR_DERIVES_FROM_CDECL
  72. ,NR_BASIC_TYPE_HANDLE_T
  73. ,NR_PRIMITIVE_HANDLE
  74. ,NR_PTR_TO_PRIMITIVE_HANDLE
  75. ,NR_GENERIC_HANDLE
  76. ,NR_PTR_TO_GENERIC_HANDLE
  77. ,NR_CTXT_HDL
  78. ,NR_PTR_TO_CTXT_HDL
  79. ,NR_PTR_TO_PTR_TO_CTXT_HDL
  80. ,NR_DERIVES_FROM_WCHAR_T
  81. };
  82. #define TRULY_NON_RPCABLE( p ) \
  83. ( \
  84. p->NonRPCAbleBecause( NR_DERIVES_FROM_INT ) || \
  85. p->NonRPCAbleBecause( NR_DERIVES_FROM_PTR_TO_INT ) || \
  86. p->NonRPCAbleBecause( NR_DERIVES_FROM_VOID ) || \
  87. p->NonRPCAbleBecause( NR_DERIVES_FROM_PTR_TO_VOID ) || \
  88. p->NonRPCAbleBecause( NR_DERIVES_FROM_FUNC ) || \
  89. p->NonRPCAbleBecause( NR_DERIVES_FROM_PTR_TO_FUNC ) || \
  90. p->NonRPCAbleBecause( NR_DERIVES_FROM_BIT_FIELDS ) || \
  91. p->NonRPCAbleBecause( NR_DERIVES_FROM_NON_RPC_UNION ) \
  92. )
  93. /**
  94. ** The basic bad use information structures
  95. **/
  96. #define SIZE_BAD_CON_REASON_ARRAY (1)
  97. #define SIZE_NON_RPC_REASON_ARRAY (1)
  98. #define SIZE_USE_CONTEXT_ARRAY (1)
  99. typedef unsigned long BAD_CONSTRUCT;
  100. typedef unsigned long NON_RPCABLE;
  101. typedef unsigned long USE_CONTEXT;
  102. typedef BAD_CONSTRUCT BadConstructReason[SIZE_BAD_CON_REASON_ARRAY];
  103. typedef NON_RPCABLE NonRPCAbleReason[SIZE_NON_RPC_REASON_ARRAY];
  104. typedef USE_CONTEXT UseContextInfo[SIZE_USE_CONTEXT_ARRAY];
  105. /**
  106. ** The use information block class
  107. **/
  108. class BadUseInfo
  109. {
  110. private:
  111. BadConstructReason AllBadConstructReasons;
  112. NonRPCAbleReason AllNonRPCAbleReasons;
  113. UseContextInfo UseContext;
  114. short NoOfArmsWithCaseLabels;
  115. friend
  116. void CopyAllBadConstructReasons( class BadUseInfo *,
  117. class BadUseInfo * );
  118. friend
  119. void CopyAllNonRPCAbleReasons( class BadUseInfo *,
  120. class BadUseInfo * );
  121. friend
  122. void CopyAllBadUseReasons( class BadUseInfo *,
  123. class BadUseInfo * );
  124. friend
  125. void CopyNoOfArmsWithCaseLabels( class BadUseInfo *,
  126. class BadUseInfo * );
  127. public:
  128. BadUseInfo();
  129. void InitBadUseInfo();
  130. BOOL BadConstructBecause( BAD_CONSTRUCT );
  131. BOOL NonRPCAbleBecause( NON_RPCABLE );
  132. void SetBadConstructBecause( BAD_CONSTRUCT );
  133. void ResetBadConstructBecause( BAD_CONSTRUCT );
  134. void SetNonRPCAbleBecause( NON_RPCABLE );
  135. void ResetNonRPCAbleBecause( NON_RPCABLE );
  136. BOOL AnyReasonForBadConstruct();
  137. BOOL AnyReasonForNonRPCAble();
  138. short GetNoOfArmsWithCaseLabels()
  139. {
  140. return NoOfArmsWithCaseLabels;
  141. }
  142. void InitNoOfArmsWithCaseLabels()
  143. {
  144. NoOfArmsWithCaseLabels = 0;
  145. }
  146. void IncrementNoOfArmsWithCaseLabels()
  147. {
  148. NoOfArmsWithCaseLabels++;
  149. }
  150. BOOL HasAnyHandleSpecification();
  151. void ResetAllHdlSpecifications();
  152. };
  153. #endif // __BADUSE_HXX__