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.

223 lines
12 KiB

  1. //mkdso.h
  2. //
  3. // Exit status codes. Exit codes start with 100 to keep them
  4. // distinct from the MKDSXE_ error codes in mkdsx.h
  5. //
  6. #define MKDSOE_SUCCESS 100 // "Success."
  7. #define MKDSOE_BAD_ARG 101 // "Invalid Arguments."
  8. #define MKDSOE_CANT_BIND 102 // "Could not bind to the DC."
  9. #define MKDSOE_NO_NTFRS_SETTINGS 103 // "Could not find 'NTFRS Settings' object. Check the /settingsdn parameter."
  10. #define MKDSOE_SET_OBJ_CRE_FAILED 104 // "Error creating replica set."
  11. #define MKDSOE_SET_OBJ_UPDATE_FAILED 105 // "Error updating replica set."
  12. #define MKDSOE_SET_NOT_FOUND_UPDATE 106 // "Error updating replica set; set not found."
  13. #define MKDSOE_SET_DUPS_FOUND_UPDATE 107 // "Error updating replica set; duplicate sets found."
  14. #define MKDSOE_SET_DUPS_FOUND_DELETE 108 // "Error deleting replica set; duplicate sets found."
  15. #define MKDSOE_SET_DELETE_FAILED 109 // "Error deleting replica set."
  16. #define MKDSOE_SET_NOT_FOUND_DELETE 110 // "Error deleting replica set; set not found."
  17. #define MKDSOE_MULTIPLE_SETS_DELETED 111 // "Deleting multiple sets."
  18. #define MKDSOE_SET_DUMP_FAILED 112 // "Error dumping replica set."
  19. #define MKDSOE_SET_NOT_FOUND_DUMP 113 // "Error dumping replica set; set not found."
  20. #define MKDSOE_MULTIPLE_SETS_DUMPED 114 // "Dumping duplicate sets."
  21. #define MKDSOE_MEMBER_OBJ_CRE_FAILED 115 // "Error creating replica member."
  22. #define MKDSOE_MEMBER_OBJ_UPDATE_FAILED 116 // "Error updating replica member."
  23. #define MKDSOE_MEMBER_NOT_FOUND_UPDATE 117 // "Error updating replica member; member not found."
  24. #define MKDSOE_MEMBER_DUPS_FOUND_UPDATE 118 // "Error updating replica member; duplicate members found."
  25. #define MKDSOE_MEMBER_DUPS_FOUND_DELETE 119 // "Error deleting member; duplicate subscribers found."
  26. #define MKDSOE_MEMBER_DELETE_FAILED 120 // "Error deleting replica member."
  27. #define MKDSOE_MEMBER_NOT_FOUND_DELETE 121 // "Error deleting replica member; member not found."
  28. #define MKDSOE_MULTIPLE_MEMBERS_DELETED 122 // "Deleting multiple members."
  29. #define MKDSOE_MEMBER_DUMP_FAILED 123 // "Error dumping replica member."
  30. #define MKDSOE_MEMBER_NOT_FOUND_DUMP 124 // "Error dumping replica member; member not found."
  31. #define MKDSOE_MULTIPLE_MEMBERS_DUMPED 125 // "Dumping duplicate members."
  32. #define MKDSOE_SUBSCRIBER_OBJ_CRE_FAILED 126 // "Error creating subscriber."
  33. #define MKDSOE_SUBSCRIBER_OBJ_UPDATE_FAILED 127 // "Error updating subscriber."
  34. #define MKDSOE_SUBSCRIBER_NOT_FOUND_UPDATE 128 // "Error updating subscriber; subscriber not found."
  35. #define MKDSOE_SUBSCRIBER_DUPS_FOUND_UPDATE 129 // "Error updating subscriber; duplicate subscribers found."
  36. #define MKDSOE_SUBSCRIBER_DELETE_FAILED 130 // "Error deleting subscriber."
  37. #define MKDSOE_SUBSCRIBER_NOT_FOUND_DELETE 131 // "Error deleting subscriber; subscriber not found."
  38. #define MKDSOE_MULTIPLE_SUBSCRIBERS_DELETE 132 // "Deleting multiple subscribers."
  39. #define MKDSOE_SUBSCRIBER_DUPS_FOUND_DELETE 133 // "Error deleting subscriber; duplicate subscribers found."
  40. #define MKDSOE_SUBSCRIBER_DUMP_FAILED 134 // "Error dumping subscriber."
  41. #define MKDSOE_SUBSCRIBER_NOT_FOUND_DUMP 135 // "Error dumping subscriber; subscriber not found."
  42. #define MKDSOE_MULTIPLE_SUBSCRIBERS_DUMPED 136 // "Dumping duplicate subscribers."
  43. #define MKDSOE_RSTYPE_MAX 4
  44. #define MKDSOE_SUBSCRIPTION L"NTFRS Subscriptions"
  45. #define FRST_SIZE_OF_SCHEDULE_GRID 168 // 168 bytes for the schedule (7days*24hours).
  46. #define FRST_SIZE_OF_SCHEDULE 188 // 20 bytes for the SCHEDULE and SCHEDULE_HEADER structure and
  47. #define WIN_SUCCESS(_Status) (_Status == ERROR_SUCCESS)
  48. #define FREE(_x_) { if (_x_) free(_x_); _x_ = NULL; }
  49. //
  50. // Is a handle valid?
  51. // Some functions set the handle to NULL and some to
  52. // INVALID_HANDLE_VALUE (-1). This define handles both
  53. // cases.
  54. //
  55. #define HANDLE_IS_VALID(_Handle) ((_Handle) && ((_Handle) != INVALID_HANDLE_VALUE))
  56. //
  57. // Only close valid handles and then set the handle invalid.
  58. // FRS_CLOSE(handle);
  59. //
  60. #define FRS_CLOSE(_Handle) \
  61. if (HANDLE_IS_VALID(_Handle)) { \
  62. CloseHandle(_Handle); \
  63. (_Handle) = INVALID_HANDLE_VALUE; \
  64. }
  65. VOID
  66. PrintSchedule(
  67. PSCHEDULE Schedule
  68. );
  69. #define FRS_LDAP_SEARCH_PAGESIZE 1000
  70. typedef struct _FRS_LDAP_SEARCH_CONTEXT {
  71. BOOL bOpen;
  72. ULONG EntriesInPage;
  73. ULONG CurrentEntry;
  74. ULONG TotalEntries;
  75. LDAPMessage * LdapMsg;
  76. LDAPMessage * CurrentLdapMsg;
  77. PWCHAR Filter;
  78. PWCHAR BaseDn;
  79. DWORD Scope;
  80. DWORD PageSize;
  81. PWCHAR * Attrs;
  82. } FRS_LDAP_SEARCH_CONTEXT, *PFRS_LDAP_SEARCH_CONTEXT;
  83. //Macros for prints.
  84. #define DPRINT0(str) (bVerboseMode) ? printf(str):printf("")
  85. #define DPRINT1(str,p1) (bVerboseMode) ? printf(str,p1):printf("")
  86. #define DPRINT2(str,p1,p2) (bVerboseMode) ? printf(str,p1,p2):printf("")
  87. #define DPRINT3(str,p1,p2,p3) (bVerboseMode) ? printf(str,p1,p2,p3):printf("")
  88. #define DPRINT4(str,p1,p2,p3,p4) (bVerboseMode) ? printf(str,p1,p2,p3,p4):printf("")
  89. #define NDPRINT0(str) (!bVerboseMode) ? printf(str):printf("")
  90. #define NDPRINT1(str,p1) (!bVerboseMode) ? printf(str,p1):printf("")
  91. #define NDPRINT2(str,p1,p2) (!bVerboseMode) ? printf(str,p1,p2):printf("")
  92. //
  93. // Some useful DS object classes and object attributes
  94. //
  95. #define SCHEMA_NAMING_CONTEXT L"CN=Schema"
  96. #define CONFIG_NAMING_CONTEXT L"CN=Configuration"
  97. #define DOMAIN_NAMING_CONTEXT L"DC="
  98. #define ATTR_SERVICE_COMMAND_STATUS L"frsServiceCommandStatus"
  99. #define ATTR_FAULT_CONDITION L"frsFaultCondition"
  100. #define ATTR_VERSION L"frsVersion"
  101. #define ATTR_CONTROL_CREATION L"frsControlDataCreation"
  102. #define ATTR_INBOUND_BACKLOG L"frsControlInboundBacklog"
  103. #define ATTR_OUTBOUND_BACKLOG L"frsControlOutboundBacklog"
  104. #define ATTR_SERVICE_COMMAND L"frsServiceCommand"
  105. #define ATTR_UPDATE_TIMEOUT L"frsUpdateTimeout"
  106. #define ATTR_LEVEL_LIMIT L"frsLevelLimit"
  107. #define ATTR_AUTH_LEVEL L"frsPartnerAuthLevel"
  108. #define ATTR_FLAGS L"frsFlags"
  109. #define ATTR_DIRECTORY_FILTER L"frsDirectoryFilter"
  110. #define ATTR_FILE_FILTER L"frsFileFilter"
  111. #define ATTR_DS_POLL L"frsDSPoll"
  112. #define ATTR_EXTENSIONS L"frsExtensions"
  113. #define ATTR_SYSTEM_MAY_CONTAIN L"systemMayContain"
  114. #define ATTR_SYSTEM_MUST_CONTAIN L"systemMustContain"
  115. #define ATTR_SYSTEM_POSS_SUPERIORS L"systemPossSuperiors"
  116. #define ATTR_SYSTEM_FLAGS L"systemFlags"
  117. #define ATTR_SET_TYPE L"frsReplicaSetType"
  118. #define ATTR_WORKING_PATH L"frsWorkingPath"
  119. #define ATTR_DEFAULT_NAMING_CONTEXT L"defaultNamingContext"
  120. #define ATTR_ATTRIBUTE_ID L"attributeID"
  121. #define ATTR_GOVERNS_ID L"governsID"
  122. #define ATTR_DN L"distinguishedName"
  123. #define ATTR_LDAP_DISPLAY L"lDAPDisplayName"
  124. #define ATTR_ROOT L""
  125. #define ATTR_NAMING_CONTEXTS L"namingContexts"
  126. #define ATTR_CLASS L"objectClass"
  127. #define ATTR_NTDS_SITE_SETTINGS L"nTDSSiteSettings"
  128. #define ATTR_NTFRS_SITE_SETTINGS L"nTFRSSiteSettings"
  129. #define ATTR_NEW_VERSION_GUID L"frsVersionGuid"
  130. #define ATTR_OLD_VERSION_GUID L"replicaVersionGuid"
  131. #define ATTR_NEW_SET_GUID L"frsReplicaSetGUID"
  132. #define ATTR_OLD_SET_GUID L"replicaSetGUID"
  133. #define ATTR_SCHEDULE L"schedule"
  134. #define ATTR_OBJECT_GUID L"objectGUID"
  135. #define ATTR_CN L"cn"
  136. #define ATTR_SERVER L"server"
  137. #define ATTR_CONTAINER L"container"
  138. #define ATTR_DNS L"machineDNSName"
  139. #define ATTR_DNS_HOST_NAME L"dNSHostName"
  140. #define ATTR_NTFRS_SETTINGS L"nTFRSSettings"
  141. #define ATTR_COMPUTER L"computer"
  142. #define ATTR_USER L"user"
  143. #define ATTR_REPLICA_SET L"nTFRSReplicaSet"
  144. #define ATTR_ENABLED_CXTION L"enabledConnection"
  145. #define ATTR_CXTION L"nTDSConnection"
  146. #define ATTR_OPTIONS L"options"
  147. #define ATTR_OPTIONS_0 L"0"
  148. #define ATTR_TRUE L"TRUE"
  149. #define ATTR_FALSE L"FALSE"
  150. #define ATTR_FROM_SERVER L"fromServer"
  151. #define ATTR_PRIMARY_MEMBER L"frsPrimaryMember"
  152. #define ATTR_REPLICA_ROOT L"frsRootPath"
  153. #define ATTR_REPLICA_STAGE L"frsStagingPath"
  154. #define ATTR_CLASS_SCHEMA L"classSchema"
  155. #define ATTR_SUPERIORS L"possSuperiors"
  156. #define ATTR_SAM L"sAMAccountName"
  157. #define ATTR_MEMBER L"nTFRSMember"
  158. #define ATTR_COMPUTER_REF L"frsComputerReference"
  159. #define ATTR_COMPUTER_REF_BL L"frsComputerReferenceBL"
  160. #define ATTR_MEMBER_REF L"frsMemberReference"
  161. #define ATTR_MEMBER_REF_BL L"frsMemberReferenceBL"
  162. #define ATTR_SERVER_REF L"serverReference"
  163. #define ATTR_SERVER_REF_BL L"serverReferenceBL"
  164. #define ATTR_SUBSCRIPTIONS L"nTFRSSubscriptions"
  165. #define ATTR_SUBSCRIBER L"nTFRSSubscriber"
  166. #define CN_NTDS_SITE_SETTINGS L"NTDS Site Settings"
  167. #define CN_SERVERS L"Servers"
  168. #define CN_TEST_SETTINGS L"NTFRS Test Settings"
  169. #define CN_SUBSCRIPTIONS L"NTFRS Subscriptions"
  170. #define CN_SITES L"Sites"
  171. #define CN_SERVICES L"Services"
  172. #define CN_SYSTEM L"System"
  173. #define CN_SYSVOLS L"Microsoft System Volumes"
  174. #define CN_NTDS_SETTINGS L"NTDS Settings"
  175. #define CN_NTFRS_SETTINGS L"File Replication Service"
  176. #define CN_DOMAIN_SYSVOL L"Domain System Volume (SYSVOL share)"
  177. #define CLASS_ANY L"(objectClass=*)"
  178. #define CLASS_SUBSCRIPTIONS L"(objectClass=nTFRSSubscriptions)"
  179. #define CLASS_COMPUTER L"(objectClass=computer)"
  180. #define CLASS_SUBSCRIBER L"(objectClass=nTFRSSubscriber)"
  181. #define CLASS_NTFRS_SETTINGS L"(objectClass=nTFRSSettings)"
  182. #define CLASS_NTDS_SETTINGS L"(objectClass=nTDSSettings)"
  183. #define CLASS_CXTION L"(objectClass=nTDSConnection)"
  184. #define CLASS_NTFRS_REPLICA_SET L"(objectClass=nTFRSReplicaSet)"
  185. #define CLASS_SCHEMA L"(objectClass=classSchema)"
  186. #define CLASS_SERVER L"(objectClass=server)"
  187. #define CLASS_MEMBER L"(objectClass=nTFRSMember)"
  188. #define CLASS_NTDS_DSA L"(objectClass=nTDSDSA)"
  189. #define CLASS_SITE_SETTINGS L"(|(objectClass=nTDSSiteSettings)"\
  190. L"(objectClass=nTFRSSiteSettings))"
  191. #define CLASS_TOPOLOGY L"(|(objectClass=nTDSSettings)" \
  192. L"(objectClass=nTFRSSettings)" \
  193. L"(objectClass=nTFRSReplicaSet)" \
  194. L"(objectClass=nTDSConnection))"
  195. #define CLASS_DELETABLE L"(|(objectClass=nTFRSSiteSettings)" \
  196. L"(objectClass=nTFRSSettings)" \
  197. L"(objectClass=nTFRSReplicaSet)" \
  198. L"(objectClass=nTDSConnection))"