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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <sys/types.h>
28 #include "wine/winnet16.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(wnet);
38 /**************************************************************************
39 * WNetOpenJob [USER.501]
41 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
43 FIXME( "(%s, %s, %d, %p): stub\n",
44 debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
45 return WN16_NET_ERROR;
48 /**************************************************************************
49 * WNetCloseJob [USER.502]
51 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
53 FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
54 return WN16_NET_ERROR;
57 /**************************************************************************
58 * WNetWriteJob [USER.524]
60 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
62 FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
63 return WN16_NET_ERROR;
66 /**************************************************************************
67 * WNetAbortJob [USER.503]
69 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
71 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
72 return WN16_NET_ERROR;
75 /**************************************************************************
76 * WNetHoldJob [USER.504]
78 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
80 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
81 return WN16_NET_ERROR;
84 /**************************************************************************
85 * WNetReleaseJob [USER.505]
87 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
89 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
90 return WN16_NET_ERROR;
93 /**************************************************************************
94 * WNetCancelJob [USER.506]
96 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
98 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
99 return WN16_NET_ERROR;
102 /**************************************************************************
103 * WNetSetJobCopies [USER.507]
105 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
107 FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
108 return WN16_NET_ERROR;
111 /**************************************************************************
112 * WNetWatchQueue [USER.508]
114 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
116 FIXME( "(%04x, %s, %s, %d): stub\n",
117 hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
118 return WN16_NET_ERROR;
121 /**************************************************************************
122 * WNetUnwatchQueue [USER.509]
124 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
126 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
127 return WN16_NET_ERROR;
130 /**************************************************************************
131 * WNetLockQueueData [USER.510]
133 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
134 LPQUEUESTRUCT16 *lplpQueueStruct )
136 FIXME( "(%s, %s, %p): stub\n",
137 debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
138 return WN16_NET_ERROR;
141 /**************************************************************************
142 * WNetUnlockQueueData [USER.511]
144 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
146 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
147 return WN16_NET_ERROR;
155 /********************************************************************
156 * WNetAddConnection [USER.517] Directs a local device to net
158 * Redirects a local device (either a disk drive or printer port)
159 * to a shared device on a remote server.
161 WORD WINAPI WNetAddConnection16( LPSTR lpNetPath, LPSTR lpPassWord,
164 FIXME( "(%s, %p, %s): stub\n",
165 debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
166 return WN16_NET_ERROR;
169 /********************************************************************
170 * WNetCancelConnection [USER.518] undirects a local device
172 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
174 FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
175 return WN16_NOT_SUPPORTED;
178 /********************************************************************
179 * WNetGetConnection [USER.512] reverse-resolves a local device
181 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
182 LPSTR lpRemoteName, UINT16 *cbRemoteName )
186 TRACE( "local %s\n", lpLocalName );
187 switch(GetDriveTypeA(lpLocalName))
190 GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
191 if (strlen(label) + 1 > *cbRemoteName)
193 *cbRemoteName = strlen(label) + 1;
194 return WN16_MORE_DATA;
196 strcpy( lpRemoteName, label );
197 *cbRemoteName = strlen(lpRemoteName) + 1;
199 case DRIVE_REMOVABLE:
202 TRACE("file is local\n");
203 return WN16_NOT_CONNECTED;
205 return WN16_BAD_LOCALNAME;
209 /**************************************************************************
210 * WNetRestoreConnection [USER.523]
212 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
214 FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
215 return WN16_NOT_SUPPORTED;
223 /**************************************************************************
224 * WNetGetCaps [USER.513]
226 WORD WINAPI WNetGetCaps16( WORD capability )
230 case WNNC16_SPEC_VERSION:
231 return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
233 case WNNC16_NET_TYPE:
234 /* hi byte = network type,
235 lo byte = network vendor (Netware = 0x03) [15 types] */
236 return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
238 case WNNC16_DRIVER_VERSION:
239 /* driver version of vendor */
240 return 0x100; /* WfW 3.11 */
243 /* 1 = WNetGetUser is supported */
246 case WNNC16_CONNECTION:
247 /* returns mask of the supported connection functions */
248 return WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
249 | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
250 | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
252 case WNNC16_PRINTING:
253 /* returns mask of the supported printing functions */
254 return WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
255 | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
256 | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
257 | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
258 | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
259 | WNNC16_PRT_WriteJob;
262 /* returns mask of the supported dialog functions */
263 return WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
264 | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
265 | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
266 | WNNC16_DLG_ConnectionDialog
267 /* | WNNC16_DLG_PrinterConnectDialog
268 | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
271 /* returns mask of the supported administration functions */
272 /* not sure if long file names is a good idea */
273 return WNNC16_ADM_GetDirectoryType
274 /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
275 | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
278 /* returns mask of the supported error functions */
279 return WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
281 case WNNC16_PRINTMGREXT:
282 /* returns the Print Manager version in major and
283 minor format if Print Manager functions are available */
284 return 0x30e; /* printman version of WfW 3.11 */
287 /* Win 3.11 returns HMODULE of network driver here
288 FIXME: what should we return ?
289 logonoff.exe needs it, msmail crashes with wrong value */
302 /**************************************************************************
303 * WNetGetUser [USER.516]
305 WORD WINAPI WNetGetUser16( LPCSTR lpName, LPSTR szUser, LPINT16 nBufferSize )
307 FIXME( "(%p, %p, %p): stub\n", lpName, szUser, nBufferSize );
308 return WN16_NOT_SUPPORTED;
316 /**************************************************************************
317 * WNetDeviceMode [USER.514]
319 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
321 FIXME( "(%04x): stub\n", hWndOwner );
322 return WN16_NOT_SUPPORTED;
325 /**************************************************************************
326 * WNetBrowseDialog [USER.515]
328 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
330 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
331 return WN16_NOT_SUPPORTED;
334 /********************************************************************
335 * WNetConnectDialog [USER.525]
337 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
339 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
343 /**************************************************************************
344 * WNetDisconnectDialog [USER.526]
346 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
348 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
349 return WN16_NOT_SUPPORTED;
352 /**************************************************************************
353 * WNetConnectionDialog [USER.527]
355 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
357 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
361 /**************************************************************************
362 * WNetViewQueueDialog [USER.528]
364 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
366 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
367 return WN16_NOT_SUPPORTED;
370 /**************************************************************************
371 * WNetPropertyDialog [USER.529]
373 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
374 WORD nPropSel, LPSTR lpszName, WORD nType )
376 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
377 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
378 return WN16_NOT_SUPPORTED;
381 /**************************************************************************
382 * WNetGetPropertyText [USER.532]
384 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
385 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
387 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
388 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
389 return WN16_NOT_SUPPORTED;
397 /*********************************************************************
398 * WNetGetDirectoryType [USER.530] Decides whether resource is local
401 * on success, puts one of the following in *lpType:
402 * - WNDT_NETWORK on a network
405 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
407 UINT type = GetDriveTypeA(lpName);
408 if ( type == DRIVE_NO_ROOT_DIR )
409 type = GetDriveTypeA(NULL);
411 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
413 TRACE( "%s is %s\n", debugstr_a(lpName),
414 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
418 /**************************************************************************
419 * WNetDirectoryNotify [USER.531]
421 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
423 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
424 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
425 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
426 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
427 return WN16_NOT_SUPPORTED;
435 /**************************************************************************
436 * WNetGetError [USER.519]
438 WORD WINAPI WNetGetError16( LPINT16 nError )
440 FIXME( "(%p): stub\n", nError );
441 return WN16_NOT_SUPPORTED;
444 /**************************************************************************
445 * WNetGetErrorText [USER.520]
447 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
449 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
450 return WN16_NET_ERROR;
453 /**************************************************************************
454 * WNetErrorText [USER.499]
456 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
458 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );