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.

1407 lines
44 KiB

  1. /*++ BUILD Version: 0002 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. sxsapi.h
  5. Abstract:
  6. Include file with definitions for calling into the sxs.dll private APIs
  7. Author:
  8. Michael Grier (MGrier) 4-May-2000
  9. Environment:
  10. Revision History:
  11. Jay Krell (JayKrell) November 30, 2001
  12. seperated guids out into sxsapi_guids.h
  13. --*/
  14. #ifndef _SXSAPI_
  15. #define _SXSAPI_
  16. #if (_MSC_VER > 1020)
  17. #pragma once
  18. #endif
  19. //
  20. // bring in IStream / ISequentialStream
  21. //
  22. #if !defined(COM_NO_WINDOWS_H)
  23. #define COM_NO_WINDOWS_H COM_NO_WINDOWS_H
  24. #endif
  25. #pragma push_macro("COM_NO_WINDOWS_H")
  26. #undef COM_NO_WINDOWS_H
  27. #include "objidl.h"
  28. #pragma pop_macro("COM_NO_WINDOWS_H")
  29. // from setupapi.h
  30. typedef PVOID HSPFILEQ;
  31. #include <sxstypes.h>
  32. #include <sxs.h>
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36. #define SXS_DLL_NAME_A ( "sxs.dll")
  37. #define SXS_DLL_NAME_W (L"sxs.dll")
  38. #define SXS_DLL_NAME (TEXT( "sxs.dll"))
  39. typedef struct _SXS_XML_DOCUMENT *PSXS_XML_DOCUMENT;
  40. typedef const struct _SXS_XML_DOCUMENT *PCSXS_XML_DOCUMENT;
  41. typedef struct _SXS_XML_STRING *PSXS_XML_STRING;
  42. typedef const struct _SXS_XML_STRING *PCSXS_XML_STRING;
  43. typedef struct _SXS_XML_LOCATION *PSXS_XML_LOCATION;
  44. typedef const struct _SXS_XML_LOCATION *PCSXS_XML_LOCATION;
  45. typedef struct _SXS_XML_NODE *PSXS_XML_NODE;
  46. typedef const struct _SXS_XML_NODE *PCSXS_XML_NODE;
  47. typedef struct _SXS_XML_ATTRIBUTE *PSXS_XML_ATTRIBUTE;
  48. typedef const struct _SXS_XML_ATTRIBUTE *PCSXS_XML_ATTRIBUTE;
  49. typedef struct _SXS_XML_DOCUMENT {
  50. ULONG Flags;
  51. ULONG StringCount;
  52. PCSXS_XML_STRING Strings; // Note that index 0 is reserved to mean "no string" or "no value"
  53. LIST_ENTRY ElementListHead; // conceptually just one element, but PIs also appear in this list
  54. } SXS_XML_DOCUMENT;
  55. // Most will not be null terminated; if they happen to be this flag will be set; this can be used
  56. // to avoid a string copy if you really need them to be null terminated.
  57. #define SXS_XML_STRING_FLAG_NULL_TERMINATED (0x00000001)
  58. #define SXS_XML_STRING_FLAG_INVALID (0x00000002)
  59. typedef struct _SXS_XML_STRING {
  60. ULONG Flags;
  61. ULONG PseudoKey;
  62. ULONG Length; // in bytes
  63. const WCHAR *Buffer; // pointer to first character of non-null-terminated string
  64. } SXS_XML_STRING;
  65. typedef struct _SXS_XML_LOCATION {
  66. ULONG Flags;
  67. ULONG SourceString; // source file name
  68. ULONG BeginningLine;
  69. ULONG BeginningColumn;
  70. ULONG EndingLine;
  71. ULONG EndingColumn;
  72. } SXS_XML_LOCATION;
  73. #define SXS_XML_NODE_TYPE_INVALID (0)
  74. #define SXS_XML_NODE_TYPE_XML_DECL (1)
  75. #define SXS_XML_NODE_TYPE_PI (2)
  76. #define SXS_XML_NODE_TYPE_ELEMENT (3)
  77. #define SXS_XML_NODE_TYPE_PCDATA (4)
  78. #define SXS_XML_NODE_TYPE_CDATA (5)
  79. typedef struct _SXS_XML_NODE_XML_DECL_DATA {
  80. ULONG AttributeCount;
  81. PCSXS_XML_ATTRIBUTE Attributes;
  82. } SXS_XML_NODE_XML_DECL_DATA;
  83. typedef struct _SXS_XML_NODE_ELEMENT_DATA {
  84. ULONG NamespaceString;
  85. ULONG NameString;
  86. ULONG AttributeCount;
  87. PCSXS_XML_ATTRIBUTE Attributes;
  88. LIST_ENTRY ChildListHead;
  89. } SXS_XML_NODE_ELEMENT_DATA;
  90. typedef struct _SXS_XML_NODE {
  91. LIST_ENTRY SiblingLink;
  92. ULONG Flags;
  93. ULONG Type;
  94. PCSXS_XML_NODE Parent;
  95. union {
  96. SXS_XML_NODE_XML_DECL_DATA XMLDecl;
  97. ULONG PIString;
  98. SXS_XML_NODE_ELEMENT_DATA Element;
  99. ULONG PCDataString;
  100. ULONG CDataString;
  101. };
  102. } SXS_XML_NODE;
  103. #define SXS_XML_ATTRIBUTE_FLAG_NAMESPACE_ATTRIBUTE (0x00000001)
  104. typedef struct _SXS_XML_ATTRIBUTE {
  105. ULONG Flags;
  106. ULONG NamespaceString;
  107. ULONG NameString;
  108. ULONG ValueString;
  109. } SXS_XML_ATTRIBUTE;
  110. //
  111. // structs for walking/locating things in the XML parse tree
  112. //
  113. typedef struct _SXS_XML_NAMED_REFERENCE *PSXS_XML_NAMED_REFERENCE;
  114. typedef const struct _SXS_XML_NAMED_REFERENCE *PCSXS_XML_NAMED_REFERENCE;
  115. typedef struct _SXS_XML_NODE_PATH *PSXS_XML_NODE_PATH;
  116. typedef const struct _SXS_XML_NODE_PATH *PCSXS_XML_NODE_PATH;
  117. typedef struct _SXS_XML_NAMED_REFERENCE {
  118. PCWSTR Namespace;
  119. ULONG NamespaceLength; // in bytes
  120. PCWSTR Name;
  121. ULONG NameLength; // in bytes
  122. } SXS_XML_NAMED_REFERENCE;
  123. typedef struct _SXS_XML_NODE_PATH {
  124. ULONG ElementCount;
  125. const PCSXS_XML_NAMED_REFERENCE *Elements;
  126. } SXS_XML_NODE_PATH;
  127. typedef VOID (WINAPI * PSXS_ENUM_XML_NODES_CALLBACK)(
  128. IN PVOID Context,
  129. IN PCSXS_XML_NODE Element,
  130. OUT BOOL *ContinueEnumeration
  131. );
  132. BOOL
  133. WINAPI
  134. SxsEnumXmlNodes(
  135. IN ULONG Flags,
  136. IN PCSXS_XML_DOCUMENT Document,
  137. IN PCSXS_XML_NODE_PATH PathToMatch,
  138. IN PSXS_ENUM_XML_NODES_CALLBACK Callback,
  139. IN PVOID Context
  140. );
  141. #define SXS_INSTALLATION_FILE_COPY_DISPOSITION_FILE_COPIED (1)
  142. #define SXS_INSTALLATION_FILE_COPY_DISPOSITION_FILE_QUEUED (2)
  143. #define SXS_INSTALLATION_FILE_COPY_DISPOSITION_PLEASE_COPY (3)
  144. #define SXS_INSTALLATION_FILE_COPY_DISPOSITION_PLEASE_MOVE (4)
  145. typedef struct _SXS_INSTALLATION_FILE_COPY_CALLBACK_PARAMETERS {
  146. IN DWORD cbSize;
  147. IN PVOID pvContext;
  148. IN DWORD dwFileFlags;
  149. IN PVOID pAlternateSource;
  150. IN PCWSTR pSourceFile;
  151. IN PCWSTR pDestinationFile;
  152. IN ULONGLONG nFileSize;
  153. OUT INT nDisposition;
  154. } SXS_INSTALLATION_FILE_COPY_CALLBACK_PARAMETERS, *PSXS_INSTALLATION_FILE_COPY_CALLBACK_PARAMETERS;
  155. typedef BOOL (WINAPI * PSXS_INSTALLATION_FILE_COPY_CALLBACK)(
  156. PSXS_INSTALLATION_FILE_COPY_CALLBACK_PARAMETERS pParameters
  157. );
  158. //
  159. // If SxsBeginAssemblyInstall() is called with SXS_INSTALL_ASSEMBLY_FILE_COPY_CALLBACK_SETUP_COPY_QUEUE as the
  160. // InstallationCallback parameter, the InstallationContext parameter is assumed to be an
  161. // HSPFILEQ copy queue handle. If SXS_INSTALL_ASSEMBLY_FILE_COPY_CALLBACK_SETUP_COPY_QUEUE_EX,
  162. // the InstallationContext must point to a SXS_INSTALL_ASSEMBLY_SETUP_COPY_QUEUE_EX_PARAMETERS.
  163. //
  164. // This provides an easy mechanism for someone maintaining a copy queue to interact with assembly installation.
  165. //
  166. #define SXS_INSTALLATION_FILE_COPY_CALLBACK_SETUP_COPY_QUEUE ((PSXS_INSTALLATION_FILE_COPY_CALLBACK) 1)
  167. #define SXS_INSTALLATION_FILE_COPY_CALLBACK_SETUP_COPY_QUEUE_EX ((PSXS_INSTALLATION_FILE_COPY_CALLBACK) 2)
  168. //
  169. // Parameters to Setupapi.dll::SetupQueueCopy
  170. //
  171. typedef struct _SXS_INSTALLATION_SETUP_COPY_QUEUE_EX_PARAMETERS {
  172. DWORD cbSize;
  173. HSPFILEQ hSetupCopyQueue; // SetupOpenFileQueue
  174. PCWSTR pszSourceDescription;
  175. DWORD dwCopyStyle;
  176. } SXS_INSTALLATION_SETUP_COPY_QUEUE_EX_PARAMETERS, *PSXS_INSTALLATION_SETUP_COPY_QUEUE_EX_PARAMETERS;
  177. typedef const SXS_INSTALLATION_SETUP_COPY_QUEUE_EX_PARAMETERS* PCSXS_INSTALLATION_SETUP_COPY_QUEUE_EX_PARAMETERS;
  178. typedef BOOL (WINAPI * PSXS_IMPERSONATION_CALLBACK)(
  179. IN PVOID Context,
  180. IN BOOL Impersonate
  181. );
  182. #define SXS_BEGIN_ASSEMBLY_INSTALL_FLAG_MOVE (0x00000001)
  183. #define SXS_BEGIN_ASSEMBLY_INSTALL_FLAG_FROM_RESOURCE (0x00000002)
  184. #define SXS_BEGIN_ASSEMBLY_INSTALL_FLAG_FROM_DIRECTORY (0x00000004)
  185. #define SXS_BEGIN_ASSEMBLY_INSTALL_FLAG_FROM_DIRECTORY_RECURSIVE (0x00000008)
  186. #define SXS_BEGIN_ASSEMBLY_INSTALL_FLAG_NOT_TRANSACTIONAL (0x00000010)
  187. #define SXS_BEGIN_ASSEMBLY_INSTALL_FLAG_NO_VERIFY (0x00000020)
  188. #define SXS_BEGIN_ASSEMBLY_INSTALL_FLAG_REPLACE_EXISTING (0x00000040)
  189. typedef BOOL (WINAPI * PSXS_BEGIN_ASSEMBLY_INSTALL)(
  190. IN DWORD Flags,
  191. IN PSXS_INSTALLATION_FILE_COPY_CALLBACK InstallationCallback OPTIONAL,
  192. IN PVOID InstallationContext OPTIONAL,
  193. IN PSXS_IMPERSONATION_CALLBACK ImpersonationCallback OPTIONAL,
  194. IN PVOID ImpersonationContext OPTIONAL,
  195. OUT PVOID *InstallCookie
  196. );
  197. #define SXS_BEGIN_ASSEMBLY_INSTALL ("SxsBeginAssemblyInstall")
  198. BOOL
  199. WINAPI
  200. SxsBeginAssemblyInstall(
  201. IN DWORD Flags,
  202. IN PSXS_INSTALLATION_FILE_COPY_CALLBACK InstallationCallback OPTIONAL,
  203. IN PVOID InstallationContext OPTIONAL,
  204. IN PSXS_IMPERSONATION_CALLBACK ImpersonationCallback OPTIONAL,
  205. IN PVOID ImpersonationContext OPTIONAL,
  206. OUT PVOID *InstallCookie
  207. );
  208. #include <initguid.h>
  209. #include "sxsapi_guids.h"
  210. typedef struct tagSXS_INSTALL_REFERENCEW
  211. {
  212. DWORD cbSize;
  213. DWORD dwFlags;
  214. GUID guidScheme;
  215. PCWSTR lpIdentifier;
  216. PCWSTR lpNonCanonicalData;
  217. } SXS_INSTALL_REFERENCEW, *PSXS_INSTALL_REFERENCEW;
  218. typedef const struct tagSXS_INSTALL_REFERENCEW *PCSXS_INSTALL_REFERENCEW;
  219. typedef struct tagSXS_INSTALLW
  220. {
  221. DWORD cbSize;
  222. DWORD dwFlags;
  223. PCWSTR lpManifestPath;
  224. PVOID pvInstallCookie;
  225. PCWSTR lpCodebaseURL;
  226. PCWSTR lpRefreshPrompt;
  227. PCWSTR lpLogFileName;
  228. PCSXS_INSTALL_REFERENCEW lpReference;
  229. } SXS_INSTALLW, *PSXS_INSTALLW;
  230. typedef const struct tagSXS_INSTALLW *PCSXS_INSTALLW;
  231. //
  232. // These flags are distinct from the begin install flags, but
  233. // we're assigning them unique numbers so that flag-reuse errors can
  234. // be caught more easily.
  235. //
  236. #define SXS_INSTALL_FLAG_CODEBASE_URL_VALID (0x00000100)
  237. #define SXS_INSTALL_FLAG_MOVE (0x00000200)
  238. #define SXS_INSTALL_FLAG_FROM_RESOURCE (0x00000400)
  239. #define SXS_INSTALL_FLAG_FROM_DIRECTORY (0x00000800)
  240. #define SXS_INSTALL_FLAG_FROM_DIRECTORY_RECURSIVE (0x00001000)
  241. #define SXS_INSTALL_FLAG_NOT_TRANSACTIONAL (0x00002000)
  242. #define SXS_INSTALL_FLAG_NO_VERIFY (0x00004000)
  243. #define SXS_INSTALL_FLAG_REPLACE_EXISTING (0x00008000)
  244. #define SXS_INSTALL_FLAG_LOG_FILE_NAME_VALID (0x00010000)
  245. #define SXS_INSTALL_FLAG_INSTALLED_BY_DARWIN (0x00020000)
  246. #define SXS_INSTALL_FLAG_INSTALLED_BY_OSSETUP (0x00040000)
  247. #define SXS_INSTALL_FLAG_INSTALL_COOKIE_VALID (0x00080000)
  248. #define SXS_INSTALL_FLAG_REFRESH_PROMPT_VALID (0x00100000)
  249. #define SXS_INSTALL_FLAG_REFERENCE_VALID (0x00200000)
  250. #define SXS_INSTALL_FLAG_REFRESH (0x00400000)
  251. typedef BOOL (WINAPI * PSXS_INSTALL_W)(
  252. IN OUT PSXS_INSTALLW lpInstall
  253. );
  254. typedef PSXS_INSTALL_W PSXS_INSTALL_W_ROUTINE;
  255. BOOL
  256. WINAPI
  257. SxsInstallW(
  258. IN OUT PSXS_INSTALLW lpInstall
  259. );
  260. #define SXS_INSTALL_W ("SxsInstallW")
  261. //
  262. // These flags are distinct from the begin assembly install flags, but
  263. // we're assigning them unique numbers so that flag-reuse errors can
  264. // be caught more easily.
  265. //
  266. #define SXS_INSTALL_ASSEMBLY_FLAG_CODEBASE_URL_VALID (0x00000100)
  267. #define SXS_INSTALL_ASSEMBLY_FLAG_MOVE (0x00000200)
  268. #define SXS_INSTALL_ASSEMBLY_FLAG_FROM_RESOURCE (0x00000400)
  269. #define SXS_INSTALL_ASSEMBLY_FLAG_FROM_DIRECTORY (0x00000800)
  270. #define SXS_INSTALL_ASSEMBLY_FLAG_FROM_DIRECTORY_RECURSIVE (0x00001000)
  271. #define SXS_INSTALL_ASSEMBLY_FLAG_NOT_TRANSACTIONAL (0x00002000)
  272. #define SXS_INSTALL_ASSEMBLY_FLAG_NO_VERIFY (0x00004000)
  273. #define SXS_INSTALL_ASSEMBLY_FLAG_REPLACE_EXISTING (0x00008000)
  274. #define SXS_INSTALL_ASSEMBLY_FLAG_LOG_FILE_NAME_VALID (0x00010000)
  275. #define SXS_INSTALL_ASSEMBLY_FLAG_INSTALLED_BY_DARWIN (0x00020000)
  276. #define SXS_INSTALL_ASSEMBLY_FLAG_INSTALLED_BY_OSSETUP (0x00040000)
  277. #define SXS_INSTALL_ASSEMBLY_FLAG_INSTALL_COOKIE_VALID (0x00080000)
  278. #define SXS_INSTALL_ASSEMBLY_FLAG_REFRESH_PROMPT_VALID (0x00100000)
  279. #define SXS_INSTALL_ASSEMBLY_FLAG_INCLUDE_CODEBASE SXS_INSTALL_ASSEMBLY_FLAG_CODEBASE_URL_VALID
  280. #define SXS_INSTALL_ASSEMBLY_FLAG_CREATE_LOGFILE SXS_INSTALL_ASSEMBLY_FLAG_LOG_FILE_NAME_VALID
  281. typedef BOOL (WINAPI * PSXS_INSTALL_ASSEMBLY_W)(
  282. IN PVOID InstallCookie OPTIONAL,
  283. IN DWORD Flags,
  284. IN PCWSTR ManifestPath,
  285. IN OUT PVOID Reserved OPTIONAL
  286. );
  287. #define SXS_INSTALL_ASSEMBLY_W ("SxsInstallAssemblyW")
  288. BOOL
  289. WINAPI
  290. SxsInstallAssemblyW(
  291. IN PVOID InstallCookie OPTIONAL,
  292. IN DWORD Flags,
  293. IN PCWSTR ManifestPath,
  294. IN OUT PVOID Reserved OPTIONAL
  295. );
  296. //
  297. // If you've specified SXS_INSTALL_ASSEMBLY_FLAG_INCLUDE_CODEBASE, you must pass
  298. // a PSXS_INSTALL_SOURCE_INFO in the Reserved value of SxsInstallAssemblyW.
  299. // This is the definition of that structure.
  300. //
  301. typedef struct _SXS_INSTALL_SOURCE_INFO {
  302. // Size of this structure. Required.
  303. SIZE_T cbSize;
  304. // Any combination of SXSINSTALLSOURCE_*
  305. DWORD dwFlags;
  306. // Codebase to reinstall this assembly from. Can be determined from the
  307. // manifest name that's being installed, but not preferrably.
  308. PCWSTR pcwszCodebaseName;
  309. // What string (localized!) that should be presented to the user during
  310. // recovery to request the media that this assembly came from.
  311. PCWSTR pcwszPromptOnRefresh;
  312. PCWSTR pcwszLogFileName;
  313. } SXS_INSTALL_SOURCE_INFO, *PSXS_INSTALL_SOURCE_INFO;
  314. typedef const struct _SXS_INSTALL_SOURCE_INFO *PCSXS_INSTALL_SOURCE_INFO;
  315. // The SXS_INSTALL_SOURCE_INFO structure has the pcwszCodebase member filled in.
  316. #define SXSINSTALLSOURCE_HAS_CODEBASE ( 0x00000001 )
  317. // The SXS_INSTALL_SOURCE_INFO structure has the pcwszPromptOnRefresh member filled in.
  318. #define SXSINSTALLSOURCE_HAS_PROMPT ( 0x00000002 )
  319. // The assembly has a catalog that must be present and copied over. If missing, then the
  320. // instaler will intuit whether it has a catalog or not.
  321. #define SXSINSTALLSOURCE_HAS_CATALOG ( 0x00000004 )
  322. // This assembly is being installed as part of OS-setup, and so the codebase actually
  323. // contains the source-relative path of the root directory of the assembly source
  324. #define SXSINSTALLSOURCE_INSTALLING_SETUP ( 0x00000008 )
  325. // The installer should not attempt to autodetect whether or not there's a catalog
  326. // associated with this assembly.
  327. #define SXSINSTALLSOURCE_DONT_DETECT_CATALOG ( 0x0000010 )
  328. #define SXSINSTALLSOURCE_CREATE_LOGFILE ( 0x0000020 )
  329. // for WFP recovery usage
  330. #define SXSINSTALLSOURCE_INSTALL_BY_DARWIN ( 0x0000040 )
  331. #define SXSINSTALLSOURCE_INSTALL_BY_OSSETUP ( 0x0000080 )
  332. //
  333. // These flags are distinct from the begin assembly install flags, but
  334. // we're assigning them unique numbers so that flag-reuse errors can
  335. // be caught more easily.
  336. //
  337. #define SXS_END_ASSEMBLY_INSTALL_FLAG_COMMIT (0x01000000)
  338. #define SXS_END_ASSEMBLY_INSTALL_FLAG_ABORT (0x02000000)
  339. #define SXS_END_ASSEMBLY_INSTALL_FLAG_NO_VERIFY (0x04000000)
  340. #define SXS_END_ASSEMBLY_INSTALL_FLAG_GET_STATUS (0x08000000)
  341. typedef BOOL (WINAPI * PSXS_END_ASSEMBLY_INSTALL)(
  342. IN PVOID InstallCookie,
  343. IN DWORD Flags,
  344. OUT DWORD *Reserved OPTIONAL
  345. );
  346. #define SXS_END_ASSEMBLY_INSTALL ("SxsEndAssemblyInstall")
  347. BOOL
  348. WINAPI
  349. SxsEndAssemblyInstall(
  350. IN PVOID InstallCookie,
  351. IN DWORD Flags,
  352. IN OUT PVOID Reserved OPTIONAL
  353. );
  354. //
  355. // Uninstallation of an assembly
  356. //
  357. typedef struct _tagSXS_UNINSTALLW {
  358. SIZE_T cbSize;
  359. DWORD dwFlags;
  360. LPCWSTR lpAssemblyIdentity;
  361. PCSXS_INSTALL_REFERENCEW lpInstallReference;
  362. LPCWSTR lpInstallLogFile;
  363. } SXS_UNINSTALLW, *PSXS_UNINSTALLW;
  364. typedef const struct _tagSXS_UNINSTALLW *PCSXS_UNINSTALLW;
  365. #define SXS_UNINSTALL_FLAG_REFERENCE_VALID (0x00000001)
  366. #define SXS_UNINSTALL_FLAG_FORCE_DELETE (0x00000002)
  367. #define SXS_UNINSTALL_FLAG_USE_INSTALL_LOG (0x00000004)
  368. #define SXS_UNINSTALL_FLAG_REFERENCE_COMPUTED (0x00000008)
  369. //
  370. // The reference to the assembly was removed
  371. //
  372. #define SXS_UNINSTALL_DISPOSITION_REMOVED_REFERENCE (0x00000001)
  373. //
  374. // The actual assembly was removed because it ran out of references.
  375. //
  376. #define SXS_UNINSTALL_DISPOSITION_REMOVED_ASSEMBLY (0x00000002)
  377. typedef BOOL (WINAPI * PSXS_UNINSTALL_ASSEMBLYW)(
  378. IN PCSXS_UNINSTALLW pcUnInstallData,
  379. OUT DWORD *pdwDisposition
  380. );
  381. typedef PSXS_UNINSTALL_ASSEMBLYW PSXS_UNINSTALL_W_ROUTINE;
  382. #define SXS_UNINSTALL_ASSEMBLYW ("SxsUninstallW")
  383. BOOL
  384. WINAPI
  385. SxsUninstallW(
  386. IN PCSXS_UNINSTALLW pcUnInstallData,
  387. OUT DWORD *pdwDisposition
  388. );
  389. #define SXS_PROBE_ASSEMBLY_INSTALLATION_DISPOSITION_NOT_INSTALLED (0x00000001)
  390. #define SXS_PROBE_ASSEMBLY_INSTALLATION_DISPOSITION_INSTALLED (0x00000002)
  391. #define SXS_PROBE_ASSEMBLY_INSTALLATION_DISPOSITION_RESIDENT (0x00000004)
  392. typedef BOOL (WINAPI * PSXS_PROBE_ASSEMBLY_INSTALLATION)(
  393. IN DWORD dwFlags,
  394. IN PCWSTR lpIdentity,
  395. OUT DWORD *plpDisposition
  396. );
  397. #define SXS_PROBE_ASSEMBLY_INSTALLATION ("SxsProbeAssemblyInstallation")
  398. BOOL
  399. WINAPI
  400. SxsProbeAssemblyInstallation(
  401. DWORD dwFlags,
  402. PCWSTR lpIdentity,
  403. PDWORD lpDisposition
  404. );
  405. #define SXS_QUERY_MANIFEST_INFORMATION_INFOCLASS_BASIC (1)
  406. #define SXS_QUERY_MANIFEST_INFORMATION_FLAG_SOURCE_IS_DLL (0x00000001)
  407. #define SXS_QUERY_MANIFEST_INFORMATION_INFOCLASS_BASIC_FLAG_OMIT_IDENTITY (0x00000001)
  408. #define SXS_QUERY_MANIFEST_INFORMATION_INFOCLASS_BASIC_FLAG_OMIT_SHORTNAME (0x00000002)
  409. typedef struct _SXS_MANIFEST_INFORMATION_BASIC
  410. {
  411. PCWSTR lpIdentity;
  412. PCWSTR lpShortName;
  413. ULONG ulFileCount;
  414. } SXS_MANIFEST_INFORMATION_BASIC, *PSXS_MANIFEST_INFORMATION_BASIC;
  415. #define SXS_QUERY_MANIFEST_INFORMATION_DLL_SOURCE_FLAG_RESOURCE_TYPE_VALID (0x00000001)
  416. #define SXS_QUERY_MANIFEST_INFORMATION_DLL_SOURCE_FLAG_RESOURCE_LANGUAGE_VALID (0x00000002)
  417. #define SXS_QUERY_MANIFEST_INFORMATION_DLL_SOURCE_FLAG_RESOURCE_ID_VALID (0x00000004)
  418. typedef struct _SXS_MANIFEST_INFORMATION_SOURCE_DLL
  419. {
  420. DWORD dwSize;
  421. DWORD dwFlags;
  422. PCWSTR pcwszDllPath;
  423. PCWSTR pcwszResourceType;
  424. PCWSTR pcwszResourceName;
  425. INT Language;
  426. } SXS_MANIFEST_INFORMATION_SOURCE_DLL, *PSXS_MANIFEST_INFORMATION_SOURCE_DLL;
  427. typedef const struct _SXS_MANIFEST_INFORMATION_SOURCE_DLL *PCSXS_MANIFEST_INFORMATION_SOURCE_DLL;
  428. typedef BOOL (WINAPI * PSXS_QUERY_MANIFEST_INFORMATION)(
  429. IN DWORD dwFlags,
  430. IN PCWSTR pszSource,
  431. IN ULONG ulInfoClass,
  432. IN DWORD dwInfoClassSpecificFlags,
  433. IN SIZE_T cbBuffer,
  434. OUT PVOID lpBuffer,
  435. OUT PSIZE_T cbWrittenOrRequired OPTIONAL
  436. );
  437. BOOL
  438. WINAPI
  439. SxsQueryManifestInformation(
  440. IN DWORD dwFlags,
  441. IN PCWSTR pszSource,
  442. IN ULONG ulInfoClass,
  443. IN DWORD dwInfoClassSpecificFlags,
  444. IN SIZE_T cbBuffer,
  445. OUT PVOID lpBuffer,
  446. OUT PSIZE_T cbWrittenOrRequired OPTIONAL
  447. );
  448. //
  449. // these flags are used for sxs.dll. when ActCtx generation for system default fails, there are two cases we could ignore this error :
  450. // Case 1 : there is no system-default at all
  451. // Case 2 : the dependency of system-default could not be found: this case may happen during the GUImode setup, when system-default is
  452. // installed before GUI assembly is installed
  453. // SXS.dll would pass out these two failure cases using these flags
  454. //
  455. #define BASESRV_SXS_RETURN_RESULT_SYSTEM_DEFAULT_NOT_FOUND (0x0001)
  456. #define BASESRV_SXS_RETURN_RESULT_SYSTEM_DEFAULT_DEPENDENCY_ASSEMBLY_NOT_FOUND (0x0002)
  457. #define SXS_GENERATE_ACTIVATION_CONTEXT_FLAG_SUPPRESS_EVENT_LOG (0x00000001)
  458. #define SXS_GENERATE_ACTIVATION_CONTEXT_FLAG_SYSTEM_DEFAULT_TEXTUAL_ASSEMBLY_IDENTITY (0x00000002)
  459. #define SXS_GENERATE_ACTIVATION_CONTEXT_FLAG_TEXTUAL_ASSEMBLY_IDENTITY (0x00000004)
  460. typedef struct _SXS_GENERATE_ACTIVATION_CONTEXT_STREAM
  461. {
  462. IStream* Stream;
  463. //
  464. // This is not necessarily a file system path, just something
  465. // for descriptive/debugging purposes.
  466. //
  467. // Still, when they are file system paths, we try to keep them as Win32 paths instead of Nt paths.
  468. //
  469. PCWSTR Path;
  470. ULONG PathType;
  471. } SXS_GENERATE_ACTIVATION_CONTEXT_STREAM;
  472. typedef struct _SXS_GENERATE_ACTIVATION_CONTEXT_PARAMETERS
  473. {
  474. IN DWORD Flags;
  475. IN USHORT ProcessorArchitecture;
  476. IN LANGID LangId;
  477. IN PCWSTR AssemblyDirectory; // should be a Win32 path
  478. IN PCWSTR TextualAssemblyIdentity;
  479. IN SXS_GENERATE_ACTIVATION_CONTEXT_STREAM Manifest;
  480. IN SXS_GENERATE_ACTIVATION_CONTEXT_STREAM Policy;
  481. OUT DWORD SystemDefaultActCxtGenerationResult; // when generate activation context for system default fails, this mask shows whether it fails for some certain reason which we could ignore the error.
  482. PSXS_IMPERSONATION_CALLBACK ImpersonationCallback;
  483. PVOID ImpersonationContext;
  484. OUT HANDLE SectionObjectHandle;
  485. } SXS_GENERATE_ACTIVATION_CONTEXT_PARAMETERS, *PSXS_GENERATE_ACTIVATION_CONTEXT_PARAMETERS;
  486. typedef const SXS_GENERATE_ACTIVATION_CONTEXT_PARAMETERS* PCSXS_GENERATE_ACTIVATION_CONTEXT_PARAMETERS;
  487. typedef
  488. BOOL
  489. (WINAPI*
  490. PSXS_GENERATE_ACTIVATION_CONTEXT_FUNCTION)(
  491. PSXS_GENERATE_ACTIVATION_CONTEXT_PARAMETERS Parameters
  492. );
  493. BOOL
  494. WINAPI
  495. SxsGenerateActivationContext(
  496. IN OUT PSXS_GENERATE_ACTIVATION_CONTEXT_PARAMETERS Parameters
  497. );
  498. //
  499. // Opaque ASSEMBLY_IDENTITY structure
  500. //
  501. typedef struct _ASSEMBLY_IDENTITY *PASSEMBLY_IDENTITY;
  502. typedef const struct _ASSEMBLY_IDENTITY *PCASSEMBLY_IDENTITY;
  503. //
  504. // The types of assembly identities.
  505. //
  506. // Definitions may not include wildcard attributes; definitions
  507. // match only if they are exactly equal. A wildcard matches
  508. // a definition if for all the non-wildcarded attributes,
  509. // there is an exact match. References may not contain
  510. // wildcarded attributes but may contain a different set of
  511. // attributes than a definition that they match. (Example:
  512. // definitions carry the full public key of the publisher, but
  513. // references usually carry just the "strong name" which is
  514. // the first 8 bytes of the SHA-1 hash of the public key.)
  515. //
  516. #define ASSEMBLY_IDENTITY_TYPE_DEFINITION (1)
  517. #define ASSEMBLY_IDENTITY_TYPE_REFERENCE (2)
  518. #define ASSEMBLY_IDENTITY_TYPE_WILDCARD (3)
  519. #define SXS_ASSEMBLY_MANIFEST_STD_NAMESPACE L"urn:schemas-microsoft-com:asm.v1"
  520. #define SXS_ASSEMBLY_MANIFEST_STD_NAMESPACE_CCH (32)
  521. #define SXS_ASSEMBLY_MANIFEST_STD_ELEMENT_NAME_ASSEMBLY L"assembly"
  522. #define SXS_ASSEMBLY_MANIFEST_STD_ELEMENT_NAME_ASSEMBLY_CCH (8)
  523. #define SXS_ASSEMBLY_MANIFEST_STD_ELEMENT_NAME_ASSEMBLY_IDENTITY L"assemblyIdentity"
  524. #define SXS_ASSEMBLY_MANIFEST_STD_ELEMENT_NAME_ASSEMBLY_IDENTITY_CCH (16)
  525. #define SXS_APPLICATION_CONFIGURATION_MANIFEST_STD_ELEMENT_NAME_CONFIGURATION L"configuration"
  526. #define SXS_APPLICATION_CONFIGURATION_MANIFEST_STD_ELEMENT_NAME_CONFIGURATION_CCH (13)
  527. #define SXS_ASSEMBLY_MANIFEST_STD_ATTRIBUTE_NAME_MANIFEST_VERSION L"manifestVersion"
  528. #define SXS_ASSEMBLY_MANIFEST_STD_ATTRIBUTE_NAME_MANIFEST_VERSION_CCH (15)
  529. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_NAME L"name"
  530. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_NAME_CCH (4)
  531. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_VERSION L"version"
  532. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_VERSION_CCH (7)
  533. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_LANGUAGE L"language"
  534. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_LANGUAGE_CCH (8)
  535. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_PUBLIC_KEY L"publicKey"
  536. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_PUBLIC_KEY_CCH (9)
  537. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_PUBLIC_KEY_TOKEN L"publicKeyToken"
  538. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_PUBLIC_KEY_TOKEN_CCH (14)
  539. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_PROCESSOR_ARCHITECTURE L"processorArchitecture"
  540. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_PROCESSOR_ARCHITECTURE_CCH (21)
  541. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_TYPE L"type"
  542. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_NAME_TYPE_CCH (4)
  543. // Pseudo-value used in some places when the language= attribute is missing from the identity.
  544. // An identity that does not have language is implicitly "worldwide".
  545. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_LANGUAGE_MISSING_VALUE L"x-ww"
  546. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_LANGUAGE_MISSING_VALUE_CCH (4)
  547. //
  548. // All win32 assemblies must have "win32" as their type.
  549. //
  550. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_TYPE_VALUE_WIN32 L"win32"
  551. #define SXS_ASSEMBLY_IDENTITY_STD_ATTRIBUTE_TYPE_VALUE_WIN32_CCH (5)
  552. //
  553. // Global flags describing the assembly identity state
  554. //
  555. //
  556. // SXS_ASSEMBLY_IDENTITY_FLAG_FROZEN means that the assembly
  557. // identity's contents are frozen and are not subject to additional
  558. // change.
  559. //
  560. #define ASSEMBLY_IDENTITY_FLAG_FROZEN (0x80000000)
  561. //
  562. // ASSEMBLY_IDENTITY_ATTRIBUTE structure
  563. //
  564. typedef struct _ASSEMBLY_IDENTITY_ATTRIBUTE {
  565. DWORD Flags;
  566. SIZE_T NamespaceCch;
  567. SIZE_T NameCch;
  568. SIZE_T ValueCch;
  569. const WCHAR *Namespace;
  570. const WCHAR *Name;
  571. const WCHAR *Value;
  572. } ASSEMBLY_IDENTITY_ATTRIBUTE, *PASSEMBLY_IDENTITY_ATTRIBUTE;
  573. typedef const struct _ASSEMBLY_IDENTITY_ATTRIBUTE *PCASSEMBLY_IDENTITY_ATTRIBUTE;
  574. typedef enum _ASSEMBLY_IDENTITY_INFORMATION_CLASS {
  575. AssemblyIdentityBasicInformation = 1,
  576. } ASSEMBLY_IDENTITY_INFORMATION_CLASS;
  577. typedef struct _ASSEMBLY_IDENTITY_BASIC_INFORMATION {
  578. DWORD Flags;
  579. ULONG Type;
  580. ULONG Hash;
  581. ULONG AttributeCount;
  582. } ASSEMBLY_IDENTITY_BASIC_INFORMATION, *PASSEMBLY_IDENTITY_BASIC_INFORMATION;
  583. #define SXS_CREATE_ASSEMBLY_IDENTITY_FLAG_FREEZE (0x00000001)
  584. BOOL
  585. WINAPI
  586. SxsCreateAssemblyIdentity(
  587. IN DWORD Flags,
  588. IN ULONG Type,
  589. OUT PASSEMBLY_IDENTITY *AssemblyIdentity,
  590. IN ULONG InitialAttributeCount OPTIONAL,
  591. IN PCASSEMBLY_IDENTITY_ATTRIBUTE const * InitialAttributes OPTIONAL
  592. );
  593. typedef BOOL (WINAPI * PSXS_CREATE_ASSEMBLY_IDENTITY_ROUTINE)(
  594. IN DWORD Flags,
  595. IN ULONG Type,
  596. OUT PASSEMBLY_IDENTITY *AssemblyIdentity,
  597. IN ULONG InitialAttributeCount OPTIONAL,
  598. IN PCASSEMBLY_IDENTITY_ATTRIBUTE const * InitialAttributes OPTIONAL
  599. );
  600. BOOL
  601. WINAPI
  602. SxsHashAssemblyIdentity(
  603. IN DWORD Flags,
  604. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  605. OUT ULONG *Hash
  606. );
  607. typedef BOOL (WINAPI * PSXS_HASH_ASSEMBLY_IDENTITY_ROUTINE)(
  608. IN DWORD Flags,
  609. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  610. OUT ULONG *Hash
  611. );
  612. #define SXS_ARE_ASSEMBLY_IDENTITIES_EQUAL_FLAG_ALLOW_REF_TO_MATCH_DEF (0x00000001)
  613. BOOL
  614. WINAPI
  615. SxsAreAssemblyIdentitiesEqual(
  616. IN DWORD Flags,
  617. IN PCASSEMBLY_IDENTITY AssemblyIdentity1,
  618. IN PCASSEMBLY_IDENTITY AssemlbyIdentity2,
  619. OUT BOOL *Equal
  620. );
  621. typedef BOOL (WINAPI * PSXS_ARE_ASSEMBLY_IDENTITIES_EQUAL_ROUTINE)(
  622. IN DWORD Flags,
  623. IN PCASSEMBLY_IDENTITY AssemblyIdentity1,
  624. IN PCASSEMBLY_IDENTITY AssemblyIdentity2,
  625. OUT BOOL *Equal
  626. );
  627. BOOL
  628. WINAPI
  629. SxsFreezeAssemblyIdentity(
  630. IN DWORD Flags,
  631. IN PASSEMBLY_IDENTITY AssemblyIdentity
  632. );
  633. typedef BOOL (WINAPI *PSXS_FREEZE_ASSEMBLY_IDENTITY_ROUTINE)(
  634. IN DWORD Flags,
  635. IN PASSEMBLY_IDENTITY AssemblyIdentity
  636. );
  637. VOID
  638. WINAPI
  639. SxsDestroyAssemblyIdentity(
  640. IN PASSEMBLY_IDENTITY AssemblyIdentity
  641. );
  642. typedef VOID (WINAPI * PSXS_DESTROY_ASSEMBLY_IDENTITY_ROUTINE)(
  643. IN PASSEMBLY_IDENTITY AssemblyIdentity
  644. );
  645. #define SXS_VALIDATE_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_VALIDATE_NAMESPACE (0x00000001)
  646. #define SXS_VALIDATE_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_VALIDATE_NAME (0x00000002)
  647. #define SXS_VALIDATE_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_VALIDATE_VALUE (0x00000004)
  648. #define SXS_VALIDATE_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_WILDCARDS_PERMITTED (0x00000008)
  649. #define SXS_HASH_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_HASH_NAMESPACE (0x00000001)
  650. #define SXS_HASH_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_HASH_NAME (0x00000002)
  651. #define SXS_HASH_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_HASH_VALUE (0x00000004)
  652. BOOL
  653. WINAPI
  654. SxsValidateAssemblyIdentityAttribute(
  655. IN DWORD Flags,
  656. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute
  657. );
  658. typedef BOOL (WINAPI * PSXS_VALIDATE_ASSEMBLY_IDENTITY_ATTRIBUTES_ROUTINE)(
  659. IN DWORD Flags,
  660. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute
  661. );
  662. BOOL
  663. WINAPI
  664. SxsHashAssemblyIdentityAttribute(
  665. IN DWORD Flags,
  666. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute,
  667. OUT ULONG *HashValue
  668. );
  669. typedef BOOL (WINAPI * PSXS_HASH_ASSEMBLY_IDENTITY_ATTRIBUTE_ROUTINE)(
  670. IN DWORD Flags,
  671. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute,
  672. OUT ULONG *HashValue
  673. );
  674. #define SXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_COMPARISON_RESULT_INVALID (0)
  675. #define SXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_COMPARISON_RESULT_LESS_THAN (1)
  676. #define SXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_COMPARISON_RESULT_EQUAL (2)
  677. #define SXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_COMPARISON_RESULT_GREATER_THAN (3)
  678. #define SXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_COMPARE_NAMESPACE (0x00000001)
  679. #define SXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_COMPARE_NAME (0x00000002)
  680. #define SXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_COMPARE_VALUE (0x00000004)
  681. BOOL
  682. WINAPI
  683. SxsCompareAssemblyIdentityAttributes(
  684. IN DWORD Flags,
  685. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute1,
  686. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute2,
  687. OUT ULONG *ComparisonResult
  688. );
  689. typedef BOOL (WINAPI * PSXS_COMPARE_ASSEMBLY_IDENTITY_ATTRIBUTES_ROUTINE)(
  690. IN DWORD Flags,
  691. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute1,
  692. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute2,
  693. OUT ULONG *ComparisonResult
  694. );
  695. #define SXS_INSERT_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_OVERWRITE_EXISTING (0x00000001)
  696. BOOL
  697. WINAPI
  698. SxsInsertAssemblyIdentityAttribute(
  699. IN DWORD Flags,
  700. IN PASSEMBLY_IDENTITY AssemblyIdentity,
  701. IN PCASSEMBLY_IDENTITY_ATTRIBUTE AssemblyIdentityAttribute
  702. );
  703. typedef BOOL (WINAPI * PSXS_INSERT_ASSEMBLY_IDENTITY_ATTRIBUTE_ROUTINE)(
  704. IN DWORD Flags,
  705. IN PASSEMBLY_IDENTITY AssemblyIdentity,
  706. IN PCASSEMBLY_IDENTITY_ATTRIBUTE AssemblyIdentityAttribute
  707. );
  708. BOOL
  709. WINAPI
  710. SxsRemoveAssemblyIdentityAttributesByOrdinal(
  711. IN DWORD Flags,
  712. IN PASSEMBLY_IDENTITY AssemblyIdentity,
  713. IN ULONG AttributeOrdinal,
  714. IN ULONG AttributeCount
  715. );
  716. typedef BOOL (WINAPI * PSXS_REMOVE_ASSEMBLY_IDENTITY_ATTRIBUTES_BY_ORDINAL_ROUTINE)(
  717. IN DWORD Flags,
  718. IN PASSEMBLY_IDENTITY AssemblyIdentity,
  719. IN ULONG AttributeOrdinal,
  720. IN ULONG AttributeCount
  721. );
  722. #define SXS_FIND_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_MATCH_NAMESPACE (0x00000001)
  723. #define SXS_FIND_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_MATCH_NAME (0x00000002)
  724. #define SXS_FIND_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_MATCH_VALUE (0x00000004)
  725. #define SXS_FIND_ASSEMBLY_IDENTITY_ATTRIBUTE_FLAG_NOT_FOUND_SUCCEEDS (0x00000008)
  726. BOOL
  727. WINAPI
  728. SxsFindAssemblyIdentityAttribute(
  729. IN DWORD Flags,
  730. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  731. IN PCASSEMBLY_IDENTITY_ATTRIBUTE AttributeToMatch,
  732. OUT ULONG *FirstMatchOrdinal OPTIONAL,
  733. OUT ULONG *MatchCount OPTIONAL
  734. );
  735. typedef BOOL (WINAPI * PSXS_FIND_ASSEMBLY_IDENTITY_ATTRIBUTE_ROUTINE)(
  736. IN DWORD Flags,
  737. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  738. IN PCASSEMBLY_IDENTITY_ATTRIBUTE AttributeToMatch,
  739. OUT ULONG *FirstMatchOrdinal OPTIONAL,
  740. OUT ULONG *MatchCount OPTIONAL
  741. );
  742. //
  743. // Rather than making "n" heap allocations, the pattern for SxsGetAssemblyIdentityAttributeByOrdinal()
  744. // is to call once with BufferSize = 0 or some reasonable fixed number to get the size of the
  745. // buffer required, allocate the buffer if the buffer passed in was too small and call again.
  746. //
  747. // The strings returned in the ASSEMBLY_IDENTITY_ATTRIBUTE are *not*
  748. // dynamically allocated, but are instead expected to fit in the buffer passed in.
  749. //
  750. BOOL
  751. WINAPI
  752. SxsGetAssemblyIdentityAttributeByOrdinal(
  753. IN DWORD Flags,
  754. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  755. IN ULONG AttributeOrdinal, // 0-based
  756. IN SIZE_T BufferSize,
  757. OUT PASSEMBLY_IDENTITY_ATTRIBUTE AssemblyIdentityAttributeBuffer,
  758. OUT SIZE_T *BytesWrittenOrRequired
  759. );
  760. typedef BOOL (WINAPI * PSXS_GET_ASSEMBLY_IDENTITY_ATTRIBUTE_BY_ORDINAL_ROUTINE)(
  761. IN DWORD Flags,
  762. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  763. IN ULONG AttributeOrdinal, // 0-based
  764. IN SIZE_T BufferSize,
  765. OUT PASSEMBLY_IDENTITY_ATTRIBUTE AssemblyIdentityAttributeBuffer,
  766. OUT SIZE_T *BytesWrittenOrRequired
  767. );
  768. #define SXS_DUPLICATE_ASSEMBLY_IDENTITY_FLAG_FREEZE (0x00000001)
  769. #define SXS_DUPLICATE_ASSEMBLY_IDENTITY_FLAG_ALLOW_NULL (0x00000002)
  770. BOOL
  771. WINAPI
  772. SxsDuplicateAssemblyIdentity(
  773. IN DWORD Flags,
  774. IN PCASSEMBLY_IDENTITY Source,
  775. OUT PASSEMBLY_IDENTITY *Destination
  776. );
  777. typedef BOOL (WINAPI * PSXS_DUPLICATE_ASSEMBLY_IDENTITY_ROUTINE)(
  778. IN DWORD Flags,
  779. IN PCASSEMBLY_IDENTITY Source,
  780. OUT PASSEMBLY_IDENTITY *Destination
  781. );
  782. BOOL
  783. WINAPI
  784. SxsQueryInformationAssemblyIdentity(
  785. IN DWORD Flags,
  786. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  787. OUT PVOID AssemblyIdentityInformation,
  788. IN SIZE_T AssemblyIdentityInformationLength,
  789. IN ASSEMBLY_IDENTITY_INFORMATION_CLASS AssemblyIdentityInformationClass
  790. );
  791. typedef BOOL (WINAPI * PSXS_QUERY_INFORMATION_ASSEMBLY_IDENTITY_ROUTINE)(
  792. IN DWORD Flags,
  793. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  794. OUT PVOID AssemblyIdentityInformation,
  795. IN SIZE_T AssemblyIdentityInformationLength,
  796. IN ASSEMBLY_IDENTITY_INFORMATION_CLASS AssemblyIdentityInformationClass
  797. );
  798. #define SXS_ENUMERATE_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_MATCH_NAMESPACE (0x00000001)
  799. #define SXS_ENUMERATE_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_MATCH_NAME (0x00000002)
  800. #define SXS_ENUMERATE_ASSEMBLY_IDENTITY_ATTRIBUTES_FLAG_MATCH_VALUE (0x00000004)
  801. typedef VOID (WINAPI * PSXS_ASSEMBLY_IDENTITY_ATTRIBUTE_ENUMERATION_ROUTINE)(
  802. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  803. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute,
  804. IN PVOID Context
  805. );
  806. BOOL
  807. WINAPI
  808. SxsEnumerateAssemblyIdentityAttributes(
  809. IN DWORD Flags,
  810. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  811. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute OPTIONAL,
  812. IN PSXS_ASSEMBLY_IDENTITY_ATTRIBUTE_ENUMERATION_ROUTINE EnumerationRoutine,
  813. IN PVOID Context
  814. );
  815. typedef BOOL (WINAPI * PSXS_ENUMERATE_ASSEMBLY_IDENTITY_ATTRIBUTES_ROUTINE)(
  816. IN DWORD Flags,
  817. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  818. IN PCASSEMBLY_IDENTITY_ATTRIBUTE Attribute OPTIONAL,
  819. IN PSXS_ASSEMBLY_IDENTITY_ATTRIBUTE_ENUMERATION_ROUTINE EnumerationRoutine,
  820. IN PVOID Context
  821. );
  822. //
  823. // Assembly Identity encoding:
  824. //
  825. // Assembly identities may be encoded in various forms. The two usual ones
  826. // are either a binary stream, suitable for embedding in other data structures
  827. // or for persisting or a textual format that looks like:
  828. //
  829. // name;[ns1,]n1="v1";[ns2,]n2="v2"[;...]
  830. //
  831. #define SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_BINARY (1)
  832. #define SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_TEXTUAL (2)
  833. BOOL
  834. SxsComputeAssemblyIdentityEncodedSize(
  835. IN DWORD Flags,
  836. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  837. IN const GUID *EncodingGroup OPTIONAL, // use NULL to use any of the SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_* encodings
  838. IN ULONG EncodingFormat,
  839. OUT SIZE_T *SizeOut
  840. );
  841. typedef BOOL (WINAPI * PSXS_COMPUTE_ASSEMBLY_IDENTITY_ENCODED_SIZE_ROUTINE)(
  842. IN DWORD Flags,
  843. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  844. IN const GUID *EncodingGroup OPTIONAL, // use NULL to use any of the SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_* encodings
  845. IN ULONG EncodingFormat,
  846. OUT SIZE_T *SizeOut
  847. );
  848. BOOL
  849. WINAPI
  850. SxsEncodeAssemblyIdentity(
  851. IN DWORD Flags,
  852. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  853. IN const GUID *EncodingGroup OPTIONAL, // use NULL to use any of the SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_* encodings
  854. IN ULONG EncodingFormat,
  855. IN SIZE_T BufferSize,
  856. OUT PVOID Buffer,
  857. OUT SIZE_T *BytesWrittenOrRequired
  858. );
  859. typedef BOOL (WINAPI * PSXS_ENCODE_ASSEMBLY_IDENTITY_ROUTINE)(
  860. IN DWORD Flags,
  861. IN PCASSEMBLY_IDENTITY AssemblyIdentity,
  862. IN const GUID *EncodingGroup OPTIONAL, // use NULL to use any of the SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_* encodings
  863. IN ULONG EncodingFormat,
  864. IN SIZE_T BufferSize,
  865. OUT PVOID Buffer,
  866. OUT SIZE_T *BytesWrittenOrRequired
  867. );
  868. #define SXS_DECODE_ASSEMBLY_IDENTITY_FLAG_FREEZE (0x00000001)
  869. BOOL
  870. WINAPI
  871. SxsDecodeAssemblyIdentity(
  872. IN ULONG Flags,
  873. IN const GUID *EncodingGroup OPTIONAL, // use NULL to use any of the SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_* encodings
  874. IN ULONG EncodingFormat,
  875. IN SIZE_T BufferSize,
  876. IN const VOID *Buffer,
  877. OUT PASSEMBLY_IDENTITY *AssemblyIdentity
  878. );
  879. typedef BOOL (WINAPI * PSXS_DECODE_ASSEMBLY_IDENTITY_ROUTINE)(
  880. IN DWORD Flags,
  881. IN const GUID *EncodingGroup OPTIONAL, // use NULL to use any of the SXS_ASSEMBLY_IDENTITY_ENCODING_DEFAULTGROUP_* encodings
  882. IN ULONG EncodingFormat,
  883. IN SIZE_T BufferSize,
  884. IN const VOID *Buffer,
  885. OUT PASSEMBLY_IDENTITY *AssemblyIdentity
  886. );
  887. //
  888. // These are the definitions that SFC requires to interact with SXS.
  889. //
  890. #define SXS_PROTECT_RECURSIVE ( 0x00000001 )
  891. #define SXS_PROTECT_SINGLE_LEVEL ( 0x00000000 )
  892. #define SXS_PROTECT_FILTER_DEFAULT ( FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE | FILE_NOTIFY_CHANGE_LAST_ACCESS | FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_SECURITY )
  893. typedef struct _SXS_PROTECT_DIRECTORY {
  894. WCHAR pwszDirectory[MAX_PATH];
  895. PVOID pvCookie;
  896. ULONG ulRecursiveFlag;
  897. ULONG ulNotifyFilter;
  898. } SXS_PROTECT_DIRECTORY, *PSXS_PROTECT_DIRECTORY;
  899. typedef const SXS_PROTECT_DIRECTORY* PCSXS_PROTECT_DIRECTORY;
  900. typedef BOOL ( WINAPI * PSXS_PROTECT_NOTIFICATION )(
  901. PVOID pvCookie,
  902. PCWSTR wsChangeText,
  903. SIZE_T cchChangeText,
  904. DWORD dwChangeAction
  905. );
  906. BOOL
  907. WINAPI
  908. SxsProtectionNotifyW(
  909. PVOID pvCookie,
  910. PCWSTR wsChangeText,
  911. SIZE_T cchChangeText,
  912. DWORD dwChangeAction
  913. );
  914. typedef BOOL ( WINAPI * PSXS_PROTECT_RETRIEVELISTS )(
  915. PCSXS_PROTECT_DIRECTORY *prgpProtectListing,
  916. SIZE_T *pcProtectEntries
  917. );
  918. BOOL
  919. WINAPI
  920. SxsProtectionGatherEntriesW(
  921. PCSXS_PROTECT_DIRECTORY *prgpProtectListing,
  922. SIZE_T *pcProtectEntries
  923. );
  924. //
  925. // This is for both the Logon and the Logoff events
  926. //
  927. typedef BOOL ( WINAPI * PSXS_PROTECT_LOGIN_EVENT )(void);
  928. BOOL
  929. WINAPI
  930. SxsProtectionUserLogonEvent(
  931. void
  932. );
  933. BOOL
  934. WINAPI
  935. SxsProtectionUserLogoffEvent(
  936. void
  937. );
  938. typedef BOOL ( WINAPI * PSXS_PROTECT_SCAN_ONCE )( HWND, BOOL, BOOL );
  939. BOOL
  940. WINAPI
  941. SxsProtectionPerformScanNow(
  942. HWND hwProgressWindow,
  943. BOOL bValidate,
  944. BOOL bUIAllowed
  945. );
  946. #define PFN_NAME_PROTECTION_GATHER_LISTS_W ( "SxsProtectionGatherEntriesW" )
  947. #define PFN_NAME_PROTECTION_NOTIFY_CHANGE_W ( "SxsProtectionNotifyW" )
  948. #define PFN_NAME_PROTECTION_NOTIFY_LOGON ( "SxsProtectionUserLogonEvent" )
  949. #define PFN_NAME_PROTECTION_NOTIFY_LOGOFF ( "SxsProtectionUserLogoffEvent" )
  950. #define PFN_NAME_PROTECTION_SCAN_ONCE ( "SxsProtectionPerformScanNow" )
  951. //
  952. // Settings API
  953. //
  954. //
  955. // These APIs are deliberately designed to look like a subset of the registry
  956. // APIs; their behavior should match the documented registry behavior in general;
  957. // the major missing functionality includes security, the win16 compatibility
  958. // APIs, loading and unloading of keys/hives and change notification.
  959. //
  960. // Settings are strictly local to the process; changes are not visible to other
  961. // processes until the settings are saved.
  962. //
  963. typedef struct _SXS_SETTINGS_KEY *PSXS_SETTINGS_KEY;
  964. typedef const struct _SXS_SETTINGS_KEY *PCSXS_SETTINGS_KEY;
  965. #define SXS_SETTINGS_USERSCOPE_INVALID (0)
  966. #define SXS_SETTINGS_USERSCOPE_PER_USER (1)
  967. #define SXS_SETTINGS_USERSCOPE_SYSTEM_WIDE (2)
  968. #define SXS_SETTINGS_APPSCOPE_INVALID (0)
  969. #define SXS_SETTINGS_APPSCOPE_PER_PROCESS_ROOT (1)
  970. #define SXS_SETTINGS_APPSCOPE_PER_CONTEXT_ROOT (2)
  971. #define SXS_SETTINGS_APPSCOPE_PER_COMPONENT (3)
  972. #define SXS_SETTINGS_ITEMTYPE_INVALID (0)
  973. #define SXS_SETTINGS_ITEMTYPE_KEY (1)
  974. #define SXS_SETTINGS_ITEMTYPE_VALUE (2)
  975. typedef VOID (WINAPI * PSXS_OPEN_SETTINGS_INITIALIZATION_CALLBACK)(
  976. IN PVOID pvContext,
  977. IN PSXS_SETTINGS_KEY lpUninitializedSettingsKey,
  978. OUT BOOL *pfFailed
  979. );
  980. #define SXS_OPEN_SETTINGS_FLAG_RETURN_NULL_IF_NONE (0x00000001)
  981. typedef LONG (WINAPI * PSXS_OPEN_SETTINGS_W)(
  982. IN DWORD dwFlags,
  983. IN ULONG ulUserScope,
  984. IN ULONG ulAppScope,
  985. IN PCWSTR lpAssemblyName,
  986. IN PSXS_OPEN_SETTINGS_INITIALIZATION_CALLBACK lpInitializationCallback OPTIONAL,
  987. IN PVOID pvContext,
  988. OUT PSXS_SETTINGS_KEY *lpKey
  989. );
  990. LONG
  991. WINAPI
  992. SxsOpenSettingsW(
  993. IN DWORD dwFlags,
  994. IN ULONG ulUserScope,
  995. IN ULONG ulAppScope,
  996. IN PCWSTR lpAssemblyName,
  997. IN PSXS_OPEN_SETTINGS_INITIALIZATION_CALLBACK lpInitializationCallback OPTIONAL,
  998. IN PVOID pvContext,
  999. OUT PSXS_SETTINGS_KEY *lpKey
  1000. );
  1001. #define SXS_MERGE_SETTINGS_KEYDISPOSITION_INVALID (0)
  1002. #define SXS_MERGE_SETTINGS_KEYDISPOSITION_COPY_ENTIRE_SUBTREE (1)
  1003. #define SXS_MERGE_SETTINGS_KEYDISPOSITION_COPY_KEY_WALK_SUBTREE (2)
  1004. typedef VOID (WINAPI * PSXS_MERGE_SETTINGS_KEY_CALLBACKW)(
  1005. IN PVOID pvContext,
  1006. IN PCWSTR lpKeyPath,
  1007. OUT ULONG *lpKeyDisposition
  1008. );
  1009. #define SXS_MERGE_SETTINGS_VALUEDISPOSITION_INVALID (0)
  1010. #define SXS_MERGE_SETTINGS_VALUEDISPOSITION_COPY (1)
  1011. #define SXS_MERGE_SETTINGS_VALUEDISPOSITION_DONT_COPY (2)
  1012. typedef VOID (WINAPI * PSXS_MERGE_SETTINGS_VALUE_CALLBACKW)(
  1013. IN PVOID pvContext,
  1014. IN PCWSTR lpKeyPath,
  1015. IN LPCWSTR lpValueName,
  1016. IN OUT LPDWORD lpType,
  1017. IN OUT LPBYTE *lplpData, // pointer to replacable data pointer. Allocate replacements using GlobalAlloc(GPTR, nBytes)
  1018. IN DWORD dwDataBufferSize, // for modifying data you can write up to this many bytes
  1019. OUT ULONG *lpValueDisposition
  1020. );
  1021. typedef LONG (WINAPI * PSXS_MERGE_SETTINGS_W)(
  1022. IN DWORD dwFlags,
  1023. IN PCSXS_SETTINGS_KEY lpKeyToMergeFrom,
  1024. IN PSXS_SETTINGS_KEY lpKeyToMergeInTo,
  1025. IN PSXS_MERGE_SETTINGS_KEY_CALLBACKW lpKeyCallback,
  1026. IN PSXS_MERGE_SETTINGS_VALUE_CALLBACKW lpValueCallback,
  1027. LPVOID pvContext
  1028. );
  1029. LONG
  1030. WINAPI
  1031. SxsMergeSettingsW(
  1032. IN DWORD dwFlags,
  1033. IN PCSXS_SETTINGS_KEY lpKeyToMergeFrom,
  1034. IN PSXS_SETTINGS_KEY lpKeyToMergeInTo,
  1035. IN PSXS_MERGE_SETTINGS_KEY_CALLBACKW lpKeyCallback,
  1036. IN PSXS_MERGE_SETTINGS_VALUE_CALLBACKW lpValueCallback,
  1037. LPVOID pvContext
  1038. );
  1039. LONG
  1040. WINAPI
  1041. SxsCloseSettingsKey(
  1042. PSXS_SETTINGS_KEY lpKey
  1043. );
  1044. LONG
  1045. WINAPI
  1046. SxsCreateSettingsKeyExW(
  1047. PSXS_SETTINGS_KEY lpKey,
  1048. LPCWSTR lpSubKey,
  1049. DWORD Reserved,
  1050. LPWSTR lpClass,
  1051. DWORD dwOptions,
  1052. REGSAM samDesired,
  1053. LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  1054. PSXS_SETTINGS_KEY *lplpKeyResult,
  1055. LPDWORD lpdwDisposition
  1056. );
  1057. LONG
  1058. WINAPI
  1059. SxsDeleteSettingsKeyW(
  1060. PSXS_SETTINGS_KEY lpKey,
  1061. LPCWSTR lpSubKey
  1062. );
  1063. LONG
  1064. WINAPI
  1065. SxsDeleteSettingsValueW(
  1066. PSXS_SETTINGS_KEY lpKey,
  1067. LPCWSTR lpValueName
  1068. );
  1069. LONG
  1070. WINAPI
  1071. SxsEnumSettingsKeyW(
  1072. IN PSXS_SETTINGS_KEY lpKey,
  1073. DWORD dwIndex,
  1074. LPWSTR lpName,
  1075. DWORD cbName
  1076. );
  1077. LONG
  1078. WINAPI
  1079. SxsEnumSettingsKeyExW(
  1080. IN PSXS_SETTINGS_KEY lpKey,
  1081. IN DWORD dwIndex,
  1082. OUT PWSTR lpName,
  1083. IN OUT LPDWORD lpcName,
  1084. IN OUT LPDWORD lpReserved,
  1085. OUT PWSTR lpClass,
  1086. OUT LPDWORD lpcClass,
  1087. OUT PFILETIME lpftLastWriteTime
  1088. );
  1089. LONG
  1090. WINAPI
  1091. SxsEnumSettingsValueW(
  1092. IN PSXS_SETTINGS_KEY lpKey,
  1093. IN DWORD dwIndex,
  1094. OUT PWSTR lpValueName,
  1095. IN OUT LPDWORD lpcValueName,
  1096. IN OUT LPDWORD lpReserved,
  1097. OUT LPDWORD lpType,
  1098. LPBYTE lpData,
  1099. LPDWORD lpcbData
  1100. );
  1101. LONG
  1102. WINAPI
  1103. SxsFlushSettingsKey(
  1104. IN PSXS_SETTINGS_KEY lpKey
  1105. );
  1106. LONG
  1107. WINAPI
  1108. SxsOpenSettingsKeyEx(
  1109. IN PSXS_SETTINGS_KEY lpKey,
  1110. LPCWSTR lpSubKey,
  1111. DWORD ulOptions,
  1112. REGSAM samDesired,
  1113. PSXS_SETTINGS_KEY *lplpKeyResult
  1114. );
  1115. LONG
  1116. WINAPI
  1117. SxsQuerySettingsInfoKeyW(
  1118. IN PSXS_SETTINGS_KEY lpKey,
  1119. OUT PWSTR lpClass,
  1120. IN OUT LPDWORD lpcClass,
  1121. IN OUT LPDWORD lpReserved,
  1122. OUT LPDWORD lpcSubKeys,
  1123. OUT LPDWORD lpcMaxSubKeyLen,
  1124. OUT LPDWORD lpcMaxClassLen,
  1125. OUT LPDWORD lpcValues,
  1126. OUT LPDWORD lpcMaxValueNameLen,
  1127. OUT LPDWORD lpcMaxValueLen,
  1128. OUT LPDWORD lpcSecurityDescriptor,
  1129. OUT PFILETIME lpftLastWriteTime
  1130. );
  1131. LONG
  1132. WINAPI
  1133. SxsQuerySettingsMultipleValuesW(
  1134. IN PSXS_SETTINGS_KEY lpKey,
  1135. PVALENT val_list,
  1136. DWORD num_vals,
  1137. LPWSTR lpValueBuf,
  1138. LPDWORD lpdwTotsize
  1139. );
  1140. LONG
  1141. WINAPI
  1142. SxsQuerySettingsValueExW(
  1143. IN PSXS_SETTINGS_KEY lpKey,
  1144. IN LPCWSTR lpValueName,
  1145. IN OUT LPDWORD lpReserved,
  1146. OUT LPDWORD lpType,
  1147. OUT LPBYTE lpData,
  1148. IN OUT LPDWORD lpcbData
  1149. );
  1150. LONG
  1151. WINAPI
  1152. SxsSetSettingsValueExW(
  1153. IN PSXS_SETTINGS_KEY lpKey,
  1154. LPCWSTR lpValueName,
  1155. DWORD dwReserved,
  1156. DWORD dwType,
  1157. CONST BYTE *lpData,
  1158. DWORD cbData
  1159. );
  1160. #ifdef __cplusplus
  1161. } /* extern "C" */
  1162. #endif
  1163. #endif /* _SXSAPI_ */