ntsecuritycon.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. # Hacked from winnt.h
  2. DELETE = (65536)
  3. READ_CONTROL = (131072)
  4. WRITE_DAC = (262144)
  5. WRITE_OWNER = (524288)
  6. SYNCHRONIZE = (1048576)
  7. STANDARD_RIGHTS_REQUIRED = (983040)
  8. STANDARD_RIGHTS_READ = (READ_CONTROL)
  9. STANDARD_RIGHTS_WRITE = (READ_CONTROL)
  10. STANDARD_RIGHTS_EXECUTE = (READ_CONTROL)
  11. STANDARD_RIGHTS_ALL = (2031616)
  12. SPECIFIC_RIGHTS_ALL = (65535)
  13. ACCESS_SYSTEM_SECURITY = (16777216)
  14. MAXIMUM_ALLOWED = (33554432)
  15. GENERIC_READ = (-2147483648)
  16. GENERIC_WRITE = (1073741824)
  17. GENERIC_EXECUTE = (536870912)
  18. GENERIC_ALL = (268435456)
  19. # file security permissions
  20. FILE_READ_DATA= ( 1 )
  21. FILE_LIST_DIRECTORY= ( 1 )
  22. FILE_WRITE_DATA= ( 2 )
  23. FILE_ADD_FILE= ( 2 )
  24. FILE_APPEND_DATA= ( 4 )
  25. FILE_ADD_SUBDIRECTORY= ( 4 )
  26. FILE_CREATE_PIPE_INSTANCE= ( 4 )
  27. FILE_READ_EA= ( 8 )
  28. FILE_WRITE_EA= ( 16 )
  29. FILE_EXECUTE= ( 32 )
  30. FILE_TRAVERSE= ( 32 )
  31. FILE_DELETE_CHILD= ( 64 )
  32. FILE_READ_ATTRIBUTES= ( 128 )
  33. FILE_WRITE_ATTRIBUTES= ( 256 )
  34. FILE_ALL_ACCESS= (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 511)
  35. FILE_GENERIC_READ= (STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE)
  36. FILE_GENERIC_WRITE= (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE)
  37. FILE_GENERIC_EXECUTE= (STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE)
  38. SECURITY_NULL_SID_AUTHORITY = (0,0,0,0,0,0)
  39. SECURITY_WORLD_SID_AUTHORITY = (0,0,0,0,0,1)
  40. SECURITY_LOCAL_SID_AUTHORITY = (0,0,0,0,0,2)
  41. SECURITY_CREATOR_SID_AUTHORITY = (0,0,0,0,0,3)
  42. SECURITY_NON_UNIQUE_AUTHORITY = (0,0,0,0,0,4)
  43. SECURITY_RESOURCE_MANAGER_AUTHORITY = (0,0,0,0,0,9)
  44. SECURITY_NULL_RID = 0
  45. SECURITY_WORLD_RID = 0
  46. SECURITY_LOCAL_RID = 0X00000000
  47. SECURITY_CREATOR_OWNER_RID = 0
  48. SECURITY_CREATOR_GROUP_RID = 1
  49. SECURITY_CREATOR_OWNER_SERVER_RID = 2
  50. SECURITY_CREATOR_GROUP_SERVER_RID = 3
  51. SECURITY_CREATOR_OWNER_RIGHTS_RID = 4
  52. # NT well-known SIDs
  53. SECURITY_NT_AUTHORITY = (0,0,0,0,0,5)
  54. SECURITY_DIALUP_RID = 1
  55. SECURITY_NETWORK_RID = 2
  56. SECURITY_BATCH_RID = 3
  57. SECURITY_INTERACTIVE_RID = 4
  58. SECURITY_SERVICE_RID = 6
  59. SECURITY_ANONYMOUS_LOGON_RID = 7
  60. SECURITY_PROXY_RID = 8
  61. SECURITY_SERVER_LOGON_RID = 9
  62. SECURITY_LOGON_IDS_RID = 5
  63. SECURITY_LOGON_IDS_RID_COUNT = 3
  64. SECURITY_LOCAL_SYSTEM_RID = 18
  65. SECURITY_NT_NON_UNIQUE = 21
  66. SECURITY_BUILTIN_DOMAIN_RID = 32
  67. # well-known domain relative sub-authority values (RIDs)...
  68. DOMAIN_USER_RID_ADMIN = 500
  69. DOMAIN_USER_RID_GUEST = 501
  70. DOMAIN_USER_RID_KRBTGT = 502
  71. DOMAIN_USER_RID_MAX = 999
  72. # well-known groups ...
  73. DOMAIN_GROUP_RID_ADMINS = 512
  74. DOMAIN_GROUP_RID_USERS = 513
  75. DOMAIN_GROUP_RID_GUESTS = 514
  76. DOMAIN_GROUP_RID_COMPUTERS = 515
  77. DOMAIN_GROUP_RID_CONTROLLERS = 516
  78. DOMAIN_GROUP_RID_CERT_ADMINS = 517
  79. DOMAIN_GROUP_RID_SCHEMA_ADMINS = 518
  80. DOMAIN_GROUP_RID_ENTERPRISE_ADMINS = 519
  81. DOMAIN_GROUP_RID_POLICY_ADMINS = 520
  82. DOMAIN_GROUP_RID_READONLY_CONTROLLERS = 521
  83. # well-known aliases ...
  84. DOMAIN_ALIAS_RID_ADMINS = 544
  85. DOMAIN_ALIAS_RID_USERS = 545
  86. DOMAIN_ALIAS_RID_GUESTS = 546
  87. DOMAIN_ALIAS_RID_POWER_USERS = 547
  88. DOMAIN_ALIAS_RID_ACCOUNT_OPS = 548
  89. DOMAIN_ALIAS_RID_SYSTEM_OPS = 549
  90. DOMAIN_ALIAS_RID_PRINT_OPS = 550
  91. DOMAIN_ALIAS_RID_BACKUP_OPS = 551
  92. DOMAIN_ALIAS_RID_REPLICATOR = 552
  93. DOMAIN_ALIAS_RID_RAS_SERVERS = 553
  94. DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 554
  95. DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 555
  96. DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 556
  97. DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 557
  98. DOMAIN_ALIAS_RID_MONITORING_USERS = 558
  99. DOMAIN_ALIAS_RID_LOGGING_USERS = 559
  100. DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 560
  101. DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 561
  102. DOMAIN_ALIAS_RID_DCOM_USERS = 562
  103. DOMAIN_ALIAS_RID_IUSERS = 568
  104. DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = 569
  105. DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = 571
  106. DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = 572
  107. DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = 573
  108. SECURITY_MANDATORY_LABEL_AUTHORITY = (0,0,0,0,0,16)
  109. SECURITY_MANDATORY_UNTRUSTED_RID = 0x00000000
  110. SECURITY_MANDATORY_LOW_RID = 0x00001000
  111. SECURITY_MANDATORY_MEDIUM_RID = 0x00002000
  112. SECURITY_MANDATORY_HIGH_RID = 0x00003000
  113. SECURITY_MANDATORY_SYSTEM_RID = 0x00004000
  114. SECURITY_MANDATORY_PROTECTED_PROCESS_RID = 0x00005000
  115. SECURITY_MANDATORY_MAXIMUM_USER_RID = SECURITY_MANDATORY_SYSTEM_RID
  116. SYSTEM_LUID = (999, 0)
  117. ANONYMOUS_LOGON_LUID = (998, 0)
  118. LOCALSERVICE_LUID = (997, 0)
  119. NETWORKSERVICE_LUID = (996, 0)
  120. IUSER_LUID = (995, 0)
  121. # Group attributes
  122. SE_GROUP_MANDATORY = 1
  123. SE_GROUP_ENABLED_BY_DEFAULT = 2
  124. SE_GROUP_ENABLED = 4
  125. SE_GROUP_OWNER = 8
  126. SE_GROUP_USE_FOR_DENY_ONLY = 16
  127. SE_GROUP_INTEGRITY = 32
  128. SE_GROUP_INTEGRITY_ENABLED = 64
  129. SE_GROUP_RESOURCE = 536870912
  130. SE_GROUP_LOGON_ID = -1073741824
  131. # User attributes
  132. # (None yet defined.)
  133. # ACE types
  134. ACCESS_MIN_MS_ACE_TYPE = (0)
  135. ACCESS_ALLOWED_ACE_TYPE = (0)
  136. ACCESS_DENIED_ACE_TYPE = (1)
  137. SYSTEM_AUDIT_ACE_TYPE = (2)
  138. SYSTEM_ALARM_ACE_TYPE = (3)
  139. ACCESS_MAX_MS_V2_ACE_TYPE = (3)
  140. ACCESS_ALLOWED_COMPOUND_ACE_TYPE = (4)
  141. ACCESS_MAX_MS_V3_ACE_TYPE = (4)
  142. ACCESS_MIN_MS_OBJECT_ACE_TYPE = (5)
  143. ACCESS_ALLOWED_OBJECT_ACE_TYPE = (5)
  144. ACCESS_DENIED_OBJECT_ACE_TYPE = (6)
  145. SYSTEM_AUDIT_OBJECT_ACE_TYPE = (7)
  146. SYSTEM_ALARM_OBJECT_ACE_TYPE = (8)
  147. ACCESS_MAX_MS_OBJECT_ACE_TYPE = (8)
  148. ACCESS_MAX_MS_V4_ACE_TYPE = (8)
  149. ACCESS_MAX_MS_ACE_TYPE = (8)
  150. ACCESS_ALLOWED_CALLBACK_ACE_TYPE = 9
  151. ACCESS_DENIED_CALLBACK_ACE_TYPE = 10
  152. ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE = 11
  153. ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE = 12
  154. SYSTEM_AUDIT_CALLBACK_ACE_TYPE = 13
  155. SYSTEM_ALARM_CALLBACK_ACE_TYPE = 14
  156. SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE = 15
  157. SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE = 16
  158. SYSTEM_MANDATORY_LABEL_ACE_TYPE = 17
  159. ACCESS_MAX_MS_V5_ACE_TYPE = 17
  160. # The following are the inherit flags that go into the AceFlags field
  161. # of an Ace header.
  162. OBJECT_INHERIT_ACE = 1
  163. CONTAINER_INHERIT_ACE = 2
  164. NO_PROPAGATE_INHERIT_ACE = 4
  165. INHERIT_ONLY_ACE = 8
  166. VALID_INHERIT_FLAGS = 15
  167. SUCCESSFUL_ACCESS_ACE_FLAG = 64
  168. FAILED_ACCESS_ACE_FLAG = 128
  169. SE_OWNER_DEFAULTED = 1
  170. SE_GROUP_DEFAULTED = 2
  171. SE_DACL_PRESENT = 4
  172. SE_DACL_DEFAULTED = 8
  173. SE_SACL_PRESENT = 16
  174. SE_SACL_DEFAULTED = 32
  175. SE_SELF_RELATIVE = 32768
  176. SE_PRIVILEGE_ENABLED_BY_DEFAULT = 1
  177. SE_PRIVILEGE_ENABLED = 2
  178. SE_PRIVILEGE_USED_FOR_ACCESS = -2147483648
  179. PRIVILEGE_SET_ALL_NECESSARY = 1
  180. # NT Defined Privileges
  181. SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege"
  182. SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege"
  183. SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege"
  184. SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege"
  185. SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege"
  186. SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege"
  187. SE_TCB_NAME = "SeTcbPrivilege"
  188. SE_SECURITY_NAME = "SeSecurityPrivilege"
  189. SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege"
  190. SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege"
  191. SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege"
  192. SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege"
  193. SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege"
  194. SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege"
  195. SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege"
  196. SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege"
  197. SE_BACKUP_NAME = "SeBackupPrivilege"
  198. SE_RESTORE_NAME = "SeRestorePrivilege"
  199. SE_SHUTDOWN_NAME = "SeShutdownPrivilege"
  200. SE_DEBUG_NAME = "SeDebugPrivilege"
  201. SE_AUDIT_NAME = "SeAuditPrivilege"
  202. SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege"
  203. SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege"
  204. SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege"
  205. # Enum SECURITY_IMPERSONATION_LEVEL:
  206. SecurityAnonymous = 0
  207. SecurityIdentification = 1
  208. SecurityImpersonation = 2
  209. SecurityDelegation = 3
  210. SECURITY_MAX_IMPERSONATION_LEVEL = SecurityDelegation
  211. DEFAULT_IMPERSONATION_LEVEL = SecurityImpersonation
  212. TOKEN_ASSIGN_PRIMARY = 1
  213. TOKEN_DUPLICATE = 2
  214. TOKEN_IMPERSONATE = 4
  215. TOKEN_QUERY = 8
  216. TOKEN_QUERY_SOURCE = 16
  217. TOKEN_ADJUST_PRIVILEGES = 32
  218. TOKEN_ADJUST_GROUPS = 64
  219. TOKEN_ADJUST_DEFAULT = 128
  220. TOKEN_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED |\
  221. TOKEN_ASSIGN_PRIMARY |\
  222. TOKEN_DUPLICATE |\
  223. TOKEN_IMPERSONATE |\
  224. TOKEN_QUERY |\
  225. TOKEN_QUERY_SOURCE |\
  226. TOKEN_ADJUST_PRIVILEGES |\
  227. TOKEN_ADJUST_GROUPS |\
  228. TOKEN_ADJUST_DEFAULT)
  229. TOKEN_READ = (STANDARD_RIGHTS_READ |\
  230. TOKEN_QUERY)
  231. TOKEN_WRITE = (STANDARD_RIGHTS_WRITE |\
  232. TOKEN_ADJUST_PRIVILEGES |\
  233. TOKEN_ADJUST_GROUPS |\
  234. TOKEN_ADJUST_DEFAULT)
  235. TOKEN_EXECUTE = (STANDARD_RIGHTS_EXECUTE)
  236. SidTypeUser = 1
  237. SidTypeGroup = 2
  238. SidTypeDomain =3
  239. SidTypeAlias = 4
  240. SidTypeWellKnownGroup = 5
  241. SidTypeDeletedAccount = 6
  242. SidTypeInvalid = 7
  243. SidTypeUnknown = 8
  244. SidTypeComputer = 9
  245. SidTypeLabel = 10
  246. # Token types
  247. TokenPrimary = 1
  248. TokenImpersonation = 2
  249. # TOKEN_INFORMATION_CLASS, used with Get/SetTokenInformation
  250. TokenUser = 1
  251. TokenGroups = 2
  252. TokenPrivileges = 3
  253. TokenOwner = 4
  254. TokenPrimaryGroup = 5
  255. TokenDefaultDacl = 6
  256. TokenSource = 7
  257. TokenType = 8
  258. TokenImpersonationLevel = 9
  259. TokenStatistics = 10
  260. TokenRestrictedSids = 11
  261. TokenSessionId = 12
  262. TokenGroupsAndPrivileges = 13
  263. TokenSessionReference = 14
  264. TokenSandBoxInert = 15
  265. TokenAuditPolicy = 16
  266. TokenOrigin = 17
  267. TokenElevationType = 18
  268. TokenLinkedToken = 19
  269. TokenElevation = 20
  270. TokenHasRestrictions = 21
  271. TokenAccessInformation = 22
  272. TokenVirtualizationAllowed = 23
  273. TokenVirtualizationEnabled = 24
  274. TokenIntegrityLevel = 25
  275. TokenUIAccess = 26
  276. TokenMandatoryPolicy = 27
  277. TokenLogonSid = 28
  278. # DirectoryService related constants.
  279. # Generated by h2py from NtDsAPI.h
  280. DS_BEHAVIOR_WIN2000 = 0
  281. DS_BEHAVIOR_WIN2003_WITH_MIXED_DOMAINS = 1
  282. DS_BEHAVIOR_WIN2003 = 2
  283. DS_SYNCED_EVENT_NAME = "NTDSInitialSyncsCompleted"
  284. ACTRL_DS_OPEN = 0x00000000
  285. ACTRL_DS_CREATE_CHILD = 0x00000001
  286. ACTRL_DS_DELETE_CHILD = 0x00000002
  287. ACTRL_DS_LIST = 0x00000004
  288. ACTRL_DS_SELF = 0x00000008
  289. ACTRL_DS_READ_PROP = 0x00000010
  290. ACTRL_DS_WRITE_PROP = 0x00000020
  291. ACTRL_DS_DELETE_TREE = 0x00000040
  292. ACTRL_DS_LIST_OBJECT = 0x00000080
  293. ACTRL_DS_CONTROL_ACCESS = 0x00000100
  294. NTDSAPI_BIND_ALLOW_DELEGATION = (0x00000001)
  295. DS_REPSYNC_ASYNCHRONOUS_OPERATION = 0x00000001
  296. DS_REPSYNC_WRITEABLE = 0x00000002
  297. DS_REPSYNC_PERIODIC = 0x00000004
  298. DS_REPSYNC_INTERSITE_MESSAGING = 0x00000008
  299. DS_REPSYNC_ALL_SOURCES = 0x00000010
  300. DS_REPSYNC_FULL = 0x00000020
  301. DS_REPSYNC_URGENT = 0x00000040
  302. DS_REPSYNC_NO_DISCARD = 0x00000080
  303. DS_REPSYNC_FORCE = 0x00000100
  304. DS_REPSYNC_ADD_REFERENCE = 0x00000200
  305. DS_REPSYNC_NEVER_COMPLETED = 0x00000400
  306. DS_REPSYNC_TWO_WAY = 0x00000800
  307. DS_REPSYNC_NEVER_NOTIFY = 0x00001000
  308. DS_REPSYNC_INITIAL = 0x00002000
  309. DS_REPSYNC_USE_COMPRESSION = 0x00004000
  310. DS_REPSYNC_ABANDONED = 0x00008000
  311. DS_REPSYNC_INITIAL_IN_PROGRESS = 0x00010000
  312. DS_REPSYNC_PARTIAL_ATTRIBUTE_SET = 0x00020000
  313. DS_REPSYNC_REQUEUE = 0x00040000
  314. DS_REPSYNC_NOTIFICATION = 0x00080000
  315. DS_REPSYNC_ASYNCHRONOUS_REPLICA = 0x00100000
  316. DS_REPSYNC_CRITICAL = 0x00200000
  317. DS_REPSYNC_FULL_IN_PROGRESS = 0x00400000
  318. DS_REPSYNC_PREEMPTED = 0x00800000
  319. DS_REPADD_ASYNCHRONOUS_OPERATION = 0x00000001
  320. DS_REPADD_WRITEABLE = 0x00000002
  321. DS_REPADD_INITIAL = 0x00000004
  322. DS_REPADD_PERIODIC = 0x00000008
  323. DS_REPADD_INTERSITE_MESSAGING = 0x00000010
  324. DS_REPADD_ASYNCHRONOUS_REPLICA = 0x00000020
  325. DS_REPADD_DISABLE_NOTIFICATION = 0x00000040
  326. DS_REPADD_DISABLE_PERIODIC = 0x00000080
  327. DS_REPADD_USE_COMPRESSION = 0x00000100
  328. DS_REPADD_NEVER_NOTIFY = 0x00000200
  329. DS_REPADD_TWO_WAY = 0x00000400
  330. DS_REPADD_CRITICAL = 0x00000800
  331. DS_REPDEL_ASYNCHRONOUS_OPERATION = 0x00000001
  332. DS_REPDEL_WRITEABLE = 0x00000002
  333. DS_REPDEL_INTERSITE_MESSAGING = 0x00000004
  334. DS_REPDEL_IGNORE_ERRORS = 0x00000008
  335. DS_REPDEL_LOCAL_ONLY = 0x00000010
  336. DS_REPDEL_NO_SOURCE = 0x00000020
  337. DS_REPDEL_REF_OK = 0x00000040
  338. DS_REPMOD_ASYNCHRONOUS_OPERATION = 0x00000001
  339. DS_REPMOD_WRITEABLE = 0x00000002
  340. DS_REPMOD_UPDATE_FLAGS = 0x00000001
  341. DS_REPMOD_UPDATE_ADDRESS = 0x00000002
  342. DS_REPMOD_UPDATE_SCHEDULE = 0x00000004
  343. DS_REPMOD_UPDATE_RESULT = 0x00000008
  344. DS_REPMOD_UPDATE_TRANSPORT = 0x00000010
  345. DS_REPUPD_ASYNCHRONOUS_OPERATION = 0x00000001
  346. DS_REPUPD_WRITEABLE = 0x00000002
  347. DS_REPUPD_ADD_REFERENCE = 0x00000004
  348. DS_REPUPD_DELETE_REFERENCE = 0x00000008
  349. DS_INSTANCETYPE_IS_NC_HEAD = 0x00000001
  350. DS_INSTANCETYPE_NC_IS_WRITEABLE = 0x00000004
  351. DS_INSTANCETYPE_NC_COMING = 0x00000010
  352. DS_INSTANCETYPE_NC_GOING = 0x00000020
  353. NTDSDSA_OPT_IS_GC = ( 1 << 0 )
  354. NTDSDSA_OPT_DISABLE_INBOUND_REPL = ( 1 << 1 )
  355. NTDSDSA_OPT_DISABLE_OUTBOUND_REPL = ( 1 << 2 )
  356. NTDSDSA_OPT_DISABLE_NTDSCONN_XLATE = ( 1 << 3 )
  357. NTDSCONN_OPT_IS_GENERATED = ( 1 << 0 )
  358. NTDSCONN_OPT_TWOWAY_SYNC = ( 1 << 1 )
  359. NTDSCONN_OPT_OVERRIDE_NOTIFY_DEFAULT = (1 << 2 )
  360. NTDSCONN_OPT_USE_NOTIFY = (1 << 3)
  361. NTDSCONN_OPT_DISABLE_INTERSITE_COMPRESSION = (1 << 4)
  362. NTDSCONN_OPT_USER_OWNED_SCHEDULE = (1 << 5)
  363. NTDSCONN_KCC_NO_REASON = ( 0 )
  364. NTDSCONN_KCC_GC_TOPOLOGY = ( 1 << 0 )
  365. NTDSCONN_KCC_RING_TOPOLOGY = ( 1 << 1 )
  366. NTDSCONN_KCC_MINIMIZE_HOPS_TOPOLOGY = ( 1 << 2 )
  367. NTDSCONN_KCC_STALE_SERVERS_TOPOLOGY = ( 1 << 3 )
  368. NTDSCONN_KCC_OSCILLATING_CONNECTION_TOPOLOGY = ( 1 << 4 )
  369. NTDSCONN_KCC_INTERSITE_GC_TOPOLOGY = (1 << 5)
  370. NTDSCONN_KCC_INTERSITE_TOPOLOGY = (1 << 6)
  371. NTDSCONN_KCC_SERVER_FAILOVER_TOPOLOGY = (1 << 7)
  372. NTDSCONN_KCC_SITE_FAILOVER_TOPOLOGY = (1 << 8)
  373. NTDSCONN_KCC_REDUNDANT_SERVER_TOPOLOGY = (1 << 9)
  374. FRSCONN_PRIORITY_MASK = 0x70000000
  375. FRSCONN_MAX_PRIORITY = 0x8
  376. NTDSCONN_OPT_IGNORE_SCHEDULE_MASK = (-2147483648)
  377. NTDSSETTINGS_OPT_IS_AUTO_TOPOLOGY_DISABLED = ( 1 << 0 )
  378. NTDSSETTINGS_OPT_IS_TOPL_CLEANUP_DISABLED = ( 1 << 1 )
  379. NTDSSETTINGS_OPT_IS_TOPL_MIN_HOPS_DISABLED = ( 1 << 2 )
  380. NTDSSETTINGS_OPT_IS_TOPL_DETECT_STALE_DISABLED = ( 1 << 3 )
  381. NTDSSETTINGS_OPT_IS_INTER_SITE_AUTO_TOPOLOGY_DISABLED = ( 1 << 4 )
  382. NTDSSETTINGS_OPT_IS_GROUP_CACHING_ENABLED = ( 1 << 5 )
  383. NTDSSETTINGS_OPT_FORCE_KCC_WHISTLER_BEHAVIOR = ( 1 << 6 )
  384. NTDSSETTINGS_OPT_FORCE_KCC_W2K_ELECTION = ( 1 << 7 )
  385. NTDSSETTINGS_OPT_IS_RAND_BH_SELECTION_DISABLED = ( 1 << 8 )
  386. NTDSSETTINGS_OPT_IS_SCHEDULE_HASHING_ENABLED = ( 1 << 9 )
  387. NTDSSETTINGS_OPT_IS_REDUNDANT_SERVER_TOPOLOGY_ENABLED = ( 1 << 10 )
  388. NTDSSETTINGS_DEFAULT_SERVER_REDUNDANCY = 2
  389. NTDSTRANSPORT_OPT_IGNORE_SCHEDULES = ( 1 << 0 )
  390. NTDSTRANSPORT_OPT_BRIDGES_REQUIRED = (1 << 1 )
  391. NTDSSITECONN_OPT_USE_NOTIFY = ( 1 << 0 )
  392. NTDSSITECONN_OPT_TWOWAY_SYNC = ( 1 << 1 )
  393. NTDSSITECONN_OPT_DISABLE_COMPRESSION = ( 1 << 2 )
  394. NTDSSITELINK_OPT_USE_NOTIFY = ( 1 << 0 )
  395. NTDSSITELINK_OPT_TWOWAY_SYNC = ( 1 << 1 )
  396. NTDSSITELINK_OPT_DISABLE_COMPRESSION = ( 1 << 2 )
  397. GUID_USERS_CONTAINER_A = "a9d1ca15768811d1aded00c04fd8d5cd"
  398. GUID_COMPUTRS_CONTAINER_A = "aa312825768811d1aded00c04fd8d5cd"
  399. GUID_SYSTEMS_CONTAINER_A = "ab1d30f3768811d1aded00c04fd8d5cd"
  400. GUID_DOMAIN_CONTROLLERS_CONTAINER_A = "a361b2ffffd211d1aa4b00c04fd7d83a"
  401. GUID_INFRASTRUCTURE_CONTAINER_A = "2fbac1870ade11d297c400c04fd8d5cd"
  402. GUID_DELETED_OBJECTS_CONTAINER_A = "18e2ea80684f11d2b9aa00c04f79f805"
  403. GUID_LOSTANDFOUND_CONTAINER_A = "ab8153b7768811d1aded00c04fd8d5cd"
  404. GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_A = "22b70c67d56e4efb91e9300fca3dc1aa"
  405. GUID_PROGRAM_DATA_CONTAINER_A = "09460c08ae1e4a4ea0f64aee7daa1e5a"
  406. GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_A = "f4be92a4c777485e878e9421d53087db"
  407. GUID_NTDS_QUOTAS_CONTAINER_A = "6227f0af1fc2410d8e3bb10615bb5b0f"
  408. GUID_USERS_CONTAINER_BYTE = "\xa9\xd1\xca\x15\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd"
  409. GUID_COMPUTRS_CONTAINER_BYTE = "\xaa\x31\x28\x25\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd"
  410. GUID_SYSTEMS_CONTAINER_BYTE = "\xab\x1d\x30\xf3\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd"
  411. GUID_DOMAIN_CONTROLLERS_CONTAINER_BYTE = "\xa3\x61\xb2\xff\xff\xd2\x11\xd1\xaa\x4b\x00\xc0\x4f\xd7\xd8\x3a"
  412. GUID_INFRASTRUCTURE_CONTAINER_BYTE = "\x2f\xba\xc1\x87\x0a\xde\x11\xd2\x97\xc4\x00\xc0\x4f\xd8\xd5\xcd"
  413. GUID_DELETED_OBJECTS_CONTAINER_BYTE = "\x18\xe2\xea\x80\x68\x4f\x11\xd2\xb9\xaa\x00\xc0\x4f\x79\xf8\x05"
  414. GUID_LOSTANDFOUND_CONTAINER_BYTE = "\xab\x81\x53\xb7\x76\x88\x11\xd1\xad\xed\x00\xc0\x4f\xd8\xd5\xcd"
  415. GUID_FOREIGNSECURITYPRINCIPALS_CONTAINER_BYTE = "\x22\xb7\x0c\x67\xd5\x6e\x4e\xfb\x91\xe9\x30\x0f\xca\x3d\xc1\xaa"
  416. GUID_PROGRAM_DATA_CONTAINER_BYTE = "\x09\x46\x0c\x08\xae\x1e\x4a\x4e\xa0\xf6\x4a\xee\x7d\xaa\x1e\x5a"
  417. GUID_MICROSOFT_PROGRAM_DATA_CONTAINER_BYTE = "\xf4\xbe\x92\xa4\xc7\x77\x48\x5e\x87\x8e\x94\x21\xd5\x30\x87\xdb"
  418. GUID_NTDS_QUOTAS_CONTAINER_BYTE = "\x62\x27\xf0\xaf\x1f\xc2\x41\x0d\x8e\x3b\xb1\x06\x15\xbb\x5b\x0f"
  419. DS_REPSYNCALL_NO_OPTIONS = 0x00000000
  420. DS_REPSYNCALL_ABORT_IF_SERVER_UNAVAILABLE = 0x00000001
  421. DS_REPSYNCALL_SYNC_ADJACENT_SERVERS_ONLY = 0x00000002
  422. DS_REPSYNCALL_ID_SERVERS_BY_DN = 0x00000004
  423. DS_REPSYNCALL_DO_NOT_SYNC = 0x00000008
  424. DS_REPSYNCALL_SKIP_INITIAL_CHECK = 0x00000010
  425. DS_REPSYNCALL_PUSH_CHANGES_OUTWARD = 0x00000020
  426. DS_REPSYNCALL_CROSS_SITE_BOUNDARIES = 0x00000040
  427. DS_LIST_DSA_OBJECT_FOR_SERVER = 0
  428. DS_LIST_DNS_HOST_NAME_FOR_SERVER = 1
  429. DS_LIST_ACCOUNT_OBJECT_FOR_SERVER = 2
  430. DS_ROLE_SCHEMA_OWNER = 0
  431. DS_ROLE_DOMAIN_OWNER = 1
  432. DS_ROLE_PDC_OWNER = 2
  433. DS_ROLE_RID_OWNER = 3
  434. DS_ROLE_INFRASTRUCTURE_OWNER = 4
  435. DS_SCHEMA_GUID_NOT_FOUND = 0
  436. DS_SCHEMA_GUID_ATTR = 1
  437. DS_SCHEMA_GUID_ATTR_SET = 2
  438. DS_SCHEMA_GUID_CLASS = 3
  439. DS_SCHEMA_GUID_CONTROL_RIGHT = 4
  440. DS_KCC_FLAG_ASYNC_OP = (1 << 0)
  441. DS_KCC_FLAG_DAMPED = (1 << 1)
  442. DS_EXIST_ADVISORY_MODE = (0x1)
  443. DS_REPL_INFO_FLAG_IMPROVE_LINKED_ATTRS = (0x00000001)
  444. DS_REPL_NBR_WRITEABLE = (0x00000010)
  445. DS_REPL_NBR_SYNC_ON_STARTUP = (0x00000020)
  446. DS_REPL_NBR_DO_SCHEDULED_SYNCS = (0x00000040)
  447. DS_REPL_NBR_USE_ASYNC_INTERSITE_TRANSPORT = (0x00000080)
  448. DS_REPL_NBR_TWO_WAY_SYNC = (0x00000200)
  449. DS_REPL_NBR_RETURN_OBJECT_PARENTS = (0x00000800)
  450. DS_REPL_NBR_FULL_SYNC_IN_PROGRESS = (0x00010000)
  451. DS_REPL_NBR_FULL_SYNC_NEXT_PACKET = (0x00020000)
  452. DS_REPL_NBR_NEVER_SYNCED = (0x00200000)
  453. DS_REPL_NBR_PREEMPTED = (0x01000000)
  454. DS_REPL_NBR_IGNORE_CHANGE_NOTIFICATIONS = (0x04000000)
  455. DS_REPL_NBR_DISABLE_SCHEDULED_SYNC = (0x08000000)
  456. DS_REPL_NBR_COMPRESS_CHANGES = (0x10000000)
  457. DS_REPL_NBR_NO_CHANGE_NOTIFICATIONS = (0x20000000)
  458. DS_REPL_NBR_PARTIAL_ATTRIBUTE_SET = (0x40000000)
  459. DS_REPL_NBR_MODIFIABLE_MASK = \
  460. ( \
  461. DS_REPL_NBR_SYNC_ON_STARTUP | \
  462. DS_REPL_NBR_DO_SCHEDULED_SYNCS | \
  463. DS_REPL_NBR_TWO_WAY_SYNC | \
  464. DS_REPL_NBR_IGNORE_CHANGE_NOTIFICATIONS | \
  465. DS_REPL_NBR_DISABLE_SCHEDULED_SYNC | \
  466. DS_REPL_NBR_COMPRESS_CHANGES | \
  467. DS_REPL_NBR_NO_CHANGE_NOTIFICATIONS \
  468. )
  469. # from enum DS_NAME_FORMAT
  470. DS_UNKNOWN_NAME = 0
  471. DS_FQDN_1779_NAME = 1
  472. DS_NT4_ACCOUNT_NAME = 2
  473. DS_DISPLAY_NAME = 3
  474. DS_UNIQUE_ID_NAME = 6
  475. DS_CANONICAL_NAME = 7
  476. DS_USER_PRINCIPAL_NAME = 8
  477. DS_CANONICAL_NAME_EX = 9
  478. DS_SERVICE_PRINCIPAL_NAME = 10
  479. DS_SID_OR_SID_HISTORY_NAME = 11
  480. DS_DNS_DOMAIN_NAME = 12
  481. DS_DOMAIN_SIMPLE_NAME = DS_USER_PRINCIPAL_NAME
  482. DS_ENTERPRISE_SIMPLE_NAME = DS_USER_PRINCIPAL_NAME
  483. # from enum DS_NAME_FLAGS
  484. DS_NAME_NO_FLAGS = 0x0
  485. DS_NAME_FLAG_SYNTACTICAL_ONLY = 0x1
  486. DS_NAME_FLAG_EVAL_AT_DC = 0x2
  487. DS_NAME_FLAG_GCVERIFY = 0x4
  488. DS_NAME_FLAG_TRUST_REFERRAL = 0x8
  489. # from enum DS_NAME_ERROR
  490. DS_NAME_NO_ERROR = 0
  491. DS_NAME_ERROR_RESOLVING = 1
  492. DS_NAME_ERROR_NOT_FOUND = 2
  493. DS_NAME_ERROR_NOT_UNIQUE = 3
  494. DS_NAME_ERROR_NO_MAPPING = 4
  495. DS_NAME_ERROR_DOMAIN_ONLY = 5
  496. DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 6
  497. DS_NAME_ERROR_TRUST_REFERRAL = 7
  498. # from enum DS_SPN_NAME_TYPE
  499. DS_SPN_DNS_HOST = 0
  500. DS_SPN_DN_HOST = 1
  501. DS_SPN_NB_HOST = 2
  502. DS_SPN_DOMAIN = 3
  503. DS_SPN_NB_DOMAIN = 4
  504. DS_SPN_SERVICE = 5
  505. # from enum DS_SPN_WRITE_OP
  506. DS_SPN_ADD_SPN_OP = 0
  507. DS_SPN_REPLACE_SPN_OP = 1
  508. DS_SPN_DELETE_SPN_OP = 2
  509. # Generated by h2py from DsGetDC.h
  510. DS_FORCE_REDISCOVERY = 0x00000001
  511. DS_DIRECTORY_SERVICE_REQUIRED = 0x00000010
  512. DS_DIRECTORY_SERVICE_PREFERRED = 0x00000020
  513. DS_GC_SERVER_REQUIRED = 0x00000040
  514. DS_PDC_REQUIRED = 0x00000080
  515. DS_BACKGROUND_ONLY = 0x00000100
  516. DS_IP_REQUIRED = 0x00000200
  517. DS_KDC_REQUIRED = 0x00000400
  518. DS_TIMESERV_REQUIRED = 0x00000800
  519. DS_WRITABLE_REQUIRED = 0x00001000
  520. DS_GOOD_TIMESERV_PREFERRED = 0x00002000
  521. DS_AVOID_SELF = 0x00004000
  522. DS_ONLY_LDAP_NEEDED = 0x00008000
  523. DS_IS_FLAT_NAME = 0x00010000
  524. DS_IS_DNS_NAME = 0x00020000
  525. DS_RETURN_DNS_NAME = 0x40000000
  526. DS_RETURN_FLAT_NAME = (-2147483648)
  527. DSGETDC_VALID_FLAGS = ( \
  528. DS_FORCE_REDISCOVERY | \
  529. DS_DIRECTORY_SERVICE_REQUIRED | \
  530. DS_DIRECTORY_SERVICE_PREFERRED | \
  531. DS_GC_SERVER_REQUIRED | \
  532. DS_PDC_REQUIRED | \
  533. DS_BACKGROUND_ONLY | \
  534. DS_IP_REQUIRED | \
  535. DS_KDC_REQUIRED | \
  536. DS_TIMESERV_REQUIRED | \
  537. DS_WRITABLE_REQUIRED | \
  538. DS_GOOD_TIMESERV_PREFERRED | \
  539. DS_AVOID_SELF | \
  540. DS_ONLY_LDAP_NEEDED | \
  541. DS_IS_FLAT_NAME | \
  542. DS_IS_DNS_NAME | \
  543. DS_RETURN_FLAT_NAME | \
  544. DS_RETURN_DNS_NAME )
  545. DS_INET_ADDRESS = 1
  546. DS_NETBIOS_ADDRESS = 2
  547. DS_PDC_FLAG = 0x00000001
  548. DS_GC_FLAG = 0x00000004
  549. DS_LDAP_FLAG = 0x00000008
  550. DS_DS_FLAG = 0x00000010
  551. DS_KDC_FLAG = 0x00000020
  552. DS_TIMESERV_FLAG = 0x00000040
  553. DS_CLOSEST_FLAG = 0x00000080
  554. DS_WRITABLE_FLAG = 0x00000100
  555. DS_GOOD_TIMESERV_FLAG = 0x00000200
  556. DS_NDNC_FLAG = 0x00000400
  557. DS_PING_FLAGS = 0x0000FFFF
  558. DS_DNS_CONTROLLER_FLAG = 0x20000000
  559. DS_DNS_DOMAIN_FLAG = 0x40000000
  560. DS_DNS_FOREST_FLAG = (-2147483648)
  561. DS_DOMAIN_IN_FOREST = 0x0001
  562. DS_DOMAIN_DIRECT_OUTBOUND = 0x0002
  563. DS_DOMAIN_TREE_ROOT = 0x0004
  564. DS_DOMAIN_PRIMARY = 0x0008
  565. DS_DOMAIN_NATIVE_MODE = 0x0010
  566. DS_DOMAIN_DIRECT_INBOUND = 0x0020
  567. DS_DOMAIN_VALID_FLAGS = ( \
  568. DS_DOMAIN_IN_FOREST | \
  569. DS_DOMAIN_DIRECT_OUTBOUND | \
  570. DS_DOMAIN_TREE_ROOT | \
  571. DS_DOMAIN_PRIMARY | \
  572. DS_DOMAIN_NATIVE_MODE | \
  573. DS_DOMAIN_DIRECT_INBOUND )
  574. DS_GFTI_UPDATE_TDO = 0x1
  575. DS_GFTI_VALID_FLAGS = 0x1
  576. DS_ONLY_DO_SITE_NAME = 0x01
  577. DS_NOTIFY_AFTER_SITE_RECORDS = 0x02
  578. DS_OPEN_VALID_OPTION_FLAGS = ( DS_ONLY_DO_SITE_NAME | DS_NOTIFY_AFTER_SITE_RECORDS )
  579. DS_OPEN_VALID_FLAGS = ( \
  580. DS_FORCE_REDISCOVERY | \
  581. DS_ONLY_LDAP_NEEDED | \
  582. DS_KDC_REQUIRED | \
  583. DS_PDC_REQUIRED | \
  584. DS_GC_SERVER_REQUIRED | \
  585. DS_WRITABLE_REQUIRED )
  586. ## from aclui.h
  587. # SI_OBJECT_INFO.dwFlags
  588. SI_EDIT_PERMS = 0x00000000
  589. SI_EDIT_OWNER = 0x00000001
  590. SI_EDIT_AUDITS = 0x00000002
  591. SI_CONTAINER = 0x00000004
  592. SI_READONLY = 0x00000008
  593. SI_ADVANCED = 0x00000010
  594. SI_RESET = 0x00000020
  595. SI_OWNER_READONLY = 0x00000040
  596. SI_EDIT_PROPERTIES = 0x00000080
  597. SI_OWNER_RECURSE = 0x00000100
  598. SI_NO_ACL_PROTECT = 0x00000200
  599. SI_NO_TREE_APPLY = 0x00000400
  600. SI_PAGE_TITLE = 0x00000800
  601. SI_SERVER_IS_DC = 0x00001000
  602. SI_RESET_DACL_TREE = 0x00004000
  603. SI_RESET_SACL_TREE = 0x00008000
  604. SI_OBJECT_GUID = 0x00010000
  605. SI_EDIT_EFFECTIVE = 0x00020000
  606. SI_RESET_DACL = 0x00040000
  607. SI_RESET_SACL = 0x00080000
  608. SI_RESET_OWNER = 0x00100000
  609. SI_NO_ADDITIONAL_PERMISSION = 0x00200000
  610. SI_MAY_WRITE = 0x10000000
  611. SI_EDIT_ALL = (SI_EDIT_PERMS | SI_EDIT_OWNER | SI_EDIT_AUDITS)
  612. SI_AUDITS_ELEVATION_REQUIRED = 0x02000000
  613. SI_VIEW_ONLY = 0x00400000
  614. SI_OWNER_ELEVATION_REQUIRED = 0x04000000
  615. SI_PERMS_ELEVATION_REQUIRED = 0x01000000
  616. # SI_ACCESS.dwFlags
  617. SI_ACCESS_SPECIFIC = 0x00010000
  618. SI_ACCESS_GENERAL = 0x00020000
  619. SI_ACCESS_CONTAINER = 0x00040000
  620. SI_ACCESS_PROPERTY = 0x00080000
  621. # SI_PAGE_TYPE enum
  622. SI_PAGE_PERM = 0
  623. SI_PAGE_ADVPERM = 1
  624. SI_PAGE_AUDIT = 2
  625. SI_PAGE_OWNER = 3
  626. SI_PAGE_EFFECTIVE =4
  627. CFSTR_ACLUI_SID_INFO_LIST = "CFSTR_ACLUI_SID_INFO_LIST"
  628. PSPCB_SI_INITDIALOG = 1025 ## WM_USER+1