The OpenD Programming Language

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