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.

198 lines
9.6 KiB

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