Leaked source code of windows server 2003
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.

377 lines
14 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (c) Microsoft Corporation. All rights reserved.
  5. //
  6. // File: obase.idl
  7. //
  8. // Synopsis: this file contain the base definitions for object
  9. // interface references.
  10. //
  11. //+-------------------------------------------------------------------------
  12. [
  13. uuid(99fcfe60-5260-101b-bbcb-00aa0021347a),
  14. pointer_default(unique)
  15. ]
  16. interface ObjectRpcBaseTypes
  17. {
  18. #ifndef DO_NO_IMPORTS
  19. import "wtypes.idl";
  20. #endif
  21. ////////////////////////////////////////////////////////////
  22. //
  23. // Identifier Definitions
  24. //
  25. ////////////////////////////////////////////////////////////
  26. typedef unsigned hyper ID;
  27. typedef ID MID; // Machine Identifier
  28. typedef ID OXID; // Object Exporter Identifier
  29. typedef ID OID; // Object Identifer
  30. typedef ID SETID; // Ping Set Identifier
  31. typedef GUID IPID; // Interface Pointer Identifier
  32. typedef GUID CID; // Causality Identifier
  33. typedef REFGUID REFIPID;
  34. ////////////////////////////////////////////////////////////
  35. //
  36. // Definitions of Location Elements
  37. //
  38. ////////////////////////////////////////////////////////////
  39. typedef DWORD APTID;
  40. typedef DWORD PROCID;
  41. typedef DWORD CTXTID;
  42. //////////////////////////////////////////////////////////////////
  43. //
  44. // ORPC Call Packet Format
  45. //
  46. //////////////////////////////////////////////////////////////////
  47. // COM_MINOR_VERSION = 1 (NT4.0, SP1, SP2, DCOM95).
  48. // - Initial Release
  49. // - Must be used when talking to downlevel machines, including
  50. // on Remote Activation calls.
  51. // COM_MINOR_VERSION = 2 (NT4.0 SP3 and beyond).
  52. // - Added ResolveOxid2 to IObjectExporter to retrieve the
  53. // COM version number of the server. Passed to the NDR engine
  54. // to fix fatal endian-ness flaw in the way OLEAUTOMATION marshals
  55. // BSTRS. Previous way used trailing padding, which is not NDR
  56. // compatible. See Bug# 69189.
  57. // COM_MINOR_VERSION = 3 (DCOM95 build 1120 and beyond)
  58. // - OLEAUT32 added two new types to the SAFEARRAY, but SAFEARRAY
  59. // previously included the "default" keyword, which prevented
  60. // downevel NDR engines from correctly handling any extensions.
  61. // Machines with version >=5.3 don't use "default" and will
  62. // gracefully handle future extensions to SAFEARRAY.
  63. // COM_MINOR_VERSION = 4 (NT5.0 1779, NT4 SP4, DCOM95 2328, and beyond)
  64. // - 1) Fix for incorrect marshal/unmarshal of array of interface
  65. // pointers by NDR. Wire representation is corrected.
  66. // - 2) Fix wire representation of a conformant struct embedded in a
  67. // complex struct.
  68. // Both fixes kick in when DCOM version is >= 5.4 or the call
  69. // is raw RPC. See NT BUG# 80139.
  70. // COM_MINOR_VERSION = 5 (Unused)
  71. // - Not used because we do not want matching major and
  72. // minor versions
  73. // COM_MINOR_VERSION = 6 (NT5.0 and beyond).
  74. // - Added EXTENDED_OBJREF which is an extensible form of OBJREF
  75. // useful for carrying additional data along with STDOBJREF
  76. // old constants (for convenience)
  77. const unsigned short COM_MINOR_VERSION_1 = 1;
  78. // current version
  79. const unsigned short COM_MAJOR_VERSION = 5;
  80. const unsigned short COM_MINOR_VERSION = 6;
  81. // Component Object Model version number
  82. typedef struct tagCOMVERSION
  83. {
  84. unsigned short MajorVersion; // Major version number
  85. unsigned short MinorVersion; // Minor version number
  86. } COMVERSION;
  87. // enumeration of additional information present in the call packet.
  88. // Should be an enum but DCE IDL does not support sparse enumerators.
  89. const unsigned long ORPCF_NULL = 0; // no additional info in packet
  90. const unsigned long ORPCF_LOCAL = 1; // call is local to this machine
  91. const unsigned long ORPCF_RESERVED1 = 2; // reserved for local use
  92. const unsigned long ORPCF_RESERVED2 = 4; // reserved for local use
  93. const unsigned long ORPCF_RESERVED3 = 8; // reserved for local use
  94. const unsigned long ORPCF_RESERVED4 = 16; // reserved for local use
  95. // Extension to implicit parameters.
  96. typedef struct tagORPC_EXTENT
  97. {
  98. GUID id; // Extension identifier.
  99. unsigned long size; // Extension size.
  100. [size_is((size+7)&~7)] byte data[]; // Extension data.
  101. } ORPC_EXTENT;
  102. // Array of extensions.
  103. typedef struct tagORPC_EXTENT_ARRAY
  104. {
  105. unsigned long size; // Num extents.
  106. unsigned long reserved; // Must be zero.
  107. [size_is((size+1)&~1,), unique] ORPC_EXTENT **extent; // extents
  108. } ORPC_EXTENT_ARRAY;
  109. // implicit 'this' pointer which is the first [in] parameter on
  110. // every ORPC call.
  111. typedef struct tagORPCTHIS
  112. {
  113. COMVERSION version; // COM version number
  114. unsigned long flags; // ORPCF flags for presence of other data
  115. unsigned long reserved1; // set to zero
  116. CID cid; // causality id of caller
  117. // Extensions.
  118. [unique] ORPC_EXTENT_ARRAY *extensions;
  119. } ORPCTHIS;
  120. // implicit 'that' pointer which is the first [out] parameter on
  121. // every ORPC call.
  122. typedef struct tagORPCTHAT
  123. {
  124. unsigned long flags; // ORPCF flags for presence of other data
  125. // Extensions.
  126. [unique] ORPC_EXTENT_ARRAY *extensions;
  127. } ORPCTHAT;
  128. //////////////////////////////////////////////////////////////////
  129. //
  130. // Marshaled COM Interface Wire Format
  131. //
  132. //////////////////////////////////////////////////////////////////
  133. // DUALSTRINGARRAYS are the return type for arrays of network addresses,
  134. // arrays of endpoints and arrays of both used in many ORPC interfaces
  135. const unsigned short NCADG_IP_UDP = 0x08;
  136. const unsigned short NCACN_IP_TCP = 0x07;
  137. const unsigned short NCADG_IPX = 0x0E;
  138. const unsigned short NCACN_SPX = 0x0C;
  139. const unsigned short NCACN_NB_NB = 0x12;
  140. const unsigned short NCACN_NB_IPX = 0x0D;
  141. const unsigned short NCACN_DNET_NSP = 0x04;
  142. const unsigned short NCALRPC = 0x10;
  143. // const unsigned short MSWMSG = 0x01; // note: not a real tower id.
  144. // This is the return type for arrays of string bindings or protseqs
  145. // used by many ORPC interfaces.
  146. // Not used for DCOM:
  147. // ncacn_np
  148. // ncacn_nb_tcp
  149. // ncacn_nb_ipx
  150. // ncacn_nb_xns
  151. // ncacn_at_dsp
  152. // ncadg_at_ddp
  153. // ncacn_vns_spp
  154. typedef struct tagSTRINGBINDING
  155. {
  156. unsigned short wTowerId; // Cannot be zero.
  157. unsigned short aNetworkAddr; // Zero terminated.
  158. } STRINGBINDING;
  159. const unsigned short COM_C_AUTHZ_NONE = 0xffff;
  160. typedef struct tagSECURITYBINDING
  161. {
  162. unsigned short wAuthnSvc; // Cannot be zero.
  163. unsigned short wAuthzSvc; // Must not be zero.
  164. unsigned short aPrincName; // Zero terminated.
  165. } SECURITYBINDING;
  166. typedef struct tagDUALSTRINGARRAY
  167. {
  168. unsigned short wNumEntries; // Number of entries in array.
  169. unsigned short wSecurityOffset; // Offset of security info.
  170. // The array contains two parts, a set of STRINGBINDINGs
  171. // and a set of SECURITYBINDINGs. Each set is terminated by an
  172. // extra zero. The shortest array contains four zeros.
  173. [size_is(wNumEntries)] unsigned short aStringArray[];
  174. } DUALSTRINGARRAY;
  175. // signature value for OBJREF (object reference, actually the
  176. // marshaled form of a COM interface).
  177. const unsigned long OBJREF_SIGNATURE = 0x574f454d; // 'MEOW'
  178. // flag values for OBJREF
  179. const unsigned long OBJREF_STANDARD = 0x1; // standard marshaled objref
  180. const unsigned long OBJREF_HANDLER = 0x2; // handler marshaled objref
  181. const unsigned long OBJREF_CUSTOM = 0x4; // custom marshaled objref
  182. const unsigned long OBJREF_EXTENDED = 0x8; // Extended standard objref
  183. // Flag values for a STDOBJREF (standard part of an OBJREF).
  184. // SORF_OXRES1 - SORF_OXRES8 are reserved for the object exporters
  185. // use only, object importers must ignore them and must not enforce MBZ.
  186. const unsigned long SORF_OXRES1 = 0x1; // reserved for exporter
  187. const unsigned long SORF_OXRES2 = 0x20; // reserved for exporter
  188. const unsigned long SORF_OXRES3 = 0x40; // reserved for exporter
  189. const unsigned long SORF_OXRES4 = 0x80; // reserved for exporter
  190. const unsigned long SORF_OXRES5 = 0x100;// reserved for exporter
  191. const unsigned long SORF_OXRES6 = 0x200;// reserved for exporter
  192. const unsigned long SORF_OXRES7 = 0x400;// reserved for exporter
  193. const unsigned long SORF_OXRES8 = 0x800;// reserved for exporter
  194. const unsigned long SORF_NULL = 0x0; // convenient for initializing SORF
  195. const unsigned long SORF_NOPING = 0x1000;// Pinging is not required
  196. // standard object reference
  197. typedef struct tagSTDOBJREF
  198. {
  199. unsigned long flags; // STDOBJREF flags (see above)
  200. unsigned long cPublicRefs; // count of references passed
  201. OXID oxid; // oxid of server with this oid
  202. OID oid; // oid of object with this ipid
  203. IPID ipid; // ipid of Interface
  204. } STDOBJREF;
  205. // data item
  206. typedef struct tagDATAELEMENT
  207. {
  208. GUID dataID; // id of data
  209. unsigned long cbSize; // size of data
  210. unsigned long cbRounded; // rounded size
  211. [size_is((cbSize+7)&~7)] BYTE Data[]; // data
  212. } DATAELEMENT;
  213. // Objref data
  214. typedef struct tagOBJREFDATA
  215. {
  216. unsigned long nElms; // number of elements
  217. [size_is(nElms+1-(nElms & 1),), unique] DATAELEMENT **ppElmArray; // elements
  218. } OBJREFDATA;
  219. // OBJREF is the format of a marshaled interface pointer.
  220. typedef struct tagOBJREF
  221. {
  222. unsigned long signature; // must be OBJREF_SIGNATURE
  223. unsigned long flags; // OBJREF flags (see above)
  224. GUID iid; // interface identifier
  225. [switch_is(flags), switch_type(unsigned long)] union
  226. {
  227. [case(OBJREF_STANDARD)] struct
  228. {
  229. STDOBJREF std; // standard objref
  230. DUALSTRINGARRAY saResAddr; // resolver address
  231. } u_standard;
  232. [case(OBJREF_HANDLER)] struct
  233. {
  234. STDOBJREF std; // standard objref
  235. CLSID clsid; // Clsid of handler code
  236. DUALSTRINGARRAY saResAddr; // resolver address
  237. } u_handler;
  238. [case(OBJREF_CUSTOM)] struct
  239. {
  240. CLSID clsid; // Clsid of unmarshaling code
  241. unsigned long cbExtension;// size of extension data
  242. unsigned long size; // size of data that follows
  243. [size_is(size), ref] byte *pData; // extension + class specific data
  244. } u_custom;
  245. [case(OBJREF_EXTENDED)] struct
  246. {
  247. STDOBJREF std; // standard objref
  248. [unique] OBJREFDATA *pORData; // objref data
  249. DUALSTRINGARRAY saResAddr; // resolver address
  250. } u_extended;
  251. } u_objref;
  252. } OBJREF;
  253. // wire representation of a marshalled interface pointer
  254. typedef struct tagMInterfacePointer
  255. {
  256. ULONG ulCntData; // size of data
  257. [size_is(ulCntData)] BYTE abData[]; // data (OBJREF)
  258. } MInterfacePointer;
  259. typedef [unique] MInterfacePointer * PMInterfacePointer;
  260. //////////////////////////////////////////////////////////////////
  261. //
  262. // OXID Resolution
  263. //
  264. //////////////////////////////////////////////////////////////////
  265. // OXID Resolver information associated with each OXID.
  266. typedef struct tagOXID_INFO
  267. {
  268. DWORD dwTid; // thread id of object exporter
  269. DWORD dwPid; // process id of object exporter
  270. DWORD dwAuthnHint; // authentication hint
  271. COMVERSION version; // COM Version of server
  272. IPID ipidRemUnknown; // IRemUnknown IPID for object exporter
  273. DWORD dwFlags; // miscellaneous flags
  274. [unique] DUALSTRINGARRAY *psa; // protocol and security info
  275. } OXID_INFO;
  276. //////////////////////////////////////////////////////////////////
  277. //
  278. // Static Marshaler
  279. //
  280. //////////////////////////////////////////////////////////////////
  281. // custom extensions
  282. typedef struct tagSTCMSHL_EXTENSION
  283. {
  284. ULONG cbSize; // size, in bytes, of entire extension
  285. GUID type; // type of extension
  286. BYTE data[1]; // extension data
  287. } STCMSHL_EXTENSION;
  288. typedef struct tagSTCMSHL_EXTENSION_ARRAY
  289. {
  290. ULONG cbSize; // size, in bytes, of entire extension
  291. ULONG cElems; // count of extension records;
  292. STCMSHL_EXTENSION data[1]; // extension records;
  293. } STCMSHL_EXTENSION_ARRAY;
  294. }
  295. //////////////////////////////////////////////////////////////////
  296. //
  297. // Generic blob definition, with 8 byte aligned buffer
  298. //
  299. //////////////////////////////////////////////////////////////////
  300. typedef struct tagOpaqueData
  301. {
  302. GUID guid;
  303. unsigned long dataLength;
  304. unsigned long reserved1;
  305. unsigned long reserved2;
  306. [size_is((dataLength+7)&~7)] BYTE *data;
  307. } OpaqueData;