4 * This is the MPR.DLL stuff from Win32, as well as the USER
5 * stuff by the same names in Win 3.x.
19 /********************************************************************
20 * WNetAddConnection16 [USER.517] Directs a local device to net
22 * Redirects a local device (either a disk drive or printer port)
23 * to a shared device on a remote server.
25 UINT16 WINAPI WNetAddConnection16(LPSTR lpNetPath, LPSTR lpPassWord,
28 return WNetAddConnection32A(lpNetPath, lpPassWord, lpLocalName);
33 UINT32 WNetAddConnection32A(LPSTR NetPath, LPSTR PassWord,
36 FIXME(wnet, "('%s', %p, '%s'): stub\n",
37 NetPath, PassWord, LocalName);
43 UINT32 WNetAddConnection32W(LPWSTR NetPath,
47 FIXME(wnet, " stub!\n");
51 /* ****************************************************************
52 * WNetAddConnection2_32A [MPR.46]
56 WNetAddConnection2_32A(LPNETRESOURCE32A netresource, /* [in] */
57 LPCSTR password, /* [in] */
58 LPCSTR username, /* [in] */
59 DWORD flags /* [in] */ )
61 FIXME(wnet, "(%p,%s,%s,0x%08lx), stub!\n", netresource,
62 password, username, (unsigned long) flags);
63 SetLastError(WN_NO_NETWORK);
67 /* ****************************************************************
68 * WNetAddConnection2W [MPR.47]
72 WNetAddConnection2_32W(LPNETRESOURCE32W netresource, /* [in] */
73 LPCWSTR password, /* [in] */
74 LPCWSTR username, /* [in] */
75 DWORD flags /* [in] */ )
77 FIXME(wnet, ", stub!\n");
78 SetLastError(WN_NO_NETWORK);
82 /* ****************************************************************
83 * WNetAddConnection3_32A [MPR.48]
86 UINT32 WNetAddConnection3_32A(HWND32 owner,
87 LPNETRESOURCE32A netresource,
92 TRACE(wnet, "owner = 0x%x\n", owner);
93 return WNetAddConnection2_32A(netresource,
94 password, username, flags);
97 /* ****************************************************************
98 * WNetAddConnection3W [MPR.49]
101 UINT32 WNetAddConnection3_32W(HWND32 owner,
102 LPNETRESOURCE32W netresource,
107 TRACE(wnet,"owner = 0x%x\n", owner);
108 return WNetAddConnection2_32W(netresource, username, password,
113 /********************************************************************
114 * WNetCancelConnection [USER.518] undirects a local device
116 UINT16 WINAPI WNetCancelConnection(LPSTR lpName, BOOL16 bForce)
118 FIXME(wnet, "('%s', %04X): stub\n", lpName, bForce);
119 return WN_NO_NETWORK;
123 /**************************************************************************
124 * WNetErrorText16 [USER.499]
126 int WINAPI WNetErrorText(WORD nError,LPSTR lpszText,WORD cbText)
128 FIXME(wnet, "(%x,%p,%x): stub\n",nError,lpszText,cbText);
132 /**************************************************************************
133 * WNetOpenJob16 [USER.501]
135 int WINAPI WNetOpenJob(LPSTR szQueue,LPSTR szJobTitle,WORD nCopies,LPWORD pfh)
137 FIXME(wnet, "('%s','%s',%x,%p): stub\n",
138 szQueue,szJobTitle,nCopies,pfh);
142 /**************************************************************************
143 * WNetCloseJob [USER.502]
145 int WINAPI WNetCloseJob(WORD fh,LPWORD pidJob,LPSTR szQueue)
147 FIXME(wnet, "(%x,%p,'%s'): stub\n",fh,pidJob,szQueue);
151 /**************************************************************************
152 * WNetAbortJob [USER.503]
154 int WINAPI WNetAbortJob(LPSTR szQueue,WORD wJobId)
156 FIXME(wnet, "('%s',%x): stub\n",szQueue,wJobId);
160 /**************************************************************************
161 * WNetHoldJob [USER.504]
163 int WINAPI WNetHoldJob(LPSTR szQueue,WORD wJobId)
165 FIXME(wnet, "('%s',%x): stub\n",szQueue,wJobId);
169 /**************************************************************************
170 * WNetReleaseJob [USER.505]
172 int WINAPI WNetReleaseJob(LPSTR szQueue,WORD wJobId)
174 FIXME(wnet, "('%s',%x): stub\n",szQueue,wJobId);
178 /**************************************************************************
179 * WNetCancelJob [USER.506]
181 int WINAPI WNetCancelJob(LPSTR szQueue,WORD wJobId)
183 FIXME(wnet, "('%s',%x): stub\n",szQueue,wJobId);
187 /**************************************************************************
188 * WNetSetJobCopies [USER.507]
190 int WINAPI WNetSetJobCopies(LPSTR szQueue,WORD wJobId,WORD nCopies)
192 FIXME(wnet, "('%s',%x,%x): stub\n",szQueue,wJobId,nCopies);
196 /**************************************************************************
197 * WNetWatchQueue [USER.508]
199 int WINAPI WNetWatchQueue(HWND16 hWnd,LPSTR szLocal,LPSTR szUser,WORD nQueue)
201 FIXME(wnet, "(%04x,'%s','%s',%x): stub\n",hWnd,szLocal,szUser,nQueue);
205 /**************************************************************************
206 * WNetUnwatchQueue [USER.509]
208 int WINAPI WNetUnwatchQueue(LPSTR szQueue)
210 FIXME(wnet, "('%s'): stub\n", szQueue);
214 /**************************************************************************
215 * WNetLockQueueData [USER.510]
217 int WINAPI WNetLockQueueData(LPSTR szQueue,LPSTR szUser,void *lplpQueueStruct)
219 FIXME(wnet, "('%s','%s',%p): stub\n",szQueue,szUser,lplpQueueStruct);
223 /**************************************************************************
224 * WNetUnlockQueueData [USER.511]
226 int WINAPI WNetUnlockQueueData(LPSTR szQueue)
228 FIXME(wnet, "('%s'): stub\n",szQueue);
233 /********************************************************************
234 * WNetGetConnection16 [USER.512] reverse-resolves a local device
237 * - WN_BAD_LOCALNAME lpLocalName makes no sense
238 * - WN_NOT_CONNECTED drive is a local drive
239 * - WN_MORE_DATA buffer isn't big enough
240 * - WN_SUCCESS success (net path in buffer)
242 int WINAPI WNetGetConnection16(LPCSTR lpLocalName,
243 LPSTR lpRemoteName, UINT16 *cbRemoteName)
247 if (lpLocalName[1] == ':')
249 int drive = toupper(lpLocalName[0]) - 'A';
250 switch(GetDriveType16(drive))
252 case DRIVE_CANNOTDETERMINE:
253 case DRIVE_DOESNOTEXIST:
254 return WN_BAD_LOCALNAME;
255 case DRIVE_REMOVABLE:
257 return WN_NOT_CONNECTED;
259 path = DRIVE_GetLabel(drive);
260 if (strlen(path) + 1 > *cbRemoteName)
262 *cbRemoteName = strlen(path) + 1;
265 strcpy( lpRemoteName, path );
266 *cbRemoteName = strlen(lpRemoteName) + 1;
270 return WN_BAD_LOCALNAME;
273 /**************************************************************************
274 * WNetGetConnectionA [MPR.70]
277 WNetGetConnection32A(LPCSTR localname,LPSTR remotename,LPDWORD buflen)
280 DWORD ret = WNetGetConnection16(localname,remotename,&x);
286 /**************************************************************************
287 * WNetGetCaps [USER.513]
289 int WINAPI WNetGetCaps(WORD capability)
291 switch (capability) {
292 case WNNC_SPEC_VERSION:
294 return 0x30a; /* WfW 3.11(and apparently other 3.1x) */
297 /* hi byte = network type,
298 lo byte = network vendor (Netware = 0x03) [15 types] */
299 return WNNC_NET_MultiNet | WNNC_SUBNET_WinWorkgroups;
301 case WNNC_DRIVER_VERSION:
302 /* driver version of vendor */
303 return 0x100; /* WfW 3.11 */
306 /* 1 = WNetGetUser is supported */
309 case WNNC_CONNECTION:
310 /* returns mask of the supported connection functions */
311 return WNNC_CON_AddConnection|WNNC_CON_CancelConnection
312 |WNNC_CON_GetConnections/*|WNNC_CON_AutoConnect*/
313 |WNNC_CON_BrowseDialog|WNNC_CON_RestoreConnection;
316 /* returns mask of the supported printing functions */
317 return WNNC_PRT_OpenJob|WNNC_PRT_CloseJob|WNNC_PRT_HoldJob
318 |WNNC_PRT_ReleaseJob|WNNC_PRT_CancelJob
319 |WNNC_PRT_SetJobCopies|WNNC_PRT_WatchQueue
320 |WNNC_PRT_UnwatchQueue|WNNC_PRT_LockQueueData
321 |WNNC_PRT_UnlockQueueData|WNNC_PRT_AbortJob
325 /* returns mask of the supported dialog functions */
326 return WNNC_DLG_DeviceMode|WNNC_DLG_BrowseDialog
327 |WNNC_DLG_ConnectDialog|WNNC_DLG_DisconnectDialog
328 |WNNC_DLG_ViewQueueDialog|WNNC_DLG_PropertyDialog
329 |WNNC_DLG_ConnectionDialog
330 /*|WNNC_DLG_PrinterConnectDialog
331 |WNNC_DLG_SharesDialog|WNNC_DLG_ShareAsDialog*/;
334 /* returns mask of the supported administration functions */
335 /* not sure if long file names is a good idea */
336 return WNNC_ADM_GetDirectoryType|WNNC_ADM_DirectoryNotify
337 |WNNC_ADM_LongNames/*|WNNC_ADM_SetDefaultDrive*/;
340 /* returns mask of the supported error functions */
341 return WNNC_ERR_GetError|WNNC_ERR_GetErrorText;
343 case WNNC_PRINTMGREXT:
344 /* returns the Print Manager version in major and
345 minor format if Print Manager functions are available */
346 return 0x30e; /* printman version of WfW 3.11 */
349 /* Win 3.11 returns HMODULE of network driver here
350 FIXME: what should we return ?
351 logonoff.exe needs it, msmail crashes with wrong value */
359 /**************************************************************************
360 * WNetDeviceMode [USER.514]
362 int WINAPI WNetDeviceMode(HWND16 hWndOwner)
364 FIXME(wnet, "(%04x): stub\n",hWndOwner);
365 return WN_NO_NETWORK;
368 /**************************************************************************
369 * WNetBrowseDialog [USER.515]
371 int WINAPI WNetBrowseDialog(HWND16 hParent,WORD nType,LPSTR szPath)
373 FIXME(wnet, "(%04x,%x,'%s'): stub\n",hParent,nType,szPath);
374 return WN_NO_NETWORK;
377 /**************************************************************************
378 * WNetGetUser [USER.516]
380 UINT16 WINAPI WNetGetUser(LPSTR lpLocalName, LPSTR lpUserName, DWORD *lpSize)
382 FIXME(wnet, "(%p, %p, %p): stub\n", lpLocalName, lpUserName, lpSize);
383 return WN_NO_NETWORK;
386 /**************************************************************************
387 * WNetGetError [USER.519]
389 int WINAPI WNetGetError(LPWORD nError)
391 FIXME(wnet, "(%p): stub\n",nError);
392 return WN_NO_NETWORK;
395 /**************************************************************************
396 * WNetGetErrorText [USER.520]
398 int WINAPI WNetGetErrorText(WORD nError, LPSTR lpBuffer, LPWORD nBufferSize)
400 FIXME(wnet, "(%x,%p,%p): stub\n",nError,lpBuffer,nBufferSize);
404 /**************************************************************************
405 * WNetRestoreConnection [USER.523]
407 int WINAPI WNetRestoreConnection(HWND16 hwndOwner,LPSTR lpszDevice)
409 FIXME(wnet, "(%04x,'%s'): stub\n",hwndOwner,lpszDevice);
410 return WN_NO_NETWORK;
413 /**************************************************************************
414 * WNetWriteJob [USER.524]
416 int WINAPI WNetWriteJob(HANDLE16 hJob,void *lpData,LPWORD lpcbData)
418 FIXME(wnet, "(%04x,%p,%p): stub\n",hJob,lpData,lpcbData);
419 return WN_NO_NETWORK;
422 /********************************************************************
423 * WNetConnectDialog [USER.525]
425 UINT16 WINAPI WNetConnectDialog(HWND16 hWndParent, WORD iType)
427 FIXME(wnet, "(%04x, %4X): stub\n", hWndParent, iType);
431 /**************************************************************************
432 * WNetDisconnectDialog [USER.526]
434 int WINAPI WNetDisconnectDialog(HWND16 hwndOwner, WORD iType)
436 FIXME(wnet, "(%04x,%x): stub\n",hwndOwner,iType);
437 return WN_NO_NETWORK;
440 /**************************************************************************
441 * WnetConnectionDialog [USER.527]
443 UINT16 WINAPI WNetConnectionDialog(HWND16 hWndParent, WORD iType)
445 FIXME(wnet, "(%04x, %4X): stub\n", hWndParent, iType);
451 /**************************************************************************
452 * WNetViewQueueDialog [USER.528]
454 int WINAPI WNetViewQueueDialog(HWND16 hwndOwner,LPSTR lpszQueue)
456 FIXME(wnet, "(%04x,'%s'): stub\n",hwndOwner,lpszQueue);
457 return WN_NO_NETWORK;
460 /**************************************************************************
461 * WNetPropertyDialog [USER.529]
463 int WINAPI WNetPropertyDialog(HWND16 hwndParent,WORD iButton,
464 WORD nPropSel,LPSTR lpszName,WORD nType)
466 FIXME(wnet, "(%04x,%x,%x,'%s',%x): stub\n",
467 hwndParent,iButton,nPropSel,lpszName,nType);
468 return WN_NO_NETWORK;
471 /*********************************************************************
472 * WNetGetDirectoryType [USER.530] Decides whether resource is local
475 * on success, puts one of the following in *lpType:
476 * - WNDT_NETWORK on a network
479 int WINAPI WNetGetDirectoryType16(LPSTR lpName, LPINT16 lpType)
481 UINT32 type = GetDriveType32A(lpName);
483 if (type == DRIVE_DOESNOTEXIST)
484 type = GetDriveType32A(NULL);
485 *lpType = (type==DRIVE_REMOTE)?WNDT_NETWORK:WNDT_NORMAL;
486 TRACE(wnet,"%s is %s\n",lpName,(*lpType==WNDT_NETWORK)?
487 "WNDT_NETWORK":"WNDT_NORMAL");
491 /*****************************************************************
492 * WNetGetDirectoryTypeA [MPR.109]
495 UINT32 WINAPI WNetGetDirectoryType32A(LPSTR lpName,void *lpType)
497 return WNetGetDirectoryType16(lpName, lpType);
500 /**************************************************************************
501 * WNetDirectoryNotify [USER.531]
503 int WINAPI WNetDirectoryNotify(HWND16 hwndOwner,void *lpDir,WORD wOper)
505 FIXME(wnet, "(%04x,%p,%x): stub\n",hwndOwner,lpDir,wOper);
506 return WN_NO_NETWORK;
509 /**************************************************************************
510 * WNetGetPropertyText [USER.532]
512 int WINAPI WNetGetPropertyText(HWND16 hwndParent,WORD iButton,WORD nPropSel,
513 LPSTR lpszName,WORD nType)
515 FIXME(wnet, "(%04x,%x,%x,'%s',%x): stub\n",
516 hwndParent,iButton,nPropSel,lpszName,nType);
517 return WN_NO_NETWORK;
521 /**************************************************************************
522 * WNetCloseEnum [USER.???]
524 UINT16 WINAPI WNetCloseEnum(HANDLE16 hEnum)
526 FIXME(wnet, "(%04x): stub\n", hEnum);
527 return WN_NO_NETWORK;
530 /**************************************************************************
531 * WNetEnumResource [USER.???]
533 UINT16 WINAPI WNetEnumResource(HANDLE16 hEnum, DWORD cRequ,
534 DWORD *lpCount, LPVOID lpBuf)
536 FIXME(wnet, "(%04x, %08lX, %p, %p): stub\n",
537 hEnum, cRequ, lpCount, lpBuf);
538 return WN_NO_NETWORK;
541 /**************************************************************************
542 * WNetOpenEnum [USER.???]
544 UINT16 WINAPI WNetOpenEnum16(DWORD dwScope, DWORD dwType,
545 LPNETRESOURCE16 lpNet, HANDLE16 *lphEnum)
547 FIXME(wnet, "(%08lX, %08lX, %p, %p): stub\n",
548 dwScope, dwType, lpNet, lphEnum);
549 return WN_NO_NETWORK;
552 /**************************************************************************
553 * WNetOpenEnumA [MPR.92]
555 UINT32 WINAPI WNetOpenEnum32A(DWORD dwScope, DWORD dwType,
556 LPNETRESOURCE32A lpNet, HANDLE32 *lphEnum)
558 FIXME(wnet, "(%08lX, %08lX, %p, %p): stub\n",
559 dwScope, dwType, lpNet, lphEnum);
560 return WN_NO_NETWORK;
563 /* ****************************************************************
564 * WNetGetResourceInformationA [MPR.80]
568 WNetGetResourceInformation32A(
569 LPNETRESOURCE32A netres,LPVOID buf,LPDWORD buflen,LPSTR systemstr
571 FIXME(wnet,"(%p,%p,%p,%p): stub!\n",netres,buf,buflen,systemstr);
572 return WN_NO_NETWORK;
575 /**************************************************************************
576 * WNetCachePassword [MPR.52] Saves password in cache
579 * Success: WN_SUCCESS
580 * Failure: WNACCESS_DENIED, WN_BAD_PASSWORD, WN_BADVALUE, WN_NET_ERROR,
581 * WN_NOT_SUPPORTED, WN_OUT_OF_MEMORY
583 DWORD WINAPI WNetCachePassword(
584 LPSTR pbResource, /* [in] Name of workgroup, computer, or resource */
585 WORD cbResource, /* [in] Size of name */
586 LPSTR pbPassword, /* [in] Buffer containing password */
587 WORD cbPassword, /* [in] Size of password */
588 BYTE nType) /* [in] Type of password to cache */
590 FIXME(mpr,"(%s,%d,%s,%d,%d): stub\n", pbResource,cbResource,
591 pbPassword,cbPassword,nType);
597 /*****************************************************************
598 * WNetGetCachedPassword [MPR.69] Retrieves password from cache
601 * Success: WN_SUCCESS
602 * Failure: WNACCESS_DENIED, WN_BAD_PASSWORD, WN_BAD_VALUE,
603 * WN_NET_ERROR, WN_NOT_SUPPORTED, WN_OUT_OF_MEMORY
605 DWORD WINAPI WNetGetCachedPassword(
606 LPSTR pbResource, /* [in] Name of workgroup, computer, or resource */
607 WORD cbResource, /* [in] Size of name */
608 LPSTR pbPassword, /* [out] Buffer to receive password */
609 LPWORD pcbPassword, /* [out] Receives size of password */
610 BYTE nType) /* [in] Type of password to retrieve */
612 FIXME(mpr,"(%s,%d,%p,%d,%d): stub\n",
613 pbResource,cbResource,pbPassword,*pcbPassword,nType);
614 return WN_ACCESS_DENIED;
617 /* ****************************************************************
618 * MultinetGetConnectionPerformanceA [MPR.25]
622 * Failure: ERROR_NOT_SUPPORTED, ERROR_NOT_CONNECTED,
623 * ERROR_NO_NET_OR_BAD_PATH, ERROR_BAD_DEVICE,
624 * ERROR_BAD_NET_NAME, ERROR_INVALID_PARAMETER,
625 * ERROR_NO_NETWORK, ERROR_EXTENDED_ERROR
627 DWORD WINAPI MultinetGetConnectionPerformance32A(
628 LPNETRESOURCE32A lpNetResource,
629 LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct
631 FIXME(mpr,"(%p,%p): stub\n",lpNetResource,lpNetConnectInfoStruct);