Added version info to 16-bit shell.dll.
[wine/multimedia.git] / dlls / user / network.c
blobadf55a637725a18d9168b402173c18f544f93af0
1 /*
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
21 #include <ctype.h>
22 #include <string.h>
23 #include <sys/types.h>
24 #include <unistd.h>
26 #include "winbase.h"
27 #include "wine/winnet16.h"
28 #include "winnetwk.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(wnet);
34 * Remote printing
37 /**************************************************************************
38 * WNetOpenJob [USER.501]
40 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
42 FIXME( "(%s, %s, %d, %p): stub\n",
43 debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
44 return WN16_NET_ERROR;
47 /**************************************************************************
48 * WNetCloseJob [USER.502]
50 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
52 FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
53 return WN16_NET_ERROR;
56 /**************************************************************************
57 * WNetWriteJob [USER.524]
59 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
61 FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
62 return WN16_NET_ERROR;
65 /**************************************************************************
66 * WNetAbortJob [USER.503]
68 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
70 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
71 return WN16_NET_ERROR;
74 /**************************************************************************
75 * WNetHoldJob [USER.504]
77 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
79 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
80 return WN16_NET_ERROR;
83 /**************************************************************************
84 * WNetReleaseJob [USER.505]
86 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
88 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
89 return WN16_NET_ERROR;
92 /**************************************************************************
93 * WNetCancelJob [USER.506]
95 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
97 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
98 return WN16_NET_ERROR;
101 /**************************************************************************
102 * WNetSetJobCopies [USER.507]
104 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
106 FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
107 return WN16_NET_ERROR;
110 /**************************************************************************
111 * WNetWatchQueue [USER.508]
113 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
115 FIXME( "(%04x, %s, %s, %d): stub\n",
116 hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
117 return WN16_NET_ERROR;
120 /**************************************************************************
121 * WNetUnwatchQueue [USER.509]
123 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
125 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
126 return WN16_NET_ERROR;
129 /**************************************************************************
130 * WNetLockQueueData [USER.510]
132 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
133 LPQUEUESTRUCT16 *lplpQueueStruct )
135 FIXME( "(%s, %s, %p): stub\n",
136 debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
137 return WN16_NET_ERROR;
140 /**************************************************************************
141 * WNetUnlockQueueData [USER.511]
143 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
145 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
146 return WN16_NET_ERROR;
151 * Connections
154 /********************************************************************
155 * WNetAddConnection [USER.517] Directs a local device to net
157 * Redirects a local device (either a disk drive or printer port)
158 * to a shared device on a remote server.
160 WORD WINAPI WNetAddConnection16( LPSTR lpNetPath, LPSTR lpPassWord,
161 LPSTR lpLocalName )
163 FIXME( "(%s, %p, %s): stub\n",
164 debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
165 return WN16_NET_ERROR;
168 /********************************************************************
169 * WNetCancelConnection [USER.518] undirects a local device
171 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
173 FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
174 return WN16_NOT_SUPPORTED;
177 /********************************************************************
178 * WNetGetConnection [USER.512] reverse-resolves a local device
180 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
181 LPSTR lpRemoteName, UINT16 *cbRemoteName )
183 char label[32];
185 TRACE( "local %s\n", lpLocalName );
186 switch(GetDriveTypeA(lpLocalName))
188 case DRIVE_REMOTE:
189 GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
190 if (strlen(label) + 1 > *cbRemoteName)
192 *cbRemoteName = strlen(label) + 1;
193 return WN16_MORE_DATA;
195 strcpy( lpRemoteName, label );
196 *cbRemoteName = strlen(lpRemoteName) + 1;
197 return WN16_SUCCESS;
198 case DRIVE_REMOVABLE:
199 case DRIVE_FIXED:
200 case DRIVE_CDROM:
201 TRACE("file is local\n");
202 return WN16_NOT_CONNECTED;
203 default:
204 return WN16_BAD_LOCALNAME;
208 /**************************************************************************
209 * WNetRestoreConnection [USER.523]
211 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
213 FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
214 return WN16_NOT_SUPPORTED;
219 * Capabilities
222 /**************************************************************************
223 * WNetGetCaps [USER.513]
225 WORD WINAPI WNetGetCaps16( WORD capability )
227 switch (capability)
229 case WNNC16_SPEC_VERSION:
230 return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
232 case WNNC16_NET_TYPE:
233 /* hi byte = network type,
234 lo byte = network vendor (Netware = 0x03) [15 types] */
235 return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
237 case WNNC16_DRIVER_VERSION:
238 /* driver version of vendor */
239 return 0x100; /* WfW 3.11 */
241 case WNNC16_USER:
242 /* 1 = WNetGetUser is supported */
243 return 1;
245 case WNNC16_CONNECTION:
246 /* returns mask of the supported connection functions */
247 return WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
248 | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
249 | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
251 case WNNC16_PRINTING:
252 /* returns mask of the supported printing functions */
253 return WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
254 | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
255 | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
256 | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
257 | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
258 | WNNC16_PRT_WriteJob;
260 case WNNC16_DIALOG:
261 /* returns mask of the supported dialog functions */
262 return WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
263 | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
264 | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
265 | WNNC16_DLG_ConnectionDialog
266 /* | WNNC16_DLG_PrinterConnectDialog
267 | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
269 case WNNC16_ADMIN:
270 /* returns mask of the supported administration functions */
271 /* not sure if long file names is a good idea */
272 return WNNC16_ADM_GetDirectoryType
273 /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
274 | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
276 case WNNC16_ERROR:
277 /* returns mask of the supported error functions */
278 return WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
280 case WNNC16_PRINTMGREXT:
281 /* returns the Print Manager version in major and
282 minor format if Print Manager functions are available */
283 return 0x30e; /* printman version of WfW 3.11 */
285 case 0xffff:
286 /* Win 3.11 returns HMODULE of network driver here
287 FIXME: what should we return ?
288 logonoff.exe needs it, msmail crashes with wrong value */
289 return 0;
291 default:
292 return 0;
298 * Get User
301 /**************************************************************************
302 * WNetGetUser [USER.516]
304 WORD WINAPI WNetGetUser16( LPCSTR lpName, LPSTR szUser, LPINT16 nBufferSize )
306 FIXME( "(%p, %p, %p): stub\n", lpName, szUser, nBufferSize );
307 return WN16_NOT_SUPPORTED;
312 * Browsing
315 /**************************************************************************
316 * WNetDeviceMode [USER.514]
318 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
320 FIXME( "(%04x): stub\n", hWndOwner );
321 return WN16_NOT_SUPPORTED;
324 /**************************************************************************
325 * WNetBrowseDialog [USER.515]
327 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
329 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
330 return WN16_NOT_SUPPORTED;
333 /********************************************************************
334 * WNetConnectDialog [USER.525]
336 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
338 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
339 return WN16_SUCCESS;
342 /**************************************************************************
343 * WNetDisconnectDialog [USER.526]
345 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
347 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
348 return WN16_NOT_SUPPORTED;
351 /**************************************************************************
352 * WNetConnectionDialog [USER.527]
354 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
356 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
357 return WN16_SUCCESS;
360 /**************************************************************************
361 * WNetViewQueueDialog [USER.528]
363 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
365 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
366 return WN16_NOT_SUPPORTED;
369 /**************************************************************************
370 * WNetPropertyDialog [USER.529]
372 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
373 WORD nPropSel, LPSTR lpszName, WORD nType )
375 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
376 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
377 return WN16_NOT_SUPPORTED;
380 /**************************************************************************
381 * WNetGetPropertyText [USER.532]
383 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
384 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
386 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
387 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
388 return WN16_NOT_SUPPORTED;
393 * Admin
396 /*********************************************************************
397 * WNetGetDirectoryType [USER.530] Decides whether resource is local
399 * RETURNS
400 * on success, puts one of the following in *lpType:
401 * - WNDT_NETWORK on a network
402 * - WNDT_LOCAL local
404 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
406 UINT type = GetDriveTypeA(lpName);
407 if ( type == DRIVE_NO_ROOT_DIR )
408 type = GetDriveTypeA(NULL);
410 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
412 TRACE( "%s is %s\n", debugstr_a(lpName),
413 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
414 return WN16_SUCCESS;
417 /**************************************************************************
418 * WNetDirectoryNotify [USER.531]
420 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
422 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
423 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
424 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
425 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
426 return WN16_NOT_SUPPORTED;
431 * Error handling
434 /**************************************************************************
435 * WNetGetError [USER.519]
437 WORD WINAPI WNetGetError16( LPINT16 nError )
439 FIXME( "(%p): stub\n", nError );
440 return WN16_NOT_SUPPORTED;
443 /**************************************************************************
444 * WNetGetErrorText [USER.520]
446 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
448 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
449 return WN16_NET_ERROR;
452 /**************************************************************************
453 * WNetErrorText [USER.499]
455 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
457 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );
458 return FALSE;