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.

185 lines
5.7 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 SAFERP_WINDOWS_GUID {0x191cd7fa, 0xf240, 0x4a17, 0x89, 0x86, 0x94, 0xd4, 0x80, 0xa6, 0xc8, 0xca}
  77. #define SAFERP_WINDOWS_EXE_GUID {0x7272edfb, 0xaf9f, 0x4ddf, 0xb6, 0x5b, 0xe4, 0x28, 0x2f, 0x2d, 0xee, 0xfc}
  78. #define SAFERP_SYSTEM_EXE_GUID {0x8868b733, 0x4b3a, 0x48f8, 0x91, 0x36, 0xaa, 0x6d, 0x05, 0xd4, 0xfc, 0x83}
  79. #define SAFERP_PROGRAMFILES_GUID {0xd2c34ab2, 0x529a, 0x46b2, 0xb2, 0x93, 0xfc, 0x85, 0x3f, 0xce, 0x72, 0xea}
  80. #define SAFER_GUID_RESULT_TRUSTED_CERT \
  81. { 0xc59e7b5a, \
  82. 0xaf71, \
  83. 0x4595, \
  84. {0xb8, 0xdb, 0x46, 0xb4, 0x91, 0xe8, 0x90, 0x07} }
  85. #define SAFER_GUID_RESULT_DEFAULT_LEVEL \
  86. { 0x11015445, \
  87. 0xd282, \
  88. 0x4f86, \
  89. {0x96, 0xa2, 0x9e, 0x48, 0x5f, 0x59, 0x33, 0x02} }
  90. //
  91. // The following is a private function that is exported
  92. // for WinVerifyTrust to call to determine if a given hash has a
  93. // WinSafer policy associated with it.
  94. //
  95. BOOL WINAPI
  96. SaferiSearchMatchingHashRules(
  97. IN ALG_ID HashAlgorithm OPTIONAL,
  98. IN PBYTE pHashBytes,
  99. IN DWORD dwHashSize,
  100. IN DWORD dwOriginalImageSize OPTIONAL,
  101. OUT PDWORD pdwFoundLevel,
  102. OUT PDWORD pdwSaferFlags
  103. );
  104. //
  105. // The following is a private function exported to allow the current
  106. // registry scope to be altered. This has the effect of changing
  107. // how AUTHZSCOPEID_REGISTRY is interepreted.
  108. //
  109. WINADVAPI
  110. BOOL WINAPI
  111. SaferiChangeRegistryScope(
  112. IN HKEY hKeyCustomRoot OPTIONAL,
  113. IN DWORD dwKeyOptions
  114. );
  115. //
  116. // The following is a private function provided to try to empiracally
  117. // determine if the two access token have been restricted with comparable
  118. // WinSafer authorization Levels. When TRUE is returned, the pdwResult
  119. // output parameter will receive any of the following values:
  120. // -1 = Client's access token is more authorized than Server's.
  121. // 0 = Client's access token is comparable level to Server's.
  122. // 1 = Server's access token is more authorized than Clients's.
  123. //
  124. WINADVAPI
  125. BOOL WINAPI
  126. SaferiCompareTokenLevels (
  127. IN HANDLE ClientAccessToken,
  128. IN HANDLE ServerAccessToken,
  129. OUT PDWORD pdwResult
  130. );
  131. //
  132. // The following is a private function exported to allow population if defaults in
  133. // the registry.
  134. //
  135. BOOL WINAPI
  136. SaferiPopulateDefaultsInRegistry(
  137. IN HKEY hKeyBase,
  138. OUT BOOL *pbSetDefaults
  139. );
  140. #ifdef __cplusplus
  141. }
  142. #endif