Silence some warnings due to casts between pointer and integers of
[wine/multimedia.git] / dlls / user / network.c
blob91854181b119a070c50c960edf4d2b5a6c301c91
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 "config.h"
23 #include <ctype.h>
24 #include <string.h>
25 #include <sys/types.h>
26 #ifdef HAVE_UNISTD_H
27 # include <unistd.h>
28 #endif
30 #include "winbase.h"
31 #include "wine/winnet16.h"
32 #include "winnetwk.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(wnet);
38 * Remote printing
41 /**************************************************************************
42 * WNetOpenJob [USER.501]
44 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
46 FIXME( "(%s, %s, %d, %p): stub\n",
47 debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
48 return WN16_NET_ERROR;
51 /**************************************************************************
52 * WNetCloseJob [USER.502]
54 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
56 FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
57 return WN16_NET_ERROR;
60 /**************************************************************************
61 * WNetWriteJob [USER.524]
63 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
65 FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
66 return WN16_NET_ERROR;
69 /**************************************************************************
70 * WNetAbortJob [USER.503]
72 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
74 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
75 return WN16_NET_ERROR;
78 /**************************************************************************
79 * WNetHoldJob [USER.504]
81 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
83 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
84 return WN16_NET_ERROR;
87 /**************************************************************************
88 * WNetReleaseJob [USER.505]
90 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
92 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
93 return WN16_NET_ERROR;
96 /**************************************************************************
97 * WNetCancelJob [USER.506]
99 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
101 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
102 return WN16_NET_ERROR;
105 /**************************************************************************
106 * WNetSetJobCopies [USER.507]
108 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
110 FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
111 return WN16_NET_ERROR;
114 /**************************************************************************
115 * WNetWatchQueue [USER.508]
117 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
119 FIXME( "(%04x, %s, %s, %d): stub\n",
120 hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
121 return WN16_NET_ERROR;
124 /**************************************************************************
125 * WNetUnwatchQueue [USER.509]
127 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
129 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
130 return WN16_NET_ERROR;
133 /**************************************************************************
134 * WNetLockQueueData [USER.510]
136 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
137 LPQUEUESTRUCT16 *lplpQueueStruct )
139 FIXME( "(%s, %s, %p): stub\n",
140 debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
141 return WN16_NET_ERROR;
144 /**************************************************************************
145 * WNetUnlockQueueData [USER.511]
147 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
149 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
150 return WN16_NET_ERROR;
155 * Connections
158 /********************************************************************
159 * WNetAddConnection [USER.517] Directs a local device to net
161 * Redirects a local device (either a disk drive or printer port)
162 * to a shared device on a remote server.
164 WORD WINAPI WNetAddConnection16( LPSTR lpNetPath, LPSTR lpPassWord,
165 LPSTR lpLocalName )
167 FIXME( "(%s, %p, %s): stub\n",
168 debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
169 return WN16_NET_ERROR;
172 /********************************************************************
173 * WNetCancelConnection [USER.518] undirects a local device
175 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
177 FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
178 return WN16_NOT_SUPPORTED;
181 /********************************************************************
182 * WNetGetConnection [USER.512] reverse-resolves a local device
184 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
185 LPSTR lpRemoteName, UINT16 *cbRemoteName )
187 char label[32];
189 TRACE( "local %s\n", lpLocalName );
190 switch(GetDriveTypeA(lpLocalName))
192 case DRIVE_REMOTE:
193 GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
194 if (strlen(label) + 1 > *cbRemoteName)
196 *cbRemoteName = strlen(label) + 1;
197 return WN16_MORE_DATA;
199 strcpy( lpRemoteName, label );
200 *cbRemoteName = strlen(lpRemoteName) + 1;
201 return WN16_SUCCESS;
202 case DRIVE_REMOVABLE:
203 case DRIVE_FIXED:
204 case DRIVE_CDROM:
205 TRACE("file is local\n");
206 return WN16_NOT_CONNECTED;
207 default:
208 return WN16_BAD_LOCALNAME;
212 /**************************************************************************
213 * WNetRestoreConnection [USER.523]
215 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
217 FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
218 return WN16_NOT_SUPPORTED;
223 * Capabilities
226 /**************************************************************************
227 * WNetGetCaps [USER.513]
229 WORD WINAPI WNetGetCaps16( WORD capability )
231 switch (capability)
233 case WNNC16_SPEC_VERSION:
234 return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
236 case WNNC16_NET_TYPE:
237 /* hi byte = network type,
238 lo byte = network vendor (Netware = 0x03) [15 types] */
239 return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
241 case WNNC16_DRIVER_VERSION:
242 /* driver version of vendor */
243 return 0x100; /* WfW 3.11 */
245 case WNNC16_USER:
246 /* 1 = WNetGetUser is supported */
247 return 1;
249 case WNNC16_CONNECTION:
250 /* returns mask of the supported connection functions */
251 return WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
252 | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
253 | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
255 case WNNC16_PRINTING:
256 /* returns mask of the supported printing functions */
257 return WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
258 | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
259 | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
260 | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
261 | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
262 | WNNC16_PRT_WriteJob;
264 case WNNC16_DIALOG:
265 /* returns mask of the supported dialog functions */
266 return WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
267 | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
268 | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
269 | WNNC16_DLG_ConnectionDialog
270 /* | WNNC16_DLG_PrinterConnectDialog
271 | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
273 case WNNC16_ADMIN:
274 /* returns mask of the supported administration functions */
275 /* not sure if long file names is a good idea */
276 return WNNC16_ADM_GetDirectoryType
277 /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
278 | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
280 case WNNC16_ERROR:
281 /* returns mask of the supported error functions */
282 return WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
284 case WNNC16_PRINTMGREXT:
285 /* returns the Print Manager version in major and
286 minor format if Print Manager functions are available */
287 return 0x30e; /* printman version of WfW 3.11 */
289 case 0xffff:
290 /* Win 3.11 returns HMODULE of network driver here
291 FIXME: what should we return ?
292 logonoff.exe needs it, msmail crashes with wrong value */
293 return 0;
295 default:
296 return 0;
302 * Get User
305 /**************************************************************************
306 * WNetGetUser [USER.516]
308 WORD WINAPI WNetGetUser16( LPCSTR lpName, LPSTR szUser, LPINT16 nBufferSize )
310 FIXME( "(%p, %p, %p): stub\n", lpName, szUser, nBufferSize );
311 return WN16_NOT_SUPPORTED;
316 * Browsing
319 /**************************************************************************
320 * WNetDeviceMode [USER.514]
322 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
324 FIXME( "(%04x): stub\n", hWndOwner );
325 return WN16_NOT_SUPPORTED;
328 /**************************************************************************
329 * WNetBrowseDialog [USER.515]
331 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
333 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
334 return WN16_NOT_SUPPORTED;
337 /********************************************************************
338 * WNetConnectDialog [USER.525]
340 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
342 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
343 return WN16_SUCCESS;
346 /**************************************************************************
347 * WNetDisconnectDialog [USER.526]
349 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
351 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
352 return WN16_NOT_SUPPORTED;
355 /**************************************************************************
356 * WNetConnectionDialog [USER.527]
358 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
360 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
361 return WN16_SUCCESS;
364 /**************************************************************************
365 * WNetViewQueueDialog [USER.528]
367 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
369 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
370 return WN16_NOT_SUPPORTED;
373 /**************************************************************************
374 * WNetPropertyDialog [USER.529]
376 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
377 WORD nPropSel, LPSTR lpszName, WORD nType )
379 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
380 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
381 return WN16_NOT_SUPPORTED;
384 /**************************************************************************
385 * WNetGetPropertyText [USER.532]
387 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
388 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
390 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
391 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
392 return WN16_NOT_SUPPORTED;
397 * Admin
400 /*********************************************************************
401 * WNetGetDirectoryType [USER.530] Decides whether resource is local
403 * RETURNS
404 * on success, puts one of the following in *lpType:
405 * - WNDT_NETWORK on a network
406 * - WNDT_LOCAL local
408 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
410 UINT type = GetDriveTypeA(lpName);
411 if ( type == DRIVE_NO_ROOT_DIR )
412 type = GetDriveTypeA(NULL);
414 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
416 TRACE( "%s is %s\n", debugstr_a(lpName),
417 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
418 return WN16_SUCCESS;
421 /**************************************************************************
422 * WNetDirectoryNotify [USER.531]
424 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
426 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
427 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
428 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
429 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
430 return WN16_NOT_SUPPORTED;
435 * Error handling
438 /**************************************************************************
439 * WNetGetError [USER.519]
441 WORD WINAPI WNetGetError16( LPINT16 nError )
443 FIXME( "(%p): stub\n", nError );
444 return WN16_NOT_SUPPORTED;
447 /**************************************************************************
448 * WNetGetErrorText [USER.520]
450 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
452 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
453 return WN16_NET_ERROR;
456 /**************************************************************************
457 * WNetErrorText [USER.499]
459 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
461 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );
462 return FALSE;