4 * Copyright 1999 Ulrich Weigand
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <sys/types.h>
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(mpr
);
38 /*********************************************************************
39 * WNetOpenEnumA [MPR.@]
41 DWORD WINAPI
WNetOpenEnumA( DWORD dwScope
, DWORD dwType
, DWORD dwUsage
,
42 LPNETRESOURCEA lpNet
, LPHANDLE lphEnum
)
44 FIXME( "(%08lX, %08lX, %08lX, %p, %p): stub\n",
45 dwScope
, dwType
, dwUsage
, lpNet
, lphEnum
);
47 SetLastError(WN_NO_NETWORK
);
51 /*********************************************************************
52 * WNetOpenEnumW [MPR.@]
54 DWORD WINAPI
WNetOpenEnumW( DWORD dwScope
, DWORD dwType
, DWORD dwUsage
,
55 LPNETRESOURCEW lpNet
, LPHANDLE lphEnum
)
57 FIXME( "(%08lX, %08lX, %08lX, %p, %p): stub\n",
58 dwScope
, dwType
, dwUsage
, lpNet
, lphEnum
);
60 SetLastError(WN_NO_NETWORK
);
64 /*********************************************************************
65 * WNetEnumResourceA [MPR.@]
67 DWORD WINAPI
WNetEnumResourceA( HANDLE hEnum
, LPDWORD lpcCount
,
68 LPVOID lpBuffer
, LPDWORD lpBufferSize
)
70 FIXME( "(%04X, %p, %p, %p): stub\n",
71 hEnum
, lpcCount
, lpBuffer
, lpBufferSize
);
73 SetLastError(WN_NO_NETWORK
);
77 /*********************************************************************
78 * WNetEnumResourceW [MPR.@]
80 DWORD WINAPI
WNetEnumResourceW( HANDLE hEnum
, LPDWORD lpcCount
,
81 LPVOID lpBuffer
, LPDWORD lpBufferSize
)
83 FIXME( "(%04X, %p, %p, %p): stub\n",
84 hEnum
, lpcCount
, lpBuffer
, lpBufferSize
);
86 SetLastError(WN_NO_NETWORK
);
90 /*********************************************************************
91 * WNetCloseEnum [MPR.@]
93 DWORD WINAPI
WNetCloseEnum( HANDLE hEnum
)
95 FIXME( "(%04X): stub\n", hEnum
);
97 SetLastError(WN_NO_NETWORK
);
101 /*********************************************************************
102 * WNetGetResourceInformationA [MPR.@]
104 DWORD WINAPI
WNetGetResourceInformationA( LPNETRESOURCEA lpNetResource
,
105 LPVOID lpBuffer
, LPDWORD cbBuffer
,
108 FIXME( "(%p, %p, %p, %p): stub\n",
109 lpNetResource
, lpBuffer
, cbBuffer
, lplpSystem
);
111 SetLastError(WN_NO_NETWORK
);
112 return WN_NO_NETWORK
;
115 /*********************************************************************
116 * WNetGetResourceInformationW [MPR.@]
118 DWORD WINAPI
WNetGetResourceInformationW( LPNETRESOURCEW lpNetResource
,
119 LPVOID lpBuffer
, LPDWORD cbBuffer
,
122 FIXME( "(%p, %p, %p, %p): stub\n",
123 lpNetResource
, lpBuffer
, cbBuffer
, lplpSystem
);
125 SetLastError(WN_NO_NETWORK
);
126 return WN_NO_NETWORK
;
129 /*********************************************************************
130 * WNetGetResourceParentA [MPR.@]
132 DWORD WINAPI
WNetGetResourceParentA( LPNETRESOURCEA lpNetResource
,
133 LPVOID lpBuffer
, LPDWORD lpBufferSize
)
135 FIXME( "(%p, %p, %p): stub\n",
136 lpNetResource
, lpBuffer
, lpBufferSize
);
138 SetLastError(WN_NO_NETWORK
);
139 return WN_NO_NETWORK
;
142 /*********************************************************************
143 * WNetGetResourceParentW [MPR.@]
145 DWORD WINAPI
WNetGetResourceParentW( LPNETRESOURCEW lpNetResource
,
146 LPVOID lpBuffer
, LPDWORD lpBufferSize
)
148 FIXME( "(%p, %p, %p): stub\n",
149 lpNetResource
, lpBuffer
, lpBufferSize
);
151 SetLastError(WN_NO_NETWORK
);
152 return WN_NO_NETWORK
;
158 * Connection Functions
161 /*********************************************************************
162 * WNetAddConnectionA [MPR.@]
164 DWORD WINAPI
WNetAddConnectionA( LPCSTR lpRemoteName
, LPCSTR lpPassword
,
167 FIXME( "(%s, %p, %s): stub\n",
168 debugstr_a(lpRemoteName
), lpPassword
, debugstr_a(lpLocalName
) );
170 SetLastError(WN_NO_NETWORK
);
171 return WN_NO_NETWORK
;
174 /*********************************************************************
175 * WNetAddConnectionW [MPR.@]
177 DWORD WINAPI
WNetAddConnectionW( LPCWSTR lpRemoteName
, LPCWSTR lpPassword
,
178 LPCWSTR lpLocalName
)
180 FIXME( "(%s, %p, %s): stub\n",
181 debugstr_w(lpRemoteName
), lpPassword
, debugstr_w(lpLocalName
) );
183 SetLastError(WN_NO_NETWORK
);
184 return WN_NO_NETWORK
;
187 /*********************************************************************
188 * WNetAddConnection2A [MPR.@]
190 DWORD WINAPI
WNetAddConnection2A( LPNETRESOURCEA lpNetResource
,
191 LPCSTR lpPassword
, LPCSTR lpUserID
,
194 FIXME( "(%p, %p, %s, 0x%08lX): stub\n",
195 lpNetResource
, lpPassword
, debugstr_a(lpUserID
), dwFlags
);
197 SetLastError(WN_NO_NETWORK
);
198 return WN_NO_NETWORK
;
201 /*********************************************************************
202 * WNetAddConnection2W [MPR.@]
204 DWORD WINAPI
WNetAddConnection2W( LPNETRESOURCEW lpNetResource
,
205 LPCWSTR lpPassword
, LPCWSTR lpUserID
,
208 FIXME( "(%p, %p, %s, 0x%08lX): stub\n",
209 lpNetResource
, lpPassword
, debugstr_w(lpUserID
), dwFlags
);
211 SetLastError(WN_NO_NETWORK
);
212 return WN_NO_NETWORK
;
215 /*********************************************************************
216 * WNetAddConnection3A [MPR.@]
218 DWORD WINAPI
WNetAddConnection3A( HWND hwndOwner
, LPNETRESOURCEA lpNetResource
,
219 LPCSTR lpPassword
, LPCSTR lpUserID
,
222 FIXME( "(%04x, %p, %p, %s, 0x%08lX), stub\n",
223 hwndOwner
, lpNetResource
, lpPassword
, debugstr_a(lpUserID
), dwFlags
);
225 SetLastError(WN_NO_NETWORK
);
226 return WN_NO_NETWORK
;
229 /*********************************************************************
230 * WNetAddConnection3W [MPR.@]
232 DWORD WINAPI
WNetAddConnection3W( HWND hwndOwner
, LPNETRESOURCEW lpNetResource
,
233 LPCWSTR lpPassword
, LPCWSTR lpUserID
,
236 FIXME( "(%04x, %p, %p, %s, 0x%08lX), stub\n",
237 hwndOwner
, lpNetResource
, lpPassword
, debugstr_w(lpUserID
), dwFlags
);
239 SetLastError(WN_NO_NETWORK
);
240 return WN_NO_NETWORK
;
243 /*****************************************************************
244 * WNetUseConnectionA [MPR.@]
246 DWORD WINAPI
WNetUseConnectionA( HWND hwndOwner
, LPNETRESOURCEA lpNetResource
,
247 LPCSTR lpPassword
, LPCSTR lpUserID
, DWORD dwFlags
,
248 LPSTR lpAccessName
, LPDWORD lpBufferSize
,
251 FIXME( "(%04x, %p, %p, %s, 0x%08lX, %s, %p, %p), stub\n",
252 hwndOwner
, lpNetResource
, lpPassword
, debugstr_a(lpUserID
), dwFlags
,
253 debugstr_a(lpAccessName
), lpBufferSize
, lpResult
);
255 SetLastError(WN_NO_NETWORK
);
256 return WN_NO_NETWORK
;
259 /*****************************************************************
260 * WNetUseConnectionW [MPR.@]
262 DWORD WINAPI
WNetUseConnectionW( HWND hwndOwner
, LPNETRESOURCEW lpNetResource
,
263 LPCWSTR lpPassword
, LPCWSTR lpUserID
, DWORD dwFlags
,
264 LPWSTR lpAccessName
, LPDWORD lpBufferSize
,
267 FIXME( "(%04x, %p, %p, %s, 0x%08lX, %s, %p, %p), stub\n",
268 hwndOwner
, lpNetResource
, lpPassword
, debugstr_w(lpUserID
), dwFlags
,
269 debugstr_w(lpAccessName
), lpBufferSize
, lpResult
);
271 SetLastError(WN_NO_NETWORK
);
272 return WN_NO_NETWORK
;
275 /*********************************************************************
276 * WNetCancelConnectionA [MPR.@]
278 DWORD WINAPI
WNetCancelConnectionA( LPCSTR lpName
, BOOL fForce
)
280 FIXME( "(%s, %d), stub\n", debugstr_a(lpName
), fForce
);
285 /*********************************************************************
286 * WNetCancelConnectionW [MPR.@]
288 DWORD WINAPI
WNetCancelConnectionW( LPCWSTR lpName
, BOOL fForce
)
290 FIXME( "(%s, %d), stub\n", debugstr_w(lpName
), fForce
);
295 /*********************************************************************
296 * WNetCancelConnection2A [MPR.@]
298 DWORD WINAPI
WNetCancelConnection2A( LPCSTR lpName
, DWORD dwFlags
, BOOL fForce
)
300 FIXME( "(%s, %08lX, %d), stub\n", debugstr_a(lpName
), dwFlags
, fForce
);
305 /*********************************************************************
306 * WNetCancelConnection2W [MPR.@]
308 DWORD WINAPI
WNetCancelConnection2W( LPCWSTR lpName
, DWORD dwFlags
, BOOL fForce
)
310 FIXME( "(%s, %08lX, %d), stub\n", debugstr_w(lpName
), dwFlags
, fForce
);
315 /*****************************************************************
316 * WNetRestoreConnectionA [MPR.@]
318 DWORD WINAPI
WNetRestoreConnectionA( HWND hwndOwner
, LPSTR lpszDevice
)
320 FIXME( "(%04X, %s), stub\n", hwndOwner
, debugstr_a(lpszDevice
) );
322 SetLastError(WN_NO_NETWORK
);
323 return WN_NO_NETWORK
;
326 /*****************************************************************
327 * WNetRestoreConnectionW [MPR.@]
329 DWORD WINAPI
WNetRestoreConnectionW( HWND hwndOwner
, LPWSTR lpszDevice
)
331 FIXME( "(%04X, %s), stub\n", hwndOwner
, debugstr_w(lpszDevice
) );
333 SetLastError(WN_NO_NETWORK
);
334 return WN_NO_NETWORK
;
337 /**************************************************************************
338 * WNetGetConnectionA [MPR.@]
341 * - WN_BAD_LOCALNAME lpLocalName makes no sense
342 * - WN_NOT_CONNECTED drive is a local drive
343 * - WN_MORE_DATA buffer isn't big enough
344 * - WN_SUCCESS success (net path in buffer)
347 DWORD WINAPI
WNetGetConnectionA( LPCSTR lpLocalName
,
348 LPSTR lpRemoteName
, LPDWORD lpBufferSize
)
352 TRACE( "local %s\n", lpLocalName
);
353 if (lpLocalName
[1] == ':')
355 switch(GetDriveTypeA(lpLocalName
))
358 if (!GetVolumeInformationA( lpLocalName
, label
, sizeof(label
),
359 NULL
, NULL
, NULL
, NULL
, 0 )) label
[0] = 0;
360 if (strlen(label
) + 1 > *lpBufferSize
)
362 *lpBufferSize
= strlen(label
) + 1;
365 strcpy( lpRemoteName
, label
);
366 *lpBufferSize
= strlen(lpRemoteName
) + 1;
368 case DRIVE_REMOVABLE
:
371 TRACE("file is local\n");
372 return WN_NOT_CONNECTED
;
374 return WN_BAD_LOCALNAME
;
377 return WN_BAD_LOCALNAME
;
380 /**************************************************************************
381 * WNetGetConnectionW [MPR.@]
383 DWORD WINAPI
WNetGetConnectionW( LPCWSTR lpLocalName
,
384 LPWSTR lpRemoteName
, LPDWORD lpBufferSize
)
387 DWORD ret
, x
= sizeof(buf
);
388 INT len
= WideCharToMultiByte( CP_ACP
, 0, lpLocalName
, -1, NULL
, 0, NULL
, NULL
);
389 LPSTR lnA
= HeapAlloc( GetProcessHeap(), 0, len
);
391 WideCharToMultiByte( CP_ACP
, 0, lpLocalName
, -1, lnA
, len
, NULL
, NULL
);
392 ret
= WNetGetConnectionA( lnA
, buf
, &x
);
393 HeapFree( GetProcessHeap(), 0, lnA
);
394 if (ret
== WN_SUCCESS
)
396 x
= MultiByteToWideChar( CP_ACP
, 0, buf
, -1, NULL
, 0 );
397 if (x
> *lpBufferSize
)
402 *lpBufferSize
= MultiByteToWideChar( CP_ACP
, 0, buf
, -1, lpRemoteName
, *lpBufferSize
);
407 /**************************************************************************
408 * WNetSetConnectionA [MPR.@]
410 DWORD WINAPI
WNetSetConnectionA( LPCSTR lpName
, DWORD dwProperty
,
413 FIXME( "(%s, %08lX, %p): stub\n", debugstr_a(lpName
), dwProperty
, pvValue
);
415 SetLastError(WN_NO_NETWORK
);
416 return WN_NO_NETWORK
;
419 /**************************************************************************
420 * WNetSetConnectionW [MPR.@]
422 DWORD WINAPI
WNetSetConnectionW( LPCWSTR lpName
, DWORD dwProperty
,
425 FIXME( "(%s, %08lX, %p): stub\n", debugstr_w(lpName
), dwProperty
, pvValue
);
427 SetLastError(WN_NO_NETWORK
);
428 return WN_NO_NETWORK
;
431 /*****************************************************************
432 * WNetGetUniversalNameA [MPR.@]
434 DWORD WINAPI
WNetGetUniversalNameA ( LPCSTR lpLocalPath
, DWORD dwInfoLevel
,
435 LPVOID lpBuffer
, LPDWORD lpBufferSize
)
437 FIXME( "(%s, 0x%08lX, %p, %p): stub\n",
438 debugstr_a(lpLocalPath
), dwInfoLevel
, lpBuffer
, lpBufferSize
);
440 SetLastError(WN_NO_NETWORK
);
441 return WN_NO_NETWORK
;
444 /*****************************************************************
445 * WNetGetUniversalNameW [MPR.@]
447 DWORD WINAPI
WNetGetUniversalNameW ( LPCWSTR lpLocalPath
, DWORD dwInfoLevel
,
448 LPVOID lpBuffer
, LPDWORD lpBufferSize
)
450 FIXME( "(%s, 0x%08lX, %p, %p): stub\n",
451 debugstr_w(lpLocalPath
), dwInfoLevel
, lpBuffer
, lpBufferSize
);
453 SetLastError(WN_NO_NETWORK
);
454 return WN_NO_NETWORK
;
463 /**************************************************************************
464 * WNetGetUserA [MPR.@]
466 * FIXME: we should not return ourselves, but the owner of the drive lpName
468 DWORD WINAPI
WNetGetUserA( LPCSTR lpName
, LPSTR lpUserID
, LPDWORD lpBufferSize
)
470 if (GetUserNameA( lpUserID
, lpBufferSize
)) return WN_SUCCESS
;
471 return GetLastError();
474 /*****************************************************************
475 * WNetGetUserW [MPR.@]
477 DWORD WINAPI
WNetGetUserW( LPCWSTR lpName
, LPWSTR lpUserID
, LPDWORD lpBufferSize
)
479 FIXME( "(%s, %p, %p): mostly stub\n",
480 debugstr_w(lpName
), lpUserID
, lpBufferSize
);
482 SetLastError(WN_NO_NETWORK
);
483 return WN_NO_NETWORK
;
486 /*********************************************************************
487 * WNetConnectionDialog [MPR.@]
489 DWORD WINAPI
WNetConnectionDialog( HWND hwnd
, DWORD dwType
)
491 FIXME( "(%04x, %08lX): stub\n", hwnd
, dwType
);
493 SetLastError(WN_NO_NETWORK
);
494 return ERROR_NO_NETWORK
;
497 /*********************************************************************
498 * WNetConnectionDialog1A [MPR.@]
500 DWORD WINAPI
WNetConnectionDialog1A( LPCONNECTDLGSTRUCTA lpConnDlgStruct
)
502 FIXME( "(%p): stub\n", lpConnDlgStruct
);
504 SetLastError(WN_NO_NETWORK
);
505 return ERROR_NO_NETWORK
;
508 /*********************************************************************
509 * WNetConnectionDialog1W [MPR.@]
511 DWORD WINAPI
WNetConnectionDialog1W( LPCONNECTDLGSTRUCTW lpConnDlgStruct
)
513 FIXME( "(%p): stub\n", lpConnDlgStruct
);
515 SetLastError(WN_NO_NETWORK
);
516 return ERROR_NO_NETWORK
;
519 /*********************************************************************
520 * WNetDisconnectDialog [MPR.@]
522 DWORD WINAPI
WNetDisconnectDialog( HWND hwnd
, DWORD dwType
)
524 FIXME( "(%04x, %08lX): stub\n", hwnd
, dwType
);
526 SetLastError(WN_NO_NETWORK
);
527 return ERROR_NO_NETWORK
;
530 /*********************************************************************
531 * WNetDisconnectDialog1A [MPR.@]
533 DWORD WINAPI
WNetDisconnectDialog1A( LPDISCDLGSTRUCTA lpConnDlgStruct
)
535 FIXME( "(%p): stub\n", lpConnDlgStruct
);
537 SetLastError(WN_NO_NETWORK
);
538 return ERROR_NO_NETWORK
;
541 /*********************************************************************
542 * WNetDisconnectDialog1W [MPR.@]
544 DWORD WINAPI
WNetDisconnectDialog1W( LPDISCDLGSTRUCTW lpConnDlgStruct
)
546 FIXME( "(%p): stub\n", lpConnDlgStruct
);
548 SetLastError(WN_NO_NETWORK
);
549 return ERROR_NO_NETWORK
;
552 /*********************************************************************
553 * WNetGetLastErrorA [MPR.@]
555 DWORD WINAPI
WNetGetLastErrorA( LPDWORD lpError
,
556 LPSTR lpErrorBuf
, DWORD nErrorBufSize
,
557 LPSTR lpNameBuf
, DWORD nNameBufSize
)
559 FIXME( "(%p, %p, %ld, %p, %ld): stub\n",
560 lpError
, lpErrorBuf
, nErrorBufSize
, lpNameBuf
, nNameBufSize
);
562 SetLastError(WN_NO_NETWORK
);
563 return ERROR_NO_NETWORK
;
566 /*********************************************************************
567 * WNetGetLastErrorW [MPR.@]
569 DWORD WINAPI
WNetGetLastErrorW( LPDWORD lpError
,
570 LPWSTR lpErrorBuf
, DWORD nErrorBufSize
,
571 LPWSTR lpNameBuf
, DWORD nNameBufSize
)
573 FIXME( "(%p, %p, %ld, %p, %ld): stub\n",
574 lpError
, lpErrorBuf
, nErrorBufSize
, lpNameBuf
, nNameBufSize
);
576 SetLastError(WN_NO_NETWORK
);
577 return ERROR_NO_NETWORK
;
580 /*********************************************************************
581 * WNetGetNetworkInformationA [MPR.@]
583 DWORD WINAPI
WNetGetNetworkInformationA( LPCSTR lpProvider
,
584 LPNETINFOSTRUCT lpNetInfoStruct
)
586 FIXME( "(%s, %p): stub\n", debugstr_a(lpProvider
), lpNetInfoStruct
);
588 SetLastError(WN_NO_NETWORK
);
589 return ERROR_NO_NETWORK
;
592 /*********************************************************************
593 * WNetGetNetworkInformationW [MPR.@]
595 DWORD WINAPI
WNetGetNetworkInformationW( LPCWSTR lpProvider
,
596 LPNETINFOSTRUCT lpNetInfoStruct
)
598 FIXME( "(%s, %p): stub\n", debugstr_w(lpProvider
), lpNetInfoStruct
);
600 SetLastError(WN_NO_NETWORK
);
601 return ERROR_NO_NETWORK
;
604 /*****************************************************************
605 * WNetGetProviderNameA [MPR.@]
607 DWORD WINAPI
WNetGetProviderNameA( DWORD dwNetType
,
608 LPSTR lpProvider
, LPDWORD lpBufferSize
)
610 FIXME( "(%ld, %p, %p): stub\n", dwNetType
, lpProvider
, lpBufferSize
);
612 SetLastError(WN_NO_NETWORK
);
613 return WN_NO_NETWORK
;
616 /*****************************************************************
617 * WNetGetProviderNameW [MPR.@]
619 DWORD WINAPI
WNetGetProviderNameW( DWORD dwNetType
,
620 LPWSTR lpProvider
, LPDWORD lpBufferSize
)
622 FIXME( "(%ld, %p, %p): stub\n", dwNetType
, lpProvider
, lpBufferSize
);
624 SetLastError(WN_NO_NETWORK
);
625 return WN_NO_NETWORK
;