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.

183 lines
5.2 KiB

  1. #ifdef __cplusplus
  2. extern "C" {
  3. #endif
  4. #define SAFER_SCOPEID_REGISTRY 3
  5. #define SAFER_LEVEL_DELETE 2
  6. #define SAFER_LEVEL_CREATE 4
  7. //
  8. // Private registry key locations.
  9. //
  10. #define SAFER_HKLM_REGBASE L"Software\\Policies\\Microsoft\\Windows\\Safer"
  11. #define SAFER_HKCU_REGBASE L"Software\\Policies\\Microsoft\\Windows\\Safer"
  12. //
  13. // default winsafer executable file types as a multisz string
  14. //
  15. #define SAFER_DEFAULT_EXECUTABLE_FILE_TYPES L"ADE\0ADP\0BAS\0BAT\0CHM\0\
  16. CMD\0COM\0CPL\0CRT\0EXE\0HLP\0HTA\0INF\0INS\0ISP\0LNK\0MDB\0MDE\0MSC\0\
  17. MSI\0MSP\0MST\0OCX\0PCD\0PIF\0REG\0SCR\0SHS\0URL\0VB\0WSC\0"
  18. //
  19. // name of the objects sub-branch.
  20. //
  21. #define SAFER_OBJECTS_REGSUBKEY L"LevelObjects"
  22. //
  23. // names of the values under each of the object sub-branches.
  24. //
  25. #define SAFER_OBJFRIENDLYNAME_REGVALUEW L"FriendlyName"
  26. #define SAFER_OBJDESCRIPTION_REGVALUEW L"Description"
  27. #define SAFER_OBJDISALLOW_REGVALUE L"DisallowExecution"
  28. //
  29. // name of the code identifiers sub-branch
  30. //
  31. #define SAFER_CODEIDS_REGSUBKEY L"CodeIdentifiers"
  32. //
  33. // name of the value under the top level code identifier branch.
  34. //
  35. #define SAFER_DEFAULTOBJ_REGVALUE L"DefaultLevel"
  36. #define SAFER_TRANSPARENTENABLED_REGVALUE L"TransparentEnabled"
  37. #define SAFER_HONORUSER_REGVALUE L"HonorUserIdentities"
  38. #define SAFER_EXETYPES_REGVALUE L"ExecutableTypes"
  39. #define SAFER_POLICY_SCOPE L"PolicyScope"
  40. #define SAFER_LOGFILE_NAME L"LogFileName"
  41. #define SAFER_HIDDEN_LEVELS L"Levels"
  42. #define SAFER_AUTHENTICODE_REGVALUE L"AuthenticodeEnabled"
  43. //
  44. // names of the various subkeys under the code identifier sub-branches
  45. //
  46. #define SAFER_PATHS_REGSUBKEY L"Paths"
  47. #define SAFER_HASHMD5_REGSUBKEY L"Hashes"
  48. #define SAFER_SOURCEURL_REGSUBKEY L"UrlZones"
  49. //
  50. // names of the various values under each code identifiery sub-branch.
  51. //
  52. #define SAFER_IDS_LASTMODIFIED_REGVALUE L"LastModified"
  53. #define SAFER_IDS_DESCRIPTION_REGVALUE L"Description"
  54. #define SAFER_IDS_ITEMSIZE_REGVALUE L"ItemSize"
  55. #define SAFER_IDS_ITEMDATA_REGVALUE L"ItemData"
  56. #define SAFER_IDS_SAFERFLAGS_REGVALUE L"SaferFlags"
  57. #define SAFER_IDS_FRIENDLYNAME_REGVALUE L"FriendlyName"
  58. #define SAFER_IDS_HASHALG_REGVALUE L"HashAlg"
  59. #define SAFER_VALUE_NAME_DEFAULT_LEVEL L"DefaultLevel"
  60. #define SAFER_VALUE_NAME_HASH_SIZE L"HashSize"
  61. //
  62. // registry values
  63. //
  64. #define SAFER_IDS_LEVEL_DESCRIPTION_FULLY_TRUSTED L"DescriptionFullyTrusted"
  65. #define SAFER_IDS_LEVEL_DESCRIPTION_NORMAL_USER L"DescriptionNormalUser"
  66. #define SAFER_IDS_LEVEL_DESCRIPTION_CONSTRAINED L"DescriptionConstrained"
  67. #define SAFER_IDS_LEVEL_DESCRIPTION_UNTRUSTED L"DescriptionUntrusted"
  68. #define SAFER_IDS_LEVEL_DESCRIPTION_DISALLOWED L"DescriptionDisallowed"
  69. //
  70. // defines for OOB rules
  71. //
  72. //#define SAFER_DEFAULT_OLK_RULE_PATH L"%USERPROFILE%\\Local Settings\\Temporary Internet Files\\OLK\\"
  73. #define SAFER_LEVEL_ZERO L"0"
  74. #define SAFER_REGKEY_SEPERATOR L"\\"
  75. #define SAFER_DEFAULT_RULE_GUID L"{dda3f824-d8cb-441b-834d-be2efd2c1a33}"
  76. #define SAFER_GUID_RESULT_TRUSTED_CERT \
  77. { 0xc59e7b5a, \
  78. 0xaf71, \
  79. 0x4595, \
  80. {0xb8, 0xdb, 0x46, 0xb4, 0x91, 0xe8, 0x90, 0x07} }
  81. #define SAFER_GUID_RESULT_DEFAULT_LEVEL \
  82. { 0x11015445, \
  83. 0xd282, \
  84. 0x4f86, \
  85. {0x96, 0xa2, 0x9e, 0x48, 0x5f, 0x59, 0x33, 0x02} }
  86. //
  87. // The following is a private function that is exported
  88. // for WinVerifyTrust to call to determine if a given hash has a
  89. // WinSafer policy associated with it.
  90. //
  91. BOOL WINAPI
  92. SaferiSearchMatchingHashRules(
  93. IN ALG_ID HashAlgorithm OPTIONAL,
  94. IN PBYTE pHashBytes,
  95. IN DWORD dwHashSize,
  96. IN DWORD dwOriginalImageSize OPTIONAL,
  97. OUT PDWORD pdwFoundLevel,
  98. OUT PDWORD pdwSaferFlags
  99. );
  100. //
  101. // The following is a private function exported to allow the current
  102. // registry scope to be altered. This has the effect of changing
  103. // how AUTHZSCOPEID_REGISTRY is interepreted.
  104. //
  105. WINADVAPI
  106. BOOL WINAPI
  107. SaferiChangeRegistryScope(
  108. IN HKEY hKeyCustomRoot OPTIONAL,
  109. IN DWORD dwKeyOptions
  110. );
  111. //
  112. // The following is a private function provided to try to empiracally
  113. // determine if the two access token have been restricted with comparable
  114. // WinSafer authorization Levels. When TRUE is returned, the pdwResult
  115. // output parameter will receive any of the following values:
  116. // -1 = Client's access token is more authorized than Server's.
  117. // 0 = Client's access token is comparable level to Server's.
  118. // 1 = Server's access token is more authorized than Clients's.
  119. //
  120. WINADVAPI
  121. BOOL WINAPI
  122. SaferiCompareTokenLevels (
  123. IN HANDLE ClientAccessToken,
  124. IN HANDLE ServerAccessToken,
  125. OUT PDWORD pdwResult
  126. );
  127. WINADVAPI
  128. BOOL WINAPI
  129. SaferiIsExecutableFileType(
  130. IN LPCWSTR szFullPathname,
  131. IN BOOLEAN bFromShellExecute
  132. );
  133. //
  134. // The following is a private function exported to allow population if defaults in
  135. // the registry.
  136. //
  137. BOOL WINAPI
  138. SaferiPopulateDefaultsInRegistry(
  139. IN HKEY hKeyBase,
  140. OUT BOOL *pbSetDefaults
  141. );
  142. #ifdef __cplusplus
  143. }
  144. #endif