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