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.

431 lines
14 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1998.
  5. //
  6. // File:
  7. // activate.idl
  8. //
  9. // Contents:
  10. // Definition of (currently) private COM system activation interfaces.
  11. //
  12. // History:
  13. // VinayKr 01-16-98 Created
  14. // SatishT 01-23-98 Added property interfaces
  15. // SatishT 02-03-98 Separated
  16. // JimLyon 02-18-98 Reworked and joined
  17. //
  18. //--------------------------------------------------------------------------
  19. #ifndef DO_NO_IMPORTS
  20. import "obase.idl";
  21. import "wtypes.idl";
  22. import "objidl.idl";
  23. import "contxt.idl";
  24. #endif
  25. //--------------------------------------------------------------------------
  26. // A custom activator supports:
  27. // ISystemActivator
  28. //
  29. // The activation properties object passed to an activator supports:
  30. // IInitActivationPropertiesIn
  31. // IActivationPropertiesIn
  32. // IServerLocationInfo
  33. // IActivationContextInfo
  34. // IActivationSecurityInfo
  35. // IActivationAgentInfo
  36. // IActivationStageInfo
  37. // IOpaqueDataInfo
  38. //
  39. // The activation properties object returned by an activator supports:
  40. // IActivationPropertiesOut
  41. // IOpaqueDataInfo
  42. //--------------------------------------------------------------------------
  43. //--------------------------------------------------------------------------
  44. //
  45. // Memory Management notes:
  46. //
  47. // 1. Whenever any of the methods defined here return interface pointers,
  48. // they return counted references. The caller must eventually call Release ().
  49. //
  50. // 2. Whenever any of the methods defined here have [out] parameters whose
  51. // type is something**, the method will set the caller's pointer to point to
  52. // data owned by the called object. The caller MUST NOT alter or free this data.
  53. // For example, IActivationPropertiesIn::GetActivationID returns a pointer to
  54. // a GUID. The actual GUID is in memory owned by the ActivationPropertiesIn
  55. // object; the caller must not alter the GUID or free the memory it occupies.
  56. //
  57. // 3. Whenever any of these methods accept pointers to data structures from
  58. // their caller, they perform a deap copy of the data. The activation properties
  59. // objects NEVER retain pointers to data structures owned by their callers.
  60. //
  61. //--------------------------------------------------------------------------
  62. // forward references:
  63. interface IActivationPropertiesIn;
  64. interface IActivationPropertiesOut;
  65. [
  66. object,
  67. uuid(000001A0-0000-0000-C000-000000000046),
  68. pointer_default(unique)
  69. ]
  70. interface ISystemActivator : IUnknown
  71. {
  72. HRESULT GetClassObject(
  73. [in,unique] IActivationPropertiesIn *pActProperties,
  74. [out] IActivationPropertiesOut **ppActProperties
  75. );
  76. HRESULT CreateInstance(
  77. [in,unique] IUnknown *pUnkOuter,
  78. [in,unique] IActivationPropertiesIn *pActProperties,
  79. [out] IActivationPropertiesOut **ppActProperties
  80. );
  81. }
  82. // These flags are used to indicate special activation requirements.
  83. typedef enum tagACTIVATION_FLAGS {
  84. ACTVFLAGS_NONE = 0,
  85. ACTVFLAGS_WX86_CALLER = 1,
  86. ACTVFLAGS_DISABLE_AAA = 2
  87. } ACTIVATION_FLAGS;
  88. [
  89. object,
  90. local,
  91. uuid(000001A1-0000-0000-C000-000000000046),
  92. pointer_default(unique)
  93. ]
  94. interface IInitActivationPropertiesIn : IUnknown
  95. {
  96. // These methods are legal only if IActivationPropertiesIn::Delegate...
  97. // has never been called.
  98. HRESULT SetClsctx ([in] DWORD clsctx);
  99. HRESULT SetActivationFlags([in] DWORD actvflags);
  100. HRESULT SetClassInfo ([in,unique] IUnknown* pUnkClassInfo);
  101. HRESULT SetContextInfo ([in,unique] IContext* pClientContext,
  102. [in] IContext* pPrototypeContext);
  103. HRESULT SetConstructFromStorage ([in,unique] IStorage* pStorage);
  104. HRESULT SetConstructFromFile ([in] WCHAR* wszFileName, [in] DWORD dwMode);
  105. }
  106. [
  107. object,
  108. local,
  109. uuid(000001A2-0000-0000-C000-000000000046),
  110. pointer_default(unique)
  111. ]
  112. interface IActivationPropertiesIn : IUnknown
  113. {
  114. HRESULT GetActivationID([out] GUID *pActivationID);
  115. HRESULT GetClassInfo([in] REFIID riid, [out,iid_is(riid)] void** ppv);
  116. HRESULT GetClsctx([out] DWORD *pclsctx);
  117. HRESULT GetActivationFlags([out] DWORD *pactvflags);
  118. HRESULT AddRequestedIIDs([in] DWORD cIfs,
  119. [in, size_is(cIfs)] IID *rgIID);
  120. HRESULT GetRequestedIIDs ([out] ULONG* pulCount, [out] IID** prgIID);
  121. // The following three methods are for activators who delegate onward.
  122. HRESULT DelegateGetClassObject([out] IActivationPropertiesOut **pActPropsOut);
  123. HRESULT DelegateCreateInstance([in] IUnknown *pUnkOuter,
  124. [out] IActivationPropertiesOut **pActPropsOut);
  125. // Following can only be used in Server Context Stage
  126. // and returns ClassFactory used in the Create Instance
  127. HRESULT DelegateCIAndGetCF([in] IUnknown *pUnkOuter,
  128. [out] IActivationPropertiesOut **pActPropsOut,
  129. [out] IClassFactory **ppCf);
  130. // The following method is for activators who do NOT delegate onward.
  131. HRESULT GetReturnActivationProperties([in] IUnknown *pUnk,
  132. [out] IActivationPropertiesOut **ppActOut);
  133. }
  134. [
  135. object,
  136. local,
  137. uuid(000001A3-0000-0000-C000-000000000046),
  138. pointer_default(unique)
  139. ]
  140. interface IActivationPropertiesOut : IUnknown
  141. {
  142. HRESULT GetActivationID([out] GUID *pActivationID);
  143. HRESULT GetObjectInterface([in] REFIID riid,
  144. [in] DWORD actvflags,
  145. [out, iid_is(riid)] void **ppv);
  146. HRESULT GetObjectInterfaces([in] DWORD cIfs,
  147. [in] DWORD actvflags,
  148. [in, size_is(cIfs)] MULTI_QI *multiQi);
  149. HRESULT RemoveRequestedIIDs([in] DWORD cIfs,
  150. [in, size_is(cIfs)] IID *rgIID);
  151. }
  152. // Enumeration of activation stage constants
  153. typedef enum tagACTIVATION_STAGE {
  154. CLIENT_CONTEXT_STAGE = 1,
  155. CLIENT_MACHINE_STAGE = 2,
  156. SERVER_MACHINE_STAGE = 3,
  157. SERVER_PROCESS_STAGE = 4,
  158. SERVER_CONTEXT_STAGE = 5
  159. } ACTIVATION_STAGE;
  160. [
  161. local,
  162. object,
  163. uuid (000001A8-0000-0000-C000-000000000046),
  164. pointer_default (unique)
  165. ]
  166. interface IActivationStageInfo : IUnknown
  167. {
  168. HRESULT SetStageAndIndex ([in] ACTIVATION_STAGE stage, [in] int index);
  169. HRESULT GetStage ([out] ACTIVATION_STAGE* pstage);
  170. HRESULT GetIndex ([out] int* pindex);
  171. }
  172. //
  173. // Flags for the dwPRT parameter of Set/GetProcess
  174. //
  175. typedef enum _PRT
  176. {
  177. PRT_IGNORE = 0,
  178. PRT_CREATE_NEW = 1,
  179. PRT_USE_THIS = 2,
  180. PRT_USE_THIS_ONLY = 3
  181. } PROCESS_REQUEST_TYPE;
  182. [
  183. object,
  184. local,
  185. uuid(000001A4-0000-0000-C000-000000000046),
  186. pointer_default(unique)
  187. ]
  188. interface IServerLocationInfo : IUnknown
  189. {
  190. // SetRemoteServerName is allowed only prior to the server Machine stage.
  191. HRESULT SetRemoteServerName([in, string, unique] WCHAR *pswzMachineName);
  192. HRESULT GetRemoteServerName([out, string] WCHAR **pswzMachineName);
  193. // SetProcess
  194. HRESULT SetProcess([in] DWORD pid, DWORD dwPRT);
  195. HRESULT GetProcess([out] DWORD* ppid, DWORD* pdwPRT);
  196. // SetApartment is allowed only in server process stage.
  197. HRESULT SetApartment([in] APTID apartmentId);
  198. HRESULT GetApartment([out] APTID *pApartmentId);
  199. // SetContext is allowed only in server process and server apartment stages.
  200. HRESULT SetContext([in] IObjContext* pContext);
  201. HRESULT GetContext([out] IObjContext** ppContext);
  202. }
  203. [
  204. object,
  205. local,
  206. uuid(000001A5-0000-0000-C000-000000000046),
  207. pointer_default(unique)
  208. ]
  209. interface IActivationContextInfo : IUnknown
  210. {
  211. // None of these methods is allowed in the server context stage.
  212. HRESULT GetClientContext([out] IContext **ppClientContext);
  213. HRESULT GetPrototypeContext([out] IContext **ppContext);
  214. HRESULT IsClientContextOK([out] BOOL *fYes);
  215. HRESULT SetClientContextNotOK();
  216. }
  217. [
  218. object,
  219. local,
  220. uuid(000001BA-0000-0000-C000-000000000046),
  221. pointer_default(unique)
  222. ]
  223. interface IOverrideTargetContext : IUnknown
  224. {
  225. HRESULT OverrideTargetContext([in] REFGUID guidTargetCtxtId);
  226. }
  227. [
  228. object,
  229. local,
  230. uuid(000001A6-0000-0000-C000-000000000046),
  231. pointer_default(unique)
  232. ]
  233. interface IActivationSecurityInfo : IUnknown
  234. {
  235. // These methods are only allowed prior to the server process stage.
  236. HRESULT SetAuthnFlags([in] DWORD dwAuthnFlags); // e.g., static/dynamic
  237. HRESULT GetAuthnFlags([out] DWORD *pdwAuthnFlags);
  238. HRESULT SetAuthnSvc([in] DWORD dwAuthnSvc);
  239. HRESULT GetAuthnSvc([out] DWORD *pdwAuthnSvc);
  240. HRESULT SetAuthzSvc([in] DWORD dwAuthzSvc);
  241. HRESULT GetAuthzSvc([out] DWORD *pdwAuthzSvc);
  242. HRESULT SetAuthnLevel([in] DWORD dwAuthnLevel);
  243. HRESULT GetAuthnLevel([out] DWORD *pdwAuthnLevel);
  244. HRESULT SetImpLevel([in] DWORD dwImpLevel);
  245. HRESULT GetImpLevel([out] DWORD *pdwImpLevel);
  246. HRESULT SetCapabilities([in] DWORD dwCapabilities);
  247. HRESULT GetCapabilities([out] DWORD *pdwCapabilities);
  248. HRESULT SetAuthIdentity([in, unique] COAUTHIDENTITY *pAuthIdentityData);
  249. HRESULT GetAuthIdentity([out] COAUTHIDENTITY **pAuthIdentityData);
  250. HRESULT SetServerPrincipalName([in, unique] WCHAR* pwszServerPrincName);
  251. HRESULT GetServerPrincipalName([out] WCHAR** pwszServerPrincName);
  252. }
  253. //
  254. // ServerType -- an enumeration describing the various
  255. // types of servers that can be registered with the scm
  256. //
  257. typedef enum
  258. {
  259. ST_SERVER = 1, // normal server
  260. ST_OLDSURROGATE, // legacy surrogate-style application
  261. ST_COMPLUSAPP, // new COM+ application
  262. ST_SERVICE // server implemented as an NT service
  263. } ServerType;
  264. //
  265. // ServerIDType -- an enumeration to differentiate
  266. // between run-as-a-specific-user server and a run-as-
  267. // interactive-user server. Does not apply to servers
  268. // implemented as NT services.
  269. //
  270. typedef enum
  271. {
  272. SIT_RUNAS_SPECIFIC_USER = 1,
  273. SIT_RUNAS_INTERACTIVE
  274. } ServerIDType;
  275. //
  276. // SCMProcessInfoFlags -- an enumeration containing various
  277. // state bits for the dwState member of the SCMProcessInfo
  278. // struct.
  279. //
  280. typedef enum
  281. {
  282. SPIF_COMPLUS = 1, // process is a com+ server
  283. SPIF_SUSPENDED = 2, // process has been suspended by an activator
  284. SPIF_RETIRED = 4, // process has been retired by an activator
  285. SPIF_READY = 8, // process is started and is ready for activations (if not set
  286. // the process is in a sort-of "started-but-suspended" state)
  287. SPIF_PAUSED = 16 // the process has paused itself (due to user action)
  288. } SCMProcessInfoFlags;
  289. //
  290. // SCMProcessInfo -- describes a server process registered with
  291. // the scm.
  292. //
  293. typedef struct
  294. {
  295. ULONG ulNumClasses;
  296. GUID* pCLSIDs;
  297. DWORD pidProcess;
  298. HANDLE hProcess; // will almost never be NULL, but caller should check anyway
  299. HANDLE hImpersonationToken;
  300. WCHAR* pwszWinstaDesktop;
  301. DWORD dwState; // see SCMProcessInfoFlags
  302. GUID AppId; // valid only if SPIF_COMPLUS bit is set
  303. ServerType ServerType;
  304. ServerIDType ServerID;
  305. FILETIME ftCreated;
  306. } SCMProcessInfo, *PSCMProcessInfo;
  307. //
  308. // IEnumSCMProcessInfo
  309. //
  310. // Interface for walking through a view of the SCM's server tables
  311. //
  312. [
  313. local,
  314. object,
  315. uuid(8bbbd026-de4d-46b7-8a90-72c66eb64ad6),
  316. pointer_default(unique)
  317. ]
  318. interface IEnumSCMProcessInfo : IUnknown
  319. {
  320. // Fetch process info for next cElems processes
  321. HRESULT Next([in] ULONG cElems,
  322. [out, size_is (cElems), length_is (*pcFetched)] SCMProcessInfo** ppSCMProcessInfo,
  323. [out] ULONG *pcFetched);
  324. // advance cursor past cElems elements
  325. HRESULT Skip([in]ULONG cElems);
  326. // reset cursor to first element
  327. HRESULT Reset();
  328. // duplicate this enumerator
  329. HRESULT Clone([out]IEnumSCMProcessInfo **ppESPI);
  330. }
  331. //
  332. // ISCMProcessControl
  333. //
  334. // Interface for querying & changing the SCM's server tables
  335. //
  336. [
  337. local,
  338. object,
  339. uuid(7629798c-f1e6-4ef0-b521-dc466fded209),
  340. pointer_default(unique)
  341. ]
  342. interface ISCMProcessControl : IUnknown
  343. {
  344. // Find info for processes implementing an application
  345. HRESULT FindApplication ([in] REFGUID rappid, [out] IEnumSCMProcessInfo **ppESPI);
  346. // Find info for processes implementing a class
  347. HRESULT FindClass ([in] REFCLSID rclsid, [out] IEnumSCMProcessInfo **ppESPI);
  348. // Find info for a particular PID.
  349. HRESULT FindProcess ([in] DWORD pid, [out] SCMProcessInfo** pSCMProcessInfo);
  350. // Send no activations to COM+ applications implementing this APPID.
  351. HRESULT SuspendApplication ([in] REFGUID rappid);
  352. // Send no activations to processes implementing this CLSID.
  353. HRESULT SuspendClass ([in] REFCLSID rclsid);
  354. // Send no activations to this process.
  355. HRESULT SuspendProcess ([in] DWORD ppid);
  356. // Resume sending activations to COM+ applications implementing this APPID
  357. HRESULT ResumeApplication([in] REFGUID rappid);
  358. // Resume sending activations to processes implementing this CLSID
  359. HRESULT ResumeClass([in] REFCLSID rclsid);
  360. // Resumt sending activations to this process
  361. HRESULT ResumeProcess([in] DWORD pid);
  362. // Send no more activations to COM+ applications implementing this APPID.
  363. HRESULT RetireApplication ([in] REFGUID rappid);
  364. // Send no more activations to processes implementing this CLSID.
  365. HRESULT RetireClass ([in] REFCLSID rclsid);
  366. // Send no more activations to this process.
  367. HRESULT RetireProcess ([in] DWORD pid);
  368. // Free a SCMProcessInfo structure
  369. HRESULT FreeSCMProcessInfo(SCMProcessInfo** ppSCMProcessInfo);
  370. }
  371. // This clsid gets defined in prvidl.lib
  372. cpp_quote("")
  373. cpp_quote("EXTERN_C const CLSID CLSID_RPCSSInfo;")
  374. cpp_quote("")
  375. cpp_quote("")
  376. cpp_quote("////////////////////////////////////////////////////////////////////////")
  377. cpp_quote("//")
  378. cpp_quote("// API for accessing SCM's objects (exported from rpcss.dll)")
  379. cpp_quote("//")
  380. cpp_quote("typedef HRESULT (__stdcall *PFNGETRPCSSINFO)(REFCLSID, REFIID, void**);")
  381. cpp_quote("//")
  382. cpp_quote("////////////////////////////////////////////////////////////////////////")
  383. cpp_quote("")