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.

1145 lines
67 KiB

  1. // This file is not used, but is retained so we can look and see what was here originally.
  2. /* Yes this file actually compiles!
  3. CallObjects:A Suite of Interfaces forManipulatingCall Frames asObjects
  4. Copyright (C) 1995-1999 Microsoft Corporation. All rights reserved.
  5. Robert Atkinson
  6. 05 February, 1999
  7. This interface suite is an architecture for talking to an engine by which variousmanipulations can be performed on call
  8. frames, including marshalling, persistence, stack walking, and the like.
  9. */
  10. import "oaidl.idl";
  11. interface ICallInterceptor;
  12. interface ICallUnmarshal;
  13. interface ICallFrame;
  14. interface ICallFrameEvents;
  15. interface ICallFrameWalker;
  16. interface IMarshallingManager;
  17. interface IInterfaceRelated;
  18. /* Introduction
  19. The central interface throughwhichmanipulations of call frames (a.k.a. "activation records,"a..ka. "stack frames")is
  20. performed is ICallFrame. Once you get your hands on an ICallFrame instance, you can manipulate the underlying stack frame in
  21. severaldifferentways.Succinctlyput,ICallFrame provides theprimitive,basicbuildingblocksoutofwhich larger
  22. functionality such asmarshalling, call frame persistence, interface-pointer swizzling, and the like can be constructed. It
  23. would be conceivable, for example, to construct a generic implementation of interface proxies and stubs that operated by
  24. dispatching operations to an appropriate ICallFrame instance. Alternately, an infrastructure thatwished to build up method
  25. invocations into a queue to dispatch them at a later time could also be built out of the same primitives.
  26. Instances of ICallFramenever exist in an unbound state; rather, they are always attached to some activation record.
  27. Accordingly, they are not created directly with CoCreateInstance. Instead, clients get their hands on an instance of IClalFrame in
  28. one of two ways.
  29. In the first instantiation technique, you create what is known as an interceptorimplementation of a given interface. Upon
  30. receipt of a call, the interceptor's implementation of the interface manufactures an appropriate ICallFrameobject and then
  31. delivers an ::OnCall notification to an instance ofICallFrameEventspreviously registeredwiththe interceptor using the
  32. ICallInterceptor interface.
  33. The second technique by which instances of ICallFrame are obtained is that of unmarshalling themarshalled form of an
  34. incoming call. The incoming call comes in in the form of a bag 'o bytes in a buffer, but semantically tagged as belonging to a
  35. certain interface (a certain IID) and a certain method number therein. An instance of the appropriate unmarshalling class is
  36. created, and interface ICallUnmarshal can be used to turn the byte stream back into an activation record.
  37. Creation of interceptors and unmarshallers is carried out in the same manner. Indeed, ICallInterceptorand ICallUnmarshalare
  38. usually both supported by the same object instance. To create an interceptor for a given interface or find its unmarshaller,
  39. instantiate the proxy-stub class for the object using CoCreateInstance (rather than the usual mechanism which uses IPsFactory-
  40. Buffer). Ask for the interface IInterfaceRelated, and set the appropriate IID. Then, query for ICallInterceptor or ICallUnmarshal and
  41. party on.
  42. */
  43. /* ICallFrame
  44. ICallFrame is the workhorse interface through which manipulation of call frames is performed. An ICallFrameinstance never
  45. exits freely in an unbound state; rather an ICallFrame instance is always bound to some particular actual invocation, and so has
  46. an associated method number, a stack frame that can be walked, and so on. If the bound-to stack frame lies in user space, the
  47. call frame is a user mode call frame; this affects the behaviour of certain methods such as, e.g., ICallFrame::Copy,where only
  48. user space data may be copied from a user mode call frame.
  49. An instance of ICallFrame canperform various interesting transformations on a call frame (a.k.a. stack frame, activation
  50. record). For example, the call can be marshalled, or it can bepersisted. The call frame can be walked, looking for various
  51. referenced data that might be of interest.
  52. An appropriate ICallFrame could serve as the internal engine by which a COM interface proxy orinterface stub functioned.
  53. The interface proxy or stub would contain generic logic to drive the marshalling process, calling upon services in ICallFrame
  54. to actually carry out the interface-specific work. Different customers could use the same pieces to, say, persist a call frame
  55. instead of marshalling it. */
  56. [uuid(D573B4B0-894E-11d2-B8B6-00C04FB9618A), object, pointer_default(unique), local]
  57. interface ICallFrame : IUnknown
  58. {
  59. /* Bookkeeping */
  60. typedef struct
  61. {
  62. ULONG iMethod; /* the method number within to which this information applies */
  63. BOOL fHasInValues; /* Are there any in-values (other than the receiver) */
  64. BOOL fHasInOutValues; /* Are there any in-out values */
  65. BOOL fHasOutValues; /* Are there any out-values other than an HRESULT or void return value */
  66. BOOL fDerivesFromIDispatch; /* whether this interface in question derived from IDispatch or not. */
  67. LONG cInInterfacesMax; /* If >= 0, is an absolute upper bound on the number in-interfaces; if < 0, the
  68. method may have an unbounded number of in-interfaces. Of course, if == 0,
  69. there are definitely no in-interfaces. */
  70. LONG cInOutInterfacesMax; /* If >= 0, is an absolute upper bound on the number in-out-interfaces; if <
  71. 0, the method may have an unbounded number of in-out-interfaces Of course,
  72. if == 0, there are definitely no in-out-interfaces. */
  73. LONG cOutInterfacesMax; /* If >= 0, is an absolute upper bound on the number out-interfaces; if < 0,
  74. the method may have an unbounded number of out-interfaces Of course, if
  75. == 0, there are definitely no out-interfaces. */
  76. LONG cTopLevelInInterfaces; /* The number of parameters which are simply [in] interface pointers, and so
  77. are passed in the actual stack frame itself (this, of course, can never be
  78. unbounded).*/
  79. IID iid; /* the interface on which this is a call */
  80. ULONG cMethod; /* the total number of methods in that interface */
  81. ULONG cParams; /* the number of parameters in this method, NOT counting the receiver */
  82. } CALLFRAMEINFO;
  83. typedef struct
  84. {
  85. BOOLEAN fIn; /* is this an in parameter */
  86. BOOLEAN fOut; /* is this an out parameter */
  87. ULONG stackOffset; /* offset in bytes from stack location of the frame to start of param */
  88. ULONG cbParam; /* size occupied by parameter on the stack */
  89. } CALLFRAMEPARAMINFO;
  90. HRESULT GetInfo /*
  91. Return miscellaneous information about the call frame. The information returned is a static analysis of the method, not a dynamic one,
  92. in that it is based on an analysis of the method signature only, not the actual current contents of the call frame. For example, the static
  93. analysis might indicate that this method has the potential of having an in-interface, but because of, say, a union switch, a given call
  94. might not actually have any such interfaces.
  95. Return value Meaning
  96. S_OK All is well
  97. E_UNEXPECTED An unexpected error occurred. */
  98. (
  99. [out] CALLFRAMEINFO* pInfo /* place at which interesting information about this call frame is returned */
  100. );
  101. HRESULT GetIIDAndMethod /*
  102. Faster form of GetInfo that just returns the IID and /or the method number.
  103. Return value Meaning
  104. S_OK All is well
  105. E_UNEXPECTED An unexpected error occurred. */
  106. (
  107. [out] IID* pIID, /* optional */
  108. [out] ULONG* piMethod /* optional */
  109. );
  110. HRESULT GetNames /*
  111. Return a string representation of the method or interface name of this call, if such is available. If a requested name is not available,
  112. then a NULL string is returned.
  113. Return value Meaning
  114. S_OK All is well
  115. E_UNEXPECTED An unexpected error occurred. */
  116. (
  117. [out] LPWSTR* pwszInterface, /* OPTIONAL: the place to return the interface name */
  118. [out] LPWSTR* pwszMethod /* OPTIONAL: the place to return the method name */
  119. );
  120. PVOID GetStackLocation /*
  121. Return the stack location onto which this call frame is bound. Notice that this method is not HRESULT-returning; the return value is
  122. rather the requested stack location. */
  123. (
  124. );
  125. void SetStackLocation /*
  126. Set the stack location onto which this call frame is bound. This method is rarely used. Note that the stack frame provided must
  127. conform to the same IID and method number as that for which the call frame was initially created. */
  128. (
  129. [in] PVOID pvStack /* The stack location for the frame. */
  130. );
  131. void SetReturnValue /*
  132. Set the return value stored within this call frame. */
  133. (
  134. [in] HRESULT hr /* The new return value. */
  135. );
  136. HRESULT GetReturnValue /*
  137. Get the return value stored within this call frame. Note: the return value of this method is the requested return value stored in this call
  138. frame. It is not the success or failure of the request to retrieve said return value. */
  139. (
  140. );
  141. HRESULT GetParamInfo /*
  142. Return miscellaneous information a particular parameter in this invocation.
  143. Return value Meaning
  144. S_OK All is well
  145. E_UNEXPECTED An unexpected error occurred. */
  146. (
  147. [in] ULONG iparam, /* zero-origin parameter number */
  148. [out] CALLFRAMEPARAMINFO* pInfo /* place at which interesting information about this call frame is returned */
  149. );
  150. HRESULT SetParam /*
  151. Set the value of a particular parameter in this frame, if possible, given the data types involved.
  152. Return value Meaning
  153. S_OK All is well
  154. E_UNEXPECTED An unexpected error occurred. */
  155. (
  156. [in] ULONG iparam, /* zero-origin parameter number */
  157. [in] VARIANT* pvar /* the new value for this parameter */
  158. );
  159. HRESULT GetParam /*
  160. Return the value of a particular parameter in this frame, if possible, given the data types involved.
  161. Return value Meaning
  162. S_OK All is well
  163. E_UNEXPECTED An unexpected error occurred. */
  164. (
  165. [in] ULONG iparam, /* zero-origin parameter number */
  166. [out] VARIANT* pvar /* the current value of this parameter */
  167. );
  168. /* Copying& Freeing */
  169. typedef enum /* flags used in ::Copy. Use exactly one value. */
  170. {
  171. CALLFRAME_COPY_NESTED = 1, /* Client guarantees that he will only use the copied call frame in a manner where its lifetime
  172. is properly nested in the lifetime of its parent frame. When this flag is used, very significant
  173. optimizations can be made and memory allocations avoided by cleverly sharing actual
  174. parameter data.
  175. Indeed, with this flag specified to a Copy operation, only the i nterface pointer s transitively
  176. reachable in the source frames are guaranteed to be deep copied and thus in the copy be
  177. stored in memory separate from that in which they are stored in the source frames; other
  178. data types may actually in the copied frame share memory with the source if the Copy
  179. operation is intelligent enough to do so
  180. A consequence is that whichever of these three CALLFRAME_COPY flags are passed to
  181. ICallFrame::Copy, the interface pointers see by optionally provided interface walkers (see
  182. the method specification) may always be modified if desired without consequence of
  183. disturbing the interface pointers residing in the parent frame. However, if
  184. CALL_FRAME_COPY_NESTED is used, then the same cannot be said of any other type
  185. data types. .*/
  186. CALLFRAME_COPY_INDEPENDENT = 2, /* Client requests that the copied call frame have a lifetime which is wholly independent
  187. from its parent */
  188. CALLFRAME_COPY_NONLOCAL = 3, /* Only significant when executing a frame copy operation in kernel mode. Requests that not
  189. only should the lifetime of the copied frame data be independent of its parent, but that the
  190. actual copied data should reside in the opposite memory space from that of the parent data:
  191. if the parent frame is a user mode frame, the copied frame will be a kernel mode frame, and
  192. visa versa */
  193. } CALLFRAME_COPY;
  194. HRESULT Copy /*
  195. Create a deep copy of this call frame. A deep copy of a call frame copies the frame and all of the data that is reachable therefrom. It
  196. can be roughly conceptualized asmarshalling the frame, then immediately unmarshalling it; however, in practice it willbe
  197. significantly more efficient than actually carrying out these two steps. A copy of a call frame can only be made of the in-values in the
  198. 'before-call' state of the frame; once the frame has been invoked, and thus contains out-values, it cannot be copied.
  199. As data is copied, interface pointers in the copied data can be noted. If an ICallFrameWalkerimplementation is provided in the
  200. optional pWalker parameter, then pWalker->OnWalkInterface will be called for each interface pointer that is copied, just after the copy
  201. of the interface pointer value is made. The call frame implementation itself simply copies interface pointers as binary values.
  202. Specifically, no reference count adjustments of any form are performed. If some other behaviour is desired, the pWalker parameter
  203. must be used.
  204. Recall that a "user mode" call frame is one whose underlying stack pointer resides in user mode. In the process of copying a user-
  205. mode call frame, kernel mode implementations of the Copy operation ensures that only user-mode addresses are used in the data
  206. transitively reachable from the frame. Should an illegal non-user mode address be provided, an HRESULT derived from the error
  207. ERROR_INVALID_ADDRESS is returned.
  208. The copyControl parameter controls how much if any the data within the copied frame can be shared with data in the parent frame.
  209. See the CALLFRAME_COPY enumeration for details.
  210. The successfully copied frame is returned to the caller through *ppFrame. The frame so returned has a (normal) indefinite lifetime.
  211. The caller is explicitly responsible for calling Free on the frame copy in order to clean up the copied data. This must always be done,
  212. or memory leakage will occur; the call frame does not clean up the copied data automatically by itself.
  213. Return value Meaning
  214. S_OK All is well
  215. HRESULT_FROM_WIN32(ERROR_INVALID_ADDRESS) An attempt was made to copy from a user mode stack frame data which itself did not lie in
  216. user space.
  217. CALLFRAME_E_ALREADYINVOKED An invocation has already been made from this frame.
  218. E_UNEXPECTED An unexpected error occurred. */
  219. (
  220. [in] CALLFRAME_COPY copyControl, /* Controls how much the child frame can share data with the parent frame */
  221. [in] ICallFrameWalker* pWalker, /* Optional. If provided, then OnWalkInterface is called for each copied
  222. interface pointer after the copy has been made. If a walker is not provided,
  223. then the any interface pointers encountered are AddRef'd. For kernel mode
  224. clients copying user mode frames, this is unlikely to be reasonable: such
  225. clients should almost certainly provide a walker to handle things safely. */
  226. [out] ICallFrame** ppFrame /* place at which new frame is returned */
  227. );
  228. HRESULT Free /*
  229. First, optionally propagate the out-values of the frame to another destination frame, which is often a parent from which this frame was
  230. originally copied. This propagation is logically a deep copy, but if the source and destination frames are either both user mode or both
  231. kernel mode frames, then much actual allocation and deallocation can be avoided by simply transferring ownership of data from
  232. source to destination frames.
  233. If there are any [in,out] parameters in the destination frame, then the propagation first requires that the existing values that reside in
  234. those [in,out] parameters be freed. For interface pointers found therein, the freeing action can be controlled by providing a callback
  235. object in pWalkerDestFree.
  236. Once [in,out] parameters in the destination frame are freed, the propagation of out-values is (logically) carried out. If pWalkerCopy is
  237. provided, then it is called on each interface pointer contained in the propagated out-values.
  238. Second, optionally free some or all of the remaining data accessible from the source frame. Whether in, in-out, and / or out parameters
  239. are to be freed are indicated by the particular flags that may be indicated in the flags parameter, see the enumeration CALL-
  240. FRAME_FLAGS for details.
  241. Third, optionally, initialize out-parameters to appropriate NULL states, including the return value.
  242. Return value Meaning
  243. S_OK All is well
  244. E_UNEXPECTED An unexpected error occurred. */
  245. (
  246. [in] ICallFrame* pframeArgsDest, /* Optional. If present, is the stack pointer of the call frame to which the
  247. out-values should be copied before freeing is carried out. */
  248. [in] ICallFrameWalker* pWalkerDestFree, /* Optional. Ignored unless pframeArgsDest is also non-NULL. Indicates
  249. a callback object which should be notified as interface pointers residing
  250. in in-out parameters of pframeArgsDest need be freed. If absent, then
  251. such interface pointers are simply Release()ed. */
  252. [in] ICallFrameWalker* pWalkerCopy, /* Optional. Ignored unless pframeArgsDest is also non-NULL. Indicates
  253. a call back object which should be notified as interfaces are copied
  254. during call frame copying. If absent, then interface pointers are
  255. AddRef()d as the copy is made. */
  256. [in] DWORD freeFlags, /* flags drawn from the enumeration CALLFRAME_FREE */
  257. [in] ICallFrameWalker* pWalkerFree, /* Optional. If specified, then a call back will be made for each interface
  258. pointer encountered as freeing is carried out. If absent, then interface
  259. pointers encountered during freeing are Release()d.
  260. Note: when freeing a frame and specifying a pframeArgsDest which is in
  261. the same memory spa ce as that of the receiver frame, then o nl y
  262. pWalkerCopy is called on each interface pointer, not both pWalkerCopy
  263. and pWalkerFree as one might perhaps expect.
  264. Note to kernel mode users: If caller of Free is in kernel mode worried
  265. about the possibility of user mode malicious guy then he should either a)
  266. always provide a walker to deal with the callbacks, or b) make sure by
  267. the way that the frame got created in the first place that there aren't any
  268. user mode objects lying around. */
  269. [in] DWORD nullFlags /* Values drawn from the enumeration CALFRAME_NULL_FLAGS. If
  270. any bits are set herein, then once any freeing has been carried out, then
  271. out-values and-or in-out values which are pointers are to be set to NULL.
  272. If no bits are set, then this NULLing need not be carried out after the
  273. freeing, though it is legal for the implementation to NULL the freed
  274. pointers anyway.
  275. Note that it is legal to NULL the out values without first having freed
  276. them. This is commonly done on the client side in the situation where the
  277. server was not actually invoked so no unmarshalling of return values was
  278. attempted. */
  279. );
  280. enum CALLFRAME_FREE /* a bitfield enumeration: use one or more values in ::Free */
  281. {
  282. CALLFRAME_FREE_NONE = 0,
  283. CALLFRAME_FREE_IN = 1, /* If TRUE, then in-values are to be freed. This includes both the data referenced
  284. therefrom an any top level pointer (should there be one).
  285. If FALSE, in-values are to be left alone.
  286. In a marshalling situation, this is typically set to TRUE on the s erve r side after clialng the
  287. object in order to free the in-parameters that were allocated by the system during
  288. unmarshalling of the in-values */
  289. CALLFRAME_FREE_INOUT = 2, /* If TRUE, then the data referenced in in-out-values is to be freed. The top-level pointer,
  290. which is the actual parameter value, is not, however freed. But see also
  291. CALLFRAME_FREE_TOP_INOUT below.
  292. If FALSE, then in-out-values are not freed; existing contents thereof are ignored.
  293. On the server side, this is typically used post-call, as in CALLFRAME_FREE_IN. On the
  294. client side, this is used in the situation where the sever was not actually invoked (and so
  295. unmarshalling of return values was not attempted) and in the situation where there was a
  296. failure during unmarshalling of the return values. */
  297. CALLFRAME_FREE_OUT = 4, /* If TRUE, then data referenced in out-values is to be freed. The top-level pointer, which
  298. is the actual parameter value, is not, however, freed.
  299. If FALSE, then out-values are not freed; existing contents thereof are ignored.
  300. On the server side, this is, again, used post call as in CALLFRAME_FREE_IN. On the
  301. client side, this is typically only use in the even of a failure during unmarshalling of return
  302. values. */
  303. CALLFRAME_FREE_TOP_INOUT = 8, /* If TRUE, then for [in,out] parameters, the top level pointer, which is the actual
  304. parameter value, is to be freed. */
  305. CALLFRAME_FREE_TOP_OUT = 16, /* If TRUE, then for [out] parameters, the top level pointer, which is the actual parameter
  306. value, is to be freed. */
  307. CALLFRAME_FREE_ALL = 31, /* Combination of all freeing flags */
  308. };
  309. enum CALLFRAME_NULL /* a bitfield enumeration: use one or more values in ::Free */
  310. {
  311. CALLFRAME_NULL_NONE = 0, /* no values are to be NULLed */
  312. CALLFRAME_NULL_INOUT = 2, /* in-out values are to be NULLed */
  313. CALLFRAME_NULL_OUT = 4, /* out-values are to be NULLed */
  314. CALLFRAME_NULL_ALL = 6, /* combination of the above two flags */
  315. };
  316. HRESULT FreeParam/*
  317. Free just a particular parameter in this frame. This method provides a proper subset of the effect that can be carried out by
  318. ICallFrame::Free. Specifically, ICallFrame::Free provides out-valuepropagation behaviour,which this method does not, and
  319. ICallFrame::Free acts on all the parameters in the method, whereas this method only acts on a particular method.
  320. Return value Meaning
  321. S_OK All is well
  322. E_UNEXPECTED An unexpected error occurred. */
  323. (
  324. [in] ULONG iparam, /* the parameter number to be freed */
  325. [in] DWORD freeFlags, /* as in ICallFrame::Free */
  326. [in] ICallFrameWalker* pWalkerFree, /* as in ICallFrame::Free. */
  327. [in] DWORD nullFlags /* as in ICallFrame::Free. */
  328. );
  329. /*Walking */
  330. HRESULT WalkFrame /*
  331. Walk this call frame, looking for interface pointers transitively reachable from the arguments of the frame.
  332. Return value Meaning
  333. S_OK All is well
  334. E_UNEXPECTED An unexpected error occurred. */
  335. (
  336. [in] DWORD walkWhat, /* Values taken from CALLFRAME_WALK, indicating what combination of
  337. [in], [in,out], or [out] parameters are to be walked */
  338. [in] ICallFrameWalker* pWalker /* The call back through which we notify of interface pointers we have found.
  339. */
  340. );
  341. enum CALLFRAME_WALK /* a bitfield enumeration: use one or more values in ::WalkFrame */
  342. {
  343. CALLFRAME_WALK_IN = 1, /* in values are to be walked */
  344. CALLFRAME_WALK_INOUT = 2, /* in-out values are to be walked */
  345. CALLFRAME_WALK_OUT = 4, /* out-values are to be walked */
  346. };
  347. /*Marshalling */
  348. /* CALLFRAME_MARSHALCONTEXT
  349. A structure used to pass about information about the context in which marshalling is to be carried out. */
  350. typedef struct
  351. {
  352. BOOLEAN fIn; /* Whether we are to marshal the in-values or the out-values. In a
  353. marshalling situation, the in-values are marshalled on the client side,
  354. and the out-values are marshalled on the server side. */
  355. DWORD dwDestContext; /* � */
  356. LPVOID pvDestContext; /* � */
  357. IMarshallingManager* mshlmgr; /* Engine responsible for marshalling object interfaces */
  358. GUID guidTransferSyntax; /* The transfer syntax with which the marshalling should occur. */
  359. } CALLFRAME_MARSHALCONTEXT;
  360. HRESULT GetMarshalSizeMax /*
  361. Return a reasonable upper limit on the amount of buffer size that would be needed were::Marshalto be called. Typically, a
  362. marshalling engine (such as an interface proxy) calls ::GetMarshalSizeMaxto learn how big of a buffer is need, talks to some other
  363. party (such as the channel) to allocate the buffer, then calls ::Marshal toactually carry out the marshalling.
  364. Return value Meaning
  365. S_OK All is well
  366. E_UNEXPECTED An unexpected error occurred. */
  367. (
  368. [in] CALLFRAME_MARSHALCONTEXT* pmshlContext, /* Context information about how we'd go about marshalling */
  369. [in] MSHLFLAGS mshlflags, /* As in the IMarshal interface */
  370. [out] ULONG* pcbBufferNeeded /* Size of the buffer that will be needed */
  371. );
  372. HRESULT Marshal /*
  373. Ask call frame to turn itself and its transitively-reachable data into a flat buffer.
  374. The act of marshalling a call frame never disturbs the frame. When marshalling in-values, after a call to ::Marshal, whether successful
  375. or not, the in-versions of in-out values are still present, and out-only values are still undefined. When marshalling out-values, after a
  376. call to ::Marshal, whether successful or not, the out-parameters are still present and valid.
  377. If this function fails (returns an error), then it is a no-op (or may as well be assumed to be, as nothing further can be done by the caller
  378. to clean up). Resources such as memory transiently allocated during the attempted marshalling have been freed, and so on.
  379. The act of marshalling interfaces warrants special attention. Non-interface data which is marshalled is simply flattened in place into
  380. the output buffer in a standard way. Interface pointers are marshalled by asking the providedIMarshallingManager*to do the
  381. marshalling; should none be provided, CoMarshalInterface is used. Different marshalling behaviour, 'marshlialng' vs. 'persisting', can
  382. be achieved by using different IMarshallingManager* engines to carry out themarshalling operation. See the description of
  383. IMarshallingManager for further information.
  384. Return value Meaning
  385. S_OK All is well
  386. E_UNEXPECTED An unexpected error occurred. */
  387. (
  388. [in] CALLFRAME_MARSHALCONTEXT* pmshlContext, /* Context information about how we'd go about marshalling */
  389. [in] MSHLFLAGS mshlflags, /* As in the IMarshal interface */
  390. [in,size_is(cbBuffer)] PVOID pBuffer, /* Buffer into which we should put the marshalled data */
  391. [in] ULONG cbBuffer, /* The size of the buffer in bytes */
  392. [out] ULONG* pcbBufferUsed, /* Optional. Size of the buffer that was actually used */
  393. [out] RPCOLEDATAREP* pdataRep, /* Optional. If provided, then through here is returned the NDR
  394. data representation with which the data was marshalled. For
  395. Win32 machines, this is always 0X00000010L, which is 'little
  396. endian, ASCII characters, IEEE floats. See also IRpcChannel-
  397. Buffer::GetBuffer */
  398. [out] ULONG* prpcFlags /* Optional. If provided, then through here is returned RPC flags
  399. associated with the call. See also IRpcChannelBuffer::-
  400. GetBuffer */
  401. );
  402. HRESULT Unmarshal /*
  403. Unmarshal a packet of data containing the previously marshalled out-vuales of a call into this already-extiisng activation record.
  404. As a side effect of the unmarshalling, the in-versions of any in-out values are freed (interface pointers are released) in order that they
  405. may be replaced with their out-versions.
  406. On exit, all the in-out-values and out-values will always be set to reasonable values, either (a) an in-version of an in-out-value, (b) an
  407. out-value successfully unmarshalled from the returned data, or (c) a value explicitly initialized to NULL. On failure return, the caller
  408. will typically want to call ::Free in order to clean up those values which are not in fact NULL.
  409. Return value Meaning
  410. S_OK All is well
  411. E_UNEXPECTED An unexpected error occurred. */
  412. (
  413. [in,size_is(cbBuffer)] PVOID pBuffer, /* Buffer containing the marshalled out-values */
  414. [in] ULONG cbBuffer, /* The size of the buffer in bytes */
  415. [in] RPCOLEDATAREP dataRep, /* The data representation with which the data was marshalled
  416. */
  417. [in] CALLFRAME_MARSHALCONTEXT* pcontext, /* Manager etc responsible for unmarshalling interface
  418. references */
  419. [out] ULONG* pcbUnmarshalled /* Optional. Is the number of bytes that were successfully
  420. unmarshalled. This parameter is returned even in error
  421. situations */
  422. );
  423. HRESULT ReleaseMarshalData /*
  424. Release resources that may be being held by interface pointers residing in a packet of marshalled data. This method finds all interface
  425. pointers in the packet, and, in effect, calls CoReleaseMarshalData on each one.
  426. Logically speaking, ReleaseMarshalData must alwaysbe ultimately called exactly once to clean up the resources held in the
  427. marshalled buffer, though typically (in the MRSHLFLAGS_NORMALcase) this is done as a side effect of the act of unmarshalling and
  428. so need not be carried out explicitly.
  429. This method can function correctly on both marshalled in-parameters and marshalled out-parameters.
  430. Return value Meaning
  431. S_OK All is well
  432. E_UNEXPECTED An unexpected error occurred. */
  433. (
  434. [in,size_is(cbBuffer)] PVOID pBuffer, /* Buffer containing the marshalled out-values */
  435. [in] ULONG cbBuffer, /* The size of the buffer in bytes */
  436. [in] ULONG ibFirstRelease, /* The first byte in the buffer which is to actually be released; a
  437. value of zero implies interface pointers in the whole buffer are to
  438. be released. The idea is that marshalled interface pointers prior
  439. to the indicated byte are assumed to have already been released
  440. by some other mechanism */
  441. [in] RPCOLEDATAREP dataRep, /* The data representation with which the data was marshalled
  442. */
  443. [in] CALLFRAME_MARSHALCONTEXT* pcontext /* Manager etc responsible for unmarshalling interface
  444. references */
  445. );
  446. /* Invocation */
  447. HRESULT Invoke /*
  448. Apply this activation record to an object. In a marshalling situation, typically this is carried out on the server side, and is the means by
  449. which the work of the actual object is accomplished.
  450. Generally speaking, carrying out the invocation involves allocating a new stack frame, shallow-copying down the data in the original
  451. frame, then calling the appropriate method in the indicated object. The object invoked may then chose to modify out-parameters
  452. which are reachable from the copied frame, according to the appropriate semantics of the invocation. When the invocation returns
  453. from the object, the call frame automatically captures the return value � la ICallFrame::SetReturnValue.
  454. Return value Meaning
  455. S_OK All is well
  456. CALLFRAME_E_ALREADYINVOKED An invocation has already been made from this frame.
  457. E_UNEXPECTED An unexpected error occurred. */
  458. (
  459. [in] void* pvReceiver, /* The interface on which the invocation is to occur. Caller is responsible for ensuring that
  460. this interface is in fact of the appropriate IID; the ::Invoke implementation will simply do a
  461. cast and assume that that is the case. */
  462. ... /* This is a VARARGS function. Additional parameters, if any, are used to fill unbound
  463. values in the activation record other than the receiver, if any should be present. At present,
  464. no known methods require this. */
  465. );
  466. };
  467. /* ICallIndirect
  468. ICallIndirect is an interface by which an invocation can be caused to be carried out on an object with an i ndirec t reference to the
  469. invocation's arguments, rather than the traditional direct call. A given instance of ICallIndirect supports indirect invocations for
  470. just one IID.
  471. The actual detailed semantics of how to carry out an indirect call are independent of the ICallIndirect interface itself; they are
  472. instead specific to the implementation of the interface. For example, implementations of ICallIndirect found in call interceptors
  473. (see below) carry out the call by constructing and appropriate IaCllFrame instance and then invoking IClalFrameEvents::OnCall in
  474. the registered sink. Other implementations might do some appropriate munging of the invocation's arguments, then forward
  475. thecallon tosomeactualspecificobject,presumablyonepreviously registeredwith theICallIndirectusingsome
  476. implementation-specific means.
  477. */
  478. [uuid(D573B4B1-894E-11d2-B8B6-00C04FB9618A), object, pointer_default(unique), local]
  479. interface ICallIndirect : IUnknown
  480. {
  481. HRESULT CallIndirect /*
  482. Invoke one of the methods in the interface that this interceptor intercepts, but with an indirect reference to the arguments of the
  483. invocation.
  484. Return value Meaning
  485. S_OK All is well
  486. E_UNEXPECTED An unexpected error occurred. */
  487. (
  488. [out] HRESULT* phrReturn, /* the value returned from the invocation of the method */
  489. [in] ULONG iMethod, /* the method number which should be invoked */
  490. [in] void* pvArgs, /* pointer to the stack frame with which to make the invocation. Details of the exact
  491. representation of this stack frame are processor-architecture specific */
  492. [out] ULONG* cbArgs /* on exit, the number of bytes which should be popped from the stack in order to clear the
  493. stack of the arguments to this invocation */
  494. );
  495. HRESULT GetMethodInfo /*
  496. Return miscellaneous information about the a method in this interface. The information returned is a static analysis of the method, not
  497. a dynamic one, in that it is based on an analysis of the method signature only, not the actual current contents of the call frame. For
  498. example, the static analysis might indicate that this method has the potential of having an in-interface, but because of, say, a union
  499. switch, a given call might not actually have any such interfaces.
  500. This method is equivalent to the GetInfo and GetNames methods in ICallFrame, but avoids the need to actually make any invocation to
  501. get the information.
  502. Return value Meaning
  503. S_OK All is well
  504. E_UNEXPECTED An unexpected error occurred. */
  505. (
  506. [in] ULONG iMethod, /* the method number which should be considered */
  507. [out] CALLFRAMEINFO* pInfo, /* place at which interesting information about said method is returned */
  508. [out] LPWSTR* pwszMethod /* OPTIONAL: the place to return the method name, if available */
  509. );
  510. HRESULT GetStackSize /*
  511. Return the number of bytes which should be popped from the stack in order to return from an invocation of the indicated method.
  512. This is equivalent to the value returned via the cbArgs parameter to CallIndirect, but avoids the need to actually make any invocation
  513. to get the information.
  514. Return value Meaning
  515. S_OK All is well
  516. E_UNEXPECTED An unexpected error occurred. */
  517. (
  518. [in] ULONG iMethod, /* the method number which should be considered */
  519. [out] ULONG* cbArgs /* on exit, the number of bytes which should be popped from the stack in order to clear the stack
  520. of the arguments to an invocation of this method number */
  521. );
  522. HRESULT GetIID /*
  523. Return the (most derived) interface id supported by this ICallIndirect implementation.
  524. Return value Meaning
  525. S_OK All is well
  526. E_UNEXPECTED An unexpected error occurred. */
  527. (
  528. [out] IID* piid, /* Optional: the interface in question */
  529. [out] BOOL* pfDerivesFromIDispatch, /* Optional: whether said interface ultimately derives frrom IDispatch */
  530. [out] ULONG* pcMethod, /* Optional: the number of methods in that interface */
  531. [out] LPWSTR* pwszInterface /* OPTIONAL: the place to return the interface name, if available */
  532. );
  533. };
  534. /* ICallInterceptor
  535. ICallInterceptor thecentral interfacesupportedby interface interceptors.This interfacesupports theregistrationand
  536. unregistration of sinks wishing to be notified of calls made directly on the interface in the normal way. In addition, this
  537. interface provides ameans bywhich an invocation can be caused to be carried outwith an indirect reference to the
  538. invocation's arguments.
  539. All implementations of ICallInterceptor also implement the interface that they intercept.
  540. Notice that the ICallInterceptor interface derives from ICallIndirect.
  541. */
  542. [uuid(60C7CA75-896D-11d2-B8B6-00C04FB9618A), object, pointer_default(unique), local]
  543. interface ICallInterceptor : ICallIndirect
  544. {
  545. HRESULT RegisterSink /*
  546. Register a sink for receiving notifications of method calls. Only a single sink may be registered with an interceptor at any given time.
  547. Registering a sink of NULL is legal, and causes the interceptor to release any previously registered sink that it might be holding on to.
  548. Return value Meaning
  549. S_OK All is well
  550. E_UNEXPECTED An unexpected error occurred. */
  551. (
  552. [in] ICallFrameEvents* psink
  553. );
  554. HRESULT GetRegisteredSink /*
  555. Return the presently registered event sink, if any.
  556. Return value Meaning
  557. S_OK All is well; the registered sink, if any, is returned.
  558. CO_E_OBJNOTREG There is no sink presently registered with this interceptor.
  559. E_UNEXPECTED An unexpected error occurred. */
  560. (
  561. [out] ICallFrameEvents** ppsink
  562. );
  563. };
  564. /* ICallFrameEvents
  565. ICallFrameEvents is the interface on which method call notifications are delivered.
  566. */
  567. [uuid(FD5E0843-FC91-11d0-97D7-00C04FB9618A), object, pointer_default(unique), local]
  568. interface ICallFrameEvents : IUnknown
  569. {
  570. HRESULT OnCall /*
  571. Informs the sink of the receipt of a method call on the interceptor. The sink is provided with an ICallFrame instance which is bound to
  572. the intercepted incoming method invocation. Through that sink the call frame can be manipulated in various ways.
  573. On return from OnCall, the interceptor assumes that by some means the out-values of the method have been appropriately initialized
  574. as needed, if any; the interceptor does not itself manipulate the call frame further in any way. Typically, the OnCall implementation
  575. will have set the out-values by somemeans, either by invoking the call frame on an object, successfully unmarshalling some
  576. previously marshaled out-values, or NULLing them with ICallFrame::Free.
  577. The return value should also have been appropriately set during the call in a similar manner. See also ICallFrame::SetReturnValue.
  578. Return value Meaning
  579. S_OK All is well
  580. E_UNEXPECTED An unexpected error occurred. */
  581. (
  582. [in] ICallFrame* pFrame /* A call frame bound to the just-received invocation */
  583. );
  584. };
  585. /*ICallUnmarshal
  586. ICallUnmarshal is typically used on the server (receiving) side of a remote invocation. An appropriate instance of ICallUnmarshal
  587. can be used to transform back into an call frame a method invocation previously marshalled by a call to IClalFrame::Marshal on
  588. the client (sending) side. Once such a reconstituted call frame is obtained, the call can be (e.g.) carried out on an actual object
  589. using ICallFrame::Invoke.
  590. ICallUnmarshal is typically implemented by the interceptor for a given interface.
  591. */
  592. [uuid(5333B003-2E42-11d2-B89D-00C04FB9618A), object, pointer_default(unique), local]
  593. interface ICallUnmarshal : IUnknown
  594. {
  595. HRESULT Unmarshal /*
  596. Turn a marshalled packet of data back into an activation record in preparation to being able to actually carry out an invocation or
  597. other manipulation of the activation record. It must always be the case that the packet of data passed here toICallUnmar-
  598. shal::Unmarshal contains the in-values of a call; see also ICallFrame::Unmarshal which deals with out-values.
  599. Return value Meaning
  600. S_OK All is well
  601. E_UNEXPECTED An unexpected error occurred. */
  602. (
  603. [in] ULONG iMethod, /* The method number which is to be unmarshalled. A value of 0xFFFFFFFF
  604. indicates that the caller instead expects the method number to be determined
  605. from the data to be unmarshalled. Which of these two is appropriate depends
  606. on the protocol used to transfer the marshalling packet from client to server. */
  607. [in,size_is(cbBuffer)]
  608. PVOID pBuffer, /* Buffer from which the activation record is to be reconstituted */
  609. [in] ULONG cbBuffer, /* Size of the buffer in bytes */
  610. [in] BOOL fForceBufferCopy, /* If true, then during the unmarshal process the engine will copy and retain
  611. the passed-in buffer so long as it needs it. If false, however, then caller
  612. promises that the buffer passed in will remain valid for at least as long as the
  613. ICallFrame returned herefrom is still alive */
  614. [in] RPCOLEDATAREP dataRep, /* The data representation with which the data was marshalled */
  615. [in] CALLFRAME_MARSHALCONTEXT *
  616. pcontext, /* Manager etc responsible for unmarshalling interface references */
  617. [out] ULONG* pcbUnmarshalled, /* Optional. Is the number of bytes that were successfully unmarshalled. This
  618. parameter is returned even in error situations. */
  619. [out] ICallFrame** ppFrame /* A call frame bound to the just-unmarshalled invocation */
  620. );
  621. HRESULT ReleaseMarshalData /*
  622. Release resources that may be being held by interface pointers residing in a packet of marshalled data. This method finds all interface
  623. pointers in the packet, and, in effect, calls CoReleaseMarshalData on each one.
  624. Logically speaking, ReleaseMarshalData must alwaysbe ultimately called exactly once to clean up the resources held in the
  625. marshalled buffer, though typically (in the MRSHLFLAGS_NORMALcase) this is done as a side effect of the act of unmarshalling and
  626. so need not be carried out explicitly.
  627. This method can function correctly on both marshalled in-parameters and marshalled out-parameters.
  628. Return value Meaning
  629. S_OK All is well
  630. E_UNEXPECTED An unexpected error occurred. */
  631. (
  632. [in] ULONG iMethod, /* the method number whose data is to be released */
  633. [in,size_is(cbBuffer)] PVOID pBuffer, /* Buffer containing the marshalled out-values */
  634. [in] ULONG cbBuffer, /* The size of the buffer in bytes */
  635. [in] ULONG ibFirstRelease, /* The first byte in the buffer which is to actually be released; a
  636. value of zero implies interface pointers in the whole buffer are to
  637. be released. The idea is that marshalled interface pointers prior
  638. to the indicated byte are assumed to have already been released
  639. by some other mechanism */
  640. [in] RPCOLEDATAREP dataRep, /* The data representation with which the data was marshalled
  641. */
  642. [in] CALLFRAME_MARSHALCONTEXT* pcontext /* Manager etc responsible for unmarshalling interface
  643. references */
  644. );
  645. };
  646. /* ICallFrameWalker
  647. ICallFrameWalker is the callback interface used to walk a stack frame, looking for interesting values. See ICallFrame::WalkFrame.
  648. */
  649. [uuid(08B23919-392D-11d2-B8A4-00C04FB9618A), object, pointer_default(unique), local]
  650. interface ICallFrameWalker : IUnknown
  651. {
  652. HRESULT OnWalkInterface /*
  653. The walker has discovered an interface in the call frame. We are informed of its IID and its location; we can manipulate the interface,
  654. and we may replace it if desired, being careful to get the reference counting right.
  655. Return value Meaning
  656. S_OK All is well
  657. E_UNEXPECTED An unexpected error occurred. */
  658. (
  659. [in] REFIID iid, /* the IID of the interface that has been found */
  660. [in] PVOID* ppvInterface, /* Buffer from which the activation record is to be reconstituted */
  661. [in] BOOL fIn, /* is this an interface inside an in- or in-out-parameter? */
  662. [in] BOOL fOut /* is this an interface inside an out- or in-out-parameter? */
  663. );
  664. };
  665. /* IMarshalSomeone
  666. IMarshalSomeone is an interface by which a client can request that some implicitly-specified object be marshalled.
  667. The functionality in the interface is similar to that of IMarshal. However, the data returned by IMarshalSomone::Marshal is a full
  668. OBJREF, just as would be returned by CoMarshalInterface. This contrasts with IMarshal, wherein IMarshal::Marshal returns just
  669. the custom-marshalling-data part of an object reference.
  670. */
  671. [uuid(174F4929-53EC-11d2-B8AC-00C04FB9618A), object, pointer_default(unique), local]
  672. interface IMarshalSomeone : IUnknown
  673. {
  674. HRESULT GetMarshalSizeMax /*
  675. Similar to IMarshal::GetMarshalSizeMax.
  676. Return value Meaning
  677. S_OK All is well
  678. E_UNEXPECTED An unexpected error occurred. */
  679. (
  680. [in] REFIID iid,
  681. [in] void* pv,
  682. [in] DWORD dwDestContext,
  683. [in,unique] void* pvDestContext,
  684. [in] DWORD mshlflags,
  685. [out] DWORD* pSize
  686. );
  687. HRESULT MarshalInterface /*
  688. Similar to IMarshal::MarshalInterface.
  689. Return value Meaning
  690. S_OK All is well
  691. E_UNEXPECTED An unexpected error occurred. */
  692. (
  693. [in,unique] IStream* pstm,
  694. [in] REFIID iid,
  695. [in] void* pv,
  696. [in] DWORD dwDestContext,
  697. [in,unique] void* pvDestContext,
  698. [in] DWORD mshlflags
  699. );
  700. HRESULT UnmarshalInterface /*
  701. Similar to IMarshal::UnmarshalInterface.
  702. Return value Meaning
  703. S_OK All is well
  704. E_UNEXPECTED An unexpected error occurred. */
  705. (
  706. [in,unique] IStream* pstm,
  707. [in] REFIID iid,
  708. [out] void** ppv
  709. );
  710. HRESULT ReleaseMarshalData /*
  711. Similar to IMarshal::ReleaseMarshalData.
  712. Return value Meaning
  713. S_OK All is well
  714. E_UNEXPECTED An unexpected error occurred. */
  715. (
  716. [in,unique] IStream* pstm
  717. );
  718. };
  719. /* IMarshallingManager
  720. IMarshallingManager instances are used as themechanismbywhich call frames actually carry out themarshalling and
  721. unmarshalling of an interface pointer.
  722. */
  723. [uuid(F6EBEB2B-C8DE-11d1-B88E-00C04FB9618A), object, pointer_default(unique), local]
  724. interface IMarshallingManager : IUnknown
  725. {
  726. HRESULT GetMarshallerFor /*
  727. Return an IMarshal instance that can then be used to marshal the indicated interface on this object. Typically, the marshaller returned
  728. is implemented by the marshalling manager itself. Internally, it usually refers to either the object's IMarshal implementation, if it
  729. custom marshals itself, or a marshalling-manager-provided 'standard' IMarshal implementation.
  730. Return value Meaning
  731. S_OK All is well
  732. E_UNEXPECTED An unexpected error occurred. */
  733. (
  734. [in] REFIID iidToMarshal, /* the IID of the interface to be marshalled */
  735. [in] PVOID pvInterface, /* the interface iid on the object which is to be marshalled */
  736. [out] IMarshalSomeone** ppMarshal /* a marshaller appropriate for this object */
  737. );
  738. HRESULT GetStandardMarshallerFor /*
  739. Similar to GetMarshallerFor, but is guaranteed to never reference the object's IMarshal implementation, but rather always use the
  740. marshalling-manager-provided 'standard' IMarshal implementation. In this respect, this method is similar to the CoGetStnadadrMar-
  741. shal API.
  742. Return value Meaning
  743. S_OK All is well
  744. E_UNEXPECTED An unexpected error occurred. */
  745. (
  746. [in] REFIID iidToMarshal, /* the IID of the interface to be marshalled */
  747. [in] PVOID pvInterface, /* the interface iid on the object which is to be marshalled */
  748. [in] LPUNKNOWN punkOuter, /* controlling unknown for the marshaller */
  749. [in] REFIID iid, /* iid sought on the returned marshaller */
  750. [out] void** ppv /* place at which marshaller is to be returned */
  751. );
  752. HRESULT GetUnmarshaller /*
  753. Return an IMarshal instance whose UnmarshalInterface can be used to unmarshal an interface pointer that was marshalled previously
  754. with a the IMarshal returned from a call to GetMarshallerFor or GetStandardMarshallerFor.
  755. Return value Meaning
  756. S_OK All is well
  757. E_UNEXPECTED An unexpected error occurred. */
  758. (
  759. [in] REFIID iidHint, /* The iid for which unmarshalling is required. May legally be
  760. IID_NULL, in which case the iid in question must be determined from the
  761. later unmarshalled data; this is common. */
  762. [out] IMarshalSomeone** ppMarshal /* place at which the unmarshaller is to be returned */
  763. );
  764. };
  765. /* IInterfaceRelated
  766. This interface is used to provide an IID parameter required in some initialization contexts.
  767. */
  768. [uuid(D1FB5A79-7706-11d1-ADBA-00C04FC2ADC0), object, pointer_default(unique), local]
  769. interface IInterfaceRelated : IUnknown
  770. {
  771. HRESULT SetIID /*
  772. Set the required IID parameter.
  773. Return value Meaning
  774. S_OK All is well
  775. E_UNEXPECTED An unexpected error occurred. */
  776. (
  777. [in] REFIID iid
  778. );
  779. HRESULT GetIID /*
  780. Return the underlying IID.
  781. Return value Meaning
  782. S_OK All is well
  783. E_UNEXPECTED An unexpected error occurred. */
  784. (
  785. [out] IID* piid
  786. );
  787. };
  788. /* Error Codes
  789. We define some new error codes intended for use with the interfaces defined here.
  790. */
  791. cpp_quote("#define CALLFRAME_E_ALREADYINVOKED _HRESULT_TYPEDEF_( 0x8004d090 )") /* An invocation has already been made on this call frame
  792. */
  793. cpp_quote("#define CALLFRAME_E_COULDNTMAKECALL _HRESULT_TYPEDEF_( 0x8004d091 )") /*A requested invocation could not be carried out */
  794. /* APIs
  795. This architecture also defines some new top-level APIs.
  796. */
  797. [uuid(15B51D8B-9BF6-11d1-B888-00C04FB9618A), local] interface ICallFrameAPIs {
  798. HRESULT __stdcall CoGetInterceptor /*
  799. Instantiate the appropriate interceptor for the indicated interface which is to be intercepted and return the newly created interceptor.
  800. Return value Meaning
  801. S_OK All is well
  802. E_UNEXPECTED An unexpected error occurred. */
  803. (
  804. [in] REFIID iidIntercepted, /* the interface for which an interceptor is sought */
  805. [in] IUnknown* punkOuter, /* controlling unknown, if any, with which the interceptor is to be
  806. aggregated */
  807. [in] REFIID iid, /* the IID desired on the interceptor */
  808. [out] void** ppv /* place at which the interceptor is returned */
  809. );
  810. HRESULT __stdcall CoGetInterceptorFromTypeInfo /*
  811. Instantiate the appropriate interceptor for the indicated interface which is to be intercepted and return the newly created interceptor.
  812. The meta data for this interface is to be extracted from the provided typeinfo.
  813. Return value Meaning
  814. S_OK All is well
  815. E_UNEXPECTED An unexpected error occurred. */
  816. (
  817. [in] REFIID iidIntercepted, /* the interface for which an interceptor is sought */
  818. [in] IUnknown* punkOuter, /* controlling unknown, if any, with which the interceptor is to be
  819. aggregated */
  820. [in] ITypeInfo* typeInfo, /* an ITypeInfo describing iidIntercepted */
  821. [in] REFIID iid, /* the IID desired on the interceptor */
  822. [out] void** ppv /* place at which the interceptor is returned */
  823. );
  824. HRESULT __stdcall CoGetInterceptorForOle32 /*
  825. Instantiate the appropriate interceptor for the indicated interface which is to be intercepted and return the newly created interceptor.
  826. Return value Meaning
  827. S_OK All is well
  828. E_UNEXPECTED An unexpected error occurred. */
  829. (
  830. [in] REFIID iidIntercepted, /* the interface for which an interceptor is sought */
  831. [in] IUnknown* punkOuter, /* controlling unknown, if any, with which the interceptor is to be
  832. aggregated */
  833. [in] REFIID iid, /* the IID desired on the interceptor */
  834. [out] void** ppv /* place at which the interceptor is returned */
  835. );
  836. };
  837. #if 0
  838. RevisionHistory
  839. 1997-07-15 First draft for limited review.
  840. 1997-11-10 Added ICallIndirect; rearrange ICallInterceptor. Add pvDatumAux to ICallFrameWalker::OnWalkData.
  841. 1997-11-25 Significant minor edits and clarifications. Changed the way that return values are returned via a call frame.
  842. Reordered the presentation of some of the interfaces. Made compilable.
  843. 1997-12-17 Tweaked ICallFrame::Copy. Changed policy of management of class ids.
  844. 1998-01-07 Added ICallIndirect::GetStackSize. Added ICallFrame::GetIIDAndMethod.
  845. 1998-01-15 Clarified user vs. kernel mode call frames; tweaked ICallFrame::Copyaccordingly. Added ICallFrame::Get-
  846. StackLocation.Modified ICallFrame::Free to aid in copying out values back to parent call frames. Changed
  847. SetReturnValue to work only for HRESULTs. Added some error code returns. Added HRESULT out-parameter
  848. to ICallFarme::Invoke.
  849. 1998-01-21 Removed the funky lifetime management stuff from ICallFrame::Copy. Now it just returns you the new call
  850. frame, period. Added explicit share-if-you can parameter.
  851. 1998-01-24 Removed the phReturnValue parameter to ICallFrame::Invoke. Instead, invoke will set the return value in the
  852. call frame, retrievablewithGetReturnValue.ChangedICallFrame::Free's parent frameparameter tobe
  853. ICallFrame* instead of void*.
  854. 1998-01-27 Separated the 'walker' variables to ICallFrame::Free.
  855. 1998-01-30 Removed ICallFrame::Unmarshal. Moved ReleaseMarshalData from ICallFrame to ICallUnmarshal.
  856. 1998-02-03 Added top-level APIs. Renamed IObjectMarshaller to IMarshallingManager; enhanced same interface. Restored
  857. and fixed ICallFrame::Unmarshal.
  858. 1998-02-05 Added ibFirstRelease parameter to ReleaseMarshalData. Changed ICaFllrame::Freeto allow separate NULLing
  859. of out vs. in-out parameters. Added ReleaseMarshalData to ICallFrame.
  860. 1998-02-19 Fix CoGetInterceptor's parameters.
  861. 1998-03-27 Extend IMarshallingManager.
  862. 1998-08-04 Add comments as to when walkers are called duringICallFrame::Free. Added ICallFrame::SetStackLocation.
  863. Allowed retention of frames beyond the ICallFrameEvents::OnCallnotification. Added buffer management
  864. control to ICallUnmarshal::Unmarshal.
  865. 1998-08-14 Separated freeing of data referenced by out-parameters from the freeing of the actual out pointer parameter
  866. itself.
  867. 1998-08-26 Added third walker in Free case to free the in-out's in the parent frame. Changed OnWalkInterface to inform
  868. as to directionality of interface in question. Removed OnWalkData method. Allowed more careful control in
  869. ICallFrame::WalkFrame as to whether in-out vs. just plain in or just plain out interfaces are walked. Add in-out
  870. information toCALLFRAMEINFO.Rearrangedmethodorder inICallFrame. AddedcParamsmember to
  871. CALLFRAMEINFO; distinguished in-out information therein; renamed othermembers for clarity.Added
  872. ICallFrame::GetParamInfomethod.AddedICallFrame::FreeParammethod.AddedICallFrame::SetParamand
  873. ICallFrame::GetParam methods.
  874. 1998-09-15 SimplifyGetStackLocation,SetReturnValue,andGetReturnValuebasedonperformancemeasurements.
  875. Enhanced CALLFRAMEINFO with cInInterfacesMax etc. Added ICallIndirect::GetInfo.
  876. 1998-10-1 Removeconfusingre-useofIMarshalinterface.DefineIMarshalSomeoneinstead.Enhance
  877. CALLFRAME_MARSHALCONTEXT to include requested transfer syntax.
  878. 1998-11-13 Added interfaceandmethodnameretrievalmethods.ChangedIIDsofICallFrame,IllICandirect,and
  879. ICallInterceptor.
  880. 1998-12-01 Added mechanism to indicate whether interface derives from IDispatch.
  881. 1999-02-05 Call CoGetInterceptorFromTypeInfo.
  882. Index
  883. ReleaseMarshalData...3 RegisterSink......8
  884. Free..........4 GetRegisteredSink....8
  885. C
  886. SetReturnValue.....5 ICallUnmarshal..........9
  887. CALLFRAME_COPY........6
  888. GetReturnValue.....5 Unmarshal.......9
  889. CALLFRAME_FREE........5
  890. Invoke.........5 ReleaseMarshalData...9
  891. CALLFRAME_MARSHALCONTEXT.2
  892. Copy.........6 IInterfaceRelated.........10
  893. CALLFRAME_NULL........5
  894. WalkFrame.......6 SetIID........10
  895. CoGetInterceptor.........11
  896. ICallFrameEvents.........8 GetIID........10
  897. OnCall.........8 IMarshallingManager.......10
  898. ICallFrameWalker.........9 GetMarshallerFor...10
  899. I
  900. OnWalkInterface.....9 interceptor............1
  901. ICallFrame............1
  902. OnWalkData.....10
  903. GetInfo........2
  904. ICallIndirect
  905. GetIIDAndMethod....2
  906. U
  907. CallIndirect.......7
  908. GetStackLocation....2
  909. user mode...........1, 6
  910. GetStackSize......7
  911. GetMarshalSizeMax...2
  912. GetIID.........7
  913. Marshal........3
  914. ICallInterceptor..........8
  915. Unmarshal.......3
  916. #endif