1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * Authors: Stewart Gordon
7  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
8  * Source: $(DRUNTIMESRC core/sys/windows/_winnetwk.d)
9  */
10 /// Automatically imported and edited from the druntime module
11 /// core.sys.windows.winnetwk for the auto-generated win32 package.
12 module win32.winnetwk;
13 //version (Windows):
14 @system:
15 
16 version (ANSI) {} else version = Unicode;
17 version (Win32_UseLib) pragma(lib, "mpr");
18 
19 import win32.winbase, win32.winerror, win32.winnt;
20 
21 enum : DWORD {
22     WNNC_NET_MSNET       = 0x00010000,
23     WNNC_NET_LANMAN      = 0x00020000,
24     WNNC_NET_NETWARE     = 0x00030000,
25     WNNC_NET_VINES       = 0x00040000,
26     WNNC_NET_10NET       = 0x00050000,
27     WNNC_NET_LOCUS       = 0x00060000,
28     WNNC_NET_SUN_PC_NFS  = 0x00070000,
29     WNNC_NET_LANSTEP     = 0x00080000,
30     WNNC_NET_9TILES      = 0x00090000,
31     WNNC_NET_LANTASTIC   = 0x000A0000,
32     WNNC_NET_AS400       = 0x000B0000,
33     WNNC_NET_FTP_NFS     = 0x000C0000,
34     WNNC_NET_PATHWORKS   = 0x000D0000,
35     WNNC_NET_LIFENET     = 0x000E0000,
36     WNNC_NET_POWERLAN    = 0x000F0000,
37     WNNC_NET_BWNFS       = 0x00100000,
38     WNNC_NET_COGENT      = 0x00110000,
39     WNNC_NET_FARALLON    = 0x00120000,
40     WNNC_NET_APPLETALK   = 0x00130000,
41     WNNC_NET_INTERGRAPH  = 0x00140000,
42     WNNC_NET_SYMFONET    = 0x00150000,
43     WNNC_NET_CLEARCASE   = 0x00160000,
44     WNNC_NET_FRONTIER    = 0x00170000,
45     WNNC_NET_BMC         = 0x00180000,
46     WNNC_NET_DCE         = 0x00190000,
47     WNNC_NET_AVID        = 0x001A0000,
48     WNNC_NET_DOCUSPACE   = 0x001B0000,
49     WNNC_NET_MANGOSOFT   = 0x001C0000,
50     WNNC_NET_SERNET      = 0x001D0000,
51     WNNC_NET_DECORB      = 0x00200000,
52     WNNC_NET_PROTSTOR    = 0x00210000,
53     WNNC_NET_FJ_REDIR    = 0x00220000,
54     WNNC_NET_DISTINCT    = 0x00230000,
55     WNNC_NET_TWINS       = 0x00240000,
56     WNNC_NET_RDR2SAMPLE  = 0x00250000,
57     WNNC_NET_CSC         = 0x00260000,
58     WNNC_NET_3IN1        = 0x00270000,
59     WNNC_NET_EXTENDNET   = 0x00290000,
60     WNNC_NET_OBJECT_DIRE = 0x00300000,
61     WNNC_NET_MASFAX      = 0x00310000,
62     WNNC_NET_HOB_NFS     = 0x00320000,
63     WNNC_NET_SHIVA       = 0x00330000,
64     WNNC_NET_IBMAL       = 0x00340000,
65     WNNC_CRED_MANAGER    = 0xFFFF0000
66 }
67 
68 enum : DWORD {
69     RESOURCE_CONNECTED  = 1,
70     RESOURCE_GLOBALNET  = 2,
71     RESOURCE_REMEMBERED = 3,
72     RESOURCE_RECENT     = 4,
73     RESOURCE_CONTEXT    = 5
74 }
75 
76 enum DWORD
77     RESOURCETYPE_ANY      = 0,
78     RESOURCETYPE_DISK     = 1,
79     RESOURCETYPE_PRINT    = 2,
80     RESOURCETYPE_RESERVED = 8,
81     RESOURCETYPE_UNKNOWN  = 0xFFFFFFFF;
82 
83 enum DWORD
84     RESOURCEUSAGE_CONNECTABLE   = 0x00000001,
85     RESOURCEUSAGE_CONTAINER     = 0x00000002,
86     RESOURCEUSAGE_NOLOCALDEVICE = 0x00000004,
87     RESOURCEUSAGE_SIBLING       = 0x00000008,
88     RESOURCEUSAGE_ATTACHED      = 0x00000010,
89     RESOURCEUSAGE_ALL           = (RESOURCEUSAGE_CONNECTABLE
90                                   | RESOURCEUSAGE_CONTAINER
91                                   | RESOURCEUSAGE_ATTACHED),
92     RESOURCEUSAGE_RESERVED      = 0x80000000;
93 
94 enum : DWORD {
95     RESOURCEDISPLAYTYPE_GENERIC,
96     RESOURCEDISPLAYTYPE_DOMAIN,
97     RESOURCEDISPLAYTYPE_SERVER,
98     RESOURCEDISPLAYTYPE_SHARE,
99     RESOURCEDISPLAYTYPE_FILE,
100     RESOURCEDISPLAYTYPE_GROUP,
101     RESOURCEDISPLAYTYPE_NETWORK,
102     RESOURCEDISPLAYTYPE_ROOT,
103     RESOURCEDISPLAYTYPE_SHAREADMIN,
104     RESOURCEDISPLAYTYPE_DIRECTORY,
105     RESOURCEDISPLAYTYPE_TREE // = 10
106 }
107 
108 enum NETPROPERTY_PERSISTENT = 1;
109 
110 enum DWORD
111     CONNECT_UPDATE_PROFILE =   1,
112     CONNECT_UPDATE_RECENT  =   2,
113     CONNECT_TEMPORARY      =   4,
114     CONNECT_INTERACTIVE    =   8,
115     CONNECT_PROMPT         =  16,
116     CONNECT_NEED_DRIVE     =  32,
117     CONNECT_REFCOUNT       =  64,
118     CONNECT_REDIRECT       = 128,
119     CONNECT_LOCALDRIVE     = 256,
120     CONNECT_CURRENT_MEDIA  = 512;
121 
122 enum DWORD
123     CONNDLG_RO_PATH     =  1,
124     CONNDLG_CONN_POINT  =  2,
125     CONNDLG_USE_MRU     =  4,
126     CONNDLG_HIDE_BOX    =  8,
127     CONNDLG_PERSIST     = 16,
128     CONNDLG_NOT_PERSIST = 32;
129 
130 enum DWORD
131     DISC_UPDATE_PROFILE =  1,
132     DISC_NO_FORCE       = 64;
133 
134 enum DWORD
135     WNFMT_MULTILINE   =  1,
136     WNFMT_ABBREVIATED =  2,
137     WNFMT_INENUM      = 16,
138     WNFMT_CONNECTION  = 32;
139 
140 enum : DWORD {
141     WN_SUCCESS                   = NO_ERROR,
142     WN_NO_ERROR                  = NO_ERROR,
143     WN_NOT_SUPPORTED             = ERROR_NOT_SUPPORTED,
144     WN_CANCEL                    = ERROR_CANCELLED,
145     WN_RETRY                     = ERROR_RETRY,
146     WN_NET_ERROR                 = ERROR_UNEXP_NET_ERR,
147     WN_MORE_DATA                 = ERROR_MORE_DATA,
148     WN_BAD_POINTER               = ERROR_INVALID_ADDRESS,
149     WN_BAD_VALUE                 = ERROR_INVALID_PARAMETER,
150     WN_BAD_USER                  = ERROR_BAD_USERNAME,
151     WN_BAD_PASSWORD              = ERROR_INVALID_PASSWORD,
152     WN_ACCESS_DENIED             = ERROR_ACCESS_DENIED,
153     WN_FUNCTION_BUSY             = ERROR_BUSY,
154     WN_WINDOWS_ERROR             = ERROR_UNEXP_NET_ERR,
155     WN_OUT_OF_MEMORY             = ERROR_NOT_ENOUGH_MEMORY,
156     WN_NO_NETWORK                = ERROR_NO_NETWORK,
157     WN_EXTENDED_ERROR            = ERROR_EXTENDED_ERROR,
158     WN_BAD_LEVEL                 = ERROR_INVALID_LEVEL,
159     WN_BAD_HANDLE                = ERROR_INVALID_HANDLE,
160     WN_NOT_INITIALIZING          = ERROR_ALREADY_INITIALIZED,
161     WN_NO_MORE_DEVICES           = ERROR_NO_MORE_DEVICES,
162     WN_NOT_CONNECTED             = ERROR_NOT_CONNECTED,
163     WN_OPEN_FILES                = ERROR_OPEN_FILES,
164     WN_DEVICE_IN_USE             = ERROR_DEVICE_IN_USE,
165     WN_BAD_NETNAME               = ERROR_BAD_NET_NAME,
166     WN_BAD_LOCALNAME             = ERROR_BAD_DEVICE,
167     WN_ALREADY_CONNECTED         = ERROR_ALREADY_ASSIGNED,
168     WN_DEVICE_ERROR              = ERROR_GEN_FAILURE,
169     WN_CONNECTION_CLOSED         = ERROR_CONNECTION_UNAVAIL,
170     WN_NO_NET_OR_BAD_PATH        = ERROR_NO_NET_OR_BAD_PATH,
171     WN_BAD_PROVIDER              = ERROR_BAD_PROVIDER,
172     WN_CANNOT_OPEN_PROFILE       = ERROR_CANNOT_OPEN_PROFILE,
173     WN_BAD_PROFILE               = ERROR_BAD_PROFILE,
174     WN_BAD_DEV_TYPE              = ERROR_BAD_DEV_TYPE,
175     WN_DEVICE_ALREADY_REMEMBERED = ERROR_DEVICE_ALREADY_REMEMBERED,
176     WN_NO_MORE_ENTRIES           = ERROR_NO_MORE_ITEMS,
177     WN_NOT_CONTAINER             = ERROR_NOT_CONTAINER,
178     WN_NOT_AUTHENTICATED         = ERROR_NOT_AUTHENTICATED,
179     WN_NOT_LOGGED_ON             = ERROR_NOT_LOGGED_ON,
180     WN_NOT_VALIDATED             = ERROR_NO_LOGON_SERVERS
181 }
182 
183 enum : DWORD {
184     UNIVERSAL_NAME_INFO_LEVEL = 1,
185     REMOTE_NAME_INFO_LEVEL
186 }
187 
188 enum DWORD
189     NETINFO_DLL16      = 1,
190     NETINFO_DISKRED    = 4,
191     NETINFO_PRINTERRED = 8;
192 
193 enum DWORD
194     RP_LOGON   = 1,
195     RP_INIFILE = 2;
196 
197 enum DWORD PP_DISPLAYERRORS = 1;
198 
199 enum DWORD
200     WNCON_FORNETCARD = 1,
201     WNCON_NOTROUTED  = 2,
202     WNCON_SLOWLINK   = 4,
203     WNCON_DYNAMIC    = 8;
204 
205 struct NETRESOURCEA {
206     DWORD dwScope;
207     DWORD dwType;
208     DWORD dwDisplayType;
209     DWORD dwUsage;
210     LPSTR lpLocalName;
211     LPSTR lpRemoteName;
212     LPSTR lpComment;
213     LPSTR lpProvider;
214 }
215 alias NETRESOURCEA* LPNETRESOURCEA;
216 
217 struct NETRESOURCEW {
218     DWORD  dwScope;
219     DWORD  dwType;
220     DWORD  dwDisplayType;
221     DWORD  dwUsage;
222     LPWSTR lpLocalName;
223     LPWSTR lpRemoteName;
224     LPWSTR lpComment ;
225     LPWSTR lpProvider;
226 }
227 alias NETRESOURCEW* LPNETRESOURCEW;
228 
229 struct CONNECTDLGSTRUCTA {
230     DWORD          cbStructure;
231     HWND           hwndOwner;
232     LPNETRESOURCEA lpConnRes;
233     DWORD          dwFlags;
234     DWORD          dwDevNum;
235 }
236 alias CONNECTDLGSTRUCTA* LPCONNECTDLGSTRUCTA;
237 
238 struct CONNECTDLGSTRUCTW {
239     DWORD          cbStructure;
240     HWND           hwndOwner;
241     LPNETRESOURCEW lpConnRes;
242     DWORD          dwFlags;
243     DWORD          dwDevNum;
244 }
245 alias CONNECTDLGSTRUCTW* LPCONNECTDLGSTRUCTW;
246 
247 struct DISCDLGSTRUCTA {
248     DWORD cbStructure;
249     HWND  hwndOwner;
250     LPSTR lpLocalName;
251     LPSTR lpRemoteName;
252     DWORD dwFlags;
253 }
254 alias DISCDLGSTRUCTA* LPDISCDLGSTRUCTA;
255 
256 struct DISCDLGSTRUCTW {
257     DWORD  cbStructure;
258     HWND   hwndOwner;
259     LPWSTR lpLocalName;
260     LPWSTR lpRemoteName;
261     DWORD  dwFlags;
262 }
263 alias DISCDLGSTRUCTW* LPDISCDLGSTRUCTW;
264 
265 struct UNIVERSAL_NAME_INFOA {
266     LPSTR lpUniversalName;
267 }
268 alias UNIVERSAL_NAME_INFOA* LPUNIVERSAL_NAME_INFOA;
269 
270 struct UNIVERSAL_NAME_INFOW {
271     LPWSTR lpUniversalName;
272 }
273 alias UNIVERSAL_NAME_INFOW* LPUNIVERSAL_NAME_INFOW;
274 
275 struct REMOTE_NAME_INFOA {
276     LPSTR lpUniversalName;
277     LPSTR lpConnectionName;
278     LPSTR lpRemainingPath;
279 }
280 alias REMOTE_NAME_INFOA* LPREMOTE_NAME_INFOA;
281 
282 struct REMOTE_NAME_INFOW {
283     LPWSTR lpUniversalName;
284     LPWSTR lpConnectionName;
285     LPWSTR lpRemainingPath;
286 }
287 alias REMOTE_NAME_INFOW* LPREMOTE_NAME_INFOW;
288 
289 struct NETINFOSTRUCT {
290     DWORD cbStructure;
291     DWORD dwProviderVersion;
292     DWORD dwStatus;
293     DWORD dwCharacteristics;
294     ULONG_PTR dwHandle;
295     WORD  wNetType;
296     DWORD dwPrinters;
297     DWORD dwDrives;
298 }
299 alias NETINFOSTRUCT* LPNETINFOSTRUCT;
300 
301 extern (Windows) {
302     alias UINT function(LPCSTR, LPSTR, UINT) PFNGETPROFILEPATHA;
303     alias UINT function(LPCWSTR, LPWSTR, UINT) PFNGETPROFILEPATHW;
304     alias UINT function(LPCSTR, LPCSTR, DWORD) PFNRECONCILEPROFILEA;
305     alias UINT function(LPCWSTR, LPCWSTR, DWORD) PFNRECONCILEPROFILEW;
306     alias BOOL function(HWND, LPCSTR, LPCSTR, LPCSTR, DWORD)
307       PFNPROCESSPOLICIESA;
308     alias BOOL function(HWND, LPCWSTR, LPCWSTR, LPCWSTR, DWORD)
309       PFNPROCESSPOLICIESW;
310 }
311 
312 struct NETCONNECTINFOSTRUCT {
313     DWORD cbStructure;
314     DWORD dwFlags;
315     DWORD dwSpeed;
316     DWORD dwDelay;
317     DWORD dwOptDataSize;
318 }
319 alias NETCONNECTINFOSTRUCT* LPNETCONNECTINFOSTRUCT;
320 
321 extern (Windows) {
322     DWORD WNetAddConnection2A(LPNETRESOURCEA, LPCSTR, LPCSTR, DWORD);
323     DWORD WNetAddConnection2W(LPNETRESOURCEW, LPCWSTR, LPCWSTR, DWORD);
324     DWORD WNetAddConnection3A(HWND, LPNETRESOURCEA, LPCSTR, LPCSTR, DWORD);
325     DWORD WNetAddConnection3W(HWND, LPNETRESOURCEW, LPCWSTR, LPCWSTR, DWORD);
326     DWORD WNetCancelConnection2A(LPCSTR, DWORD, BOOL);
327     DWORD WNetCancelConnection2W(LPCWSTR, DWORD, BOOL);
328     DWORD WNetGetConnectionA(LPCSTR, LPSTR, PDWORD);
329     DWORD WNetGetConnectionW(LPCWSTR, LPWSTR, PDWORD);
330     DWORD WNetUseConnectionA(HWND, LPNETRESOURCEA, LPCSTR, LPCSTR, DWORD,
331       LPSTR, PDWORD, PDWORD);
332     DWORD WNetUseConnectionW(HWND, LPNETRESOURCEW, LPCWSTR, LPCWSTR, DWORD,
333       LPWSTR, PDWORD, PDWORD);
334     DWORD WNetSetConnectionA(LPCSTR, DWORD, PVOID);
335     DWORD WNetSetConnectionW(LPCWSTR, DWORD, PVOID);
336     DWORD WNetConnectionDialog(HWND, DWORD);
337     DWORD WNetDisconnectDialog(HWND, DWORD);
338     DWORD WNetConnectionDialog1A(LPCONNECTDLGSTRUCTA);
339     DWORD WNetConnectionDialog1W(LPCONNECTDLGSTRUCTW);
340     DWORD WNetDisconnectDialog1A(LPDISCDLGSTRUCTA);
341     DWORD WNetDisconnectDialog1W(LPDISCDLGSTRUCTW);
342     DWORD WNetOpenEnumA(DWORD, DWORD, DWORD, LPNETRESOURCEA, LPHANDLE);
343     DWORD WNetOpenEnumW(DWORD, DWORD, DWORD, LPNETRESOURCEW, LPHANDLE);
344     DWORD WNetEnumResourceA(HANDLE, PDWORD, PVOID, PDWORD);
345     DWORD WNetEnumResourceW(HANDLE, PDWORD, PVOID, PDWORD);
346     DWORD WNetCloseEnum(HANDLE);
347     DWORD WNetGetUniversalNameA(LPCSTR, DWORD, PVOID, PDWORD);
348     DWORD WNetGetUniversalNameW(LPCWSTR, DWORD, PVOID, PDWORD);
349     DWORD WNetGetUserA(LPCSTR, LPSTR, PDWORD);
350     DWORD WNetGetUserW(LPCWSTR, LPWSTR, PDWORD);
351     DWORD WNetGetProviderNameA(DWORD, LPSTR, PDWORD);
352     DWORD WNetGetProviderNameW(DWORD, LPWSTR, PDWORD);
353     DWORD WNetGetNetworkInformationA(LPCSTR, LPNETINFOSTRUCT);
354     DWORD WNetGetNetworkInformationW(LPCWSTR, LPNETINFOSTRUCT);
355     DWORD WNetGetResourceInformationA(LPNETRESOURCEA, LPVOID, LPDWORD,
356       LPSTR*);
357     DWORD WNetGetResourceInformationW(LPNETRESOURCEA, LPVOID, LPDWORD,
358       LPWSTR*);
359     DWORD WNetGetResourceParentA(LPNETRESOURCEA, LPVOID, LPDWORD);
360     DWORD WNetGetResourceParentW(LPNETRESOURCEW, LPVOID, LPDWORD);
361     DWORD WNetGetLastErrorA(PDWORD, LPSTR, DWORD, LPSTR, DWORD);
362     DWORD WNetGetLastErrorW(PDWORD, LPWSTR, DWORD, LPWSTR, DWORD);
363     DWORD MultinetGetConnectionPerformanceA(LPNETRESOURCEA,
364       LPNETCONNECTINFOSTRUCT);
365     DWORD MultinetGetConnectionPerformanceW(LPNETRESOURCEW,
366       LPNETCONNECTINFOSTRUCT);
367     deprecated {
368         DWORD WNetAddConnectionA(LPCSTR, LPCSTR, LPCSTR);
369         DWORD WNetAddConnectionW(LPCWSTR, LPCWSTR, LPCWSTR);
370         DWORD WNetCancelConnectionA(LPCSTR, BOOL);
371         DWORD WNetCancelConnectionW(LPCWSTR, BOOL);
372     }
373 }
374 
375 version (Unicode) {
376     alias PFNGETPROFILEPATHW PFNGETPROFILEPATH;
377     alias PFNRECONCILEPROFILEW PFNRECONCILEPROFILE;
378     alias PFNPROCESSPOLICIESW PFNPROCESSPOLICIES;
379     alias NETRESOURCEW NETRESOURCE;
380     alias CONNECTDLGSTRUCTW CONNECTDLGSTRUCT;
381     alias DISCDLGSTRUCTW DISCDLGSTRUCT;
382     alias REMOTE_NAME_INFOW REMOTE_NAME_INFO;
383     alias UNIVERSAL_NAME_INFOW UNIVERSAL_NAME_INFO;
384     alias WNetAddConnection2W WNetAddConnection2;
385     alias WNetAddConnection3W WNetAddConnection3;
386     alias WNetCancelConnection2W WNetCancelConnection2;
387     alias WNetGetConnectionW WNetGetConnection;
388     alias WNetUseConnectionW WNetUseConnection;
389     alias WNetSetConnectionW WNetSetConnection;
390     alias WNetConnectionDialog1W WNetConnectionDialog1;
391     alias WNetDisconnectDialog1W WNetDisconnectDialog1;
392     alias WNetOpenEnumW WNetOpenEnum;
393     alias WNetEnumResourceW WNetEnumResource;
394     alias WNetGetUniversalNameW WNetGetUniversalName;
395     alias WNetGetUserW WNetGetUser;
396     alias WNetGetProviderNameW WNetGetProviderName;
397     alias WNetGetNetworkInformationW WNetGetNetworkInformation;
398     alias WNetGetResourceInformationW WNetGetResourceInformation;
399     alias WNetGetResourceParentW WNetGetResourceParent;
400     alias WNetGetLastErrorW WNetGetLastError;
401     alias MultinetGetConnectionPerformanceW MultinetGetConnectionPerformance;
402     deprecated {
403         alias WNetAddConnectionW WNetAddConnection;
404         alias WNetCancelConnectionW WNetCancelConnection;
405     }
406 } else {
407     alias PFNGETPROFILEPATHA PFNGETPROFILEPATH;
408     alias PFNRECONCILEPROFILEA PFNRECONCILEPROFILE;
409     alias PFNPROCESSPOLICIESA PFNPROCESSPOLICIES;
410     alias NETRESOURCEA NETRESOURCE;
411     alias CONNECTDLGSTRUCTA CONNECTDLGSTRUCT;
412     alias DISCDLGSTRUCTA DISCDLGSTRUCT;
413     alias REMOTE_NAME_INFOA REMOTE_NAME_INFO;
414     alias UNIVERSAL_NAME_INFOA UNIVERSAL_NAME_INFO;
415     alias WNetAddConnection2A WNetAddConnection2;
416     alias WNetAddConnection3A WNetAddConnection3;
417     alias WNetCancelConnection2A WNetCancelConnection2;
418     alias WNetGetConnectionA WNetGetConnection;
419     alias WNetUseConnectionA WNetUseConnection;
420     alias WNetSetConnectionA WNetSetConnection;
421     alias WNetConnectionDialog1A WNetConnectionDialog1;
422     alias WNetDisconnectDialog1A WNetDisconnectDialog1;
423     alias WNetOpenEnumA WNetOpenEnum;
424     alias WNetEnumResourceA WNetEnumResource;
425     alias WNetGetUniversalNameA WNetGetUniversalName;
426     alias WNetGetUserA WNetGetUser;
427     alias WNetGetProviderNameA WNetGetProviderName;
428     alias WNetGetNetworkInformationA WNetGetNetworkInformation;
429     alias WNetGetResourceInformationA WNetGetResourceInformation;
430     alias WNetGetResourceParentA WNetGetResourceParent;
431     alias WNetGetLastErrorA WNetGetLastError;
432     alias MultinetGetConnectionPerformanceA MultinetGetConnectionPerformance;
433     deprecated {
434         alias WNetAddConnectionA WNetAddConnection;
435         alias WNetCancelConnectionA WNetCancelConnection;
436     }
437 }
438 
439 alias NETRESOURCE* LPNETRESOURCE;
440 alias CONNECTDLGSTRUCT* LPCONNECTDLGSTRUCT;
441 alias DISCDLGSTRUCT* LPDISCDLGSTRUCT;
442 alias REMOTE_NAME_INFO* LPREMOTE_NAME_INFO;
443 alias UNIVERSAL_NAME_INFO* LPUNIVERSAL_NAME_INFO;