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.

280 lines
10 KiB

  1. #ifndef _NTDSAPIP_H_
  2. #define _NTDSAPIP_H_
  3. // Private definitions related to sdk\inc\ntdsapi.h.
  4. // The following are DS_NAME_FORMATs which we don't want to publish
  5. // in ntdsapi.h. Although DS_NAME_FORMAT is an enumerated type, we
  6. // pass vanilla DWORDs on the wire such that RPC doesn't complain about
  7. // enumerated type values out of range or unknown. These should be
  8. // defined at the high end of the range so we can extend DS_NAME_FORMAT
  9. // in future versions w/o holes which will leave people wondering and
  10. // experimenting what those "unused" values are used for.
  11. #define DS_LIST_SITES 0xffffffff
  12. #define DS_LIST_SERVERS_IN_SITE 0xfffffffe
  13. #define DS_LIST_DOMAINS_IN_SITE 0xfffffffd
  14. #define DS_LIST_SERVERS_FOR_DOMAIN_IN_SITE 0xfffffffc
  15. #define DS_LIST_INFO_FOR_SERVER 0xfffffffb
  16. #define DS_LIST_ROLES 0xfffffffa
  17. #define DS_NT4_ACCOUNT_NAME_SANS_DOMAIN 0xfffffff9
  18. #define DS_MAP_SCHEMA_GUID 0xfffffff8
  19. #define DS_LIST_DOMAINS 0xfffffff7
  20. #define DS_LIST_NCS 0xfffffff6
  21. #define DS_ALT_SECURITY_IDENTITIES_NAME 0xfffffff5
  22. #define DS_STRING_SID_NAME 0xfffffff4
  23. #define DS_LIST_SERVERS_WITH_DCS_IN_SITE 0xfffffff3
  24. #define DS_USER_PRINCIPAL_NAME_FOR_LOGON 0xfffffff2
  25. #define DS_LIST_GLOBAL_CATALOG_SERVERS 0xfffffff1
  26. #define DS_NT4_ACCOUNT_NAME_SANS_DOMAIN_EX 0xfffffff0
  27. // following should always be equal to lowest private #define
  28. #define DS_NAME_FORMAT_PRIVATE_BEGIN 0xfffffff0
  29. // The following are DS_NAME_ERRORs which we don't want to publish
  30. // in ntdsapi.h. Same reasoning as above.
  31. #define DS_NAME_ERROR_IS_FPO 0xffffffff
  32. #define DS_NAME_ERROR_SCHEMA_GUID_NOT_FOUND 0xfffffffe
  33. #define DS_NAME_ERROR_SCHEMA_GUID_ATTR 0xfffffffd
  34. #define DS_NAME_ERROR_SCHEMA_GUID_ATTR_SET 0xfffffffc
  35. #define DS_NAME_ERROR_SCHEMA_GUID_CLASS 0xfffffffb
  36. #define DS_NAME_ERROR_SCHEMA_GUID_CONTROL_RIGHT 0xfffffffa
  37. #define DS_NAME_ERROR_IS_SID_USER 0xfffffff9
  38. #define DS_NAME_ERROR_IS_SID_GROUP 0xfffffff8
  39. #define DS_NAME_ERROR_IS_SID_ALIAS 0xfffffff7
  40. #define DS_NAME_ERROR_IS_SID_UNKNOWN 0xfffffff6
  41. #define DS_NAME_ERROR_IS_SID_HISTORY_USER 0xfffffff5
  42. #define DS_NAME_ERROR_IS_SID_HISTORY_GROUP 0xfffffff4
  43. #define DS_NAME_ERROR_IS_SID_HISTORY_ALIAS 0xfffffff3
  44. #define DS_NAME_ERROR_IS_SID_HISTORY_UNKNOWN 0xfffffff2
  45. // following should always be equal to lowest private #define
  46. #define DS_NAME_ERROR_PRIVATE_BEGIN 0xfffffff2
  47. // The following are DS_NAME_FLAGs which we don't want to publish
  48. // in ntdsapi.h. Same reasoning as above. Remember that the flags
  49. // field is a bit map, not an enumeration.
  50. #define DS_NAME_FLAG_PRIVATE_PURE_SYNTACTIC 0x40000000
  51. #define DS_NAME_FLAG_PRIVATE_RESOLVE_FPOS 0x80000000
  52. // following should always be equal to lowest private #define
  53. #define DS_NAME_FLAG_PRIVATE_BEGIN 0x80000000
  54. // The following are DS_ADDSID_FLAGs which we don't want to publish
  55. // in ntdsapi.h. Same reasoning as above. Remember that the flags
  56. // field is a bit map, not an enumeration.
  57. #define DS_ADDSID_FLAG_PRIVATE_DEL_SRC_OBJ 0x80000000
  58. #define DS_ADDSID_FLAG_PRIVATE_CHK_SECURE 0x40000000
  59. // following should always be equal to lowest private #define
  60. #define DS_ADDSID_FLAG_PRIVATE_BEGIN 0x40000000
  61. // The following are dc info infolevels that we don't want to publish.
  62. // While the published APIs are used to get information from the set of
  63. // DCs published in a domain, some of these private infolevels are used
  64. // to get information from a single domain controller. These private
  65. // infolevels are intended mostly for debugging and monitoring.
  66. #define DS_DCINFO_LEVEL_FFFFFFFF 0xffffffff
  67. // following should always be equal to lowest private #define
  68. #define DS_DCINFO_LEVEL_PRIVATE_BEGIN 0xffffffff
  69. // For DS_DOMAIN_CONTROLLER_INFO_FFFFFFFF. This retrieves the ldap
  70. // connection list from a single domain controller.
  71. typedef struct _DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW {
  72. DWORD IPAddress; // IP Address of client
  73. DWORD NotificationCount; // number of outstanding notifications
  74. DWORD secTimeConnected; // total time in seconds connected
  75. DWORD Flags; // Connection properties. defined below.
  76. DWORD TotalRequests; // Total number of requests made
  77. DWORD Reserved1; // Unused
  78. #ifdef MIDL_PASS
  79. [string,unique] WCHAR *UserName;
  80. #else
  81. LPWSTR UserName; // the security principal used to bind
  82. #endif
  83. } DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW, *PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW;
  84. typedef struct _DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA {
  85. DWORD IPAddress; // IP Address of client
  86. DWORD NotificationCount; // number of outstanding notifications
  87. DWORD secTimeConnected; // total time in seconds connected
  88. DWORD Flags; // Connection properties. defined below.
  89. DWORD TotalRequests; // Total number of requests made
  90. DWORD Reserved1; // Unused
  91. #ifdef MIDL_PASS
  92. [string,unique] CHAR *UserName;
  93. #else
  94. LPSTR UserName; // the security principal used to bind
  95. #endif
  96. } DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA, *PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA;
  97. //
  98. // connection flags
  99. //
  100. #define LDAP_CONN_FLAG_BOUND 0x00000001 // bound connection
  101. #define LDAP_CONN_FLAG_SSL 0x00000002 // connect using SSL
  102. #define LDAP_CONN_FLAG_UDP 0x00000004 // UDP connection
  103. #define LDAP_CONN_FLAG_GC 0x00000008 // came through the GC port
  104. #define LDAP_CONN_FLAG_GSSAPI 0x00000010 // used gssapi
  105. #define LDAP_CONN_FLAG_SPNEGO 0x00000020 // used spnego
  106. #define LDAP_CONN_FLAG_SIMPLE 0x00000040 // used simple
  107. #define LDAP_CONN_FLAG_DIGEST 0x00000080 // used Digest-MD5
  108. #define LDAP_CONN_FLAG_SIGN 0x00000100 // signing on
  109. #define LDAP_CONN_FLAG_SEAL 0x00000200 // sealing on
  110. #ifdef UNICODE
  111. #define DS_DOMAIN_CONTROLLER_INFO_FFFFFFFF DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW
  112. #define PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFF PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFW
  113. #else
  114. #define DS_DOMAIN_CONTROLLER_INFO_FFFFFFFF DS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA
  115. #define PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFF PDS_DOMAIN_CONTROLLER_INFO_FFFFFFFFA
  116. #endif
  117. // ==========================================================
  118. // DsCrackSpn2() -- parse a counted-length SPN into the ServiceClass,
  119. // ServiceName, and InstanceName (and InstancePort) pieces.
  120. // An SPN is passed in, along with a pointer to the maximum length
  121. // for each piece and a pointer to a buffer where each piece should go.
  122. // On exit, the maximum lengths are updated to the actual length for each piece
  123. // and the buffer contain the appropriate piece. The InstancePort is 0 if not
  124. // present.
  125. //
  126. // DWORD DsCrackSpn(
  127. // IN LPTSTR pszSPN, // the SPN to parse
  128. // IN DWORD cSpn, // length of pszSPN
  129. // IN OUT PUSHORT pcServiceClass, // input -- max length of ServiceClass;
  130. // output -- actual length
  131. // OUT LPCTSTR ServiceClass, // the ServiceClass part of the SPN
  132. // IN OUT PUSHORT pcServiceName, // input -- max length of ServiceName;
  133. // output -- actual length
  134. // OUT LPCTSTR ServiceName, // the ServiceName part of the SPN
  135. // IN OUT PUSHORT pcInstance, // input -- max length of ServiceClass;
  136. // output -- actual length
  137. // OUT LPCTSTR InstanceName, // the InstanceName part of the SPN
  138. // OUT PUSHORT InstancePort // instance port
  139. //
  140. // Note: lengths are in characters; all string lengths include terminators
  141. // All arguments except pszSpn are optional.
  142. //
  143. NTDSAPI
  144. DWORD
  145. WINAPI
  146. DsCrackSpn2A(
  147. IN LPCSTR pszSpn,
  148. IN DWORD cSpn,
  149. IN OUT LPDWORD pcServiceClass,
  150. OUT LPSTR ServiceClass,
  151. IN OUT LPDWORD pcServiceName,
  152. OUT LPSTR ServiceName,
  153. IN OUT LPDWORD pcInstanceName,
  154. OUT LPSTR InstanceName,
  155. OUT USHORT *pInstancePort
  156. );
  157. NTDSAPI
  158. DWORD
  159. WINAPI
  160. DsCrackSpn2W(
  161. IN LPCWSTR pszSpn,
  162. IN DWORD cSpn,
  163. IN OUT DWORD *pcServiceClass,
  164. OUT LPWSTR ServiceClass,
  165. IN OUT DWORD *pcServiceName,
  166. OUT LPWSTR ServiceName,
  167. IN OUT DWORD *pcInstanceName,
  168. OUT LPWSTR InstanceName,
  169. OUT USHORT *pInstancePort
  170. );
  171. NTDSAPI
  172. DWORD
  173. WINAPI
  174. DsCrackSpn3W(
  175. IN LPCWSTR pszSpn,
  176. IN DWORD cSpn,
  177. IN OUT DWORD *pcHostName,
  178. OUT LPWSTR HostName,
  179. IN OUT DWORD *pcInstanceName,
  180. OUT LPWSTR InstanceName,
  181. OUT USHORT *pPortNumber,
  182. IN OUT DWORD *pcDomainName,
  183. OUT LPWSTR DomainName,
  184. IN OUT DWORD *pcRealmName,
  185. OUT LPWSTR RealmName
  186. );
  187. #ifdef UNICODE
  188. #define DsCrackSpn2 DsCrackSpn2W
  189. #else
  190. #define DsCrackSpn2 DsCrackSpn2A
  191. #endif
  192. #ifndef MIDL_PASS
  193. DWORD
  194. DsaopExecuteScript (
  195. IN PVOID phAsync,
  196. IN RPC_BINDING_HANDLE hRpc,
  197. IN DWORD cbPassword,
  198. IN BYTE *pbPassword,
  199. OUT DWORD *dwOutVersion,
  200. OUT PVOID reply
  201. );
  202. DWORD
  203. DsaopPrepareScript (
  204. IN PVOID phAsync,
  205. IN RPC_BINDING_HANDLE hRpc,
  206. OUT DWORD *dwOutVersion,
  207. OUT PVOID reply
  208. );
  209. DWORD
  210. DsaopBind(
  211. IN LPCWSTR DomainControllerName,
  212. IN LPCWSTR DnsDomainName,
  213. IN ULONG AuthnSvc,
  214. IN ULONG AuthnLevel,
  215. OUT RPC_BINDING_HANDLE *phRpc
  216. );
  217. DWORD
  218. DsaopBindWithCred(
  219. IN LPCWSTR DomainControllerName,
  220. IN LPCWSTR DnsDomainName,
  221. IN RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
  222. IN ULONG AuthnSvc,
  223. IN ULONG AuthnLevel,
  224. OUT RPC_BINDING_HANDLE *phRpc
  225. );
  226. DWORD
  227. DsaopBindWithSpn(
  228. IN LPCWSTR DomainControllerName,
  229. IN LPCWSTR DnsDomainName,
  230. IN RPC_AUTH_IDENTITY_HANDLE AuthIdentity,
  231. IN ULONG AuthnSvc,
  232. IN ULONG AuthnLevel,
  233. IN LPCWSTR ServicePrincipalName,
  234. OUT RPC_BINDING_HANDLE *phRpc
  235. );
  236. DWORD
  237. DsaopUnBind(
  238. RPC_BINDING_HANDLE *phRpc
  239. );
  240. #endif
  241. #endif // _NTDSAPIP_H_