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.

394 lines
7.9 KiB

4 years ago
  1. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. btcls.hxx
  5. Abstract:
  6. Contains definitions for base type related code generation class
  7. definitions.
  8. Notes:
  9. History:
  10. VibhasC Jul-29-1993 Created.
  11. ----------------------------------------------------------------------------*/
  12. #ifndef __BTCLS_HXX__
  13. #define __BTCLS_HXX__
  14. #include "nulldefs.h"
  15. extern "C"
  16. {
  17. #include <stdio.h>
  18. #include <assert.h>
  19. }
  20. #include "ndrcls.hxx"
  21. class RESOURCE;
  22. /////////////////////////////////////////////////////////////////////////////
  23. // the base type code generation class.
  24. /////////////////////////////////////////////////////////////////////////////
  25. //
  26. // This class corresponds to a base type. All base types are clubbed together
  27. // into this class, since they share a whole lot of properties.
  28. //
  29. class CG_BASETYPE : public CG_NDR
  30. {
  31. private:
  32. public:
  33. //
  34. // The constructor.
  35. //
  36. CG_BASETYPE(
  37. node_skl * pBT,
  38. XLAT_SIZE_INFO & Info) // packing and size info
  39. : CG_NDR( pBT, Info )
  40. {
  41. SetSStubAllocLocation(
  42. S_STUB_ALLOC_LOCATION_UNKNOWN );
  43. SetSStubAllocType( S_STUB_ALLOC_TYPE_NONE );
  44. SetSStubInitNeed( S_STUB_INIT_NOT_NEEDED );
  45. }
  46. //
  47. // VARDESC generation routine
  48. //
  49. virtual
  50. CG_STATUS GetTypeDesc(TYPEDESC * &ptd, CCB * pCCB);
  51. //
  52. // Get and set methods.
  53. //
  54. virtual
  55. ID_CG GetCGID()
  56. {
  57. return ID_CG_BT;
  58. }
  59. //
  60. // Marshall a base type.
  61. //
  62. virtual
  63. CG_STATUS GenMarshall( CCB * pCCB );
  64. virtual
  65. CG_STATUS GenUnMarshall( CCB * pCCB );
  66. //
  67. // Format string routines for base types.
  68. //
  69. virtual
  70. void GenNdrFormat( CCB * pCCB );
  71. //
  72. // This method is called to generate offline portions of a types
  73. // format string.
  74. //
  75. virtual
  76. void GenNdrParamOffline( CCB * pCCB )
  77. {
  78. // Do nothing.
  79. }
  80. virtual
  81. void GenNdrParamDescription( CCB * pCCB );
  82. virtual
  83. void GenNdrParamDescriptionOld( CCB * pCCB )
  84. {
  85. pCCB->GetProcFormatString()->
  86. PushFormatChar( GetFormatChar() );
  87. }
  88. //
  89. // CG_ENUM redefines the GetFormatChar* methods.
  90. //
  91. virtual
  92. FORMAT_CHARACTER GetFormatChar( CCB * pCCB = 0 );
  93. virtual
  94. FORMAT_CHARACTER GetSignedFormatChar();
  95. char * GetTypeName();
  96. long FixedBufferSize( CCB * pCCB );
  97. BOOL InterpreterMustFree( CCB * pCCB )
  98. {
  99. return GetFormatChar() != FC_ENUM16;
  100. }
  101. //
  102. // This routine adjusts the stack size for the basetype, based upon the
  103. // current machine and environment. Needed for computing the stack
  104. // offsets in the NDR format string conformance descripions for top level
  105. // attributed arrays/pointers.
  106. //
  107. void IncrementStackOffset( long * pOffset );
  108. // end format string routines
  109. virtual
  110. BOOL IsSimpleType()
  111. {
  112. return TRUE;
  113. }
  114. BOOL HasAFixedBufferSize()
  115. {
  116. return TRUE;
  117. }
  118. virtual
  119. CG_STATUS S_GenInitOutLocals( CCB * pCCB );
  120. /////////////////////////////////////////////////////////////////////
  121. virtual
  122. CG_STATUS BufferAnalysis( ANALYSIS_INFO * pAna )
  123. {
  124. UNUSED( pAna );
  125. return CG_OK;
  126. }
  127. virtual
  128. CG_STATUS MarshallAnalysis( ANALYSIS_INFO * pAna );
  129. virtual
  130. CG_STATUS SizeAnalysis( ANALYSIS_INFO * pAna )
  131. {
  132. UNUSED( pAna );
  133. return CG_OK;
  134. }
  135. virtual
  136. CG_STATUS UnMarshallAnalysis( ANALYSIS_INFO * pAna );
  137. virtual
  138. CG_STATUS S_OutLocalAnalysis( ANALYSIS_INFO * pAna );
  139. virtual
  140. CG_STATUS FollowerMarshallAnalysis( ANALYSIS_INFO * pAna )
  141. {
  142. UNUSED( pAna );
  143. return CG_OK;
  144. }
  145. virtual
  146. CG_STATUS FollowerUnMarshallAnalysis( ANALYSIS_INFO * pAna )
  147. {
  148. UNUSED( pAna );
  149. return CG_OK;
  150. }
  151. virtual
  152. CG_STATUS GenFollowerMarshall( CCB * pCCB )
  153. {
  154. UNUSED( pCCB );
  155. return CG_OK;
  156. }
  157. virtual
  158. CG_STATUS GenFollowerUnMarshall( CCB * pCCB )
  159. {
  160. UNUSED( pCCB );
  161. return CG_OK;
  162. }
  163. virtual
  164. CG_STATUS GenFollowerSizing( CCB * pCCB )
  165. {
  166. UNUSED( pCCB );
  167. return CG_OK;
  168. }
  169. virtual
  170. void SetNextNdrAlignment( CCB * pCCB )
  171. {
  172. pCCB->SetNextNdrAlignment( GetWireSize() );
  173. }
  174. };
  175. /////////////////////////////////////////////////////////////////////////////
  176. // the enum code generation class.
  177. /////////////////////////////////////////////////////////////////////////////
  178. //
  179. // This class corresponds to an enum. This inherits from the basetypes,
  180. // since they share a whole lot of properties.
  181. //
  182. class CG_ENUM : public CG_BASETYPE
  183. {
  184. private:
  185. void * _pCTI;
  186. public:
  187. //
  188. // The constructor.
  189. //
  190. CG_ENUM(
  191. node_skl * pBT,
  192. XLAT_SIZE_INFO & Info )
  193. : CG_BASETYPE( pBT, Info )
  194. {
  195. _pCTI = NULL;
  196. }
  197. //
  198. // Get and set methods.
  199. //
  200. BOOL IsEnumLong()
  201. {
  202. return GetWireSize() != 2;
  203. }
  204. virtual
  205. ID_CG GetCGID()
  206. {
  207. return ID_CG_ENUM;
  208. }
  209. //
  210. // Generate typeinfo
  211. //
  212. virtual
  213. CG_STATUS GenTypeInfo( CCB * pCCB);
  214. virtual
  215. CG_STATUS GetTypeDesc(TYPEDESC * &ptd, CCB * pCCB)
  216. {
  217. return CG_NDR::GetTypeDesc(ptd, pCCB);
  218. };
  219. virtual
  220. FORMAT_CHARACTER GetFormatChar( CCB * pCCB = 0 );
  221. virtual
  222. FORMAT_CHARACTER GetSignedFormatChar();
  223. };
  224. /////////////////////////////////////////////////////////////////////////////
  225. // the error_status_t code generation class.
  226. /////////////////////////////////////////////////////////////////////////////
  227. //
  228. // This class corresponds to an error_status_t. This inherits from the basetypes,
  229. // since they share a whole lot of properties.
  230. //
  231. class CG_ERROR_STATUS_T : public CG_BASETYPE
  232. {
  233. private:
  234. public:
  235. //
  236. // The constructor.
  237. //
  238. CG_ERROR_STATUS_T(
  239. node_skl * pBT,
  240. XLAT_SIZE_INFO & Info )
  241. : CG_BASETYPE( pBT, Info )
  242. {
  243. }
  244. //
  245. // Get and set methods.
  246. //
  247. virtual
  248. ID_CG GetCGID()
  249. {
  250. return ID_CG_ERROR_STATUS_T;
  251. }
  252. virtual
  253. FORMAT_CHARACTER GetFormatChar( CCB * pCCB = 0 );
  254. virtual
  255. FORMAT_CHARACTER GetSignedFormatChar()
  256. {
  257. assert(0);
  258. return FC_ZERO;
  259. }
  260. };
  261. /////////////////////////////////////////////////////////////////////////////
  262. // the error_status_t code generation class.
  263. /////////////////////////////////////////////////////////////////////////////
  264. //
  265. // This class corresponds to an error_status_t. This inherits from the basetypes,
  266. // since they share a whole lot of properties.
  267. //
  268. class CG_HRESULT : public CG_BASETYPE
  269. {
  270. private:
  271. public:
  272. //
  273. // The constructor.
  274. //
  275. CG_HRESULT(
  276. node_skl * pBT,
  277. XLAT_SIZE_INFO & Info )
  278. : CG_BASETYPE( pBT, Info )
  279. {
  280. }
  281. //
  282. // Get and set methods.
  283. //
  284. virtual
  285. ID_CG GetCGID()
  286. {
  287. return ID_CG_HRESULT;
  288. }
  289. virtual
  290. FORMAT_CHARACTER GetFormatChar( CCB * pCCB = 0 )
  291. {
  292. return FC_LONG;
  293. }
  294. virtual
  295. FORMAT_CHARACTER GetSignedFormatChar()
  296. {
  297. assert(0);
  298. return FC_ZERO;
  299. }
  300. };
  301. #endif // __BTCLS_HXX__