1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #ifndef _LMDFS_
7 #define _LMDFS_
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #ifndef NET_API_FUNCTION
14 #define NET_API_FUNCTION WINAPI
15 #endif
16 
17 #define DFS_VOLUME_STATES 0xF
18 
19 #define DFS_VOLUME_STATE_OK 1
20 #define DFS_VOLUME_STATE_INCONSISTENT 2
21 #define DFS_VOLUME_STATE_OFFLINE 3
22 #define DFS_VOLUME_STATE_ONLINE 4
23 
24 #define DFS_VOLUME_STATE_RESYNCHRONIZE 0x10
25 #define DFS_VOLUME_STATE_STANDBY 0x20
26 
27 #define DFS_VOLUME_FLAVORS 0x0300
28 
29 #define DFS_VOLUME_FLAVOR_UNUSED1 0x0000
30 #define DFS_VOLUME_FLAVOR_STANDALONE 0x0100
31 #define DFS_VOLUME_FLAVOR_AD_BLOB 0x0200
32 #define DFS_STORAGE_FLAVOR_UNUSED2 0x0300
33 
34 #define DFS_STORAGE_STATES 0xF
35 #define DFS_STORAGE_STATE_OFFLINE 1
36 #define DFS_STORAGE_STATE_ONLINE 2
37 #define DFS_STORAGE_STATE_ACTIVE 4
38 
39   typedef enum _DFS_TARGET_PRIORITY_CLASS {
40     DfsInvalidPriorityClass = -1,DfsSiteCostNormalPriorityClass = 0,DfsGlobalHighPriorityClass,DfsSiteCostHighPriorityClass,
41     DfsSiteCostLowPriorityClass,DfsGlobalLowPriorityClass
42   } DFS_TARGET_PRIORITY_CLASS;
43 
44   typedef struct _DFS_TARGET_PRIORITY {
45     DFS_TARGET_PRIORITY_CLASS TargetPriorityClass;
46     USHORT TargetPriorityRank;
47     USHORT Reserved;
48   } DFS_TARGET_PRIORITY,*PDFS_TARGET_PRIORITY;
49 
50   typedef struct _DFS_INFO_1 {
51     LPWSTR EntryPath;
52   } DFS_INFO_1,*PDFS_INFO_1,*LPDFS_INFO_1;
53 
54   typedef struct _DFS_INFO_2 {
55     LPWSTR EntryPath;
56     LPWSTR Comment;
57     DWORD State;
58     DWORD NumberOfStorages;
59   } DFS_INFO_2,*PDFS_INFO_2,*LPDFS_INFO_2;
60 
61   typedef struct _DFS_STORAGE_INFO {
62     ULONG State;
63     LPWSTR ServerName;
64     LPWSTR ShareName;
65   } DFS_STORAGE_INFO,*PDFS_STORAGE_INFO,*LPDFS_STORAGE_INFO;
66 
67 #ifdef _WIN64
68   typedef struct _DFS_STORAGE_INFO_0_32 {
69     ULONG State;
70     ULONG ServerName;
71     ULONG ShareName;
72   } DFS_STORAGE_INFO_0_32,*PDFS_STORAGE_INFO_0_32,*LPDFS_STORAGE_INFO_0_32;
73 #endif
74 
75   typedef struct _DFS_STORAGE_INFO_1 {
76     ULONG State;
77     LPWSTR ServerName;
78     LPWSTR ShareName;
79     DFS_TARGET_PRIORITY TargetPriority;
80   } DFS_STORAGE_INFO_1,*PDFS_STORAGE_INFO_1,*LPDFS_STORAGE_INFO_1;
81 
82   typedef struct _DFS_INFO_3 {
83     LPWSTR EntryPath;
84     LPWSTR Comment;
85     DWORD State;
86     DWORD NumberOfStorages;
87     LPDFS_STORAGE_INFO Storage;
88   } DFS_INFO_3,*PDFS_INFO_3,*LPDFS_INFO_3;
89 
90 #ifdef _WIN64
91   typedef struct _DFS_INFO_3_32 {
92     ULONG EntryPath;
93     ULONG Comment;
94     DWORD State;
95     DWORD NumberOfStorages;
96     ULONG Storage;
97   } DFS_INFO_3_32,*PDFS_INFO_3_32,*LPDFS_INFO_3_32;
98 #endif
99 
100   typedef struct _DFS_INFO_4 {
101     LPWSTR EntryPath;
102     LPWSTR Comment;
103     DWORD State;
104     ULONG Timeout;
105     GUID Guid;
106     DWORD NumberOfStorages;
107     LPDFS_STORAGE_INFO Storage;
108   } DFS_INFO_4,*PDFS_INFO_4,*LPDFS_INFO_4;
109 
110 #ifdef _WIN64
111   typedef struct _DFS_INFO_4_32 {
112     ULONG EntryPath;
113     ULONG Comment;
114     DWORD State;
115     ULONG Timeout;
116     GUID Guid;
117     DWORD NumberOfStorages;
118     ULONG Storage;
119   } DFS_INFO_4_32,*PDFS_INFO_4_32,*LPDFS_INFO_4_32;
120 #endif
121 
122   typedef struct _DFS_INFO_5 {
123     LPWSTR EntryPath;
124     LPWSTR Comment;
125     DWORD State;
126     ULONG Timeout;
127     GUID Guid;
128     ULONG PropertyFlags;
129     ULONG MetadataSize;
130     DWORD NumberOfStorages;
131   } DFS_INFO_5,*PDFS_INFO_5,*LPDFS_INFO_5;
132 
133   typedef struct _DFS_INFO_6 {
134     LPWSTR EntryPath;
135     LPWSTR Comment;
136     DWORD State;
137     ULONG Timeout;
138     GUID Guid;
139     ULONG PropertyFlags;
140     ULONG MetadataSize;
141     DWORD NumberOfStorages;
142     LPDFS_STORAGE_INFO_1 Storage;
143   } DFS_INFO_6,*PDFS_INFO_6,*LPDFS_INFO_6;
144 
145   typedef struct _DFS_INFO_7 {
146     GUID GenerationGuid;
147   } DFS_INFO_7,*PDFS_INFO_7,*LPDFS_INFO_7;
148 
149 #define DFS_PROPERTY_FLAG_INSITE_REFERRALS 0x00000001
150 #define DFS_PROPERTY_FLAG_ROOT_SCALABILITY 0x00000002
151 #define DFS_PROPERTY_FLAG_SITE_COSTING 0x00000004
152 #define DFS_PROPERTY_FLAG_TARGET_FAILBACK 0x00000008
153 #define DFS_PROPERTY_FLAG_CLUSTER_ENABLED 0x00000010
154 #define DFS_PROPERTY_FLAG_ABDE 0x00000020
155 
156   typedef struct _DFS_INFO_100 {
157     LPWSTR Comment;
158   } DFS_INFO_100,*PDFS_INFO_100,*LPDFS_INFO_100;
159 
160   typedef struct _DFS_INFO_101 {
161     DWORD State;
162   } DFS_INFO_101,*PDFS_INFO_101,*LPDFS_INFO_101;
163 
164   typedef struct _DFS_INFO_102 {
165     ULONG Timeout;
166   } DFS_INFO_102,*PDFS_INFO_102,*LPDFS_INFO_102;
167 
168   typedef struct _DFS_INFO_103 {
169     ULONG PropertyFlagMask;
170     ULONG PropertyFlags;
171   } DFS_INFO_103,*PDFS_INFO_103,*LPDFS_INFO_103;
172 
173   typedef struct _DFS_INFO_104 {
174     DFS_TARGET_PRIORITY TargetPriority;
175   } DFS_INFO_104,*PDFS_INFO_104,*LPDFS_INFO_104;
176 
177   typedef struct _DFS_INFO_105 {
178     LPWSTR Comment;
179     DWORD State;
180     ULONG Timeout;
181     ULONG PropertyFlagMask;
182     ULONG PropertyFlags;
183   } DFS_INFO_105,*PDFS_INFO_105,*LPDFS_INFO_105;
184 
185   typedef struct _DFS_INFO_106 {
186     DWORD State;
187     DFS_TARGET_PRIORITY TargetPriority;
188   } DFS_INFO_106,*PDFS_INFO_106,*LPDFS_INFO_106;
189 
190 #if (_WIN32_WINNT >= 0x0600)
191 #define DFS_NAMESPACE_CAPABILITY_ABDE 0x0000000000000001
192 
193   typedef enum _DFS_NAMESPACE_VERSION_ORIGIN {
194     DFS_NAMESPACE_VERSION_ORIGIN_COMBINED   = 0,
195     DFS_NAMESPACE_VERSION_ORIGIN_SERVER     = 1,
196     DFS_NAMESPACE_VERSION_ORIGIN_DOMAIN     = 2
197   } DFS_NAMESPACE_VERSION_ORIGIN;
198 
199 typedef struct _DFS_SUPPORTED_NAMESPACE_VERSION_INFO {
200   ULONG     DomainDfsMajorVersion;
201   ULONG     NamespaceMinorVersion;
202   ULONGLONG DomainDfsCapabilities;
203   ULONG     StandaloneDfsMajorVersion;
204   ULONG     StandaloneDfsMinorVersion;
205   ULONGLONG StandaloneDfsCapabilities;
206 } DFS_SUPPORTED_NAMESPACE_VERSION_INFO, *PDFS_SUPPORTED_NAMESPACE_VERSION_INFO;
207 
208   typedef struct _DFS_INFO_8 {
209     LPWSTR               EntryPath;
210     LPWSTR               Comment;
211     DWORD                State;
212     ULONG                Timeout;
213     GUID                 Guid;
214     ULONG                PropertyFlags;
215     ULONG                MetadataSize;
216     ULONG                SdLengthReserved;
217     PSECURITY_DESCRIPTOR pSecurityDescriptor;
218     DWORD                NumberOfStorages;
219   } DFS_INFO_8, *PDFS_INFO_8;
220 
221   typedef struct _DFS_INFO_9 {
222     LPWSTR               EntryPath;
223     LPWSTR               Comment;
224     DWORD                State;
225     ULONG                Timeout;
226     GUID                 Guid;
227     ULONG                PropertyFlags;
228     ULONG                MetadataSize;
229     ULONG                SdLengthReserved;
230     PSECURITY_DESCRIPTOR pSecurityDescriptor;
231     DWORD                NumberOfStorages;
232     LPDFS_STORAGE_INFO_1 Storage;
233   } DFS_INFO_9, *PDFS_INFO_9;
234 
235   typedef struct _DFS_INFO_50 {
236     ULONG     NamespaceMajorVersion;
237     ULONG     NamespaceMinorVersion;
238     ULONGLONG NamespaceCapabilities;
239   } DFS_INFO_50, *PDFS_INFO_50;
240 
241   typedef struct _DFS_INFO_107 {
242     LPWSTR               Comment;
243     DWORD                State;
244     ULONG                Timeout;
245     ULONG                PropertyFlagMask;
246     ULONG                PropertyFlags;
247     ULONG                SdLengthReserved;
248     PSECURITY_DESCRIPTOR pSecurityDescriptor;
249   } DFS_INFO_107, *PDFS_INFO_107;
250 
251   typedef struct _DFS_INFO_150 {
252     ULONG                SdLengthReserved;
253     PSECURITY_DESCRIPTOR pSecurityDescriptor;
254   } DFS_INFO_150, *PDFS_INFO_150;
255 
256 NET_API_STATUS NET_API_FUNCTION NetDfsAddRootTarget(
257   LPWSTR pDfsPath,
258   LPWSTR pTargetPath,
259   ULONG MajorVersion,
260   LPWSTR pComment,
261   ULONG Flags
262 );
263 
264 NET_API_STATUS NET_API_FUNCTION NetDfsGetSupportedNamespaceVersion(
265   DFS_NAMESPACE_VERSION_ORIGIN Origin,
266   PWSTR pName,
267   PDFS_SUPPORTED_NAMESPACE_VERSION_INFO *ppVersionInfo
268 );
269 
270 NET_API_STATUS NET_API_FUNCTION NetDfsRemoveRootTarget(
271   LPWSTR pDfsPath,
272   LPWSTR pTargetPath,
273   ULONG Flags
274 );
275 
276 NET_API_STATUS WINAPI NetShareDelEx(
277   LMSTR servername,
278   DWORD level,
279   LPBYTE buf
280 );
281 
282 #endif /*(_WIN32_WINNT >= 0x0600)*/
283 
284   typedef struct _DFS_INFO_200 {
285     LPWSTR FtDfsName;
286   } DFS_INFO_200,*PDFS_INFO_200,*LPDFS_INFO_200;
287 
288   typedef struct _DFS_INFO_300 {
289     DWORD Flags;
290     LPWSTR DfsName;
291   } DFS_INFO_300,*PDFS_INFO_300,*LPDFS_INFO_300;
292 
293 #define DFS_ADD_VOLUME 1
294 #define DFS_RESTORE_VOLUME 2
295 
296   NET_API_STATUS WINAPI NetDfsAdd(LPWSTR DfsEntryPath,LPWSTR ServerName,LPWSTR ShareName,LPWSTR Comment,DWORD Flags);
297   NET_API_STATUS WINAPI NetDfsAddStdRoot(LPWSTR ServerName,LPWSTR RootShare,LPWSTR Comment,DWORD Flags);
298   NET_API_STATUS WINAPI NetDfsRemoveStdRoot(LPWSTR ServerName,LPWSTR RootShare,DWORD Flags);
299   NET_API_STATUS WINAPI NetDfsAddFtRoot(LPWSTR ServerName,LPWSTR RootShare,LPWSTR FtDfsName,LPWSTR Comment,DWORD Flags);
300   NET_API_STATUS WINAPI NetDfsRemoveFtRoot(LPWSTR ServerName,LPWSTR RootShare,LPWSTR FtDfsName,DWORD Flags);
301   NET_API_STATUS WINAPI NetDfsRemoveFtRootForced(LPWSTR DomainName,LPWSTR ServerName,LPWSTR RootShare,LPWSTR FtDfsName,DWORD Flags);
302   NET_API_STATUS WINAPI NetDfsManagerInitialize(LPWSTR ServerName,DWORD Flags);
303   NET_API_STATUS WINAPI NetDfsAddStdRootForced(LPWSTR ServerName,LPWSTR RootShare,LPWSTR Comment,LPWSTR Store);
304   NET_API_STATUS WINAPI NetDfsGetDcAddress(LPWSTR ServerName,LPWSTR *DcIpAddress,BOOLEAN *IsRoot,ULONG *Timeout);
305 
306 #define NET_DFS_SETDC_FLAGS 0x00000000
307 #define NET_DFS_SETDC_TIMEOUT 0x00000001
308 #define NET_DFS_SETDC_INITPKT 0x00000002
309 
310   typedef struct {
311     ULONG SiteFlags;
312     LPWSTR SiteName;
313   } DFS_SITENAME_INFO,*PDFS_SITENAME_INFO,*LPDFS_SITENAME_INFO;
314 
315 #define DFS_SITE_PRIMARY 0x1
316 
317   typedef struct {
318     ULONG cSites;
319     DFS_SITENAME_INFO Site[1];
320   } DFS_SITELIST_INFO,*PDFS_SITELIST_INFO,*LPDFS_SITELIST_INFO;
321 
322   NET_API_STATUS WINAPI NetDfsRemove(LPWSTR DfsEntryPath,LPWSTR ServerName,LPWSTR ShareName);
323   NET_API_STATUS WINAPI NetDfsEnum(LPWSTR DfsName,DWORD Level,DWORD PrefMaxLen,LPBYTE *Buffer,LPDWORD EntriesRead,LPDWORD ResumeHandle);
324   NET_API_STATUS WINAPI NetDfsGetInfo(LPWSTR DfsEntryPath,LPWSTR ServerName,LPWSTR ShareName,DWORD Level,LPBYTE *Buffer);
325   NET_API_STATUS WINAPI NetDfsSetInfo(LPWSTR DfsEntryPath,LPWSTR ServerName,LPWSTR ShareName,DWORD Level,LPBYTE Buffer);
326   NET_API_STATUS WINAPI NetDfsGetClientInfo(LPWSTR DfsEntryPath,LPWSTR ServerName,LPWSTR ShareName,DWORD Level,LPBYTE *Buffer);
327   NET_API_STATUS WINAPI NetDfsSetClientInfo(LPWSTR DfsEntryPath,LPWSTR ServerName,LPWSTR ShareName,DWORD Level,LPBYTE Buffer);
328   NET_API_STATUS WINAPI NetDfsMove(LPWSTR DfsEntryPath,LPWSTR DfsNewEntryPath,ULONG Flags);
329 
330 #define DFS_MOVE_FLAG_REPLACE_IF_EXISTS 0x00000001
331 
332   NET_API_STATUS WINAPI NetDfsRename(LPWSTR Path,LPWSTR NewPath);
333   NET_API_STATUS WINAPI NetDfsGetSecurity(LPWSTR DfsEntryPath,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR *ppSecurityDescriptor,LPDWORD lpcbSecurityDescriptor);
334   NET_API_STATUS WINAPI NetDfsSetSecurity(LPWSTR DfsEntryPath,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor);
335   NET_API_STATUS WINAPI NetDfsGetStdContainerSecurity(LPWSTR MachineName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR *ppSecurityDescriptor,LPDWORD lpcbSecurityDescriptor);
336   NET_API_STATUS WINAPI NetDfsSetStdContainerSecurity(LPWSTR MachineName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor);
337   NET_API_STATUS WINAPI NetDfsGetFtContainerSecurity(LPWSTR DomainName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR *ppSecurityDescriptor,LPDWORD lpcbSecurityDescriptor);
338   NET_API_STATUS WINAPI NetDfsSetFtContainerSecurity(LPWSTR DomainName,SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor);
339 
340 #ifdef __cplusplus
341 }
342 #endif
343 #endif
344