winapi_ui_automation/um/
lmdfs.rs

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 NetDfs API
7use shared::guiddef::GUID;
8use shared::lmcons::NET_API_STATUS;
9use shared::minwindef::{DWORD, LPBYTE, LPDWORD, ULONG, USHORT};
10use um::winnt::{LPWSTR, PSECURITY_DESCRIPTOR, PWSTR, SECURITY_INFORMATION, ULONGLONG, WCHAR};
11pub const DFS_VOLUME_STATES: DWORD = 0xF;
12pub const DFS_VOLUME_STATE_OK: DWORD = 1;
13pub const DFS_VOLUME_STATE_INCONSISTENT: DWORD = 2;
14pub const DFS_VOLUME_STATE_OFFLINE: DWORD = 3;
15pub const DFS_VOLUME_STATE_ONLINE: DWORD = 4;
16pub const DFS_VOLUME_STATE_RESYNCHRONIZE: DWORD = 0x10;
17pub const DFS_VOLUME_STATE_STANDBY: DWORD = 0x20;
18pub const DFS_VOLUME_STATE_FORCE_SYNC: DWORD = 0x40;
19pub const DFS_VOLUME_FLAVORS: DWORD = 0x0300;
20pub const DFS_VOLUME_FLAVOR_UNUSED1: DWORD = 0x0000;
21pub const DFS_VOLUME_FLAVOR_STANDALONE: DWORD = 0x0100;
22pub const DFS_VOLUME_FLAVOR_AD_BLOB: DWORD = 0x0200;
23pub const DFS_STORAGE_FLAVOR_UNUSED2: DWORD = 0x0300;
24pub const DFS_STORAGE_STATES: ULONG = 0xF;
25pub const DFS_STORAGE_STATE_OFFLINE: ULONG = 1;
26pub const DFS_STORAGE_STATE_ONLINE: ULONG = 2;
27pub const DFS_STORAGE_STATE_ACTIVE: ULONG = 4;
28ENUM!{enum DFS_TARGET_PRIORITY_CLASS {
29    DfsInvalidPriorityClass = -1i32 as u32,
30    DfsSiteCostNormalPriorityClass = 0,
31    DfsGlobalHighPriorityClass,
32    DfsSiteCostHighPriorityClass,
33    DfsSiteCostLowPriorityClass,
34    DfsGlobalLowPriorityClass,
35}}
36STRUCT!{struct DFS_TARGET_PRIORITY {
37    TargetPriorityClass: DFS_TARGET_PRIORITY_CLASS,
38    TargetPriorityRank: USHORT,
39    Reserved: USHORT,
40}}
41pub type PDFS_TARGET_PRIORITY = *mut DFS_TARGET_PRIORITY;
42STRUCT!{struct DFS_INFO_1 {
43    EntryPath: LPWSTR,
44}}
45pub type PDFS_INFO_1 = *mut DFS_INFO_1;
46pub type LPDFS_INFO_1 = *mut DFS_INFO_1;
47#[cfg(target_pointer_width = "64")]
48IFDEF!{
49STRUCT!{struct DFS_INFO_1_32 {
50    EntryPath: ULONG,
51}}
52pub type PDFS_INFO_1_32 = *mut DFS_INFO_1_32;
53pub type LPDFS_INFO_1_32 = *mut DFS_INFO_1_32;
54}
55STRUCT!{struct DFS_INFO_2 {
56    EntryPath: LPWSTR,
57    Comment: LPWSTR,
58    State: DWORD,
59    NumberOfStorages: DWORD,
60}}
61pub type PDFS_INFO_2 = *mut DFS_INFO_2;
62pub type LPDFS_INFO_2 = *mut DFS_INFO_2;
63#[cfg(target_pointer_width = "64")]
64IFDEF!{
65STRUCT!{struct DFS_INFO_2_32 {
66    EntryPath: ULONG,
67    Comment: ULONG,
68    State: DWORD,
69    NumberOfStorages: DWORD,
70}}
71pub type PDFS_INFO_2_32 = *mut DFS_INFO_2_32;
72pub type LPDFS_INFO_2_32 = *mut DFS_INFO_2_32;
73}
74STRUCT!{struct DFS_STORAGE_INFO {
75    State: ULONG,
76    ServerName: LPWSTR,
77    ShareName: LPWSTR,
78}}
79pub type PDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO;
80pub type LPDFS_STORAGE_INFO = *mut DFS_STORAGE_INFO;
81#[cfg(target_pointer_width = "64")]
82IFDEF!{
83STRUCT!{struct DFS_STORAGE_INFO_0_32 {
84    State: ULONG,
85    ServerName: ULONG,
86    ShareName: ULONG,
87}}
88pub type PDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32;
89pub type LPDFS_STORAGE_INFO_0_32 = *mut DFS_STORAGE_INFO_0_32;
90}
91STRUCT!{struct DFS_STORAGE_INFO_1 {
92    State: ULONG,
93    ServerName: LPWSTR,
94    ShareName: LPWSTR,
95    TargetPriority: DFS_TARGET_PRIORITY,
96}}
97pub type PDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1;
98pub type LPDFS_STORAGE_INFO_1 = *mut DFS_STORAGE_INFO_1;
99STRUCT!{struct DFS_INFO_3 {
100    EntryPath: LPWSTR,
101    Comment: LPWSTR,
102    State: DWORD,
103    NumberOfStorages: DWORD,
104    Storage: LPDFS_STORAGE_INFO,
105}}
106pub type PDFS_INFO_3 = *mut DFS_INFO_3;
107pub type LPDFS_INFO_3 = *mut DFS_INFO_3;
108#[cfg(target_pointer_width = "64")]
109IFDEF!{
110STRUCT!{struct DFS_INFO_3_32 {
111    EntryPath: ULONG,
112    Comment: ULONG,
113    State: DWORD,
114    NumberOfStorages: DWORD,
115    Storage: ULONG,
116}}
117pub type PDFS_INFO_3_32 = *mut DFS_INFO_3_32;
118pub type LPDFS_INFO_3_32 = *mut DFS_INFO_3_32;
119}
120STRUCT!{struct DFS_INFO_4 {
121    EntryPath: LPWSTR,
122    Comment: LPWSTR,
123    State: DWORD,
124    Timeout: ULONG,
125    Guid: GUID,
126    NumberOfStorages: DWORD,
127    Storage: LPDFS_STORAGE_INFO,
128}}
129pub type PDFS_INFO_4 = *mut DFS_INFO_4;
130pub type LPDFS_INFO_4 = *mut DFS_INFO_4;
131#[cfg(target_pointer_width = "64")]
132IFDEF!{
133STRUCT!{struct DFS_INFO_4_32 {
134    EntryPath: ULONG,
135    Comment: ULONG,
136    State: DWORD,
137    Timeout: ULONG,
138    Guid: GUID,
139    NumberOfStorages: DWORD,
140    Storage: ULONG,
141}}
142pub type PDFS_INFO_4_32 = *mut DFS_INFO_4_32;
143pub type LPDFS_INFO_4_32 = *mut DFS_INFO_4_32;
144}
145STRUCT!{struct DFS_INFO_5 {
146    EntryPath: LPWSTR,
147    Comment: LPWSTR,
148    State: DWORD,
149    Timeout: ULONG,
150    Guid: GUID,
151    PropertyFlags: ULONG,
152    MetadataSize: ULONG,
153    NumberOfStorages: DWORD,
154}}
155pub type PDFS_INFO_5 = *mut DFS_INFO_5;
156pub type LPDFS_INFO_5 = *mut DFS_INFO_5;
157STRUCT!{struct DFS_INFO_6 {
158    EntryPath: LPWSTR,
159    Comment: LPWSTR,
160    State: DWORD,
161    Timeout: ULONG,
162    Guid: GUID,
163    PropertyFlags: ULONG,
164    MetadataSize: ULONG,
165    NumberOfStorages: DWORD,
166    Storage: LPDFS_STORAGE_INFO,
167}}
168pub type PDFS_INFO_6 = *mut DFS_INFO_6;
169pub type LPDFS_INFO_6 = *mut DFS_INFO_6;
170STRUCT!{struct DFS_INFO_7 {
171    GenerationGuid: GUID,
172}}
173pub type PDFS_INFO_7 = *mut DFS_INFO_7;
174pub type LPDFS_INFO_7 = *mut DFS_INFO_7;
175STRUCT!{struct DFS_INFO_8 {
176    EntryPath: LPWSTR,
177    Comment: LPWSTR,
178    State: DWORD,
179    Timeout: ULONG,
180    Guid: GUID,
181    PropertyFlags: ULONG,
182    MetadataSize: ULONG,
183    SdLengthReserved: ULONG,
184    pSecurityDescriptor: PSECURITY_DESCRIPTOR,
185    NumberOfStorages: DWORD,
186}}
187pub type PDFS_INFO_8 = *mut DFS_INFO_8;
188pub type LPDFS_INFO_8 = *mut DFS_INFO_8;
189STRUCT!{struct DFS_INFO_9 {
190    EntryPath: LPWSTR,
191    Comment: LPWSTR,
192    State: DWORD,
193    Timeout: ULONG,
194    Guid: GUID,
195    PropertyFlags: ULONG,
196    MetadataSize: ULONG,
197    SdLengthReserved: ULONG,
198    pSecurityDescriptor: PSECURITY_DESCRIPTOR,
199    NumberOfStorages: DWORD,
200    Storage: LPDFS_STORAGE_INFO,
201}}
202pub type PDFS_INFO_9 = *mut DFS_INFO_9;
203pub type LPDFS_INFO_9 = *mut DFS_INFO_9;
204pub const DFS_VALID_PROPERTY_FLAGS: ULONG = DFS_PROPERTY_FLAG_INSITE_REFERRALS
205    | DFS_PROPERTY_FLAG_ROOT_SCALABILITY | DFS_PROPERTY_FLAG_SITE_COSTING
206    | DFS_PROPERTY_FLAG_TARGET_FAILBACK | DFS_PROPERTY_FLAG_CLUSTER_ENABLED
207    | DFS_PROPERTY_FLAG_ABDE;
208pub const DFS_PROPERTY_FLAG_INSITE_REFERRALS: ULONG = 0x00000001;
209pub const DFS_PROPERTY_FLAG_ROOT_SCALABILITY: ULONG = 0x00000002;
210pub const DFS_PROPERTY_FLAG_SITE_COSTING: ULONG = 0x00000004;
211pub const DFS_PROPERTY_FLAG_TARGET_FAILBACK: ULONG = 0x00000008;
212pub const DFS_PROPERTY_FLAG_CLUSTER_ENABLED: ULONG = 0x00000010;
213pub const DFS_PROPERTY_FLAG_ABDE: ULONG = 0x00000020;
214STRUCT!{struct DFS_INFO_50 {
215    NamespaceMajorVersion: ULONG,
216    NamespaceMinorVersion: ULONG,
217    NamespaceCapabilities: ULONGLONG,
218}}
219pub type PDFS_INFO_50 = *mut DFS_INFO_50;
220pub type LPDFS_INFO_50 = *mut DFS_INFO_50;
221STRUCT!{struct DFS_INFO_100 {
222    Comment: LPWSTR,
223}}
224pub type PDFS_INFO_100 = *mut DFS_INFO_100;
225pub type LPDFS_INFO_100 = *mut DFS_INFO_100;
226STRUCT!{struct DFS_INFO_101 {
227    State: DWORD,
228}}
229pub type PDFS_INFO_101 = *mut DFS_INFO_101;
230pub type LPDFS_INFO_101 = *mut DFS_INFO_101;
231STRUCT!{struct DFS_INFO_102 {
232    Timeout: ULONG,
233}}
234pub type PDFS_INFO_102 = *mut DFS_INFO_102;
235pub type LPDFS_INFO_102 = *mut DFS_INFO_102;
236STRUCT!{struct DFS_INFO_103 {
237    PropertyFlagMask: ULONG,
238    PropertyFlags: ULONG,
239}}
240pub type PDFS_INFO_103 = *mut DFS_INFO_103;
241pub type LPDFS_INFO_103 = *mut DFS_INFO_103;
242STRUCT!{struct DFS_INFO_104 {
243    TargetPriority: DFS_TARGET_PRIORITY,
244}}
245pub type PDFS_INFO_104 = *mut DFS_INFO_104;
246pub type LPDFS_INFO_104 = *mut DFS_INFO_104;
247STRUCT!{struct DFS_INFO_105 {
248    Comment: LPWSTR,
249    State: DWORD,
250    Timeout: ULONG,
251    PropertyFlagMask: ULONG,
252    PropertyFlags: ULONG,
253}}
254pub type PDFS_INFO_105 = *mut DFS_INFO_105;
255pub type LPDFS_INFO_105 = *mut DFS_INFO_105;
256STRUCT!{struct DFS_INFO_106 {
257    State: DWORD,
258    TargetPriority: DFS_TARGET_PRIORITY,
259}}
260pub type PDFS_INFO_106 = *mut DFS_INFO_106;
261pub type LPDFS_INFO_106 = *mut DFS_INFO_106;
262STRUCT!{struct DFS_INFO_107 {
263    Comment: LPWSTR,
264    State: DWORD,
265    Timeout: ULONG,
266    PropertyFlagMask: ULONG,
267    PropertyFlags: ULONG,
268    SdLengthReserved: ULONG,
269    pSecurityDescriptor: PSECURITY_DESCRIPTOR,
270}}
271pub type PDFS_INFO_107 = *mut DFS_INFO_107;
272pub type LPDFS_INFO_107 = *mut DFS_INFO_107;
273STRUCT!{struct DFS_INFO_150 {
274    SdLengthReserved: ULONG,
275    pSecurityDescriptor: PSECURITY_DESCRIPTOR,
276}}
277pub type PDFS_INFO_150 = *mut DFS_INFO_150;
278pub type LPDFS_INFO_150 = *mut DFS_INFO_150;
279STRUCT!{struct DFS_INFO_200 {
280    FtDfsName: LPWSTR,
281}}
282pub type PDFS_INFO_200 = *mut DFS_INFO_200;
283pub type LPDFS_INFO_200 = *mut DFS_INFO_200;
284STRUCT!{struct DFS_INFO_300 {
285    Flags: DWORD,
286    DfsName: LPWSTR,
287}}
288pub type PDFS_INFO_300 = *mut DFS_INFO_300;
289pub type LPDFS_INFO_300 = *mut DFS_INFO_300;
290extern "system" {
291    pub fn NetDfsAdd(
292        DfsEntryPath: LPWSTR,
293        ServerName: LPWSTR,
294        ShareName: LPWSTR,
295        Comment: LPWSTR,
296        Flags: DWORD,
297    ) -> NET_API_STATUS;
298}
299pub const DFS_ADD_VOLUME: DWORD = 1;
300pub const DFS_RESTORE_VOLUME: DWORD = 2;
301extern "system" {
302    pub fn NetDfsAddStdRoot(
303        ServerName: LPWSTR,
304        RootShare: LPWSTR,
305        Comment: LPWSTR,
306        Flags: DWORD,
307    ) -> NET_API_STATUS;
308    pub fn NetDfsRemoveStdRoot(
309        ServerName: LPWSTR,
310        RootShare: LPWSTR,
311        Flags: DWORD,
312    ) -> NET_API_STATUS;
313    pub fn NetDfsAddFtRoot(
314        ServerName: LPWSTR,
315        RootShare: LPWSTR,
316        FtDfsName: LPWSTR,
317        Comment: LPWSTR,
318        Flags: DWORD,
319    ) -> NET_API_STATUS;
320    pub fn NetDfsRemoveFtRoot(
321        ServerName: LPWSTR,
322        RootShare: LPWSTR,
323        FtDfsName: LPWSTR,
324        Flags: DWORD,
325    ) -> NET_API_STATUS;
326    pub fn NetDfsRemoveFtRootForced(
327        DomainName: LPWSTR,
328        ServerName: LPWSTR,
329        RootShare: LPWSTR,
330        FtDfsName: LPWSTR,
331        Flags: DWORD,
332    ) -> NET_API_STATUS;
333}
334pub const NET_DFS_SETDC_FLAGS: DWORD = 0x00000000;
335pub const NET_DFS_SETDC_TIMEOUT: DWORD = 0x00000001;
336pub const NET_DFS_SETDC_INITPKT: DWORD = 0x00000002;
337STRUCT!{struct DFS_SITENAME_INFO {
338    SiteFlags: ULONG,
339    SiteName: LPWSTR,
340}}
341pub type PDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO;
342pub type LPDFS_SITENAME_INFO = *mut DFS_SITENAME_INFO;
343pub const DFS_SITE_PRIMARY: ULONG = 0x1;
344STRUCT!{struct DFS_SITELIST_INFO {
345    cSites: ULONG,
346    Site: [DFS_SITENAME_INFO; 1],
347}}
348pub type PDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO;
349pub type LPDFS_SITELIST_INFO = *mut DFS_SITELIST_INFO;
350extern "system" {
351    pub fn NetDfsRemove(
352        DfsEntryPath: LPWSTR,
353        ServerName: LPWSTR,
354        ShareName: LPWSTR,
355    ) -> NET_API_STATUS;
356    pub fn NetDfsEnum(
357        DfsName: LPWSTR,
358        Level: DWORD,
359        PrefMaxLen: DWORD,
360        Buffer: *mut LPBYTE,
361        EntriesRead: LPDWORD,
362        ResumeHandle: LPDWORD,
363    ) -> NET_API_STATUS;
364    pub fn NetDfsGetInfo(
365        DfsEntryPath: LPWSTR,
366        ServerName: LPWSTR,
367        ShareName: LPWSTR,
368        Level: DWORD,
369        Buffer: *mut LPBYTE,
370    ) -> NET_API_STATUS;
371    pub fn NetDfsSetInfo(
372        DfsEntryPath: LPWSTR,
373        ServerName: LPWSTR,
374        ShareName: LPWSTR,
375        Level: DWORD,
376        Buffer: LPBYTE,
377    ) -> NET_API_STATUS;
378    pub fn NetDfsGetClientInfo(
379        DfsEntryPath: LPWSTR,
380        ServerName: LPWSTR,
381        ShareName: LPWSTR,
382        Level: DWORD,
383        Buffer: *mut LPBYTE,
384    ) -> NET_API_STATUS;
385    pub fn NetDfsSetClientInfo(
386        DfsEntryPath: LPWSTR,
387        ServerName: LPWSTR,
388        ShareName: LPWSTR,
389        Level: DWORD,
390        Buffer: LPBYTE,
391    ) -> NET_API_STATUS;
392    pub fn NetDfsMove(
393        OldDfsEntryPath: LPWSTR,
394        NewDfsEntryPath: LPWSTR,
395        Flags: ULONG,
396    ) -> NET_API_STATUS;
397}
398pub const DFS_MOVE_FLAG_REPLACE_IF_EXISTS: ULONG = 0x00000001;
399extern "system" {
400    pub fn NetDfsRename(
401        Path: LPWSTR,
402        NewPath: LPWSTR,
403    ) -> NET_API_STATUS;
404    pub fn NetDfsAddRootTarget(
405        pDfsPath: LPWSTR,
406        pTargetPath: LPWSTR,
407        MajorVersion: ULONG,
408        pComment: LPWSTR,
409        Flags: ULONG,
410    ) -> NET_API_STATUS;
411}
412pub const DFS_FORCE_REMOVE: ULONG = 0x80000000;
413extern "system" {
414    pub fn NetDfsRemoveRootTarget(
415        pDfsPath: LPWSTR,
416        pTargetPath: LPWSTR,
417        Flags: DWORD,
418    ) -> NET_API_STATUS;
419    pub fn NetDfsGetSecurity(
420        DfsEntryPath: LPWSTR,
421        SecurityInformation: SECURITY_INFORMATION,
422        ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR,
423        lpcbSecurityDescriptor: LPDWORD,
424    ) -> NET_API_STATUS;
425    pub fn NetDfsSetSecurity(
426        DfsEntryPath: LPWSTR,
427        SecurityInformation: SECURITY_INFORMATION,
428        pSecurityDescriptor: PSECURITY_DESCRIPTOR,
429    ) -> NET_API_STATUS;
430    pub fn NetDfsGetStdContainerSecurity(
431        MachineName: LPWSTR,
432        SecurityInformation: SECURITY_INFORMATION,
433        ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR,
434        lpcbSecurityDescriptor: LPDWORD,
435    ) -> NET_API_STATUS;
436    pub fn NetDfsSetStdContainerSecurity(
437        MachineName: LPWSTR,
438        SecurityInformation: SECURITY_INFORMATION,
439        pSecurityDescriptor: PSECURITY_DESCRIPTOR,
440    ) -> NET_API_STATUS;
441    pub fn NetDfsGetFtContainerSecurity(
442        DomainName: LPWSTR,
443        SecurityInformation: SECURITY_INFORMATION,
444        ppSecurityDescriptor: *mut PSECURITY_DESCRIPTOR,
445        lpcbSecurityDescriptor: LPDWORD,
446    ) -> NET_API_STATUS;
447    pub fn NetDfsSetFtContainerSecurity(
448        DomainName: LPWSTR,
449        SecurityInformation: SECURITY_INFORMATION,
450        pSecurityDescriptor: PSECURITY_DESCRIPTOR,
451    ) -> NET_API_STATUS;
452}
453ENUM!{enum DFS_NAMESPACE_VERSION_ORIGIN {
454    DFS_NAMESPACE_VERSION_ORIGIN_COMBINED = 0,
455    DFS_NAMESPACE_VERSION_ORIGIN_SERVER,
456    DFS_NAMESPACE_VERSION_ORIGIN_DOMAIN,
457}}
458pub type PDFS_NAMESPACE_VERSION_ORIGIN = *mut DFS_NAMESPACE_VERSION_ORIGIN;
459pub const DFS_NAMESPACE_CAPABILITY_ABDE: ULONGLONG = 0x0000000000000001;
460STRUCT!{struct DFS_SUPPORTED_NAMESPACE_VERSION_INFO {
461    DomainDfsMajorVersion: ULONG,
462    DomainDfsMinorVersion: ULONG,
463    DomainDfsCapabilities: ULONGLONG,
464    StandaloneDfsMajorVersion: ULONG,
465    StandaloneDfsMinorVersion: ULONG,
466    StandaloneDfsCapabilities: ULONGLONG,
467}}
468pub type PDFS_SUPPORTED_NAMESPACE_VERSION_INFO = *mut DFS_SUPPORTED_NAMESPACE_VERSION_INFO;
469extern "system" {
470    pub fn NetDfsGetSupportedNamespaceVersion(
471        Origin: DFS_NAMESPACE_VERSION_ORIGIN,
472        pName: PWSTR,
473        ppVersionInfo: *mut PDFS_SUPPORTED_NAMESPACE_VERSION_INFO,
474    ) -> NET_API_STATUS;
475}
476STRUCT!{struct DFS_GET_PKT_ENTRY_STATE_ARG {
477    DfsEntryPathLen: USHORT,
478    ServerNameLen: USHORT,
479    ShareNameLen: USHORT,
480    Level: ULONG,
481    Buffer: [WCHAR; 1],
482}}
483pub type PDFS_GET_PKT_ENTRY_STATE_ARG = *mut DFS_GET_PKT_ENTRY_STATE_ARG;