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.

512 lines
15 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // File: Context.idl
  4. //
  5. // Contents: Context interfaces
  6. //
  7. // History: 04-Dec-97 Gopalk Created
  8. //
  9. //--------------------------------------------------------------------
  10. cpp_quote("//+-----------------------------------------------------------------")
  11. cpp_quote("//")
  12. cpp_quote("// Microsoft Windows")
  13. cpp_quote("// Copyright (C) Microsoft Corporation, 1992 - 1997.")
  14. cpp_quote("//")
  15. cpp_quote("//------------------------------------------------------------------")
  16. #ifndef DO_NO_IMPORTS
  17. import "wtypes.idl";
  18. import "objidl.idl";
  19. import "unknwn.idl";
  20. #endif
  21. /****************************************************************************
  22. * Context Types *
  23. ****************************************************************************/
  24. // Event types
  25. enum tagCONTEXTEVENT
  26. {
  27. CONTEXTEVENT_NONE = 0x00000000,
  28. // Call Events
  29. CONTEXTEVENT_CALL = 0x00000001,
  30. CONTEXTEVENT_ENTER = 0x00000002,
  31. CONTEXTEVENT_LEAVE = 0x00000004,
  32. CONTEXTEVENT_RETURN = 0x00000008,
  33. // Buffer Events
  34. CONTEXTEVENT_CALLFILLBUFFER = 0x00000010,
  35. CONTEXTEVENT_ENTERWITHBUFFER = 0x00000020,
  36. CONTEXTEVENT_LEAVEFILLBUFFER = 0x00000040,
  37. CONTEXTEVENT_RETURNWITHBUFFER = 0x00000080,
  38. // Begin Events
  39. CONTEXTEVENT_BEGINCALL = 0x00000100,
  40. CONTEXTEVENT_BEGINENTER = 0x00000200,
  41. CONTEXTEVENT_BEGINLEAVE = 0x00000400,
  42. CONTEXTEVENT_BEGINRETURN = 0x00000800,
  43. // Finish Events
  44. CONTEXTEVENT_FINISHCALL = 0x00001000,
  45. CONTEXTEVENT_FINISHENTER = 0x00002000,
  46. CONTEXTEVENT_FINISHLEAVE = 0x00004000,
  47. CONTEXTEVENT_FINISHRETURN = 0x00008000,
  48. // Buffer Events
  49. CONTEXTEVENT_BEGINCALLFILLBUFFER = 0x00010000,
  50. CONTEXTEVENT_BEGINENTERWITHBUFFER = 0x00020000,
  51. CONTEXTEVENT_FINISHLEAVEFILLBUFFER = 0x00040000,
  52. CONTEXTEVENT_FINISHRETURNWITHBUFFER = 0x00080000,
  53. // Exception Events
  54. CONTEXTEVENT_LEAVEEXCEPTION = 0x00100000,
  55. CONTEXTEVENT_LEAVEEXCEPTIONFILLBUFFER = 0x00200000,
  56. CONTEXTEVENT_RETURNEXCEPTION = 0x00400000,
  57. CONTEXTEVENT_RETURNEXCEPTIONWITHBUFFER = 0x00800000,
  58. // Other Events
  59. CONTEXTEVENT_ADDREFPOLICY = 0x10000000,
  60. CONTEXTEVENT_RELEASEPOLICY = 0x20000000
  61. };
  62. typedef DWORD ContextEvent;
  63. enum tagCPFLAGS
  64. {
  65. CPFLAG_NONE = 0x0,
  66. // Flags to determine whether the property gets copied when the context does
  67. CPFLAG_PROPAGATE = 0x1,
  68. CPFLAG_EXPOSE = 0x2,
  69. CPFLAG_ENVOY = 0x4,
  70. // Flags to determine whether the property receives stub/proxy
  71. // create/destroy events.
  72. CPFLAG_MONITORSTUB = 0x8,
  73. CPFLAG_MONITORPROXY = 0x10,
  74. // Flags to determine whether a property is used in context comparison
  75. CPFLAG_DONTCOMPARE = 0x20
  76. };
  77. typedef DWORD CPFLAGS;
  78. #define MSHLFLAGS_NO_IEC 0x8 // don't use IExternalConnextion
  79. #define MSHLFLAGS_NO_IMARSHAL 0x10 // don't use IMarshal
  80. /****************************************************************************
  81. * Context Interfaces *
  82. ****************************************************************************/
  83. // IEnunContextProperties interface
  84. typedef struct tagContextProperty {
  85. GUID policyId;
  86. CPFLAGS flags;
  87. [unique] IUnknown *pUnk;
  88. } ContextProperty;
  89. [
  90. object,
  91. uuid(000001c1-0000-0000-C000-000000000046),
  92. pointer_default(unique)
  93. ]
  94. interface IEnumContextProps : IUnknown
  95. {
  96. typedef [unique] IEnumContextProps *LPENUMCONTEXTPROPS;
  97. HRESULT Next([in] ULONG celt,
  98. [out, size_is(celt), length_is(*pceltFetched)] ContextProperty *pContextProperties,
  99. [out] ULONG *pceltFetched);
  100. HRESULT Skip([in] ULONG celt);
  101. HRESULT Reset();
  102. HRESULT Clone([out] IEnumContextProps **ppEnumContextProps);
  103. HRESULT Count([out] ULONG *pcelt);
  104. }
  105. // IContext interface
  106. [
  107. local,
  108. object,
  109. uuid(000001c0-0000-0000-C000-000000000046),
  110. pointer_default(unique)
  111. ]
  112. interface IContext : IUnknown
  113. {
  114. //typedef [unique] IContext *LPCONTEXT;
  115. HRESULT SetProperty([in] REFGUID rpolicyId,
  116. [in] CPFLAGS flags,
  117. [in] IUnknown *pUnk);
  118. HRESULT RemoveProperty([in] REFGUID rPolicyId);
  119. HRESULT GetProperty([in] REFGUID rGuid,
  120. [out] CPFLAGS *pFlags,
  121. [out] IUnknown **ppUnk);
  122. HRESULT EnumContextProps([out] IEnumContextProps **ppEnumContextProps);
  123. }
  124. // Interface for context-controlled marshalling
  125. [
  126. local,
  127. object,
  128. uuid(000001D8-0000-0000-C000-000000000046)
  129. ]
  130. interface IContextMarshaler : IUnknown
  131. {
  132. typedef [unique] IContextMarshaler *LPCTXMARSHALER;
  133. HRESULT GetMarshalSizeMax([in] REFIID riid,
  134. [in, unique] void *pv,
  135. [in] DWORD dwDestContext,
  136. [in, unique] void *pvDestContext,
  137. [in] DWORD mshlflags,
  138. [out] DWORD *pSize);
  139. HRESULT MarshalInterface([in, unique] IStream *pStm,
  140. [in] REFIID riid,
  141. [in, unique] void *pv,
  142. [in] DWORD dwDestContext,
  143. [in, unique] void *pvDestContext,
  144. [in] DWORD mshlflags);
  145. }
  146. // IObjContext interface
  147. [
  148. local,
  149. object,
  150. uuid(000001c6-0000-0000-C000-000000000046),
  151. pointer_default(unique)
  152. ]
  153. interface IObjContext : IContext
  154. {
  155. typedef [ref] HRESULT __stdcall (*PFNCTXCALLBACK)(void* pParam);
  156. HRESULT Freeze();
  157. HRESULT DoCallback([in] PFNCTXCALLBACK pfnCallback,
  158. [in] void* pParam,
  159. [in] REFIID riid,
  160. [in] unsigned int iMethod);
  161. // These methods are here to minimize the code path for marshalling
  162. // otherwise I would put them in a separate interface
  163. // The Set methods can only be called before the context is frozen
  164. // Methods to set and get a special marshaller that is invoked for
  165. // GetMarshalSizeMax and MarshalInterface if MSHLFLAGS_USE_CTX_MSH is set
  166. HRESULT SetContextMarshaler([in] IContextMarshaler *pICM);
  167. HRESULT GetContextMarshaler([out] IContextMarshaler **pICM);
  168. // Ugly back-door methods to let us examine or modify the context flags
  169. // externally.
  170. HRESULT SetContextFlags([in] DWORD dwFlags); // flags |= dwFlags
  171. HRESULT ClearContextFlags([in] DWORD dwFlags); // flags &= ~dwFlags
  172. HRESULT GetContextFlags([out] DWORD *pdwFlags);
  173. }
  174. // IGetContextId
  175. [
  176. local,
  177. object,
  178. uuid(000001dd-0000-0000-C000-000000000046),
  179. pointer_default(unique)
  180. ]
  181. interface IGetContextId : IUnknown
  182. {
  183. HRESULT GetContextId([out] GUID *pguidCtxtId);
  184. };
  185. // IAggregator
  186. [
  187. local,
  188. object,
  189. uuid(000001d8-0000-0000-C000-000000000046),
  190. pointer_default(unique)
  191. ]
  192. interface IAggregator : IUnknown
  193. {
  194. typedef [unique] IAggregator *IAGGREGATOR;
  195. HRESULT Aggregate([in] IUnknown* pInnerUnk);
  196. }
  197. // ICall interface
  198. [
  199. local,
  200. object,
  201. uuid(000001d6-0000-0000-C000-000000000046),
  202. pointer_default(unique)
  203. ]
  204. interface ICall : IUnknown
  205. {
  206. typedef [unique] ICall *LPCALL;
  207. HRESULT GetCallInfo([out] const void **ppIdentity,
  208. [out] IID *piid,
  209. [out] DWORD *pdwMethod,
  210. [out] HRESULT *phr);
  211. HRESULT Nullify([in] HRESULT hr);
  212. HRESULT GetServerHR([out] HRESULT *phr);
  213. };
  214. // IRpcCall interface
  215. [
  216. local,
  217. object,
  218. uuid(000001c5-0000-0000-C000-000000000046),
  219. pointer_default(unique)
  220. ]
  221. interface IRpcCall : IUnknown
  222. {
  223. typedef [unique] IRpcCall *LPRPCCALL;
  224. HRESULT GetRpcOleMessage([out] RPCOLEMESSAGE **ppMessage);
  225. };
  226. typedef enum _CALLSOURCE
  227. {
  228. CALLSOURCE_CROSSAPT = 0,
  229. CALLSOURCE_CROSSCTX = 1
  230. } CALLSOURCE;
  231. // ICallInfo interface
  232. [
  233. local,
  234. object,
  235. uuid(000001dc-0000-0000-C000-000000000046),
  236. pointer_default(unique)
  237. ]
  238. interface ICallInfo : IUnknown
  239. {
  240. HRESULT GetCallSource([out] CALLSOURCE* pCallSource);
  241. };
  242. // IPolicy interface
  243. [
  244. local,
  245. object,
  246. uuid(000001c2-0000-0000-C000-000000000046),
  247. pointer_default(unique)
  248. ]
  249. interface IPolicy : IUnknown
  250. {
  251. HRESULT Call([in] ICall *pCall);
  252. HRESULT Enter([in] ICall *pCall);
  253. HRESULT Leave([in] ICall *pCall);
  254. HRESULT Return([in] ICall *pCall);
  255. HRESULT CallGetSize([in] ICall *pCall,
  256. [out] ULONG *pcb);
  257. HRESULT CallFillBuffer([in] ICall *pCall,
  258. [in] void *pvBuf,
  259. [out] ULONG *pcb);
  260. HRESULT EnterWithBuffer([in] ICall *pCall,
  261. [in] void *pvBuf,
  262. [in] ULONG cb);
  263. HRESULT LeaveGetSize([in] ICall *pCall,
  264. [out] ULONG *pcb);
  265. HRESULT LeaveFillBuffer([in] ICall *pCall,
  266. [in] void *pvBuf,
  267. [out] ULONG *pcb);
  268. HRESULT ReturnWithBuffer([in] ICall *pCall,
  269. [in] void *pvBuf,
  270. [in] ULONG cb);
  271. ULONG AddRefPolicy();
  272. ULONG ReleasePolicy();
  273. };
  274. // IPolicyAsync interface
  275. [
  276. local,
  277. object,
  278. uuid(000001cd-0000-0000-C000-000000000046),
  279. pointer_default(unique)
  280. ]
  281. interface IPolicyAsync : IUnknown
  282. {
  283. HRESULT BeginCallGetSize([in] ICall *pCall,
  284. [out] ULONG *pcb);
  285. HRESULT BeginCall([in] ICall *pCall);
  286. HRESULT BeginCallFillBuffer([in] ICall *pCall,
  287. [in] void *pvBuf,
  288. [out] ULONG *pcb);
  289. HRESULT BeginEnter([in] ICall *pCall);
  290. HRESULT BeginEnterWithBuffer([in] ICall *pCall,
  291. [in] void *pvBuf,
  292. [in] ULONG cb);
  293. HRESULT BeginLeave([in] ICall *pCall);
  294. HRESULT BeginReturn([in] ICall *pCall);
  295. HRESULT FinishCall([in] ICall *pCall);
  296. HRESULT FinishEnter([in] ICall *pCall);
  297. HRESULT FinishLeaveGetSize([in] ICall *pCall,
  298. [out] ULONG *pcb);
  299. HRESULT FinishLeave([in] ICall *pCall);
  300. HRESULT FinishLeaveFillBuffer([in] ICall *pCall,
  301. [in] void *pvBuf,
  302. [out] ULONG *pcb);
  303. HRESULT FinishReturn([in] ICall *pCall);
  304. HRESULT FinishReturnWithBuffer([in] ICall *pCall,
  305. [in] void *pvBuf,
  306. [in] ULONG cb);
  307. };
  308. // IPolicySet interface
  309. [
  310. local,
  311. object,
  312. uuid(000001c3-0000-0000-C000-000000000046),
  313. pointer_default(unique)
  314. ]
  315. interface IPolicySet : IUnknown
  316. {
  317. HRESULT AddPolicy([in] ContextEvent ctxEvent,
  318. [in] REFGUID rguid,
  319. [in] IPolicy *pPolicy);
  320. }
  321. // IComObjIdentity interface
  322. [
  323. local,
  324. object,
  325. uuid(000001d7-0000-0000-C000-000000000046),
  326. pointer_default(unique)
  327. ]
  328. interface IComObjIdentity : IUnknown
  329. {
  330. BOOL IsServer();
  331. BOOL IsDeactivated();
  332. HRESULT GetIdentity([out] IUnknown** ppUnk);
  333. }
  334. // IPolicyMaker interface
  335. [
  336. local,
  337. object,
  338. uuid(000001c4-0000-0000-C000-000000000046),
  339. pointer_default(unique)
  340. ]
  341. interface IPolicyMaker : IUnknown
  342. {
  343. HRESULT AddClientPoliciesToSet([in] IPolicySet *pPS,
  344. [in] IContext *pClientContext,
  345. [in] IContext *pServerContext);
  346. HRESULT AddEnvoyPoliciesToSet([in] IPolicySet *pPS,
  347. [in] IContext *pClientContext,
  348. [in] IContext *pServerContext);
  349. HRESULT AddServerPoliciesToSet([in] IPolicySet *pPS,
  350. [in] IContext *pClientContext,
  351. [in] IContext *pServerContext);
  352. HRESULT Freeze([in] IObjContext *pObjContext);
  353. HRESULT CreateStub([in] IComObjIdentity *pID);
  354. HRESULT DestroyStub([in] IComObjIdentity *pID);
  355. HRESULT CreateProxy([in] IComObjIdentity *pID);
  356. HRESULT DestroyProxy([in] IComObjIdentity *pID);
  357. }
  358. // IExceptionNotification interface
  359. [
  360. local,
  361. object,
  362. uuid(000001db-0000-0000-C000-000000000046),
  363. pointer_default(unique)
  364. ]
  365. interface IExceptionNotification : IUnknown
  366. {
  367. void ServerException([in] void *pExcepPtrs);
  368. }
  369. // IAbandonmentNotification interface
  370. [
  371. local,
  372. object,
  373. uuid(000001de-0000-0000-C000-000000000046),
  374. pointer_default(unique)
  375. ]
  376. interface IAbandonmentNotification : IUnknown
  377. {
  378. void Abandoned (IObjContext* pObjContext);
  379. }
  380. // IMarshalEnvoy
  381. [
  382. local,
  383. object,
  384. uuid(000001c8-0000-0000-C000-000000000046),
  385. pointer_default(unique)
  386. ]
  387. interface IMarshalEnvoy : IUnknown
  388. {
  389. HRESULT GetEnvoyUnmarshalClass([in] DWORD dwDestContext,
  390. [out] CLSID* pClsid);
  391. HRESULT GetEnvoySizeMax([in] DWORD dwDestContext,
  392. [out] DWORD* pcb);
  393. HRESULT MarshalEnvoy([in] IStream* pStream,
  394. [in] DWORD dwDestContext);
  395. HRESULT UnmarshalEnvoy([in] IStream* pStream,
  396. [in] REFIID riid,
  397. [out, iid_is(riid)] void** ppunk);
  398. };
  399. // IWrapperInfo
  400. [
  401. local,
  402. object,
  403. uuid(5052f924-7ab8-11d3-b93f-00c04f990176),
  404. pointer_default(unique)
  405. ]
  406. interface IWrapperInfo : IUnknown
  407. {
  408. void SetMapping(void *pv);
  409. void *GetMapping();
  410. IObjContext *GetServerObjectContext();
  411. IUnknown *GetServerObject();
  412. };
  413. // ICOMDispatchInfo
  414. [
  415. local,
  416. object,
  417. uuid(000001d9-0000-0000-C000-000000000046),
  418. pointer_default(unique)
  419. ]
  420. interface IComDispatchInfo : IUnknown
  421. {
  422. HRESULT EnableComInits([out] void **ppvCookie);
  423. HRESULT DisableComInits([in] void *pvCookie);
  424. };
  425. typedef DWORD HActivator;
  426. cpp_quote("STDAPI CoCreateObjectInContext(IUnknown *pUnk, IObjContext *pObjectCtx, REFIID riid, void **ppv);")
  427. cpp_quote("STDAPI CoGetApartmentID(APTTYPE dAptType, HActivator* pAptID);")
  428. cpp_quote("STDAPI CoDeactivateObject(IUnknown *pUnk, IUnknown **ppCookie);")
  429. cpp_quote("STDAPI CoReactivateObject(IUnknown *pUnk, IUnknown *pCookie);")
  430. cpp_quote("#define MSHLFLAGS_NO_IEC 0x8 // don't use IExternalConnextion")
  431. cpp_quote("#define MSHLFLAGS_NO_IMARSHAL 0x10 // don't use IMarshal")
  432. cpp_quote("#define CONTEXTFLAGS_FROZEN 0x01 // Frozen context")
  433. cpp_quote("#define CONTEXTFLAGS_ALLOWUNAUTH 0x02 // Allow unauthenticated calls")
  434. cpp_quote("#define CONTEXTFLAGS_ENVOYCONTEXT 0x04 // Envoy context")
  435. cpp_quote("#define CONTEXTFLAGS_DEFAULTCONTEXT 0x08 // Default context")
  436. cpp_quote("#define CONTEXTFLAGS_STATICCONTEXT 0x10 // Static context")
  437. cpp_quote("#define CONTEXTFLAGS_INPROPTABLE 0x20 // Is in property table")
  438. cpp_quote("#define CONTEXTFLAGS_INDESTRUCTOR 0x40 // Is in destructor")
  439. cpp_quote("#define CONTEXTFLAGS_URTPROPPRESENT 0x80 // URT property added")