14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(mpr);
23 /*********************************************************************
24 * WNetOpenEnumA [MPR.@]
26 DWORD WINAPI WNetOpenEnumA( DWORD dwScope, DWORD dwType, DWORD dwUsage,
27 LPNETRESOURCEA lpNet, LPHANDLE lphEnum )
29 FIXME( "(%08lX, %08lX, %08lX, %p, %p): stub\n",
30 dwScope, dwType, dwUsage, lpNet, lphEnum );
32 SetLastError(WN_NO_NETWORK);
36 /*********************************************************************
37 * WNetOpenEnumW [MPR.@]
39 DWORD WINAPI WNetOpenEnumW( DWORD dwScope, DWORD dwType, DWORD dwUsage,
40 LPNETRESOURCEW lpNet, LPHANDLE lphEnum )
42 FIXME( "(%08lX, %08lX, %08lX, %p, %p): stub\n",
43 dwScope, dwType, dwUsage, lpNet, lphEnum );
45 SetLastError(WN_NO_NETWORK);
49 /*********************************************************************
50 * WNetEnumResourceA [MPR.@]
52 DWORD WINAPI WNetEnumResourceA( HANDLE hEnum, LPDWORD lpcCount,
53 LPVOID lpBuffer, LPDWORD lpBufferSize )
55 FIXME( "(%04X, %p, %p, %p): stub\n",
56 hEnum, lpcCount, lpBuffer, lpBufferSize );
58 SetLastError(WN_NO_NETWORK);
62 /*********************************************************************
63 * WNetEnumResourceW [MPR.@]
65 DWORD WINAPI WNetEnumResourceW( HANDLE hEnum, LPDWORD lpcCount,
66 LPVOID lpBuffer, LPDWORD lpBufferSize )
68 FIXME( "(%04X, %p, %p, %p): stub\n",
69 hEnum, lpcCount, lpBuffer, lpBufferSize );
71 SetLastError(WN_NO_NETWORK);
75 /*********************************************************************
76 * WNetCloseEnum [MPR.@]
78 DWORD WINAPI WNetCloseEnum( HANDLE hEnum )
80 FIXME( "(%04X): stub\n", hEnum );
82 SetLastError(WN_NO_NETWORK);
86 /*********************************************************************
87 * WNetGetResourceInformationA [MPR.@]
89 DWORD WINAPI WNetGetResourceInformationA( LPNETRESOURCEA lpNetResource,
90 LPVOID lpBuffer, LPDWORD cbBuffer,
93 FIXME( "(%p, %p, %p, %p): stub\n",
94 lpNetResource, lpBuffer, cbBuffer, lplpSystem );
96 SetLastError(WN_NO_NETWORK);
100 /*********************************************************************
101 * WNetGetResourceInformationW [MPR.@]
103 DWORD WINAPI WNetGetResourceInformationW( LPNETRESOURCEW lpNetResource,
104 LPVOID lpBuffer, LPDWORD cbBuffer,
107 FIXME( "(%p, %p, %p, %p): stub\n",
108 lpNetResource, lpBuffer, cbBuffer, lplpSystem );
110 SetLastError(WN_NO_NETWORK);
111 return WN_NO_NETWORK;
114 /*********************************************************************
115 * WNetGetResourceParentA [MPR.@]
117 DWORD WINAPI WNetGetResourceParentA( LPNETRESOURCEA lpNetResource,
118 LPVOID lpBuffer, LPDWORD lpBufferSize )
120 FIXME( "(%p, %p, %p): stub\n",
121 lpNetResource, lpBuffer, lpBufferSize );
123 SetLastError(WN_NO_NETWORK);
124 return WN_NO_NETWORK;
127 /*********************************************************************
128 * WNetGetResourceParentW [MPR.@]
130 DWORD WINAPI WNetGetResourceParentW( LPNETRESOURCEW lpNetResource,
131 LPVOID lpBuffer, LPDWORD lpBufferSize )
133 FIXME( "(%p, %p, %p): stub\n",
134 lpNetResource, lpBuffer, lpBufferSize );
136 SetLastError(WN_NO_NETWORK);
137 return WN_NO_NETWORK;
143 * Connection Functions
146 /*********************************************************************
147 * WNetAddConnectionA [MPR.@]
149 DWORD WINAPI WNetAddConnectionA( LPCSTR lpRemoteName, LPCSTR lpPassword,
152 FIXME( "(%s, %p, %s): stub\n",
153 debugstr_a(lpRemoteName), lpPassword, debugstr_a(lpLocalName) );
155 SetLastError(WN_NO_NETWORK);
156 return WN_NO_NETWORK;
159 /*********************************************************************
160 * WNetAddConnectionW [MPR.@]
162 DWORD WINAPI WNetAddConnectionW( LPCWSTR lpRemoteName, LPCWSTR lpPassword,
163 LPCWSTR lpLocalName )
165 FIXME( "(%s, %p, %s): stub\n",
166 debugstr_w(lpRemoteName), lpPassword, debugstr_w(lpLocalName) );
168 SetLastError(WN_NO_NETWORK);
169 return WN_NO_NETWORK;
172 /*********************************************************************
173 * WNetAddConnection2A [MPR.@]
175 DWORD WINAPI WNetAddConnection2A( LPNETRESOURCEA lpNetResource,
176 LPCSTR lpPassword, LPCSTR lpUserID,
179 FIXME( "(%p, %p, %s, 0x%08lX): stub\n",
180 lpNetResource, lpPassword, debugstr_a(lpUserID), dwFlags );
182 SetLastError(WN_NO_NETWORK);
183 return WN_NO_NETWORK;
186 /*********************************************************************
187 * WNetAddConnection2W [MPR.@]
189 DWORD WINAPI WNetAddConnection2W( LPNETRESOURCEW lpNetResource,
190 LPCWSTR lpPassword, LPCWSTR lpUserID,
193 FIXME( "(%p, %p, %s, 0x%08lX): stub\n",
194 lpNetResource, lpPassword, debugstr_w(lpUserID), dwFlags );
196 SetLastError(WN_NO_NETWORK);
197 return WN_NO_NETWORK;
200 /*********************************************************************
201 * WNetAddConnection3A [MPR.@]
203 DWORD WINAPI WNetAddConnection3A( HWND hwndOwner, LPNETRESOURCEA lpNetResource,
204 LPCSTR lpPassword, LPCSTR lpUserID,
207 FIXME( "(%04x, %p, %p, %s, 0x%08lX), stub\n",
208 hwndOwner, lpNetResource, lpPassword, debugstr_a(lpUserID), dwFlags );
210 SetLastError(WN_NO_NETWORK);
211 return WN_NO_NETWORK;
214 /*********************************************************************
215 * WNetAddConnection3W [MPR.@]
217 DWORD WINAPI WNetAddConnection3W( HWND hwndOwner, LPNETRESOURCEW lpNetResource,
218 LPCWSTR lpPassword, LPCWSTR lpUserID,
221 FIXME( "(%04x, %p, %p, %s, 0x%08lX), stub\n",
222 hwndOwner, lpNetResource, lpPassword, debugstr_w(lpUserID), dwFlags );
224 SetLastError(WN_NO_NETWORK);
225 return WN_NO_NETWORK;
228 /*****************************************************************
229 * WNetUseConnectionA [MPR.@]
231 DWORD WINAPI WNetUseConnectionA( HWND hwndOwner, LPNETRESOURCEA lpNetResource,
232 LPCSTR lpPassword, LPCSTR lpUserID, DWORD dwFlags,
233 LPSTR lpAccessName, LPDWORD lpBufferSize,
236 FIXME( "(%04x, %p, %p, %s, 0x%08lX, %s, %p, %p), stub\n",
237 hwndOwner, lpNetResource, lpPassword, debugstr_a(lpUserID), dwFlags,
238 debugstr_a(lpAccessName), lpBufferSize, lpResult );
240 SetLastError(WN_NO_NETWORK);
241 return WN_NO_NETWORK;
244 /*****************************************************************
245 * WNetUseConnectionW [MPR.@]
247 DWORD WINAPI WNetUseConnectionW( HWND hwndOwner, LPNETRESOURCEW lpNetResource,
248 LPCWSTR lpPassword, LPCWSTR lpUserID, DWORD dwFlags,
249 LPWSTR lpAccessName, LPDWORD lpBufferSize,
252 FIXME( "(%04x, %p, %p, %s, 0x%08lX, %s, %p, %p), stub\n",
253 hwndOwner, lpNetResource, lpPassword, debugstr_w(lpUserID), dwFlags,
254 debugstr_w(lpAccessName), lpBufferSize, lpResult );
256 SetLastError(WN_NO_NETWORK);
257 return WN_NO_NETWORK;
260 /*********************************************************************
261 * WNetCancelConnectionA [MPR.@]
263 DWORD WINAPI WNetCancelConnectionA( LPCSTR lpName, BOOL fForce )
265 FIXME( "(%s, %d), stub\n", debugstr_a(lpName), fForce );
270 /*********************************************************************
271 * WNetCancelConnectionW [MPR.@]
273 DWORD WINAPI WNetCancelConnectionW( LPCWSTR lpName, BOOL fForce )
275 FIXME( "(%s, %d), stub\n", debugstr_w(lpName), fForce );
280 /*********************************************************************
281 * WNetCancelConnection2A [MPR.@]
283 DWORD WINAPI WNetCancelConnection2A( LPCSTR lpName, DWORD dwFlags, BOOL fForce )
285 FIXME( "(%s, %08lX, %d), stub\n", debugstr_a(lpName), dwFlags, fForce );
290 /*********************************************************************
291 * WNetCancelConnection2W [MPR.@]
293 DWORD WINAPI WNetCancelConnection2W( LPCWSTR lpName, DWORD dwFlags, BOOL fForce )
295 FIXME( "(%s, %08lX, %d), stub\n", debugstr_w(lpName), dwFlags, fForce );
300 /*****************************************************************
301 * WNetRestoreConnectionA [MPR.@]
303 DWORD WINAPI WNetRestoreConnectionA( HWND hwndOwner, LPSTR lpszDevice )
305 FIXME( "(%04X, %s), stub\n", hwndOwner, debugstr_a(lpszDevice) );
307 SetLastError(WN_NO_NETWORK);
308 return WN_NO_NETWORK;
311 /*****************************************************************
312 * WNetRestoreConnectionW [MPR.@]
314 DWORD WINAPI WNetRestoreConnectionW( HWND hwndOwner, LPWSTR lpszDevice )
316 FIXME( "(%04X, %s), stub\n", hwndOwner, debugstr_w(lpszDevice) );
318 SetLastError(WN_NO_NETWORK);
319 return WN_NO_NETWORK;
322 /**************************************************************************
323 * WNetGetConnectionA [MPR.@]
326 * - WN_BAD_LOCALNAME lpLocalName makes no sense
327 * - WN_NOT_CONNECTED drive is a local drive
328 * - WN_MORE_DATA buffer isn't big enough
329 * - WN_SUCCESS success (net path in buffer)
332 DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName,
333 LPSTR lpRemoteName, LPDWORD lpBufferSize )
337 TRACE( "local %s\n", lpLocalName );
338 if (lpLocalName[1] == ':')
340 switch(GetDriveTypeA(lpLocalName))
343 if (!GetVolumeInformationA( lpLocalName, label, sizeof(label),
344 NULL, NULL, NULL, NULL, 0 )) label[0] = 0;
345 if (strlen(label) + 1 > *lpBufferSize)
347 *lpBufferSize = strlen(label) + 1;
350 strcpy( lpRemoteName, label );
351 *lpBufferSize = strlen(lpRemoteName) + 1;
353 case DRIVE_REMOVABLE:
356 TRACE("file is local\n");
357 return WN_NOT_CONNECTED;
359 return WN_BAD_LOCALNAME;
362 return WN_BAD_LOCALNAME;
365 /**************************************************************************
366 * WNetGetConnectionW [MPR.@]
368 DWORD WINAPI WNetGetConnectionW( LPCWSTR lpLocalName,
369 LPWSTR lpRemoteName, LPDWORD lpBufferSize )
372 DWORD ret, x = sizeof(buf);
373 INT len = WideCharToMultiByte( CP_ACP, 0, lpLocalName, -1, NULL, 0, NULL, NULL );
374 LPSTR lnA = HeapAlloc( GetProcessHeap(), 0, len );
376 WideCharToMultiByte( CP_ACP, 0, lpLocalName, -1, lnA, len, NULL, NULL );
377 ret = WNetGetConnectionA( lnA, buf, &x );
378 HeapFree( GetProcessHeap(), 0, lnA );
379 if (ret == WN_SUCCESS)
381 x = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
382 if (x > *lpBufferSize)
387 *lpBufferSize = MultiByteToWideChar( CP_ACP, 0, buf, -1, lpRemoteName, *lpBufferSize );
392 /**************************************************************************
393 * WNetSetConnectionA [MPR.@]
395 DWORD WINAPI WNetSetConnectionA( LPCSTR lpName, DWORD dwProperty,
398 FIXME( "(%s, %08lX, %p): stub\n", debugstr_a(lpName), dwProperty, pvValue );
400 SetLastError(WN_NO_NETWORK);
401 return WN_NO_NETWORK;
404 /**************************************************************************
405 * WNetSetConnectionW [MPR.@]
407 DWORD WINAPI WNetSetConnectionW( LPCWSTR lpName, DWORD dwProperty,
410 FIXME( "(%s, %08lX, %p): stub\n", debugstr_w(lpName), dwProperty, pvValue );
412 SetLastError(WN_NO_NETWORK);
413 return WN_NO_NETWORK;
416 /*****************************************************************
417 * WNetGetUniversalNameA [MPR.@]
419 DWORD WINAPI WNetGetUniversalNameA ( LPCSTR lpLocalPath, DWORD dwInfoLevel,
420 LPVOID lpBuffer, LPDWORD lpBufferSize )
422 FIXME( "(%s, 0x%08lX, %p, %p): stub\n",
423 debugstr_a(lpLocalPath), dwInfoLevel, lpBuffer, lpBufferSize);
425 SetLastError(WN_NO_NETWORK);
426 return WN_NO_NETWORK;
429 /*****************************************************************
430 * WNetGetUniversalNameW [MPR.@]
432 DWORD WINAPI WNetGetUniversalNameW ( LPCWSTR lpLocalPath, DWORD dwInfoLevel,
433 LPVOID lpBuffer, LPDWORD lpBufferSize )
435 FIXME( "(%s, 0x%08lX, %p, %p): stub\n",
436 debugstr_w(lpLocalPath), dwInfoLevel, lpBuffer, lpBufferSize);
438 SetLastError(WN_NO_NETWORK);
439 return WN_NO_NETWORK;
448 /**************************************************************************
449 * WNetGetUserA [MPR.@]
451 * FIXME: we should not return ourselves, but the owner of the drive lpName
453 DWORD WINAPI WNetGetUserA( LPCSTR lpName, LPSTR lpUserID, LPDWORD lpBufferSize )
455 struct passwd *pwd = getpwuid(getuid());
457 FIXME( "(%s, %p, %p): mostly stub\n",
458 debugstr_a(lpName), lpUserID, lpBufferSize );
462 if ( strlen(pwd->pw_name) + 1 > *lpBufferSize )
464 *lpBufferSize = strlen(pwd->pw_name) + 1;
466 SetLastError(ERROR_MORE_DATA);
467 return ERROR_MORE_DATA;
470 strcpy( lpUserID, pwd->pw_name );
471 *lpBufferSize = strlen(pwd->pw_name) + 1;
475 /* FIXME: wrong return value */
476 SetLastError(ERROR_NO_NETWORK);
477 return ERROR_NO_NETWORK;
480 /*****************************************************************
481 * WNetGetUserW [MPR.@]
483 DWORD WINAPI WNetGetUserW( LPCWSTR lpName, LPWSTR lpUserID, LPDWORD lpBufferSize )
485 FIXME( "(%s, %p, %p): mostly stub\n",
486 debugstr_w(lpName), lpUserID, lpBufferSize );
488 SetLastError(WN_NO_NETWORK);
489 return WN_NO_NETWORK;
492 /*********************************************************************
493 * WNetConnectionDialog [MPR.@]
495 DWORD WINAPI WNetConnectionDialog( HWND hwnd, DWORD dwType )
497 FIXME( "(%04x, %08lX): stub\n", hwnd, dwType );
499 SetLastError(WN_NO_NETWORK);
500 return ERROR_NO_NETWORK;
503 /*********************************************************************
504 * WNetConnectionDialog1A [MPR.@]
506 DWORD WINAPI WNetConnectionDialog1A( LPCONNECTDLGSTRUCTA lpConnDlgStruct )
508 FIXME( "(%p): stub\n", lpConnDlgStruct );
510 SetLastError(WN_NO_NETWORK);
511 return ERROR_NO_NETWORK;
514 /*********************************************************************
515 * WNetConnectionDialog1W [MPR.@]
517 DWORD WINAPI WNetConnectionDialog1W( LPCONNECTDLGSTRUCTW lpConnDlgStruct )
519 FIXME( "(%p): stub\n", lpConnDlgStruct );
521 SetLastError(WN_NO_NETWORK);
522 return ERROR_NO_NETWORK;
525 /*********************************************************************
526 * WNetDisconnectDialog [MPR.@]
528 DWORD WINAPI WNetDisconnectDialog( HWND hwnd, DWORD dwType )
530 FIXME( "(%04x, %08lX): stub\n", hwnd, dwType );
532 SetLastError(WN_NO_NETWORK);
533 return ERROR_NO_NETWORK;
536 /*********************************************************************
537 * WNetDisconnectDialog1A [MPR.@]
539 DWORD WINAPI WNetDisconnectDialog1A( LPDISCDLGSTRUCTA lpConnDlgStruct )
541 FIXME( "(%p): stub\n", lpConnDlgStruct );
543 SetLastError(WN_NO_NETWORK);
544 return ERROR_NO_NETWORK;
547 /*********************************************************************
548 * WNetDisconnectDialog1W [MPR.@]
550 DWORD WINAPI WNetDisconnectDialog1W( LPDISCDLGSTRUCTW lpConnDlgStruct )
552 FIXME( "(%p): stub\n", lpConnDlgStruct );
554 SetLastError(WN_NO_NETWORK);
555 return ERROR_NO_NETWORK;
558 /*********************************************************************
559 * WNetGetLastErrorA [MPR.@]
561 DWORD WINAPI WNetGetLastErrorA( LPDWORD lpError,
562 LPSTR lpErrorBuf, DWORD nErrorBufSize,
563 LPSTR lpNameBuf, DWORD nNameBufSize )
565 FIXME( "(%p, %p, %ld, %p, %ld): stub\n",
566 lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize );
568 SetLastError(WN_NO_NETWORK);
569 return ERROR_NO_NETWORK;
572 /*********************************************************************
573 * WNetGetLastErrorW [MPR.@]
575 DWORD WINAPI WNetGetLastErrorW( LPDWORD lpError,
576 LPWSTR lpErrorBuf, DWORD nErrorBufSize,
577 LPWSTR lpNameBuf, DWORD nNameBufSize )
579 FIXME( "(%p, %p, %ld, %p, %ld): stub\n",
580 lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize );
582 SetLastError(WN_NO_NETWORK);
583 return ERROR_NO_NETWORK;
586 /*********************************************************************
587 * WNetGetNetworkInformationA [MPR.@]
589 DWORD WINAPI WNetGetNetworkInformationA( LPCSTR lpProvider,
590 LPNETINFOSTRUCT lpNetInfoStruct )
592 FIXME( "(%s, %p): stub\n", debugstr_a(lpProvider), lpNetInfoStruct );
594 SetLastError(WN_NO_NETWORK);
595 return ERROR_NO_NETWORK;
598 /*********************************************************************
599 * WNetGetNetworkInformationW [MPR.@]
601 DWORD WINAPI WNetGetNetworkInformationW( LPCWSTR lpProvider,
602 LPNETINFOSTRUCT lpNetInfoStruct )
604 FIXME( "(%s, %p): stub\n", debugstr_w(lpProvider), lpNetInfoStruct );
606 SetLastError(WN_NO_NETWORK);
607 return ERROR_NO_NETWORK;
610 /*****************************************************************
611 * WNetGetProviderNameA [MPR.@]
613 DWORD WINAPI WNetGetProviderNameA( DWORD dwNetType,
614 LPSTR lpProvider, LPDWORD lpBufferSize )
616 FIXME( "(%ld, %p, %p): stub\n", dwNetType, lpProvider, lpBufferSize );
618 SetLastError(WN_NO_NETWORK);
619 return WN_NO_NETWORK;
622 /*****************************************************************
623 * WNetGetProviderNameW [MPR.@]
625 DWORD WINAPI WNetGetProviderNameW( DWORD dwNetType,
626 LPWSTR lpProvider, LPDWORD lpBufferSize )
628 FIXME( "(%ld, %p, %p): stub\n", dwNetType, lpProvider, lpBufferSize );
630 SetLastError(WN_NO_NETWORK);
631 return WN_NO_NETWORK;