Authors: Chris Morgan <cmorgan@wpi.edu>, James Abbatiello <abbeyj@wpi.edu>
[wine.git] / misc / network.c
blob5690623ff7860719cc1fc75d8d597521e7a1bbf5
1 /*
2 * Network functions
4 * This is the MPR.DLL stuff from Win32, as well as the USER
5 * stuff by the same names in Win 3.x.
7 */
9 #include <ctype.h>
10 #include <string.h>
11 #include <sys/types.h>
12 #include <pwd.h>
13 #include <unistd.h>
15 #include "windef.h"
16 #include "winnetwk.h"
17 #include "winuser.h"
18 #include "winerror.h"
19 #include "drive.h"
20 #include "wnet.h"
21 #include "debugtools.h"
22 #include "heap.h"
24 DECLARE_DEBUG_CHANNEL(mpr)
25 DECLARE_DEBUG_CHANNEL(wnet)
27 /********************************************************************
28 * WNetAddConnection16 [USER.517] Directs a local device to net
30 * Redirects a local device (either a disk drive or printer port)
31 * to a shared device on a remote server.
33 UINT16 WINAPI WNetAddConnection16(LPCSTR lpNetPath, LPCSTR lpPassWord,
34 LPCSTR lpLocalName)
36 return WNetAddConnectionA(lpNetPath, lpPassWord, lpLocalName);
39 /*********************************************************************
40 * WNetAddConnection32 [MPR.50]
43 UINT WINAPI WNetAddConnectionA(LPCSTR NetPath, LPCSTR PassWord,
44 LPCSTR LocalName)
46 FIXME_(wnet)("('%s', %p, '%s'): stub\n",
47 NetPath, PassWord, LocalName);
48 return WN_NO_NETWORK;
51 /* [MPR.51] */
53 UINT WINAPI WNetAddConnectionW(LPCWSTR NetPath,
54 LPCWSTR PassWord,
55 LPCWSTR LocalName)
57 FIXME_(wnet)(" stub!\n");
58 SetLastError(WN_NO_NETWORK);
59 return WN_NO_NETWORK;
62 /* ****************************************************************
63 * WNetAddConnection2_32A [MPR.46]
66 UINT WINAPI
67 WNetAddConnection2A(LPNETRESOURCEA netresource, /* [in] */
68 LPCSTR password, /* [in] */
69 LPCSTR username, /* [in] */
70 DWORD flags /* [in] */ )
72 FIXME_(wnet)("(%p,%s,%s,0x%08lx), stub!\n", netresource,
73 password, username, (unsigned long) flags);
74 SetLastError(WN_NO_NETWORK);
75 return WN_NO_NETWORK;
78 /* ****************************************************************
79 * WNetAddConnection2W [MPR.47]
82 UINT WINAPI
83 WNetAddConnection2W(LPNETRESOURCEW netresource, /* [in] */
84 LPCWSTR password, /* [in] */
85 LPCWSTR username, /* [in] */
86 DWORD flags /* [in] */ )
88 FIXME_(wnet)(", stub!\n");
89 SetLastError(WN_NO_NETWORK);
90 return WN_NO_NETWORK;
93 /* ****************************************************************
94 * WNetAddConnection3_32A [MPR.48]
97 UINT WINAPI WNetAddConnection3A(HWND owner,
98 LPNETRESOURCEA netresource,
99 LPCSTR password,
100 LPCSTR username,
101 DWORD flags)
103 TRACE_(wnet)("owner = 0x%x\n", owner);
104 return WNetAddConnection2A(netresource,
105 password, username, flags);
108 /* ****************************************************************
109 * WNetAddConnection3W [MPR.49]
112 UINT WINAPI WNetAddConnection3W(HWND owner,
113 LPNETRESOURCEW netresource,
114 LPCWSTR username,
115 LPCWSTR password,
116 DWORD flags)
118 TRACE_(wnet)("owner = 0x%x\n", owner);
119 return WNetAddConnection2W(netresource, username, password,
120 flags);
123 /*******************************************************************
124 * WNetConnectionDialog1_32A [MPR.59]
126 UINT WINAPI WNetConnectionDialog1A (LPCONNECTDLGSTRUCTA lpConnDlgStruct)
127 { FIXME_(wnet)("%p stub\n", lpConnDlgStruct);
128 SetLastError(WN_NO_NETWORK);
129 return ERROR_NO_NETWORK;
131 /*******************************************************************
132 * WNetConnectionDialog1_32W [MPR.60]
134 UINT WINAPI WNetConnectionDialog1W (LPCONNECTDLGSTRUCTW lpConnDlgStruct)
135 { FIXME_(wnet)("%p stub\n", lpConnDlgStruct);
136 SetLastError(WN_NO_NETWORK);
137 return ERROR_NO_NETWORK;
140 /*******************************************************************
141 * WNetConnectionDialog_32 [MPR.61]
143 UINT WINAPI WNetConnectionDialog(HWND owner, DWORD flags )
144 { FIXME_(wnet)("owner = 0x%x, flags=0x%lx stub\n", owner,flags);
145 SetLastError(WN_NO_NETWORK);
146 return ERROR_NO_NETWORK;
150 /*******************************************************************
151 * WNetEnumCachedPasswords32 [MPR.61]
153 UINT WINAPI WNetEnumCachedPasswords(LPSTR sometext, DWORD count1,
154 DWORD res_nr, DWORD *enumPasswordProc)
156 return ERROR_NO_NETWORK;
159 /********************************************************************
160 * WNetCancelConnection [USER.518] undirects a local device
162 UINT16 WINAPI WNetCancelConnection16(LPCSTR lpName, BOOL16 bForce)
164 FIXME_(wnet)("('%s', %04X): stub\n", lpName, bForce);
165 return WN_NO_NETWORK;
169 /**************************************************************************
170 * WNetErrorText16 [USER.499]
172 int WINAPI WNetErrorText16(WORD nError,LPSTR lpszText,WORD cbText)
174 FIXME_(wnet)("(%x,%p,%x): stub\n",nError,lpszText,cbText);
175 return FALSE;
178 /**************************************************************************
179 * WNetOpenJob16 [USER.501]
181 int WINAPI WNetOpenJob16(LPSTR szQueue,LPSTR szJobTitle,WORD nCopies,LPWORD pfh)
183 FIXME_(wnet)("('%s','%s',%x,%p): stub\n",
184 szQueue,szJobTitle,nCopies,pfh);
185 return WN_NET_ERROR;
188 /**************************************************************************
189 * WNetCloseJob [USER.502]
191 int WINAPI WNetCloseJob16(WORD fh,LPWORD pidJob,LPSTR szQueue)
193 FIXME_(wnet)("(%x,%p,'%s'): stub\n",fh,pidJob,szQueue);
194 return WN_NET_ERROR;
197 /**************************************************************************
198 * WNetAbortJob [USER.503]
200 int WINAPI WNetAbortJob16(LPSTR szQueue,WORD wJobId)
202 FIXME_(wnet)("('%s',%x): stub\n",szQueue,wJobId);
203 return WN_NET_ERROR;
206 /**************************************************************************
207 * WNetHoldJob [USER.504]
209 int WINAPI WNetHoldJob16(LPSTR szQueue,WORD wJobId)
211 FIXME_(wnet)("('%s',%x): stub\n",szQueue,wJobId);
212 return WN_NET_ERROR;
215 /**************************************************************************
216 * WNetReleaseJob [USER.505]
218 int WINAPI WNetReleaseJob16(LPSTR szQueue,WORD wJobId)
220 FIXME_(wnet)("('%s',%x): stub\n",szQueue,wJobId);
221 return WN_NET_ERROR;
224 /**************************************************************************
225 * WNetCancelJob [USER.506]
227 int WINAPI WNetCancelJob16(LPSTR szQueue,WORD wJobId)
229 FIXME_(wnet)("('%s',%x): stub\n",szQueue,wJobId);
230 return WN_NET_ERROR;
233 /**************************************************************************
234 * WNetSetJobCopies [USER.507]
236 int WINAPI WNetSetJobCopies16(LPSTR szQueue,WORD wJobId,WORD nCopies)
238 FIXME_(wnet)("('%s',%x,%x): stub\n",szQueue,wJobId,nCopies);
239 return WN_NET_ERROR;
242 /**************************************************************************
243 * WNetWatchQueue [USER.508]
245 int WINAPI WNetWatchQueue16(HWND16 hWnd,LPSTR szLocal,LPSTR szUser,WORD nQueue)
247 FIXME_(wnet)("(%04x,'%s','%s',%x): stub\n",hWnd,szLocal,szUser,nQueue);
248 return WN_NET_ERROR;
251 /**************************************************************************
252 * WNetUnwatchQueue [USER.509]
254 int WINAPI WNetUnwatchQueue16(LPSTR szQueue)
256 FIXME_(wnet)("('%s'): stub\n", szQueue);
257 return WN_NET_ERROR;
260 /**************************************************************************
261 * WNetLockQueueData [USER.510]
263 int WINAPI WNetLockQueueData16(LPSTR szQueue,LPSTR szUser,void *lplpQueueStruct)
265 FIXME_(wnet)("('%s','%s',%p): stub\n",szQueue,szUser,lplpQueueStruct);
266 return WN_NET_ERROR;
269 /**************************************************************************
270 * WNetUnlockQueueData [USER.511]
272 int WINAPI WNetUnlockQueueData16(LPSTR szQueue)
274 FIXME_(wnet)("('%s'): stub\n",szQueue);
275 return WN_NET_ERROR;
279 /********************************************************************
280 * WNetGetConnection16 [USER.512] reverse-resolves a local device
282 * RETURNS
283 * - WN_BAD_LOCALNAME lpLocalName makes no sense
284 * - WN_NOT_CONNECTED drive is a local drive
285 * - WN_MORE_DATA buffer isn't big enough
286 * - WN_SUCCESS success (net path in buffer)
288 int WINAPI WNetGetConnection16(LPCSTR lpLocalName,
289 LPSTR lpRemoteName, UINT16 *cbRemoteName)
291 const char *path;
293 TRACE_(wnet)("local %s\n",lpLocalName);
294 if (lpLocalName[1] == ':')
296 int drive = toupper(lpLocalName[0]) - 'A';
297 switch(DRIVE_GetType(drive))
299 case TYPE_INVALID:
300 return WN_BAD_LOCALNAME;
301 case TYPE_NETWORK:
302 path = DRIVE_GetLabel(drive);
303 if (strlen(path) + 1 > *cbRemoteName)
305 *cbRemoteName = strlen(path) + 1;
306 return WN_MORE_DATA;
308 strcpy( lpRemoteName, path );
309 *cbRemoteName = strlen(lpRemoteName) + 1;
310 return WN_SUCCESS;
311 case TYPE_FLOPPY:
312 case TYPE_HD:
313 case TYPE_CDROM:
314 TRACE_(wnet)("file is local\n");
315 return WN_NOT_CONNECTED;
316 default:
317 return WN_BAD_LOCALNAME;
320 return WN_BAD_LOCALNAME;
323 /**************************************************************************
324 * WNetGetConnectionA [MPR.70]
326 DWORD WINAPI
327 WNetGetConnectionA(LPCSTR localname,LPSTR remotename,LPDWORD buflen)
329 UINT16 x;
330 DWORD ret = WNetGetConnection16(localname,remotename,&x);
331 *buflen = x;
332 return ret;
335 /**************************************************************************
336 * WNetGetConnectionW [MPR.72]
338 DWORD WINAPI
339 WNetGetConnectionW(LPCWSTR localnameW,LPWSTR remotenameW,LPDWORD buflen)
341 UINT16 x;
342 CHAR buf[200];
343 LPSTR lnA = HEAP_strdupWtoA(GetProcessHeap(),0,localnameW);
344 DWORD ret = WNetGetConnection16(lnA,buf,&x);
346 lstrcpyAtoW(remotenameW,buf);
347 *buflen=lstrlenW(remotenameW);
348 HeapFree(GetProcessHeap(),0,lnA);
349 return ret;
352 /**************************************************************************
353 * WNetGetCaps [USER.513]
355 int WINAPI WNetGetCaps16(WORD capability)
357 switch (capability) {
358 case WNNC_SPEC_VERSION:
360 return 0x30a; /* WfW 3.11(and apparently other 3.1x) */
362 case WNNC_NET_TYPE:
363 /* hi byte = network type,
364 lo byte = network vendor (Netware = 0x03) [15 types] */
365 return WNNC_NET_MultiNet | WNNC_SUBNET_WinWorkgroups;
367 case WNNC_DRIVER_VERSION:
368 /* driver version of vendor */
369 return 0x100; /* WfW 3.11 */
371 case WNNC_USER:
372 /* 1 = WNetGetUser is supported */
373 return 1;
375 case WNNC_CONNECTION:
376 /* returns mask of the supported connection functions */
377 return WNNC_CON_AddConnection|WNNC_CON_CancelConnection
378 |WNNC_CON_GetConnections/*|WNNC_CON_AutoConnect*/
379 |WNNC_CON_BrowseDialog|WNNC_CON_RestoreConnection;
381 case WNNC_PRINTING:
382 /* returns mask of the supported printing functions */
383 return WNNC_PRT_OpenJob|WNNC_PRT_CloseJob|WNNC_PRT_HoldJob
384 |WNNC_PRT_ReleaseJob|WNNC_PRT_CancelJob
385 |WNNC_PRT_SetJobCopies|WNNC_PRT_WatchQueue
386 |WNNC_PRT_UnwatchQueue|WNNC_PRT_LockQueueData
387 |WNNC_PRT_UnlockQueueData|WNNC_PRT_AbortJob
388 |WNNC_PRT_WriteJob;
390 case WNNC_DIALOG:
391 /* returns mask of the supported dialog functions */
392 return WNNC_DLG_DeviceMode|WNNC_DLG_BrowseDialog
393 |WNNC_DLG_ConnectDialog|WNNC_DLG_DisconnectDialog
394 |WNNC_DLG_ViewQueueDialog|WNNC_DLG_PropertyDialog
395 |WNNC_DLG_ConnectionDialog
396 /*|WNNC_DLG_PrinterConnectDialog
397 |WNNC_DLG_SharesDialog|WNNC_DLG_ShareAsDialog*/;
399 case WNNC_ADMIN:
400 /* returns mask of the supported administration functions */
401 /* not sure if long file names is a good idea */
402 return WNNC_ADM_GetDirectoryType
403 /*|WNNC_ADM_DirectoryNotify*//*not yet supported*/
404 |WNNC_ADM_LongNames/*|WNNC_ADM_SetDefaultDrive*/;
406 case WNNC_ERROR:
407 /* returns mask of the supported error functions */
408 return WNNC_ERR_GetError|WNNC_ERR_GetErrorText;
410 case WNNC_PRINTMGREXT:
411 /* returns the Print Manager version in major and
412 minor format if Print Manager functions are available */
413 return 0x30e; /* printman version of WfW 3.11 */
415 case 0xffff:
416 /* Win 3.11 returns HMODULE of network driver here
417 FIXME: what should we return ?
418 logonoff.exe needs it, msmail crashes with wrong value */
419 return 0;
421 default:
422 return 0;
426 /**************************************************************************
427 * WNetDeviceMode [USER.514]
429 int WINAPI WNetDeviceMode16(HWND16 hWndOwner)
431 FIXME_(wnet)("(%04x): stub\n",hWndOwner);
432 return WN_NO_NETWORK;
435 /**************************************************************************
436 * WNetBrowseDialog [USER.515]
438 int WINAPI WNetBrowseDialog16(HWND16 hParent,WORD nType,LPSTR szPath)
440 FIXME_(wnet)("(%04x,%x,'%s'): stub\n",hParent,nType,szPath);
441 return WN_NO_NETWORK;
444 /**************************************************************************
445 * WNetGetUser [USER.516]
447 UINT16 WINAPI WNetGetUser16(LPSTR lpLocalName, LPSTR lpUserName, DWORD *lpSize)
449 FIXME_(wnet)("(%p, %p, %p): stub\n", lpLocalName, lpUserName, lpSize);
450 return WN_NO_NETWORK;
453 /**************************************************************************
454 * WNetGetUser [MPR.86]
455 * FIXME: we should not return ourselves, but the owner of the drive lpLocalName
457 DWORD WINAPI WNetGetUserA(LPCSTR lpLocalName, LPSTR lpUserName, DWORD *lpSize)
459 struct passwd *pwd = getpwuid(getuid());
461 FIXME_(wnet)("(%s, %p, %p), mostly stub\n", lpLocalName, lpUserName, lpSize);
462 if (pwd) {
463 if (strlen(pwd->pw_name)+1>*lpSize) {
464 *lpSize = strlen(pwd->pw_name)+1;
465 SetLastError(ERROR_MORE_DATA);
466 return ERROR_MORE_DATA;
468 strcpy(lpUserName,pwd->pw_name);
469 if (lpSize)
470 *lpSize = strlen(pwd->pw_name)+1;
471 return WN_SUCCESS;
473 /* FIXME: wrong return value */
474 SetLastError(ERROR_NO_NETWORK);
475 return ERROR_NO_NETWORK;
478 /**************************************************************************
479 * WNetGetError [USER.519]
481 int WINAPI WNetGetError16(LPWORD nError)
483 FIXME_(wnet)("(%p): stub\n",nError);
484 return WN_NO_NETWORK;
487 /**************************************************************************
488 * WNetGetErrorText [USER.520]
490 int WINAPI WNetGetErrorText16(WORD nError, LPSTR lpBuffer, LPWORD nBufferSize)
492 FIXME_(wnet)("(%x,%p,%p): stub\n",nError,lpBuffer,nBufferSize);
493 return WN_NET_ERROR;
496 /**************************************************************************
497 * WNetRestoreConnection [USER.523]
499 int WINAPI WNetRestoreConnection16(HWND16 hwndOwner,LPSTR lpszDevice)
501 FIXME_(wnet)("(%04x,'%s'): stub\n",hwndOwner,lpszDevice);
502 return WN_NO_NETWORK;
505 /**************************************************************************
506 * WNetWriteJob [USER.524]
508 int WINAPI WNetWriteJob16(HANDLE16 hJob,void *lpData,LPWORD lpcbData)
510 FIXME_(wnet)("(%04x,%p,%p): stub\n",hJob,lpData,lpcbData);
511 return WN_NO_NETWORK;
514 /********************************************************************
515 * WNetConnectDialog [USER.525]
517 UINT16 WINAPI WNetConnectDialog(HWND16 hWndParent, WORD iType)
519 FIXME_(wnet)("(%04x, %4X): stub\n", hWndParent, iType);
520 return WN_SUCCESS;
523 /**************************************************************************
524 * WNetDisconnectDialog [USER.526]
526 int WINAPI WNetDisconnectDialog16(HWND16 hwndOwner, WORD iType)
528 FIXME_(wnet)("(%04x,%x): stub\n",hwndOwner,iType);
529 return WN_NO_NETWORK;
532 /**************************************************************************
533 * WnetConnectionDialog [USER.527]
535 UINT16 WINAPI WNetConnectionDialog16(HWND16 hWndParent, WORD iType)
537 FIXME_(wnet)("(%04x, %4X): stub\n", hWndParent, iType);
538 return WN_SUCCESS;
543 /**************************************************************************
544 * WNetViewQueueDialog [USER.528]
546 int WINAPI WNetViewQueueDialog16(HWND16 hwndOwner,LPSTR lpszQueue)
548 FIXME_(wnet)("(%04x,'%s'): stub\n",hwndOwner,lpszQueue);
549 return WN_NO_NETWORK;
552 /**************************************************************************
553 * WNetPropertyDialog [USER.529]
555 int WINAPI WNetPropertyDialog16(HWND16 hwndParent,WORD iButton,
556 WORD nPropSel,LPSTR lpszName,WORD nType)
558 FIXME_(wnet)("(%04x,%x,%x,'%s',%x): stub\n",
559 hwndParent,iButton,nPropSel,lpszName,nType);
560 return WN_NO_NETWORK;
563 /*********************************************************************
564 * WNetGetDirectoryType [USER.530] Decides whether resource is local
566 * RETURNS
567 * on success, puts one of the following in *lpType:
568 * - WNDT_NETWORK on a network
569 * - WNDT_LOCAL local
571 int WINAPI WNetGetDirectoryType16(LPSTR lpName, LPINT16 lpType)
573 UINT type = GetDriveTypeA(lpName);
575 if (type == DRIVE_DOESNOTEXIST)
576 type = GetDriveTypeA(NULL);
577 *lpType = (type==DRIVE_REMOTE)?WNDT_NETWORK:WNDT_NORMAL;
578 TRACE_(wnet)("%s is %s\n",lpName,(*lpType==WNDT_NETWORK)?
579 "WNDT_NETWORK":"WNDT_NORMAL");
580 return WN_SUCCESS;
583 /*****************************************************************
584 * WNetGetDirectoryTypeA [MPR.109]
587 UINT WINAPI WNetGetDirectoryTypeA(LPSTR lpName,void *lpType)
589 return WNetGetDirectoryType16(lpName, lpType);
592 /**************************************************************************
593 * WNetDirectoryNotify [USER.531]
595 int WINAPI WNetDirectoryNotify16(HWND16 hwndOwner,LPSTR lpDir,WORD wOper)
597 FIXME_(wnet)("(%04x,%s,%s): stub\n",hwndOwner,
598 lpDir,(wOper==WNDN_MKDIR)?
599 "WNDN_MKDIR":(wOper==WNDN_MVDIR)?"WNDN_MVDIR":
600 (wOper==WNDN_RMDIR)?"WNDN_RMDIR":"unknown");
601 return WN_NOT_SUPPORTED;
604 /**************************************************************************
605 * WNetGetPropertyText [USER.532]
607 int WINAPI WNetGetPropertyText16(WORD iButton, WORD nPropSel, LPSTR lpszName,
608 LPSTR lpszButtonName, WORD cbButtonName, WORD nType)
610 FIXME_(wnet)("(%04x,%04x,'%s','%s',%04x): stub\n",
611 iButton,nPropSel,lpszName,lpszButtonName, nType);
612 return WN_NO_NETWORK;
616 /**************************************************************************
617 * WNetCloseEnum [USER.???]
619 UINT16 WINAPI WNetCloseEnum(HANDLE16 hEnum)
621 FIXME_(wnet)("(%04x): stub\n", hEnum);
622 return WN_NO_NETWORK;
625 /**************************************************************************
626 * WNetEnumResource [USER.???]
628 UINT16 WINAPI WNetEnumResource(HANDLE16 hEnum, DWORD cRequ,
629 DWORD *lpCount, LPVOID lpBuf)
631 FIXME_(wnet)("(%04x, %08lX, %p, %p): stub\n",
632 hEnum, cRequ, lpCount, lpBuf);
633 return WN_NO_NETWORK;
636 /**************************************************************************
637 * WNetOpenEnum [USER.???]
639 UINT16 WINAPI WNetOpenEnum16(DWORD dwScope, DWORD dwType,
640 LPNETRESOURCE16 lpNet, HANDLE16 *lphEnum)
642 FIXME_(wnet)("(%08lX, %08lX, %p, %p): stub\n",
643 dwScope, dwType, lpNet, lphEnum);
644 return WN_NO_NETWORK;
647 /**************************************************************************
648 * WNetOpenEnumA [MPR.92]
650 UINT WINAPI WNetOpenEnumA(DWORD dwScope, DWORD dwType, DWORD dwUsage,
651 LPNETRESOURCEA lpNet, HANDLE *lphEnum)
653 FIXME_(wnet)("(%08lX, %08lX, %08lX, %p, %p): stub\n",
654 dwScope, dwType, dwUsage, lpNet, lphEnum);
655 SetLastError(WN_NO_NETWORK);
656 return WN_NO_NETWORK;
659 /**************************************************************************
660 * WNetOpenEnumW [MPR.93]
662 UINT WINAPI WNetOpenEnumW(DWORD dwScope, DWORD dwType, DWORD dwUsage,
663 LPNETRESOURCEA lpNet, HANDLE *lphEnum)
665 FIXME_(wnet)("(%08lX, %08lX, %08lX, %p, %p): stub\n",
666 dwScope, dwType, dwUsage, lpNet, lphEnum);
667 SetLastError(WN_NO_NETWORK);
668 return WN_NO_NETWORK;
671 /* ****************************************************************
672 * WNetGetResourceInformationA [MPR.80]
673 * */
675 DWORD WINAPI
676 WNetGetResourceInformationA(
677 LPNETRESOURCEA netres,LPVOID buf,LPDWORD buflen,LPSTR systemstr
679 FIXME_(wnet)("(%p,%p,%p,%p): stub!\n",netres,buf,buflen,systemstr);
680 SetLastError(WN_NO_NETWORK);
681 return WN_NO_NETWORK;
684 /**************************************************************************
685 * WNetCachePassword [MPR.52] Saves password in cache
687 * RETURNS
688 * Success: WN_SUCCESS
689 * Failure: WNACCESS_DENIED, WN_BAD_PASSWORD, WN_BADVALUE, WN_NET_ERROR,
690 * WN_NOT_SUPPORTED, WN_OUT_OF_MEMORY
692 DWORD WINAPI WNetCachePassword(
693 LPSTR pbResource, /* [in] Name of workgroup, computer, or resource */
694 WORD cbResource, /* [in] Size of name */
695 LPSTR pbPassword, /* [in] Buffer containing password */
696 WORD cbPassword, /* [in] Size of password */
697 BYTE nType) /* [in] Type of password to cache */
699 FIXME_(mpr)("(%s,%d,%s,%d,%d): stub\n", pbResource,cbResource,
700 pbPassword,cbPassword,nType);
701 return WN_SUCCESS;
706 /*****************************************************************
707 * WNetGetCachedPassword [MPR.69] Retrieves password from cache
709 * RETURNS
710 * Success: WN_SUCCESS
711 * Failure: WNACCESS_DENIED, WN_BAD_PASSWORD, WN_BAD_VALUE,
712 * WN_NET_ERROR, WN_NOT_SUPPORTED, WN_OUT_OF_MEMORY
714 DWORD WINAPI WNetGetCachedPassword(
715 LPSTR pbResource, /* [in] Name of workgroup, computer, or resource */
716 WORD cbResource, /* [in] Size of name */
717 LPSTR pbPassword, /* [out] Buffer to receive password */
718 LPWORD pcbPassword, /* [out] Receives size of password */
719 BYTE nType) /* [in] Type of password to retrieve */
721 FIXME_(mpr)("(%s,%d,%p,%d,%d): stub\n",
722 pbResource,cbResource,pbPassword,*pcbPassword,nType);
723 return WN_ACCESS_DENIED;
726 /*****************************************************************
727 * MultinetGetConnectionPerformanceA [MPR.25]
729 * RETURNS
730 * Success: NO_ERROR
731 * Failure: ERROR_NOT_SUPPORTED, ERROR_NOT_CONNECTED,
732 * ERROR_NO_NET_OR_BAD_PATH, ERROR_BAD_DEVICE,
733 * ERROR_BAD_NET_NAME, ERROR_INVALID_PARAMETER,
734 * ERROR_NO_NETWORK, ERROR_EXTENDED_ERROR
736 DWORD WINAPI MultinetGetConnectionPerformanceA(
737 LPNETRESOURCEA lpNetResource,
738 LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct
740 FIXME_(mpr)("(%p,%p): stub\n",lpNetResource,lpNetConnectInfoStruct);
741 return WN_NO_NETWORK;
745 /*****************************************************************
746 * MultinetGetErrorTextA [MPR.28]
749 UINT WINAPI MultinetGetErrorTextA (DWORD x, DWORD y, DWORD z)
750 { FIXME_(mpr)("(%lx,%lx,%lx): stub\n",x,y,z);
751 return 0;
754 /*****************************************************************
755 * MultinetGetErrorTextW [MPR.29]
757 UINT WINAPI MultinetGetErrorTextW (DWORD x, DWORD y, DWORD z)
758 { FIXME_(mpr)("(%lx,%lx,%lx): stub\n",x,y,z);
759 return 0;
762 /*****************************************************************
763 * NPSGetProviderHandle [MPR.33]
765 DWORD WINAPI NPSGetProviderHandleA(DWORD x) {
766 FIXME_(mpr)("(0x%08lx),stub!\n",x);
767 return 0;
770 /*****************************************************************
771 * WNetCancelConnection232A [MPR.53]
773 DWORD WINAPI WNetCancelConnection2A(
774 LPCSTR lpName,
775 DWORD dwFlags,
776 BOOL fForce) {
778 FIXME_(wnet)(": stub\n");
779 return WN_SUCCESS;
782 /*****************************************************************
783 * WNetCancelConnection232W [MPR.54]
785 DWORD WINAPI WNetCancelConnection2W(
786 LPCWSTR lpName,
787 DWORD dwFlags,
788 BOOL fForce) {
790 FIXME_(wnet)(": stub\n");
791 return WN_SUCCESS;
794 /*****************************************************************
795 * WNetCancelConnection32A [MPR.55]
797 DWORD WINAPI WNetCancelConnectionA(
798 LPCSTR lpName,
799 DWORD dwFlags,
800 BOOL fForce) {
802 FIXME_(wnet)(": stub\n");
803 return WN_SUCCESS;
806 /*****************************************************************
807 * WNetCancelConnection32W [MPR.56]
809 DWORD WINAPI WNetCancelConnectionW(
810 LPCWSTR lpName,
811 DWORD dwFlags,
812 BOOL fForce) {
814 FIXME_(wnet)(": stub\n");
815 return WN_SUCCESS;
818 /*****************************************************************
819 * WNetGetUser32W [MPR.87]
821 DWORD WINAPI WNetGetUserW(
822 LPCWSTR lpName,
823 LPWSTR lpUserName,
824 LPDWORD lpnLength) {
826 FIXME_(wnet)(": stub\n");
827 SetLastError(WN_NO_NETWORK);
828 return WN_NO_NETWORK;
831 /*****************************************************************
832 * WNetGetProviderNameA [MPR.79]
834 DWORD WINAPI WNetGetProviderNameA(
835 DWORD dwNetType,
836 LPSTR lpProvider,
837 LPDWORD lpBufferSize)
839 FIXME_(wnet)(": stub\n");
840 SetLastError(WN_NO_NETWORK);
841 return WN_NO_NETWORK;
844 /*****************************************************************
845 * WNetGetProviderNameW [MPR.80]
847 DWORD WINAPI WNetGetProviderNameW(
848 DWORD dwNetType,
849 LPWSTR lpProvider,
850 LPDWORD lpBufferSize)
852 FIXME_(wnet)(": stub\n");
853 SetLastError(WN_NO_NETWORK);
854 return WN_NO_NETWORK;
857 /*****************************************************************
858 * WNetUseConnectionA [MPR.100]
860 DWORD WINAPI WNetUseConnectionA(
861 HWND hwndOwner,
862 LPNETRESOURCEA lpNetResource,
863 LPSTR lpPassword,
864 LPSTR lpUserID,
865 DWORD dwFlags,
866 LPSTR lpAccessName,
867 LPDWORD lpBufferSize,
868 LPDWORD lpResult)
870 FIXME_(wnet)(": stub\n");
871 SetLastError(WN_NO_NETWORK);
872 return WN_NO_NETWORK;
875 /*****************************************************************
876 * WNetUseConnectionW [MPR.101]
878 DWORD WINAPI WNetUseConnectionW(
879 HWND hwndOwner,
880 LPNETRESOURCEW lpNetResource,
881 LPWSTR lpPassword,
882 LPWSTR lpUserID,
883 DWORD dwFlags,
884 LPWSTR lpAccessName,
885 LPDWORD lpBufferSize,
886 LPDWORD lpResult)
888 FIXME_(wnet)(": stub\n");
889 SetLastError(WN_NO_NETWORK);
890 return WN_NO_NETWORK;
895 * FIXME: The following routines should use a private heap ...
898 /*****************************************************************
899 * MPR_Alloc [MPR.22]
901 LPVOID WINAPI MPR_Alloc( DWORD dwSize )
903 return HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, dwSize );
906 /*****************************************************************
907 * MPR_ReAlloc [MPR.23]
909 LPVOID WINAPI MPR_ReAlloc( LPVOID lpSrc, DWORD dwSize )
911 if ( lpSrc )
912 return HeapReAlloc( SystemHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize );
913 else
914 return HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, dwSize );
917 /*****************************************************************
918 * MPR_Free [MPR.24]
920 BOOL WINAPI MPR_Free( LPVOID lpMem )
922 if ( lpMem )
923 return HeapFree( SystemHeap, 0, lpMem );
924 else
925 return FALSE;
928 /*****************************************************************
929 * [MPR.25]
931 BOOL WINAPI _MPR_25( LPBYTE lpMem, INT len )
933 FIXME_(mpr)( "(%p, %d): stub\n", lpMem, len );
935 return FALSE;