]>
Commit | Line | Data |
---|---|---|
ff7c6d11 XL |
1 | // Licensed under the Apache License, Version 2.0 |
2 | // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
3 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. | |
4 | // All files in the project carrying such notice may not be copied, modified, or distributed | |
5 | // except according to those terms. | |
6 | //! This file contains structures, function prototypes, and definitions for the DsGetDcName API. | |
7 | use shared::guiddef::GUID; | |
8 | use shared::minwindef::{DWORD, PULONG, ULONG}; | |
9 | use shared::ws2def::{LPSOCKET_ADDRESS, PSOCKET_ADDRESS}; | |
10 | use um::ntsecapi::PLSA_FOREST_TRUST_INFORMATION; | |
11 | use um::winnt::{HANDLE, LPCSTR, LPCWSTR, LPSTR, LPWSTR, PHANDLE, PSID}; | |
12 | pub const DS_FORCE_REDISCOVERY: ULONG = 0x00000001; | |
13 | pub const DS_DIRECTORY_SERVICE_REQUIRED: ULONG = 0x00000010; | |
14 | pub const DS_DIRECTORY_SERVICE_PREFERRED: ULONG = 0x00000020; | |
15 | pub const DS_GC_SERVER_REQUIRED: ULONG = 0x00000040; | |
16 | pub const DS_PDC_REQUIRED: ULONG = 0x00000080; | |
17 | pub const DS_BACKGROUND_ONLY: ULONG = 0x00000100; | |
18 | pub const DS_IP_REQUIRED: ULONG = 0x00000200; | |
19 | pub const DS_KDC_REQUIRED: ULONG = 0x00000400; | |
20 | pub const DS_TIMESERV_REQUIRED: ULONG = 0x00000800; | |
21 | pub const DS_WRITABLE_REQUIRED: ULONG = 0x00001000; | |
22 | pub const DS_GOOD_TIMESERV_PREFERRED: ULONG = 0x00002000; | |
23 | pub const DS_AVOID_SELF: ULONG = 0x00004000; | |
24 | pub const DS_ONLY_LDAP_NEEDED: ULONG = 0x00008000; | |
25 | pub const DS_IS_FLAT_NAME: ULONG = 0x00010000; | |
26 | pub const DS_IS_DNS_NAME: ULONG = 0x00020000; | |
27 | pub const DS_TRY_NEXTCLOSEST_SITE: ULONG = 0x00040000; | |
28 | pub const DS_DIRECTORY_SERVICE_6_REQUIRED: ULONG = 0x00080000; | |
29 | pub const DS_WEB_SERVICE_REQUIRED: ULONG = 0x00100000; | |
30 | pub const DS_DIRECTORY_SERVICE_8_REQUIRED: ULONG = 0x00200000; | |
31 | pub const DS_DIRECTORY_SERVICE_9_REQUIRED: ULONG = 0x00400000; | |
32 | pub const DS_DIRECTORY_SERVICE_10_REQUIRED: ULONG = 0x00800000; | |
33 | pub const DS_RETURN_DNS_NAME: ULONG = 0x40000000; | |
34 | pub const DS_RETURN_FLAT_NAME: ULONG = 0x80000000; | |
35 | pub const DSGETDC_VALID_FLAGS: ULONG = DS_FORCE_REDISCOVERY | DS_DIRECTORY_SERVICE_REQUIRED | |
36 | | DS_DIRECTORY_SERVICE_PREFERRED | DS_GC_SERVER_REQUIRED | DS_PDC_REQUIRED | DS_BACKGROUND_ONLY | |
37 | | DS_IP_REQUIRED | DS_KDC_REQUIRED | DS_TIMESERV_REQUIRED | DS_WRITABLE_REQUIRED | |
38 | | DS_GOOD_TIMESERV_PREFERRED | DS_AVOID_SELF | DS_ONLY_LDAP_NEEDED | DS_IS_FLAT_NAME | |
39 | | DS_IS_DNS_NAME | DS_TRY_NEXTCLOSEST_SITE | DS_DIRECTORY_SERVICE_6_REQUIRED | |
40 | | DS_DIRECTORY_SERVICE_8_REQUIRED | DS_DIRECTORY_SERVICE_9_REQUIRED | |
41 | | DS_DIRECTORY_SERVICE_10_REQUIRED | DS_WEB_SERVICE_REQUIRED | DS_RETURN_FLAT_NAME | |
42 | | DS_RETURN_DNS_NAME; | |
43 | STRUCT!{struct DOMAIN_CONTROLLER_INFOA { | |
44 | DomainControllerName: LPSTR, | |
45 | DomainControllerAddress: LPSTR, | |
46 | DomainControllerAddressType: ULONG, | |
47 | DomainGuid: GUID, | |
48 | DomainName: LPSTR, | |
49 | DnsForestName: LPSTR, | |
50 | Flags: ULONG, | |
51 | DcSiteName: LPSTR, | |
52 | ClientSiteName: LPSTR, | |
53 | }} | |
54 | pub type PDOMAIN_CONTROLLER_INFOA = *mut DOMAIN_CONTROLLER_INFOA; | |
55 | STRUCT!{struct DOMAIN_CONTROLLER_INFOW { | |
56 | DomainControllerName: LPWSTR, | |
57 | DomainControllerAddress: LPWSTR, | |
58 | DomainControllerAddressType: ULONG, | |
59 | DomainGuid: GUID, | |
60 | DomainName: LPWSTR, | |
61 | DnsForestName: LPWSTR, | |
62 | Flags: ULONG, | |
63 | DcSiteName: LPWSTR, | |
64 | ClientSiteName: LPWSTR, | |
65 | }} | |
66 | pub type PDOMAIN_CONTROLLER_INFOW = *mut DOMAIN_CONTROLLER_INFOW; | |
67 | pub const DS_INET_ADDRESS: ULONG = 1; | |
68 | pub const DS_NETBIOS_ADDRESS: ULONG = 2; | |
69 | pub const DS_PDC_FLAG: ULONG = 0x00000001; | |
70 | pub const DS_GC_FLAG: ULONG = 0x00000004; | |
71 | pub const DS_LDAP_FLAG: ULONG = 0x00000008; | |
72 | pub const DS_DS_FLAG: ULONG = 0x00000010; | |
73 | pub const DS_KDC_FLAG: ULONG = 0x00000020; | |
74 | pub const DS_TIMESERV_FLAG: ULONG = 0x00000040; | |
75 | pub const DS_CLOSEST_FLAG: ULONG = 0x00000080; | |
76 | pub const DS_WRITABLE_FLAG: ULONG = 0x00000100; | |
77 | pub const DS_GOOD_TIMESERV_FLAG: ULONG = 0x00000200; | |
78 | pub const DS_NDNC_FLAG: ULONG = 0x00000400; | |
79 | pub const DS_SELECT_SECRET_DOMAIN_6_FLAG: ULONG = 0x00000800; | |
80 | pub const DS_FULL_SECRET_DOMAIN_6_FLAG: ULONG = 0x00001000; | |
81 | pub const DS_WS_FLAG: ULONG = 0x00002000; | |
82 | pub const DS_DS_8_FLAG: ULONG = 0x00004000; | |
83 | pub const DS_DS_9_FLAG: ULONG = 0x00008000; | |
84 | pub const DS_DS_10_FLAG: ULONG = 0x00010000; | |
85 | pub const DS_PING_FLAGS: ULONG = 0x000FFFFF; | |
86 | pub const DS_DNS_CONTROLLER_FLAG: ULONG = 0x20000000; | |
87 | pub const DS_DNS_DOMAIN_FLAG: ULONG = 0x40000000; | |
88 | pub const DS_DNS_FOREST_FLAG: ULONG = 0x80000000; | |
89 | extern "system" { | |
90 | pub fn DsGetDcNameA( | |
91 | ComputerName: LPCSTR, | |
92 | DomainName: LPCSTR, | |
93 | DomainGuid: *mut GUID, | |
94 | SiteName: LPCSTR, | |
95 | Flags: ULONG, | |
96 | DomainControllerInfo: *mut PDOMAIN_CONTROLLER_INFOA, | |
97 | ) -> DWORD; | |
98 | pub fn DsGetDcNameW( | |
99 | ComputerName: LPCWSTR, | |
100 | DomainName: LPCWSTR, | |
101 | DomainGuid: *mut GUID, | |
102 | SiteName: LPCWSTR, | |
103 | Flags: ULONG, | |
104 | DomainControllerInfo: *mut PDOMAIN_CONTROLLER_INFOW, | |
105 | ) -> DWORD; | |
106 | pub fn DsGetSiteNameA( | |
107 | ComputerName: LPCSTR, | |
108 | SiteName: *mut LPSTR, | |
109 | ) -> DWORD; | |
110 | pub fn DsGetSiteNameW( | |
111 | ComputerName: LPCWSTR, | |
112 | SiteName: *mut LPWSTR, | |
113 | ) -> DWORD; | |
114 | pub fn DsValidateSubnetNameW( | |
115 | SubnetName: LPCWSTR, | |
116 | ) -> DWORD; | |
117 | pub fn DsValidateSubnetNameA( | |
118 | SubnetName: LPCSTR, | |
119 | ) -> DWORD; | |
120 | pub fn DsAddressToSiteNamesW( | |
121 | ComputerName: LPCWSTR, | |
122 | EntryCount: DWORD, | |
123 | SocketAddresses: PSOCKET_ADDRESS, | |
124 | SiteNames: *mut *mut LPWSTR, | |
125 | ) -> DWORD; | |
126 | pub fn DsAddressToSiteNamesA( | |
127 | ComputerName: LPCSTR, | |
128 | EntryCount: DWORD, | |
129 | SocketAddresses: PSOCKET_ADDRESS, | |
130 | SiteNames: *mut *mut LPSTR, | |
131 | ) -> DWORD; | |
132 | pub fn DsAddressToSiteNamesExW( | |
133 | ComputerName: LPCWSTR, | |
134 | EntryCount: DWORD, | |
135 | SocketAddresses: PSOCKET_ADDRESS, | |
136 | SiteNames: *mut *mut LPWSTR, | |
137 | SubnetNames: *mut *mut LPWSTR, | |
138 | ) -> DWORD; | |
139 | pub fn DsAddressToSiteNamesExA( | |
140 | ComputerName: LPCSTR, | |
141 | EntryCount: DWORD, | |
142 | SocketAddresses: PSOCKET_ADDRESS, | |
143 | SiteNames: *mut *mut LPSTR, | |
144 | SubnetNames: *mut *mut LPSTR, | |
145 | ) -> DWORD; | |
146 | } | |
147 | pub const DS_DOMAIN_IN_FOREST: ULONG = 0x0001; | |
148 | pub const DS_DOMAIN_DIRECT_OUTBOUND: ULONG = 0x0002; | |
149 | pub const DS_DOMAIN_TREE_ROOT: ULONG = 0x0004; | |
150 | pub const DS_DOMAIN_PRIMARY: ULONG = 0x0008; | |
151 | pub const DS_DOMAIN_NATIVE_MODE: ULONG = 0x0010; | |
152 | pub const DS_DOMAIN_DIRECT_INBOUND: ULONG = 0x0020; | |
153 | pub const DS_DOMAIN_VALID_FLAGS: ULONG = DS_DOMAIN_IN_FOREST | DS_DOMAIN_DIRECT_OUTBOUND | |
154 | | DS_DOMAIN_TREE_ROOT | DS_DOMAIN_PRIMARY | DS_DOMAIN_NATIVE_MODE | DS_DOMAIN_DIRECT_INBOUND; | |
155 | STRUCT!{struct DS_DOMAIN_TRUSTSW { | |
156 | NetbiosDomainName: LPWSTR, | |
157 | DnsDomainName: LPWSTR, | |
158 | Flags: ULONG, | |
159 | ParentIndex: ULONG, | |
160 | TrustType: ULONG, | |
161 | TrustAttributes: ULONG, | |
162 | DomainSid: PSID, | |
163 | DomainGuid: GUID, | |
164 | }} | |
165 | pub type PDS_DOMAIN_TRUSTSW = *mut DS_DOMAIN_TRUSTSW; | |
166 | STRUCT!{struct DS_DOMAIN_TRUSTSA { | |
167 | NetbiosDomainName: LPSTR, | |
168 | DnsDomainName: LPSTR, | |
169 | Flags: ULONG, | |
170 | ParentIndex: ULONG, | |
171 | TrustType: ULONG, | |
172 | TrustAttributes: ULONG, | |
173 | DomainSid: PSID, | |
174 | DomainGuid: GUID, | |
175 | }} | |
176 | pub type PDS_DOMAIN_TRUSTSA = *mut DS_DOMAIN_TRUSTSA; | |
177 | extern "system" { | |
178 | pub fn DsEnumerateDomainTrustsW( | |
179 | ServerName: LPWSTR, | |
180 | Flags: ULONG, | |
181 | Domains: *mut PDS_DOMAIN_TRUSTSW, | |
182 | DomainCount: PULONG, | |
183 | ) -> DWORD; | |
184 | pub fn DsEnumerateDomainTrustsA( | |
185 | ServerName: LPSTR, | |
186 | Flags: ULONG, | |
187 | Domains: *mut PDS_DOMAIN_TRUSTSA, | |
188 | DomainCount: PULONG, | |
189 | ) -> DWORD; | |
190 | pub fn DsGetForestTrustInformationW( | |
191 | ServerName: LPCWSTR, | |
192 | TrustedDomainName: LPCWSTR, | |
193 | Flags: DWORD, | |
194 | ForestTrustInfo: *mut PLSA_FOREST_TRUST_INFORMATION, | |
195 | ) -> DWORD; | |
196 | pub fn DsMergeForestTrustInformationW( | |
197 | DomainName: LPCWSTR, | |
198 | NewForestTrustInfo: PLSA_FOREST_TRUST_INFORMATION, | |
199 | OldForestTrustInfo: PLSA_FOREST_TRUST_INFORMATION, | |
200 | MergedForestTrustInfo: *mut PLSA_FOREST_TRUST_INFORMATION, | |
201 | ) -> DWORD; | |
202 | pub fn DsGetDcSiteCoverageW( | |
203 | ServerName: LPCWSTR, | |
204 | EntryCount: PULONG, | |
205 | SiteNames: *mut *mut LPWSTR, | |
206 | ) -> DWORD; | |
207 | pub fn DsGetDcSiteCoverageA( | |
208 | ServerName: LPCSTR, | |
209 | EntryCount: PULONG, | |
210 | SiteNames: *mut *mut LPSTR, | |
211 | ) -> DWORD; | |
212 | pub fn DsDeregisterDnsHostRecordsW( | |
213 | ServerName: LPWSTR, | |
214 | DnsDomainName: LPWSTR, | |
215 | DomainGuid: *mut GUID, | |
216 | DsaGuid: *mut GUID, | |
217 | DnsHostName: LPWSTR, | |
218 | ) -> DWORD; | |
219 | pub fn DsDeregisterDnsHostRecordsA( | |
220 | ServerName: LPSTR, | |
221 | DnsDomainName: LPSTR, | |
222 | DomainGuid: *mut GUID, | |
223 | DsaGuid: *mut GUID, | |
224 | DnsHostName: LPSTR, | |
225 | ) -> DWORD; | |
226 | } | |
227 | pub const DS_ONLY_DO_SITE_NAME: ULONG = 0x01; | |
228 | pub const DS_NOTIFY_AFTER_SITE_RECORDS: ULONG = 0x02; | |
229 | pub const DS_OPEN_VALID_OPTION_FLAGS: ULONG = DS_ONLY_DO_SITE_NAME | |
230 | | DS_NOTIFY_AFTER_SITE_RECORDS; | |
231 | pub const DS_OPEN_VALID_FLAGS: ULONG = DS_FORCE_REDISCOVERY | DS_ONLY_LDAP_NEEDED | |
232 | | DS_KDC_REQUIRED | DS_PDC_REQUIRED | DS_GC_SERVER_REQUIRED | DS_WRITABLE_REQUIRED; | |
233 | extern "system" { | |
234 | pub fn DsGetDcOpenW( | |
235 | DnsName: LPCWSTR, | |
236 | OptionFlags: ULONG, | |
237 | SiteName: LPCWSTR, | |
238 | DomainGuid: *mut GUID, | |
239 | DnsForestName: LPCWSTR, | |
240 | DcFlags: ULONG, | |
241 | RetGetDcContext: PHANDLE, | |
242 | ) -> DWORD; | |
243 | pub fn DsGetDcOpenA( | |
244 | DnsName: LPCSTR, | |
245 | OptionFlags: ULONG, | |
246 | SiteName: LPCSTR, | |
247 | DomainGuid: *mut GUID, | |
248 | DnsForestName: LPCSTR, | |
249 | DcFlags: ULONG, | |
250 | RetGetDcContext: PHANDLE, | |
251 | ) -> DWORD; | |
252 | pub fn DsGetDcNextA( | |
253 | GetDcContextHandle: HANDLE, | |
254 | SockAddressCount: PULONG, | |
255 | SockAddresses: *mut LPSOCKET_ADDRESS, | |
256 | DnsHostName: *mut LPSTR, | |
257 | ) -> DWORD; | |
258 | pub fn DsGetDcNextW( | |
259 | GetDcContextHandle: HANDLE, | |
260 | SockAddressCount: PULONG, | |
261 | SockAddresses: *mut LPSOCKET_ADDRESS, | |
262 | DnsHostName: *mut LPWSTR, | |
263 | ) -> DWORD; | |
264 | pub fn DsGetDcCloseW( | |
265 | GetDcContextHandle: HANDLE, | |
266 | ); | |
267 | } |