include: Add some API prototypes to appropriate header files, fix some prototypes.
[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 /*
24  * Network types
25  */
26
27 #define WNNC_NET_MSNET      0x00010000
28 #define WNNC_NET_LANMAN     0x00020000
29 #define WNNC_NET_NETWARE    0x00030000
30 #define WNNC_NET_VINES      0x00040000
31 #define WNNC_NET_10NET      0x00050000
32 #define WNNC_NET_LOCUS      0x00060000
33 #define WNNC_NET_SUN_PC_NFS 0x00070000
34 #define WNNC_NET_LANSTEP    0x00080000
35 #define WNNC_NET_9TILES     0x00090000
36 #define WNNC_NET_LANTASTIC  0x000A0000
37 #define WNNC_NET_AS400      0x000B0000
38 #define WNNC_NET_FTP_NFS    0x000C0000
39 #define WNNC_NET_PATHWORKS  0x000D0000
40 #define WNNC_NET_LIFENET    0x000E0000
41 #define WNNC_NET_POWERLAN   0x000F0000
42 #define WNNC_NET_BWNFS      0x00100000
43 #define WNNC_NET_COGENT     0x00110000
44 #define WNNC_NET_FARALLON   0x00120000
45 #define WNNC_NET_APPLETALK  0x00130000
46 #define WNNC_NET_INTERGRAPH 0x00140000
47
48 /*
49  *  Network resources
50  */
51
52 #define RESOURCE_CONNECTED      0x00000001
53 #define RESOURCE_GLOBALNET      0x00000002
54 #define RESOURCE_REMEMBERED     0x00000003
55 #define RESOURCE_RECENT         0x00000004
56 #define RESOURCE_CONTEXT        0x00000005
57
58 #define RESOURCETYPE_ANY        0x00000000
59 #define RESOURCETYPE_DISK       0x00000001
60 #define RESOURCETYPE_PRINT      0x00000002
61 #define RESOURCETYPE_RESERVED   0x00000008
62 #define RESOURCETYPE_UNKNOWN    0xFFFFFFFF
63
64 #define RESOURCEUSAGE_CONNECTABLE   0x00000001
65 #define RESOURCEUSAGE_CONTAINER     0x00000002
66 #define RESOURCEUSAGE_NOLOCALDEVICE 0x00000004
67 #define RESOURCEUSAGE_SIBLING       0x00000008
68 #define RESOURCEUSAGE_ATTACHED      0x00000010
69 #define RESOURCEUSAGE_ALL           (RESOURCEUSAGE_CONNECTABLE | RESOURCEUSAGE_CONTAINER | RESOURCEUSAGE_ATTACHED)
70 #define RESOURCEUSAGE_RESERVED      0x80000000
71
72 #define RESOURCEDISPLAYTYPE_GENERIC        0x00000000
73 #define RESOURCEDISPLAYTYPE_DOMAIN         0x00000001
74 #define RESOURCEDISPLAYTYPE_SERVER         0x00000002
75 #define RESOURCEDISPLAYTYPE_SHARE          0x00000003
76 #define RESOURCEDISPLAYTYPE_FILE           0x00000004
77 #define RESOURCEDISPLAYTYPE_GROUP          0x00000005
78 #define RESOURCEDISPLAYTYPE_NETWORK        0x00000006
79 #define RESOURCEDISPLAYTYPE_ROOT           0x00000007
80 #define RESOURCEDISPLAYTYPE_SHAREADMIN     0x00000008
81 #define RESOURCEDISPLAYTYPE_DIRECTORY      0x00000009
82 #define RESOURCEDISPLAYTYPE_TREE           0x0000000A
83
84 typedef struct {
85         DWORD   dwScope;
86         DWORD   dwType;
87         DWORD   dwDisplayType;
88         DWORD   dwUsage;
89         LPSTR   lpLocalName;
90         LPSTR   lpRemoteName;
91         LPSTR   lpComment ;
92         LPSTR   lpProvider;
93 } NETRESOURCEA,*LPNETRESOURCEA;
94
95 typedef struct {
96         DWORD   dwScope;
97         DWORD   dwType;
98         DWORD   dwDisplayType;
99         DWORD   dwUsage;
100         LPWSTR  lpLocalName;
101         LPWSTR  lpRemoteName;
102         LPWSTR  lpComment ;
103         LPWSTR  lpProvider;
104 } NETRESOURCEW,*LPNETRESOURCEW;
105
106 DECL_WINELIB_TYPE_AW(NETRESOURCE)
107 DECL_WINELIB_TYPE_AW(LPNETRESOURCE)
108
109
110 /*
111  *  Network connections
112  */
113
114 #define NETPROPERTY_PERSISTENT       1
115
116 #define CONNECT_UPDATE_PROFILE      0x00000001
117 #define CONNECT_UPDATE_RECENT       0x00000002
118 #define CONNECT_TEMPORARY           0x00000004
119 #define CONNECT_INTERACTIVE         0x00000008
120 #define CONNECT_PROMPT              0x00000010
121 #define CONNECT_NEED_DRIVE          0x00000020
122 #define CONNECT_REFCOUNT            0x00000040
123 #define CONNECT_REDIRECT            0x00000080
124 #define CONNECT_LOCALDRIVE          0x00000100
125 #define CONNECT_CURRENT_MEDIA       0x00000200
126
127 DWORD WINAPI WNetAddConnectionA(LPCSTR,LPCSTR,LPCSTR);
128 DWORD WINAPI WNetAddConnectionW(LPCWSTR,LPCWSTR,LPCWSTR);
129 #define      WNetAddConnection WINELIB_NAME_AW(WNetAddConnection)
130 DWORD WINAPI WNetAddConnection2A(LPNETRESOURCEA,LPCSTR,LPCSTR,DWORD);
131 DWORD WINAPI WNetAddConnection2W(LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD);
132 #define      WNetAddConnection2 WINELIB_NAME_AW(WNetAddConnection2)
133 DWORD WINAPI WNetAddConnection3A(HWND,LPNETRESOURCEA,LPCSTR,LPCSTR,DWORD);
134 DWORD WINAPI WNetAddConnection3W(HWND,LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD);
135 #define      WNetAddConnection3 WINELIB_NAME_AW(WNetAddConnection3)
136 DWORD WINAPI WNetCancelConnectionA(LPCSTR,BOOL);
137 DWORD WINAPI WNetCancelConnectionW(LPCWSTR,BOOL);
138 #define      WNetCancelConnection WINELIB_NAME_AW(WNetCancelConnection)
139 DWORD WINAPI WNetCancelConnection2A(LPCSTR,DWORD,BOOL);
140 DWORD WINAPI WNetCancelConnection2W(LPCWSTR,DWORD,BOOL);
141 #define      WNetCancelConnection2 WINELIB_NAME_AW(WNetCancelConnection2)
142 DWORD WINAPI WNetGetConnectionA(LPCSTR,LPSTR,LPDWORD);
143 DWORD WINAPI WNetGetConnectionW(LPCWSTR,LPWSTR,LPDWORD);
144 #define      WNetGetConnection WINELIB_NAME_AW(WNetGetConnection)
145 DWORD WINAPI WNetGetLastErrorA(LPDWORD,LPSTR,DWORD,LPSTR,DWORD);
146 DWORD WINAPI WNetGetLastErrorW(LPDWORD,LPWSTR,DWORD,LPWSTR,DWORD);
147 #define      WNetGetLastError WINELIB_NAME_AW(WNetGetLastError)
148 DWORD WINAPI WNetRestoreConnectionA(HWND,LPCSTR);
149 DWORD WINAPI WNetRestoreConnectionW(HWND,LPCWSTR);
150 #define      WNetRestoreConnection WINELIB_NAME_AW(WNetRestoreConnection)
151 DWORD WINAPI WNetUseConnectionA(HWND,LPNETRESOURCEA,LPCSTR,LPCSTR,DWORD,LPSTR,LPDWORD,LPDWORD);
152 DWORD WINAPI WNetUseConnectionW(HWND,LPNETRESOURCEW,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPDWORD,LPDWORD);
153 #define      WNetUseConnection WINELIB_NAME_AW(WNetUseConnection)
154 DWORD WINAPI WNetSetConnectionA(LPCSTR,DWORD,LPVOID);
155 DWORD WINAPI WNetSetConnectionW(LPCWSTR,DWORD,LPVOID);
156 #define      WNetSetConnection WINELIB_NAME_AW(WNetSetConnection)
157
158 /*
159  *  Network connection dialogs
160  */
161
162 typedef struct {
163     DWORD cbStructure;       /* size of this structure in bytes */
164     HWND hwndOwner;          /* owner window for the dialog */
165     LPNETRESOURCEA lpConnRes;/* Requested Resource info    */
166     DWORD dwFlags;           /* flags (see below) */
167     DWORD dwDevNum;          /* number of devices connected to */
168 } CONNECTDLGSTRUCTA, *LPCONNECTDLGSTRUCTA;
169 typedef struct {
170     DWORD cbStructure;       /* size of this structure in bytes */
171     HWND hwndOwner;          /* owner window for the dialog */
172     LPNETRESOURCEW lpConnRes;/* Requested Resource info    */
173     DWORD dwFlags;           /* flags (see below) */
174     DWORD dwDevNum;          /* number of devices connected to */
175 } CONNECTDLGSTRUCTW, *LPCONNECTDLGSTRUCTW;
176
177 DECL_WINELIB_TYPE_AW(CONNECTDLGSTRUCT)
178 DECL_WINELIB_TYPE_AW(LPCONNECTDLGSTRUCT)
179
180 #define CONNDLG_RO_PATH     0x00000001 /* Resource path should be read-only    */
181 #define CONNDLG_CONN_POINT  0x00000002 /* Netware -style movable connection point enabled */
182 #define CONNDLG_USE_MRU     0x00000004 /* Use MRU combobox  */
183 #define CONNDLG_HIDE_BOX    0x00000008 /* Hide persistent connect checkbox  */
184 #define CONNDLG_PERSIST     0x00000010 /* Force persistent connection */
185 #define CONNDLG_NOT_PERSIST 0x00000020 /* Force connection NOT persistent */
186
187 typedef struct {
188     DWORD           cbStructure;      /* size of this structure in bytes */
189     HWND            hwndOwner;        /* owner window for the dialog */
190     LPSTR           lpLocalName;      /* local device name */
191     LPSTR           lpRemoteName;     /* network resource name */
192     DWORD           dwFlags;          /* flags */
193 } DISCDLGSTRUCTA, *LPDISCDLGSTRUCTA;
194 typedef struct {
195     DWORD           cbStructure;      /* size of this structure in bytes */
196     HWND            hwndOwner;        /* owner window for the dialog */
197     LPWSTR          lpLocalName;      /* local device name */
198     LPWSTR          lpRemoteName;     /* network resource name */
199     DWORD           dwFlags;          /* flags */
200 } DISCDLGSTRUCTW, *LPDISCDLGSTRUCTW;
201
202 DECL_WINELIB_TYPE_AW(DISCDLGSTRUCT)
203 DECL_WINELIB_TYPE_AW(LPDISCDLGSTRUCT)
204
205 #define DISC_UPDATE_PROFILE         0x00000001
206 #define DISC_NO_FORCE               0x00000040
207
208 DWORD WINAPI WNetConnectionDialog(HWND,DWORD);
209 DWORD WINAPI WNetDisconnectDialog(HWND,DWORD);
210 DWORD WINAPI WNetConnectionDialog1A(LPCONNECTDLGSTRUCTA);
211 DWORD WINAPI WNetConnectionDialog1W(LPCONNECTDLGSTRUCTW);
212 #define      WNetConnectionDialog1 WINELIB_NAME_AW(WNetConnectionDialog1)
213 DWORD WINAPI WNetDisconnectDialog1A(LPDISCDLGSTRUCTA);
214 DWORD WINAPI WNetDisconnectDialog1W(LPDISCDLGSTRUCTW);
215 #define      WNetDisconnectDialog1 WINELIB_NAME_AW(WNetDisconnectDialog1)
216
217 /*
218  *  Network browsing
219  */
220
221 DWORD WINAPI WNetOpenEnumA(DWORD,DWORD,DWORD,LPNETRESOURCEA,LPHANDLE);
222 DWORD WINAPI WNetOpenEnumW(DWORD,DWORD,DWORD,LPNETRESOURCEW,LPHANDLE);
223 #define      WNetOpenEnum WINELIB_NAME_AW(WNetOpenEnum)
224 DWORD WINAPI WNetEnumResourceA(HANDLE,LPDWORD,LPVOID,LPDWORD);
225 DWORD WINAPI WNetEnumResourceW(HANDLE,LPDWORD,LPVOID,LPDWORD);
226 #define      WNetEnumResource WINELIB_NAME_AW(WNetEnumResource)
227 DWORD WINAPI WNetGetResourceInformationA(LPNETRESOURCEA,LPVOID,LPDWORD,LPSTR*);
228 DWORD WINAPI WNetGetResourceInformationW(LPNETRESOURCEW,LPVOID,LPDWORD,LPWSTR*);
229 #define      WNetGetResourceInformation WINELIB_NAME_AW(WNetGetResourceInformation)
230 DWORD WINAPI WNetGetResourceParentA(LPNETRESOURCEA,LPVOID,LPDWORD);
231 DWORD WINAPI WNetGetResourceParentW(LPNETRESOURCEW,LPVOID,LPDWORD);
232 #define      WNetGetResourceParent WINELIB_NAME_AW(WNetGetResourceParent)
233 DWORD WINAPI WNetCloseEnum(HANDLE);
234
235 /*
236  *  Universal naming
237  */
238
239 #define UNIVERSAL_NAME_INFO_LEVEL   0x00000001
240 #define REMOTE_NAME_INFO_LEVEL      0x00000002
241
242 typedef struct {
243     LPSTR    lpUniversalName;
244 } UNIVERSAL_NAME_INFOA, *LPUNIVERSAL_NAME_INFOA;
245 typedef struct {
246     LPWSTR   lpUniversalName;
247 } UNIVERSAL_NAME_INFOW, *LPUNIVERSAL_NAME_INFOW;
248
249 DECL_WINELIB_TYPE_AW(UNIVERSAL_NAME_INFO)
250 DECL_WINELIB_TYPE_AW(LPUNIVERSAL_NAME_INFO)
251
252 typedef struct {
253     LPSTR    lpUniversalName;
254     LPSTR    lpConnectionName;
255     LPSTR    lpRemainingPath;
256 }REMOTE_NAME_INFOA, *LPREMOTE_NAME_INFOA;
257 typedef struct {
258     LPWSTR   lpUniversalName;
259     LPWSTR   lpConnectionName;
260     LPWSTR   lpRemainingPath;
261 }REMOTE_NAME_INFOW, *LPREMOTE_NAME_INFOW;
262
263 DECL_WINELIB_TYPE_AW(REMOTE_NAME_INFO)
264 DECL_WINELIB_TYPE_AW(LPREMOTE_NAME_INFO)
265
266 DWORD WINAPI WNetGetUniversalNameA(LPCSTR,DWORD,LPVOID,LPDWORD);
267 DWORD WINAPI WNetGetUniversalNameW(LPCWSTR,DWORD,LPVOID,LPDWORD);
268 #define      WNetGetUniversalName WINELIB_NAME_AW(WNetGetUniversalName)
269
270 /*
271  *  Other
272  */
273
274 DWORD WINAPI WNetGetUserA(LPCSTR,LPSTR,LPDWORD);
275 DWORD WINAPI WNetGetUserW(LPCWSTR,LPWSTR,LPDWORD);
276 #define      WNetGetUser WINELIB_NAME_AW(WNetGetUser)
277
278 #define WNFMT_MULTILINE         0x01
279 #define WNFMT_ABBREVIATED       0x02
280 #define WNFMT_INENUM            0x10
281 #define WNFMT_CONNECTION        0x20
282
283 DWORD WINAPI WNetGetProviderNameA(DWORD,LPSTR,LPDWORD);
284 DWORD WINAPI WNetGetProviderNameW(DWORD,LPWSTR,LPDWORD);
285 #define      WNetGetProviderName WINELIB_NAME_AW(WNetGetProviderName)
286
287 typedef struct {
288     DWORD cbStructure;
289     DWORD dwProviderVersion;
290     DWORD dwStatus;
291     DWORD dwCharacteristics;
292     DWORD dwHandle;
293     WORD  wNetType;
294     DWORD dwPrinters;
295     DWORD dwDrives;
296 } NETINFOSTRUCT, *LPNETINFOSTRUCT;
297
298 #define NETINFO_DLL16       0x00000001
299 #define NETINFO_DISKRED     0x00000004
300 #define NETINFO_PRINTERRED  0x00000008
301
302 DWORD WINAPI WNetGetNetworkInformationA(LPCSTR,LPNETINFOSTRUCT);
303 DWORD WINAPI WNetGetNetworkInformationW(LPCWSTR,LPNETINFOSTRUCT);
304 #define      WNetGetNetworkInformation WINELIB_NAME_AW(WNetGetNetworkInformation)
305
306
307 /*
308  *  Status codes
309  */
310
311 DWORD WINAPI WNetGetLastErrorA(LPDWORD,LPSTR,DWORD,LPSTR,DWORD);
312 DWORD WINAPI WNetGetLastErrorW(LPDWORD,LPWSTR,DWORD,LPWSTR,DWORD);
313 #define      WNetGetLastError WINELIB_NAME_AW(WNetGetLastError)
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
405 #endif /* _WINNETWK_H_ */