2 * USER Windows Network functions
4 * Copyright 1995 Martin von Loewis
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include <sys/types.h>
33 #include "wine/winnet16.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(wnet);
42 /**************************************************************************
43 * WNetOpenJob [USER.501]
45 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
47 FIXME( "(%s, %s, %d, %p): stub\n",
48 debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
49 return WN16_NET_ERROR;
52 /**************************************************************************
53 * WNetCloseJob [USER.502]
55 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
57 FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
58 return WN16_NET_ERROR;
61 /**************************************************************************
62 * WNetWriteJob [USER.524]
64 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
66 FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
67 return WN16_NET_ERROR;
70 /**************************************************************************
71 * WNetAbortJob [USER.503]
73 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
75 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
76 return WN16_NET_ERROR;
79 /**************************************************************************
80 * WNetHoldJob [USER.504]
82 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
84 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
85 return WN16_NET_ERROR;
88 /**************************************************************************
89 * WNetReleaseJob [USER.505]
91 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
93 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
94 return WN16_NET_ERROR;
97 /**************************************************************************
98 * WNetCancelJob [USER.506]
100 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
102 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
103 return WN16_NET_ERROR;
106 /**************************************************************************
107 * WNetSetJobCopies [USER.507]
109 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
111 FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
112 return WN16_NET_ERROR;
115 /**************************************************************************
116 * WNetWatchQueue [USER.508]
118 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
120 FIXME( "(%04x, %s, %s, %d): stub\n",
121 hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
122 return WN16_NET_ERROR;
125 /**************************************************************************
126 * WNetUnwatchQueue [USER.509]
128 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
130 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
131 return WN16_NET_ERROR;
134 /**************************************************************************
135 * WNetLockQueueData [USER.510]
137 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
138 LPQUEUESTRUCT16 *lplpQueueStruct )
140 FIXME( "(%s, %s, %p): stub\n",
141 debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
142 return WN16_NET_ERROR;
145 /**************************************************************************
146 * WNetUnlockQueueData [USER.511]
148 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
150 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
151 return WN16_NET_ERROR;
159 /********************************************************************
160 * WNetAddConnection [USER.517] Directs a local device to net
162 * Redirects a local device (either a disk drive or printer port)
163 * to a shared device on a remote server.
165 WORD WINAPI WNetAddConnection16( LPCSTR lpNetPath, LPCSTR lpPassWord,
168 FIXME( "(%s, %p, %s): stub\n",
169 debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
170 return WN16_NET_ERROR;
173 /********************************************************************
174 * WNetCancelConnection [USER.518] undirects a local device
176 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
178 FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
179 return WN16_NOT_SUPPORTED;
182 /********************************************************************
183 * WNetGetConnection [USER.512] reverse-resolves a local device
185 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
186 LPSTR lpRemoteName, UINT16 *cbRemoteName )
190 TRACE( "local %s\n", lpLocalName );
191 switch(GetDriveTypeA(lpLocalName))
194 GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
195 if (strlen(label) + 1 > *cbRemoteName)
197 *cbRemoteName = strlen(label) + 1;
198 return WN16_MORE_DATA;
200 strcpy( lpRemoteName, label );
201 *cbRemoteName = strlen(lpRemoteName) + 1;
203 case DRIVE_REMOVABLE:
206 TRACE("file is local\n");
207 return WN16_NOT_CONNECTED;
209 return WN16_BAD_LOCALNAME;
213 /**************************************************************************
214 * WNetRestoreConnection [USER.523]
216 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
218 FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
219 return WN16_NOT_SUPPORTED;
227 /**************************************************************************
228 * WNetGetCaps [USER.513]
230 WORD WINAPI WNetGetCaps16( WORD capability )
234 case WNNC16_SPEC_VERSION:
235 return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
237 case WNNC16_NET_TYPE:
238 /* hi byte = network type,
239 lo byte = network vendor (Netware = 0x03) [15 types] */
240 return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
242 case WNNC16_DRIVER_VERSION:
243 /* driver version of vendor */
244 return 0x100; /* WfW 3.11 */
247 /* 1 = WNetGetUser is supported */
250 case WNNC16_CONNECTION:
251 /* returns mask of the supported connection functions */
252 return WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
253 | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
254 | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
256 case WNNC16_PRINTING:
257 /* returns mask of the supported printing functions */
258 return WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
259 | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
260 | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
261 | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
262 | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
263 | WNNC16_PRT_WriteJob;
266 /* returns mask of the supported dialog functions */
267 return WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
268 | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
269 | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
270 | WNNC16_DLG_ConnectionDialog
271 /* | WNNC16_DLG_PrinterConnectDialog
272 | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
275 /* returns mask of the supported administration functions */
276 /* not sure if long file names is a good idea */
277 return WNNC16_ADM_GetDirectoryType
278 /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
279 | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
282 /* returns mask of the supported error functions */
283 return WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
285 case WNNC16_PRINTMGREXT:
286 /* returns the Print Manager version in major and
287 minor format if Print Manager functions are available */
288 return 0x30e; /* printman version of WfW 3.11 */
291 /* Win 3.11 returns HMODULE of network driver here
292 FIXME: what should we return ?
293 logonoff.exe needs it, msmail crashes with wrong value */
306 /**************************************************************************
307 * WNetGetUser [USER.516]
309 WORD WINAPI WNetGetUser16( LPCSTR lpName, LPSTR szUser, LPINT16 nBufferSize )
311 FIXME( "(%p, %p, %p): stub\n", lpName, szUser, nBufferSize );
312 return WN16_NOT_SUPPORTED;
320 /**************************************************************************
321 * WNetDeviceMode [USER.514]
323 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
325 FIXME( "(%04x): stub\n", hWndOwner );
326 return WN16_NOT_SUPPORTED;
329 /**************************************************************************
330 * WNetBrowseDialog [USER.515]
332 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
334 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
335 return WN16_NOT_SUPPORTED;
338 /********************************************************************
339 * WNetConnectDialog [USER.525]
341 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
343 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
347 /**************************************************************************
348 * WNetDisconnectDialog [USER.526]
350 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
352 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
353 return WN16_NOT_SUPPORTED;
356 /**************************************************************************
357 * WNetConnectionDialog [USER.527]
359 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
361 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
365 /**************************************************************************
366 * WNetViewQueueDialog [USER.528]
368 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
370 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
371 return WN16_NOT_SUPPORTED;
374 /**************************************************************************
375 * WNetPropertyDialog [USER.529]
377 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
378 WORD nPropSel, LPSTR lpszName, WORD nType )
380 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
381 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
382 return WN16_NOT_SUPPORTED;
385 /**************************************************************************
386 * WNetGetPropertyText [USER.532]
388 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
389 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
391 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
392 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
393 return WN16_NOT_SUPPORTED;
401 /*********************************************************************
402 * WNetGetDirectoryType [USER.530] Decides whether resource is local
405 * on success, puts one of the following in *lpType:
406 * - WNDT_NETWORK on a network
409 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
411 UINT type = GetDriveTypeA(lpName);
412 if ( type == DRIVE_NO_ROOT_DIR )
413 type = GetDriveTypeA(NULL);
415 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
417 TRACE( "%s is %s\n", debugstr_a(lpName),
418 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
422 /**************************************************************************
423 * WNetDirectoryNotify [USER.531]
425 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
427 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
428 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
429 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
430 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
431 return WN16_NOT_SUPPORTED;
439 /**************************************************************************
440 * WNetGetError [USER.519]
442 WORD WINAPI WNetGetError16( LPINT16 nError )
444 FIXME( "(%p): stub\n", nError );
445 return WN16_NOT_SUPPORTED;
448 /**************************************************************************
449 * WNetGetErrorText [USER.520]
451 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
453 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
454 return WN16_NET_ERROR;
457 /**************************************************************************
458 * WNetErrorText [USER.499]
460 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
462 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );