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.

760 lines
21 KiB

  1. /*++
  2. Copyright (c) 1997-2001 Microsoft Corporation
  3. Module Name:
  4. winsafer.h
  5. Abstract:
  6. This file implements the publicly exported functions, data types,
  7. data structures, and definitions usable by programs that directly
  8. interact with the Windows SAFER APIs.
  9. --*/
  10. #ifndef _WINSAFER_H
  11. #define _WINSAFER_H
  12. #include <guiddef.h>
  13. #include <wincrypt.h>
  14. ;begin_both
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. ;end_both
  19. //
  20. // Opaque datatype for representing handles to Safer objects.
  21. //
  22. DECLARE_HANDLE(SAFER_LEVEL_HANDLE);
  23. //
  24. // Constants to represent scope with SaferCreateLevel and others.
  25. //
  26. #define SAFER_SCOPEID_MACHINE 1
  27. #define SAFER_SCOPEID_USER 2
  28. ;begin_internal
  29. #define SAFER_SCOPEID_REGISTRY 3
  30. ;end_internal
  31. //
  32. // Pre-defined levels that can be used with SaferCreateLevel
  33. //
  34. #define SAFER_LEVELID_FULLYTRUSTED 0x40000
  35. #define SAFER_LEVELID_NORMALUSER 0x20000
  36. #define SAFER_LEVELID_CONSTRAINED 0x10000
  37. #define SAFER_LEVELID_UNTRUSTED 0x01000
  38. #define SAFER_LEVELID_DISALLOWED 0x00000
  39. //
  40. // Flags to use when creating/opening a Level with SaferCreateLevel
  41. //
  42. #define SAFER_LEVEL_OPEN 1
  43. ;begin_internal
  44. #define SAFER_LEVEL_DELETE 2
  45. #define SAFER_LEVEL_CREATE 4
  46. ;end_internal
  47. //
  48. // Maximum string size.
  49. //
  50. #define SAFER_MAX_FRIENDLYNAME_SIZE 256
  51. #define SAFER_MAX_DESCRIPTION_SIZE 256
  52. #define SAFER_MAX_HASH_SIZE 64
  53. //
  54. // Flags to use with SaferComputeTokenFromLevel.
  55. //
  56. #define SAFER_TOKEN_NULL_IF_EQUAL 0x00000001
  57. #define SAFER_TOKEN_COMPARE_ONLY 0x00000002
  58. #define SAFER_TOKEN_MAKE_INERT 0x00000004
  59. #define SAFER_TOKEN_WANT_FLAGS 0x00000008
  60. //
  61. // Flags for specifying what criteria within SAFER_CODE_PROPERTIES to evaluate
  62. // when finding code identity with SaferIdentifyLevel.
  63. //
  64. #define SAFER_CRITERIA_IMAGEPATH 0x00001
  65. #define SAFER_CRITERIA_NOSIGNEDHASH 0x00002
  66. #define SAFER_CRITERIA_IMAGEHASH 0x00004
  67. #define SAFER_CRITERIA_AUTHENTICODE 0x00008
  68. #define SAFER_CRITERIA_URLZONE 0x00010
  69. #define SAFER_CRITERIA_IMAGEPATH_NT 0x01000
  70. //
  71. // Code image information structure passed to SaferIdentifyLevel.
  72. //
  73. #include <pshpack8.h>
  74. typedef struct _SAFER_CODE_PROPERTIES
  75. {
  76. //
  77. // Must be initialized to be the size of this structure,
  78. // for the purposes of future/backwards compatibility.
  79. //
  80. DWORD cbSize;
  81. //
  82. // Must be initialized to the types of criteria that should
  83. // be considered when evaluating this structure. This can be
  84. // a combination of the SAFER_CRITERIA_xxxx flags. If not enough
  85. // of the structure elements needed to evaluate the criteria
  86. // types indicated were supplied, then some of those criteria
  87. // flags may be silently ignored. Specifying 0 for this value
  88. // will cause the entire structure's contents to be ignored.
  89. //
  90. DWORD dwCheckFlags;
  91. //
  92. // Optionally specifies the fully-qualified path and filename
  93. // to be used for discrimination checks based on the path.
  94. // The ImagePath will additionally be used to open and read the
  95. // file to identify any other discrimination criteria that was
  96. // unsupplied in this structure.
  97. //
  98. LPCWSTR ImagePath;
  99. //
  100. // Optionally specifies a file handle that has been opened to
  101. // code image with at least GENERIC_READ access. The handle will
  102. // be used instead of explicitly opening the file again to compute
  103. // other discrimination criteria that was unsupplied in this structure.
  104. //
  105. HANDLE hImageFileHandle;
  106. //
  107. // Optionally specifies the pre-determined Internet Explorer
  108. // security zone. These enums are defined within urlmon.h
  109. // For example: URLZONE_LOCAL_MACHINE, URLZONE_INTRANET,
  110. // URLZONE_TRUSTED, URLZONE_INTERNET, or URLZONE_UNTRUSTED.
  111. //
  112. DWORD UrlZoneId;
  113. //
  114. // Optionally specifies the pre-computed hash of the image.
  115. // The supplied hash is interpreted as being valid if ImageSize
  116. // is non-zero and dwImageHashSize is non-zero and HashAlgorithm
  117. // represents a valid hashing algorithm from wincrypt.h
  118. //
  119. // If the supplied hash fails to meet the conditions above, then
  120. // the hash will be automatically computed against:
  121. // 1) by using ImageSize and pByteBlock if both are non-zero.
  122. // 2) by using hImageFileHandle if it is non-null.
  123. // 3) by attempting to open ImagePath if it is non-null.
  124. //
  125. BYTE ImageHash[SAFER_MAX_HASH_SIZE];
  126. DWORD dwImageHashSize;
  127. LARGE_INTEGER ImageSize;
  128. ALG_ID HashAlgorithm;
  129. //
  130. // Optionally specifies a memory block of memory representing
  131. // the image for which the trust is being requested for. When
  132. // this member is specified, ImageSize must also be supplied.
  133. //
  134. LPBYTE pByteBlock;
  135. //
  136. // Optionally gives the arguments used for Authenticode signer
  137. // certificate verification. These arguments are supplied to the
  138. // WinVerifyTrust() API and control the user-interface prompting
  139. // to accept untrusted certificates.
  140. //
  141. HWND hWndParent;
  142. DWORD dwWVTUIChoice;
  143. } SAFER_CODE_PROPERTIES, *PSAFER_CODE_PROPERTIES;
  144. #include <poppack.h>
  145. //
  146. // Masks for the per-identity WinSafer flags
  147. //
  148. #define SAFER_POLICY_JOBID_MASK 0xFF000000
  149. #define SAFER_POLICY_JOBID_CONSTRAINED 0x04000000
  150. #define SAFER_POLICY_JOBID_UNTRUSTED 0x03000000
  151. #define SAFER_POLICY_ONLY_EXES 0x00010000
  152. #define SAFER_POLICY_SANDBOX_INERT 0x00020000
  153. #define SAFER_POLICY_UIFLAGS_MASK 0x000000FF
  154. #define SAFER_POLICY_UIFLAGS_INFORMATION_PROMPT 0x00000001
  155. #define SAFER_POLICY_UIFLAGS_OPTION_PROMPT 0x00000002
  156. //
  157. // Information classes on the overall policy that can be queried
  158. // with SaferSet/GetPolicyInformation and set at different
  159. // policy scopes based on access of the caller.
  160. //
  161. typedef enum _SAFER_POLICY_INFO_CLASS
  162. {
  163. //
  164. // Accesses the list of all Levels defined in a policy.
  165. // The corresponding data element is a buffer that is filled
  166. // with multiple DWORDs, each representing the LevelIds that
  167. // are defined within this scope.
  168. //
  169. SaferPolicyLevelList = 1,
  170. //
  171. // for transparent enforcement of policy in the execution
  172. // framework -- will be used by native code execution but can
  173. // be used by any policy enforcement environment.
  174. // Corresponding data element is a DWORD holding a Boolean value.
  175. //
  176. SaferPolicyEnableTransparentEnforcement,
  177. //
  178. // Returns the name of the Level that has been designed
  179. // as the default level within the specified scope.
  180. // The corresponding data element is a single DWORD buffer
  181. // representing the LevelId of the default Level. If no
  182. // level has been configured to be the default, then the
  183. // GetInfo API will return FALSE and GetLastError will
  184. // return ERROR_NOT_FOUND.
  185. //
  186. SaferPolicyDefaultLevel,
  187. //
  188. // Returns whether Code Identities or Default Level within the
  189. // user scope can be considered during identification.
  190. //
  191. SaferPolicyEvaluateUserScope,
  192. //
  193. // Control Flags for for safer policy scope.
  194. //
  195. SaferPolicyScopeFlags
  196. } SAFER_POLICY_INFO_CLASS;
  197. //
  198. // Enumerations used for retrieving specific information about a
  199. // single authorization Level via SaferGet/SetInformationFromLevel.
  200. //
  201. typedef enum _SAFER_OBJECT_INFO_CLASS
  202. {
  203. SaferObjectLevelId = 1, // get: DWORD
  204. SaferObjectScopeId, // get: DWORD
  205. SaferObjectFriendlyName, // get/set: LPCWSTR
  206. SaferObjectDescription, // get/set: LPCWSTR
  207. SaferObjectBuiltin, // get: DWORD boolean
  208. SaferObjectDisallowed, // get: DWORD boolean
  209. SaferObjectDisableMaxPrivilege, // get: DWORD boolean
  210. SaferObjectInvertDeletedPrivileges, // get: DWORD boolean
  211. SaferObjectDeletedPrivileges, // get: TOKEN_PRIVILEGES
  212. SaferObjectDefaultOwner, // get: TOKEN_OWNER
  213. SaferObjectSidsToDisable, // get: TOKEN_GROUPS
  214. SaferObjectRestrictedSidsInverted, // get: TOKEN_GROUPS
  215. SaferObjectRestrictedSidsAdded, // get: TOKEN_GROUPS
  216. //
  217. // To enumerate all identities, call GetInfo with
  218. // SaferObjectAllIdentificationGuids.
  219. //
  220. SaferObjectAllIdentificationGuids, // get: SAFER_IDENTIFICATION_GUIDS
  221. //
  222. // To create a new identity, call SetInfo with
  223. // SaferObjectSingleIdentification with a new
  224. // unique GUID that you have generated.
  225. // To get details on a single identity, call GetInfo with
  226. // SaferObjectSingleIdentification with desired GUID.
  227. // To modify details of a single identity, call SetInfo with
  228. // SaferObjectSingleIdentification with desired info and GUID.
  229. // To delete an identity, call SetInfo with
  230. // SaferObjectSingleIdentification with the
  231. // header.dwIdentificationType set to 0.
  232. //
  233. SaferObjectSingleIdentification, // get/set: SAFER_IDENTIFICATION_*
  234. SaferObjectExtendedError // get: DWORD dwError
  235. } SAFER_OBJECT_INFO_CLASS;
  236. //
  237. // Structures and enums used by the SaferGet/SetLevelInformation APIs.
  238. //
  239. #include <pshpack8.h>
  240. typedef enum _SAFER_IDENTIFICATION_TYPES
  241. {
  242. SaferIdentityDefault,
  243. SaferIdentityTypeImageName = 1,
  244. SaferIdentityTypeImageHash,
  245. SaferIdentityTypeUrlZone,
  246. SaferIdentityTypeCertificate
  247. } SAFER_IDENTIFICATION_TYPES;
  248. typedef struct _SAFER_IDENTIFICATION_HEADER
  249. {
  250. //
  251. // indicates the type of the structure, one of SaferIdentityType*
  252. //
  253. SAFER_IDENTIFICATION_TYPES dwIdentificationType;
  254. //
  255. // size of the whole structure, not just the common header.
  256. //
  257. DWORD cbStructSize;
  258. //
  259. // the unique GUID of the Identity in question.
  260. //
  261. GUID IdentificationGuid;
  262. //
  263. // last change of this identification.
  264. //
  265. FILETIME lastModified;
  266. } SAFER_IDENTIFICATION_HEADER, *PSAFER_IDENTIFICATION_HEADER;
  267. typedef struct _SAFER_PATHNAME_IDENTIFICATION
  268. {
  269. //
  270. // header.dwIdentificationType must be SaferIdentityTypeImageName
  271. // header.cbStructSize must be sizeof(SAFER_PATHNAME_IDENTIFICATION)
  272. //
  273. SAFER_IDENTIFICATION_HEADER header;
  274. //
  275. // user-entered description
  276. //
  277. WCHAR Description[SAFER_MAX_DESCRIPTION_SIZE];
  278. //
  279. // filepath or name, possibly with vars
  280. //
  281. PWCHAR ImageName;
  282. //
  283. // any combo of SAFER_POL_SAFERFLAGS_*
  284. //
  285. DWORD dwSaferFlags;
  286. } SAFER_PATHNAME_IDENTIFICATION, *PSAFER_PATHNAME_IDENTIFICATION;
  287. typedef struct _SAFER_HASH_IDENTIFICATION
  288. {
  289. //
  290. // header.dwIdentificationType must be SaferIdentityTypeImageHash
  291. // header.cbStructSize must be sizeof(SAFER_HASH_IDENTIFICATION)
  292. //
  293. SAFER_IDENTIFICATION_HEADER header;
  294. //
  295. // user-entered friendly name, initially from file's resources.
  296. //
  297. WCHAR Description[SAFER_MAX_DESCRIPTION_SIZE];
  298. //
  299. // user-entered description.
  300. //
  301. WCHAR FriendlyName[SAFER_MAX_FRIENDLYNAME_SIZE];
  302. //
  303. // amount of ImageHash actually used, in bytes (MD5 is 16 bytes).
  304. //
  305. DWORD HashSize;
  306. //
  307. // computed hash data itself.
  308. //
  309. BYTE ImageHash[SAFER_MAX_HASH_SIZE];
  310. //
  311. // algorithm in which the hash was computed (CALG_MD5, etc).
  312. //
  313. ALG_ID HashAlgorithm;
  314. //
  315. // size of the original file in bytes.
  316. //
  317. LARGE_INTEGER ImageSize;
  318. //
  319. // any combo of SAFER_POL_SAFERFLAGS_*
  320. //
  321. DWORD dwSaferFlags;
  322. } SAFER_HASH_IDENTIFICATION, *PSAFER_HASH_IDENTIFICATION;
  323. typedef struct _SAFER_URLZONE_IDENTIFICATION
  324. {
  325. //
  326. // header.dwIdentificationType must be SaferIdentityTypeUrlZone
  327. // header.cbStructSize must be sizeof(SAFER_URLZONE_IDENTIFICATION)
  328. //
  329. SAFER_IDENTIFICATION_HEADER header;
  330. //
  331. // any single URLZONE_* from urlmon.h
  332. //
  333. DWORD UrlZoneId;
  334. //
  335. // any combo of SAFER_POLICY_*
  336. //
  337. DWORD dwSaferFlags;
  338. } SAFER_URLZONE_IDENTIFICATION, *PSAFER_URLZONE_IDENTIFICATION;
  339. #include <poppack.h>
  340. //
  341. // Functions related to querying and setting the global policy
  342. // controls to disable transparent enforcement, and perform level
  343. // enumeration operations.
  344. //
  345. WINADVAPI
  346. BOOL WINAPI
  347. SaferGetPolicyInformation(
  348. IN DWORD dwScopeId,
  349. IN SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass,
  350. IN DWORD InfoBufferSize,
  351. IN OUT PVOID InfoBuffer,
  352. IN OUT PDWORD InfoBufferRetSize,
  353. IN LPVOID lpReserved
  354. );
  355. WINADVAPI
  356. BOOL WINAPI
  357. SaferSetPolicyInformation(
  358. IN DWORD dwScopeId,
  359. IN SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass,
  360. IN DWORD InfoBufferSize,
  361. IN PVOID InfoBuffer,
  362. IN LPVOID lpReserved
  363. );
  364. //
  365. // Functions to open or close a handle to a Safer Level.
  366. //
  367. WINADVAPI
  368. BOOL WINAPI
  369. SaferCreateLevel(
  370. IN DWORD dwScopeId,
  371. IN DWORD dwLevelId,
  372. IN DWORD OpenFlags,
  373. OUT SAFER_LEVEL_HANDLE * pLevelHandle,
  374. IN LPVOID lpReserved
  375. );
  376. WINADVAPI
  377. BOOL WINAPI
  378. SaferCloseLevel(
  379. IN SAFER_LEVEL_HANDLE hLevelHandle
  380. );
  381. WINADVAPI
  382. BOOL WINAPI
  383. SaferIdentifyLevel(
  384. IN DWORD dwNumProperties,
  385. IN PSAFER_CODE_PROPERTIES pCodeProperties,
  386. OUT SAFER_LEVEL_HANDLE * pLevelHandle,
  387. IN LPVOID lpReserved
  388. );
  389. WINADVAPI
  390. BOOL WINAPI
  391. SaferComputeTokenFromLevel(
  392. IN SAFER_LEVEL_HANDLE LevelHandle,
  393. IN HANDLE InAccessToken OPTIONAL,
  394. OUT PHANDLE OutAccessToken,
  395. IN DWORD dwFlags,
  396. IN LPVOID lpReserved
  397. );
  398. WINADVAPI
  399. BOOL WINAPI
  400. SaferGetLevelInformation(
  401. IN SAFER_LEVEL_HANDLE LevelHandle,
  402. IN SAFER_OBJECT_INFO_CLASS dwInfoType,
  403. OUT LPVOID lpQueryBuffer OPTIONAL,
  404. IN DWORD dwInBufferSize,
  405. OUT LPDWORD lpdwOutBufferSize
  406. );
  407. WINADVAPI
  408. BOOL WINAPI
  409. SaferSetLevelInformation(
  410. IN SAFER_LEVEL_HANDLE LevelHandle,
  411. IN SAFER_OBJECT_INFO_CLASS dwInfoType,
  412. IN LPVOID lpQueryBuffer,
  413. IN DWORD dwInBufferSize
  414. );
  415. //
  416. // This function performs logging of messages to the Application
  417. // event log. This is called by the hooks within CreateProcess,
  418. // ShellExecute and cmd when a lower trust evaluation result occurs.
  419. //
  420. WINADVAPI
  421. BOOL WINAPI
  422. SaferRecordEventLogEntry(
  423. IN SAFER_LEVEL_HANDLE hLevel,
  424. IN LPCWSTR szTargetPath,
  425. IN LPVOID lpReserved
  426. );
  427. WINADVAPI
  428. BOOL WINAPI
  429. SaferiIsExecutableFileType(
  430. IN LPCWSTR szFullPathname,
  431. IN BOOLEAN bFromShellExecute
  432. );
  433. ;begin_internal
  434. //
  435. // Private registry key locations.
  436. //
  437. #define SAFER_HKLM_REGBASE L"Software\\Policies\\Microsoft\\Windows\\Safer"
  438. #define SAFER_HKCU_REGBASE L"Software\\Policies\\Microsoft\\Windows\\Safer"
  439. //
  440. // default winsafer executable file types as a multisz string
  441. //
  442. #define SAFER_DEFAULT_EXECUTABLE_FILE_TYPES L"ADE\0ADP\0BAS\0BAT\0CHM\0\
  443. CMD\0COM\0CPL\0CRT\0EXE\0HLP\0HTA\0INF\0INS\0ISP\0LNK\0MDB\0MDE\0MSC\0\
  444. MSI\0MSP\0MST\0OCX\0PCD\0PIF\0REG\0SCR\0SHS\0URL\0VB\0WSC\0"
  445. //
  446. // name of the objects sub-branch.
  447. //
  448. #define SAFER_OBJECTS_REGSUBKEY L"LevelObjects"
  449. //
  450. // names of the values under each of the object sub-branches.
  451. //
  452. #define SAFER_OBJFRIENDLYNAME_REGVALUEW L"FriendlyName"
  453. #define SAFER_OBJDESCRIPTION_REGVALUEW L"Description"
  454. #define SAFER_OBJDISALLOW_REGVALUE L"DisallowExecution"
  455. //
  456. // name of the code identifiers sub-branch
  457. //
  458. #define SAFER_CODEIDS_REGSUBKEY L"CodeIdentifiers"
  459. //
  460. // name of the value under the top level code identifier branch.
  461. //
  462. #define SAFER_DEFAULTOBJ_REGVALUE L"DefaultLevel"
  463. #define SAFER_TRANSPARENTENABLED_REGVALUE L"TransparentEnabled"
  464. #define SAFER_HONORUSER_REGVALUE L"HonorUserIdentities"
  465. #define SAFER_EXETYPES_REGVALUE L"ExecutableTypes"
  466. #define SAFER_POLICY_SCOPE L"PolicyScope"
  467. #define SAFER_LOGFILE_NAME L"LogFileName"
  468. #define SAFER_HIDDEN_LEVELS L"Levels"
  469. #define SAFER_AUTHENTICODE_REGVALUE L"AuthenticodeEnabled"
  470. //
  471. // names of the various subkeys under the code identifier sub-branches
  472. //
  473. #define SAFER_PATHS_REGSUBKEY L"Paths"
  474. #define SAFER_HASHMD5_REGSUBKEY L"Hashes"
  475. #define SAFER_SOURCEURL_REGSUBKEY L"UrlZones"
  476. //
  477. // names of the various values under each code identifiery sub-branch.
  478. //
  479. #define SAFER_IDS_LASTMODIFIED_REGVALUE L"LastModified"
  480. #define SAFER_IDS_DESCRIPTION_REGVALUE L"Description"
  481. #define SAFER_IDS_ITEMSIZE_REGVALUE L"ItemSize"
  482. #define SAFER_IDS_ITEMDATA_REGVALUE L"ItemData"
  483. #define SAFER_IDS_SAFERFLAGS_REGVALUE L"SaferFlags"
  484. #define SAFER_IDS_FRIENDLYNAME_REGVALUE L"FriendlyName"
  485. #define SAFER_IDS_HASHALG_REGVALUE L"HashAlg"
  486. #define SAFER_VALUE_NAME_DEFAULT_LEVEL L"DefaultLevel"
  487. #define SAFER_VALUE_NAME_HASH_SIZE L"HashSize"
  488. //
  489. // registry values
  490. //
  491. #define SAFER_IDS_LEVEL_DESCRIPTION_FULLY_TRUSTED L"DescriptionFullyTrusted"
  492. #define SAFER_IDS_LEVEL_DESCRIPTION_NORMAL_USER L"DescriptionNormalUser"
  493. #define SAFER_IDS_LEVEL_DESCRIPTION_CONSTRAINED L"DescriptionConstrained"
  494. #define SAFER_IDS_LEVEL_DESCRIPTION_UNTRUSTED L"DescriptionUntrusted"
  495. #define SAFER_IDS_LEVEL_DESCRIPTION_DISALLOWED L"DescriptionDisallowed"
  496. //
  497. // defines for OOB rules
  498. //
  499. //#define SAFER_DEFAULT_OLK_RULE_PATH L"%USERPROFILE%\\Local Settings\\Temporary Internet Files\\OLK\\"
  500. #define SAFER_LEVEL_ZERO L"0"
  501. #define SAFER_REGKEY_SEPERATOR L"\\"
  502. #define SAFER_DEFAULT_RULE_GUID L"{dda3f824-d8cb-441b-834d-be2efd2c1a33}"
  503. #define SAFERP_WINDOWS_GUID {0x191cd7fa, 0xf240, 0x4a17, 0x89, 0x86, 0x94, 0xd4, 0x80, 0xa6, 0xc8, 0xca}
  504. #define SAFERP_WINDOWS_EXE_GUID {0x7272edfb, 0xaf9f, 0x4ddf, 0xb6, 0x5b, 0xe4, 0x28, 0x2f, 0x2d, 0xee, 0xfc}
  505. #define SAFERP_SYSTEM_EXE_GUID {0x8868b733, 0x4b3a, 0x48f8, 0x91, 0x36, 0xaa, 0x6d, 0x05, 0xd4, 0xfc, 0x83}
  506. #define SAFERP_PROGRAMFILES_GUID {0xd2c34ab2, 0x529a, 0x46b2, 0xb2, 0x93, 0xfc, 0x85, 0x3f, 0xce, 0x72, 0xea}
  507. #define SAFER_GUID_RESULT_TRUSTED_CERT \
  508. { 0xc59e7b5a, \
  509. 0xaf71, \
  510. 0x4595, \
  511. {0xb8, 0xdb, 0x46, 0xb4, 0x91, 0xe8, 0x90, 0x07} }
  512. #define SAFER_GUID_RESULT_DEFAULT_LEVEL \
  513. { 0x11015445, \
  514. 0xd282, \
  515. 0x4f86, \
  516. {0x96, 0xa2, 0x9e, 0x48, 0x5f, 0x59, 0x33, 0x02} }
  517. //
  518. // The following is a private function that is exported
  519. // for WinVerifyTrust to call to determine if a given hash has a
  520. // WinSafer policy associated with it.
  521. //
  522. BOOL WINAPI
  523. SaferiSearchMatchingHashRules(
  524. IN ALG_ID HashAlgorithm OPTIONAL,
  525. IN PBYTE pHashBytes,
  526. IN DWORD dwHashSize,
  527. IN DWORD dwOriginalImageSize OPTIONAL,
  528. OUT PDWORD pdwFoundLevel,
  529. OUT PDWORD pdwSaferFlags
  530. );
  531. //
  532. // The following is a private function exported to allow the current
  533. // registry scope to be altered. This has the effect of changing
  534. // how AUTHZSCOPEID_REGISTRY is interepreted.
  535. //
  536. WINADVAPI
  537. BOOL WINAPI
  538. SaferiChangeRegistryScope(
  539. IN HKEY hKeyCustomRoot OPTIONAL,
  540. IN DWORD dwKeyOptions
  541. );
  542. //
  543. // The following is a private function provided to try to empiracally
  544. // determine if the two access token have been restricted with comparable
  545. // WinSafer authorization Levels. When TRUE is returned, the pdwResult
  546. // output parameter will receive any of the following values:
  547. // -1 = Client's access token is more authorized than Server's.
  548. // 0 = Client's access token is comparable level to Server's.
  549. // 1 = Server's access token is more authorized than Clients's.
  550. //
  551. WINADVAPI
  552. BOOL WINAPI
  553. SaferiCompareTokenLevels (
  554. IN HANDLE ClientAccessToken,
  555. IN HANDLE ServerAccessToken,
  556. OUT PDWORD pdwResult
  557. );
  558. //
  559. // The following is a private function exported to allow population if defaults in
  560. // the registry.
  561. //
  562. BOOL WINAPI
  563. SaferiPopulateDefaultsInRegistry(
  564. IN HKEY hKeyBase,
  565. OUT BOOL *pbSetDefaults
  566. );
  567. ;end_internal
  568. ;begin_both
  569. #ifdef __cplusplus
  570. }
  571. #endif
  572. ;end_both
  573. #endif