Release 1.5.29.
[wine] / include / winnetwk.h
1 /*
2  * Copyright (C) the Wine project
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19
20 #ifndef _WINNETWK_H_
21 #define _WINNETWK_H_
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /*
28  * Network types
29  */
30
31 #define WNNC_NET_MSNET      0x00010000
32 #define WNNC_NET_LANMAN     0x00020000
33 #define WNNC_NET_NETWARE    0x00030000
34 #define WNNC_NET_VINES      0x00040000
35 #define WNNC_NET_10NET      0x00050000
36 #define WNNC_NET_LOCUS      0x00060000
37 #define WNNC_NET_SUN_PC_NFS 0x00070000
38 #define WNNC_NET_LANSTEP    0x00080000
39 #define WNNC_NET_9TILES     0x00090000
40 #define WNNC_NET_LANTASTIC  0x000A0000
41 #define WNNC_NET_AS400      0x000B0000
42 #define WNNC_NET_FTP_NFS    0x000C0000
43 #define WNNC_NET_PATHWORKS  0x000D0000
44 #define WNNC_NET_LIFENET    0x000E0000
45 #define WNNC_NET_POWERLAN   0x000F0000
46 #define WNNC_NET_BWNFS      0x00100000
47 #define WNNC_NET_COGENT     0x00110000
48 #define WNNC_NET_FARALLON   0x00120000
49 #define WNNC_NET_APPLETALK  0x00130000
50 #define WNNC_NET_INTERGRAPH 0x00140000
51
52 /*
53  *  Network resources
54  */
55
56 #define RESOURCE_CONNECTED      0x00000001
57 #define RESOURCE_GLOBALNET      0x00000002
58 #define RESOURCE_REMEMBERED     0x00000003
59 #define RESOURCE_RECENT         0x00000004
60 #define RESOURCE_CONTEXT        0x00000005
61
62 #define RESOURCETYPE_ANY        0x00000000
63 #define RESOURCETYPE_DISK       0x00000001
64 #define RESOURCETYPE_PRINT      0x00000002
65 #define RESOURCETYPE_RESERVED   0x00000008
66 #define RESOURCETYPE_UNKNOWN    0xFFFFFFFF
67
68 #define RESOURCEUSAGE_CONNECTABLE   0x00000001
69 #define RESOURCEUSAGE_CONTAINER     0x00000002
70 #define RESOURCEUSAGE_NOLOCALDEVICE 0x00000004
71 #define RESOURCEUSAGE_SIBLING       0x00000008
72 #define RESOURCEUSAGE_ATTACHED      0x00000010
73 #define RESOURCEUSAGE_ALL           (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED)
74 #define RESOURCEUSAGE_RESERVED      0x80000000
75
76 #define RESOURCEDISPLAYTYPE_GENERIC        0x00000000
77 #define RESOURCEDISPLAYTYPE_DOMAIN         0x00000001
78 #define RESOURCEDISPLAYTYPE_SERVER         0x00000002
79 #define RESOURCEDISPLAYTYPE_SHARE          0x00000003
80 #define RESOURCEDISPLAYTYPE_FILE           0x00000004
81 #define RESOURCEDISPLAYTYPE_GROUP          0x00000005
82 #define RESOURCEDISPLAYTYPE_NETWORK        0x00000006
83 #define RESOURCEDISPLAYTYPE_ROOT           0x00000007
84 #define RESOURCEDISPLAYTYPE_SHAREADMIN     0x00000008
85 #define RESOURCEDISPLAYTYPE_DIRECTORY      0x00000009
86 #define RESOURCEDISPLAYTYPE_TREE           0x0000000A
87
88 typedef struct {
89         DWORD   dwScope;
90         DWORD   dwType;
91         DWORD   dwDisplayType;
92         DWORD   dwUsage;
93         LPSTR   lpLocalName;
94         LPSTR   lpRemoteName;
95         LPSTR   lpComment ;
96         LPSTR   lpProvider;
97 } NETRESOURCEA,*LPNETRESOURCEA;
98
99 typedef struct {
100         DWORD   dwScope;
101         DWORD   dwType;
102         DWORD   dwDisplayType;
103         DWORD   dwUsage;
104         LPWSTR  lpLocalName;
105         LPWSTR  lpRemoteName;
106         LPWSTR  lpComment ;
107         LPWSTR  lpProvider;
108 } NETRESOURCEW,*LPNETRESOURCEW;
109
110 DECL_WINELIB_TYPE_AW(NETRESOURCE)
111 DECL_WINELIB_TYPE_AW(LPNETRESOURCE)
112
113
114 /*
115  *  Network connections
116  */
117
118 #define NETPROPERTY_PERSISTENT       1
119
120 #define CONNECT_UPDATE_PROFILE      0x00000001
121 #define CONNECT_UPDATE_RECENT       0x00000002
122 #define CONNECT_TEMPORARY           0x00000004
123 #define CONNECT_INTERACTIVE         0x00000008
124 #define CONNECT_PROMPT              0x00000010
125 #define CONNECT_NEED_DRIVE          0x00000020
126 #define CONNECT_REFCOUNT            0x00000040
127 #define CONNECT_REDIRECT            0x00000080
128 #define CONNECT_LOCALDRIVE          0x00000100
129 #define CONNECT_CURRENT_MEDIA       0x00000200
130
131 DWORD WINAPI WNetAddConnectionA(LPCSTR,LPCSTR,LPCSTR);
132 DWORD WINAPI WNetAddConnectionW(LPCWSTR,LPCWSTR,LPCWSTR);
133 #define      WNetAddConnection WINELIB_NAME_AW(WNetAddConnection)
134 DWORD WINAPI WNetAddConnection2A(LPNETRESOURCEA,LPCSTR,LPCSTR,DWORD);
135 DWORD WINAPI WNetAddConnection2W(LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD);
136 #define      WNetAddConnection2 WINELIB_NAME_AW(WNetAddConnection2)
137 DWORD WINAPI WNetAddConnection3A(HWND,LPNETRESOURCEA,LPCSTR,LPCSTR,DWORD);
138 DWORD WINAPI WNetAddConnection3W(HWND,LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD);
139 #define      WNetAddConnection3 WINELIB_NAME_AW(WNetAddConnection3)
140 DWORD WINAPI WNetCancelConnectionA(LPCSTR,BOOL);
141 DWORD WINAPI WNetCancelConnectionW(LPCWSTR,BOOL);
142 #define      WNetCancelConnection WINELIB_NAME_AW(WNetCancelConnection)
143 DWORD WINAPI WNetCancelConnection2A(LPCSTR,DWORD,BOOL);
144 DWORD WINAPI WNetCancelConnection2W(LPCWSTR,DWORD,BOOL);
145 #define      WNetCancelConnection2 WINELIB_NAME_AW(WNetCancelConnection2)
146 DWORD WINAPI WNetGetConnectionA(LPCSTR,LPSTR,LPDWORD);
147 DWORD WINAPI WNetGetConnectionW(LPCWSTR,LPWSTR,LPDWORD);
148 #define      WNetGetConnection WINELIB_NAME_AW(WNetGetConnection)
149 DWORD WINAPI WNetGetLastErrorA(LPDWORD,LPSTR,DWORD,LPSTR,DWORD);
150 DWORD WINAPI WNetGetLastErrorW(LPDWORD,LPWSTR,DWORD,LPWSTR,DWORD);
151 #define      WNetGetLastError WINELIB_NAME_AW(WNetGetLastError)
152 DWORD WINAPI WNetRestoreConnectionA(HWND,LPCSTR);
153 DWORD WINAPI WNetRestoreConnectionW(HWND,LPCWSTR);
154 #define      WNetRestoreConnection WINELIB_NAME_AW(WNetRestoreConnection)
155 DWORD WINAPI WNetUseConnectionA(HWND,LPNETRESOURCEA,LPCSTR,LPCSTR,DWORD,LPSTR,LPDWORD,LPDWORD);
156 DWORD WINAPI WNetUseConnectionW(HWND,LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPDWORD,LPDWORD);
157 #define      WNetUseConnection WINELIB_NAME_AW(WNetUseConnection)
158 DWORD WINAPI WNetSetConnectionA(LPCSTR,DWORD,LPVOID);
159 DWORD WINAPI WNetSetConnectionW(LPCWSTR,DWORD,LPVOID);
160 #define      WNetSetConnection WINELIB_NAME_AW(WNetSetConnection)
161
162 /*
163  *  Network connection dialogs
164  */
165
166 typedef struct {
167     DWORD cbStructure;       /* size of this structure in bytes */
168     HWND hwndOwner;          /* owner window for the dialog */
169     LPNETRESOURCEA lpConnRes;/* Requested Resource info    */
170     DWORD dwFlags;           /* flags (see below) */
171     DWORD dwDevNum;          /* number of devices connected to */
172 } CONNECTDLGSTRUCTA, *LPCONNECTDLGSTRUCTA;
173 typedef struct {
174     DWORD cbStructure;       /* size of this structure in bytes */
175     HWND hwndOwner;          /* owner window for the dialog */
176     LPNETRESOURCEW lpConnRes;/* Requested Resource info    */
177     DWORD dwFlags;           /* flags (see below) */
178     DWORD dwDevNum;          /* number of devices connected to */
179 } CONNECTDLGSTRUCTW, *LPCONNECTDLGSTRUCTW;
180
181 DECL_WINELIB_TYPE_AW(CONNECTDLGSTRUCT)
182 DECL_WINELIB_TYPE_AW(LPCONNECTDLGSTRUCT)
183
184 #define CONNDLG_RO_PATH     0x00000001 /* Resource path should be read-only    */
185 #define CONNDLG_CONN_POINT  0x00000002 /* Netware -style movable connection point enabled */
186 #define CONNDLG_USE_MRU     0x00000004 /* Use MRU combobox  */
187 #define CONNDLG_HIDE_BOX    0x00000008 /* Hide persistent connect checkbox  */
188 #define CONNDLG_PERSIST     0x00000010 /* Force persistent connection */
189 #define CONNDLG_NOT_PERSIST 0x00000020 /* Force connection NOT persistent */
190
191 typedef struct {
192     DWORD           cbStructure;      /* size of this structure in bytes */
193     HWND            hwndOwner;        /* owner window for the dialog */
194     LPSTR           lpLocalName;      /* local device name */
195     LPSTR           lpRemoteName;     /* network resource name */
196     DWORD           dwFlags;          /* flags */
197 } DISCDLGSTRUCTA, *LPDISCDLGSTRUCTA;
198 typedef struct {
199     DWORD           cbStructure;      /* size of this structure in bytes */
200     HWND            hwndOwner;        /* owner window for the dialog */
201     LPWSTR          lpLocalName;      /* local device name */
202     LPWSTR          lpRemoteName;     /* network resource name */
203     DWORD           dwFlags;          /* flags */
204 } DISCDLGSTRUCTW, *LPDISCDLGSTRUCTW;
205
206 DECL_WINELIB_TYPE_AW(DISCDLGSTRUCT)
207 DECL_WINELIB_TYPE_AW(LPDISCDLGSTRUCT)
208
209 #define DISC_UPDATE_PROFILE         0x00000001
210 #define DISC_NO_FORCE               0x00000040
211
212 DWORD WINAPI WNetConnectionDialog(HWND,DWORD);
213 DWORD WINAPI WNetDisconnectDialog(HWND,DWORD);
214 DWORD WINAPI WNetConnectionDialog1A(LPCONNECTDLGSTRUCTA);
215 DWORD WINAPI WNetConnectionDialog1W(LPCONNECTDLGSTRUCTW);
216 #define      WNetConnectionDialog1 WINELIB_NAME_AW(WNetConnectionDialog1)
217 DWORD WINAPI WNetDisconnectDialog1A(LPDISCDLGSTRUCTA);
218 DWORD WINAPI WNetDisconnectDialog1W(LPDISCDLGSTRUCTW);
219 #define      WNetDisconnectDialog1 WINELIB_NAME_AW(WNetDisconnectDialog1)
220
221 /*
222  *  Network browsing
223  */
224
225 DWORD WINAPI WNetOpenEnumA(DWORD,DWORD,DWORD,LPNETRESOURCEA,LPHANDLE);
226 DWORD WINAPI WNetOpenEnumW(DWORD,DWORD,DWORD,LPNETRESOURCEW,LPHANDLE);
227 #define      WNetOpenEnum WINELIB_NAME_AW(WNetOpenEnum)
228 DWORD WINAPI WNetEnumResourceA(HANDLE,LPDWORD,LPVOID,LPDWORD);
229 DWORD WINAPI WNetEnumResourceW(HANDLE,LPDWORD,LPVOID,LPDWORD);
230 #define      WNetEnumResource WINELIB_NAME_AW(WNetEnumResource)
231 DWORD WINAPI WNetGetResourceInformationA(LPNETRESOURCEA,LPVOID,LPDWORD,LPSTR*);
232 DWORD WINAPI WNetGetResourceInformationW(LPNETRESOURCEW,LPVOID,LPDWORD,LPWSTR*);
233 #define      WNetGetResourceInformation WINELIB_NAME_AW(WNetGetResourceInformation)
234 DWORD WINAPI WNetGetResourceParentA(LPNETRESOURCEA,LPVOID,LPDWORD);
235 DWORD WINAPI WNetGetResourceParentW(LPNETRESOURCEW,LPVOID,LPDWORD);
236 #define      WNetGetResourceParent WINELIB_NAME_AW(WNetGetResourceParent)
237 DWORD WINAPI WNetCloseEnum(HANDLE);
238
239 /*
240  *  Universal naming
241  */
242
243 #define UNIVERSAL_NAME_INFO_LEVEL   0x00000001
244 #define REMOTE_NAME_INFO_LEVEL      0x00000002
245
246 typedef struct {
247     LPSTR    lpUniversalName;
248 } UNIVERSAL_NAME_INFOA, *LPUNIVERSAL_NAME_INFOA;
249 typedef struct {
250     LPWSTR   lpUniversalName;
251 } UNIVERSAL_NAME_INFOW, *LPUNIVERSAL_NAME_INFOW;
252
253 DECL_WINELIB_TYPE_AW(UNIVERSAL_NAME_INFO)
254 DECL_WINELIB_TYPE_AW(LPUNIVERSAL_NAME_INFO)
255
256 typedef struct {
257     LPSTR    lpUniversalName;
258     LPSTR    lpConnectionName;
259     LPSTR    lpRemainingPath;
260 }REMOTE_NAME_INFOA, *LPREMOTE_NAME_INFOA;
261 typedef struct {
262     LPWSTR   lpUniversalName;
263     LPWSTR   lpConnectionName;
264     LPWSTR   lpRemainingPath;
265 }REMOTE_NAME_INFOW, *LPREMOTE_NAME_INFOW;
266
267 DECL_WINELIB_TYPE_AW(REMOTE_NAME_INFO)
268 DECL_WINELIB_TYPE_AW(LPREMOTE_NAME_INFO)
269
270 DWORD WINAPI WNetGetUniversalNameA(LPCSTR,DWORD,LPVOID,LPDWORD);
271 DWORD WINAPI WNetGetUniversalNameW(LPCWSTR,DWORD,LPVOID,LPDWORD);
272 #define      WNetGetUniversalName WINELIB_NAME_AW(WNetGetUniversalName)
273
274 /*
275  *  Other
276  */
277
278 DWORD WINAPI WNetGetUserA(LPCSTR,LPSTR,LPDWORD);
279 DWORD WINAPI WNetGetUserW(LPCWSTR,LPWSTR,LPDWORD);
280 #define      WNetGetUser WINELIB_NAME_AW(WNetGetUser)
281
282 #define WNFMT_MULTILINE         0x01
283 #define WNFMT_ABBREVIATED       0x02
284 #define WNFMT_INENUM            0x10
285 #define WNFMT_CONNECTION        0x20
286
287 DWORD WINAPI WNetGetProviderNameA(DWORD,LPSTR,LPDWORD);
288 DWORD WINAPI WNetGetProviderNameW(DWORD,LPWSTR,LPDWORD);
289 #define      WNetGetProviderName WINELIB_NAME_AW(WNetGetProviderName)
290
291 typedef struct {
292     DWORD cbStructure;
293     DWORD dwProviderVersion;
294     DWORD dwStatus;
295     DWORD dwCharacteristics;
296     DWORD dwHandle;
297     WORD  wNetType;
298     DWORD dwPrinters;
299     DWORD dwDrives;
300 } NETINFOSTRUCT, *LPNETINFOSTRUCT;
301
302 #define NETINFO_DLL16       0x00000001
303 #define NETINFO_DISKRED     0x00000004
304 #define NETINFO_PRINTERRED  0x00000008
305
306 DWORD WINAPI WNetGetNetworkInformationA(LPCSTR,LPNETINFOSTRUCT);
307 DWORD WINAPI WNetGetNetworkInformationW(LPCWSTR,LPNETINFOSTRUCT);
308 #define      WNetGetNetworkInformation WINELIB_NAME_AW(WNetGetNetworkInformation)
309
310
311 /*
312  *  Status codes
313  */
314
315 #define WN_SUCCESS                      NO_ERROR
316 #define WN_NO_ERROR                     NO_ERROR
317 #define WN_NOT_SUPPORTED                ERROR_NOT_SUPPORTED
318 #define WN_CANCEL                       ERROR_CANCELLED
319 #define WN_RETRY                        ERROR_RETRY
320 #define WN_NET_ERROR                    ERROR_UNEXP_NET_ERR
321 #define WN_MORE_DATA                    ERROR_MORE_DATA
322 #define WN_BAD_POINTER                  ERROR_INVALID_ADDRESS
323 #define WN_BAD_VALUE                    ERROR_INVALID_PARAMETER
324 #define WN_BAD_USER                     ERROR_BAD_USERNAME
325 #define WN_BAD_PASSWORD                 ERROR_INVALID_PASSWORD
326 #define WN_ACCESS_DENIED                ERROR_ACCESS_DENIED
327 #define WN_FUNCTION_BUSY                ERROR_BUSY
328 #define WN_WINDOWS_ERROR                ERROR_UNEXP_NET_ERR
329 #define WN_OUT_OF_MEMORY                ERROR_NOT_ENOUGH_MEMORY
330 #define WN_NO_NETWORK                   ERROR_NO_NETWORK
331 #define WN_EXTENDED_ERROR               ERROR_EXTENDED_ERROR
332 #define WN_BAD_LEVEL                    ERROR_INVALID_LEVEL
333 #define WN_BAD_HANDLE                   ERROR_INVALID_HANDLE
334 #define WN_NOT_INITIALIZING             ERROR_ALREADY_INITIALIZED
335 #define WN_NO_MORE_DEVICES              ERROR_NO_MORE_DEVICES
336
337 #define WN_NOT_CONNECTED                ERROR_NOT_CONNECTED
338 #define WN_OPEN_FILES                   ERROR_OPEN_FILES
339 #define WN_DEVICE_IN_USE                ERROR_DEVICE_IN_USE
340 #define WN_BAD_NETNAME                  ERROR_BAD_NET_NAME
341 #define WN_BAD_LOCALNAME                ERROR_BAD_DEVICE
342 #define WN_ALREADY_CONNECTED            ERROR_ALREADY_ASSIGNED
343 #define WN_DEVICE_ERROR                 ERROR_GEN_FAILURE
344 #define WN_CONNECTION_CLOSED            ERROR_CONNECTION_UNAVAIL
345 #define WN_NO_NET_OR_BAD_PATH           ERROR_NO_NET_OR_BAD_PATH
346 #define WN_BAD_PROVIDER                 ERROR_BAD_PROVIDER
347 #define WN_CANNOT_OPEN_PROFILE          ERROR_CANNOT_OPEN_PROFILE
348 #define WN_BAD_PROFILE                  ERROR_BAD_PROFILE
349 #define WN_BAD_DEV_TYPE                 ERROR_BAD_DEV_TYPE
350 #define WN_DEVICE_ALREADY_REMEMBERED    ERROR_DEVICE_ALREADY_REMEMBERED
351
352 #define WN_NO_MORE_ENTRIES              ERROR_NO_MORE_ITEMS
353 #define WN_NOT_CONTAINER                ERROR_NOT_CONTAINER
354
355 #define WN_NOT_AUTHENTICATED            ERROR_NOT_AUTHENTICATED
356 #define WN_NOT_LOGGED_ON                ERROR_NOT_LOGGED_ON
357 #define WN_NOT_VALIDATED                ERROR_NO_LOGON_SERVERS
358
359
360 /*
361  *  Multinet (for Shell)
362  */
363
364 typedef struct {
365         DWORD   cbStructure;
366         DWORD   dwFlags;
367         DWORD   dwSpeed;
368         DWORD   dwDelay;
369         DWORD   dwOptDataSize;
370 } NETCONNECTINFOSTRUCT,*LPNETCONNECTINFOSTRUCT;
371
372 #define WNCON_FORNETCARD        0x00000001
373 #define WNCON_NOTROUTED         0x00000002
374 #define WNCON_SLOWLINK          0x00000004
375 #define WNCON_DYNAMIC           0x00000008
376
377 DWORD WINAPI MultinetGetConnectionPerformanceA(LPNETRESOURCEA,LPNETCONNECTINFOSTRUCT);
378 DWORD WINAPI MultinetGetConnectionPerformanceW(LPNETRESOURCEW,LPNETCONNECTINFOSTRUCT);
379 #define      MultinetGetConnectionPerformance WINELIB_NAME_AW(MultinetGetConnectionPerformance)
380 DWORD WINAPI MultinetGetErrorTextA(DWORD,DWORD,DWORD);
381 DWORD WINAPI MultinetGetErrorTextW(DWORD,DWORD,DWORD);
382 #define      MultinetGetErrorText WINELIB_NAME_AW(MultinetGetErrorText)
383
384 /*
385  * Password cache
386  */
387
388 /* WNetEnumCachedPasswords */
389 typedef struct tagPASSWORD_CACHE_ENTRY
390 {
391         WORD cbEntry;
392         WORD cbResource;
393         WORD cbPassword;
394         BYTE iEntry;
395         BYTE nType;
396         BYTE abResource[1];
397 } PASSWORD_CACHE_ENTRY;
398
399 typedef BOOL (CALLBACK *ENUMPASSWORDPROC)(PASSWORD_CACHE_ENTRY *, DWORD);
400 UINT WINAPI WNetEnumCachedPasswords( LPSTR, WORD, BYTE, ENUMPASSWORDPROC, DWORD);
401 DWORD WINAPI WNetGetCachedPassword( LPSTR, WORD, LPSTR, LPWORD, BYTE );
402 DWORD WINAPI WNetCachePassword( LPSTR, WORD, LPSTR, WORD, BYTE, WORD );
403
404 #ifdef __cplusplus
405 }
406 #endif
407
408 #endif /* _WINNETWK_H_ */