d3d11/tests: Add test for combined clip and cull distances.
[wine.git] / dlls / user.exe16 / network.c
blob8dc31b16191a6fc757d69d3aed36705bb2bcae0d
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #include <ctype.h>
24 #include <stdarg.h>
25 #include <string.h>
26 #include <sys/types.h>
27 #ifdef HAVE_UNISTD_H
28 # include <unistd.h>
29 #endif
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winnetwk.h"
34 #include "wine/winnet16.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(wnet);
40 * Remote printing
43 /**************************************************************************
44 * WNetOpenJob [USER.501]
46 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
48 FIXME( "(%s, %s, %d, %p): stub\n",
49 debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
50 return WN16_NET_ERROR;
53 /**************************************************************************
54 * WNetCloseJob [USER.502]
56 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
58 FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
59 return WN16_NET_ERROR;
62 /**************************************************************************
63 * WNetWriteJob [USER.524]
65 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
67 FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
68 return WN16_NET_ERROR;
71 /**************************************************************************
72 * WNetAbortJob [USER.503]
74 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
76 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
77 return WN16_NET_ERROR;
80 /**************************************************************************
81 * WNetHoldJob [USER.504]
83 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
85 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
86 return WN16_NET_ERROR;
89 /**************************************************************************
90 * WNetReleaseJob [USER.505]
92 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
94 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
95 return WN16_NET_ERROR;
98 /**************************************************************************
99 * WNetCancelJob [USER.506]
101 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
103 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
104 return WN16_NET_ERROR;
107 /**************************************************************************
108 * WNetSetJobCopies [USER.507]
110 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
112 FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
113 return WN16_NET_ERROR;
116 /**************************************************************************
117 * WNetWatchQueue [USER.508]
119 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
121 FIXME( "(%04x, %s, %s, %d): stub\n",
122 hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
123 return WN16_NET_ERROR;
126 /**************************************************************************
127 * WNetUnwatchQueue [USER.509]
129 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
131 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
132 return WN16_NET_ERROR;
135 /**************************************************************************
136 * WNetLockQueueData [USER.510]
138 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
139 LPQUEUESTRUCT16 *lplpQueueStruct )
141 FIXME( "(%s, %s, %p): stub\n",
142 debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
143 return WN16_NET_ERROR;
146 /**************************************************************************
147 * WNetUnlockQueueData [USER.511]
149 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
151 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
152 return WN16_NET_ERROR;
157 * Connections
160 /********************************************************************
161 * WNetAddConnection [USER.517] Directs a local device to net
163 * Redirects a local device (either a disk drive or printer port)
164 * to a shared device on a remote server.
166 WORD WINAPI WNetAddConnection16( LPCSTR lpNetPath, LPCSTR lpPassWord,
167 LPCSTR lpLocalName )
169 FIXME( "(%s, %p, %s): stub\n",
170 debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
171 return WN16_NET_ERROR;
174 /********************************************************************
175 * WNetCancelConnection [USER.518] undirects a local device
177 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
179 FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
180 return WN16_NOT_SUPPORTED;
183 /********************************************************************
184 * WNetGetConnection [USER.512] reverse-resolves a local device
186 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
187 LPSTR lpRemoteName, UINT16 *cbRemoteName )
189 char label[32];
191 TRACE( "local %s\n", lpLocalName );
192 switch(GetDriveTypeA(lpLocalName))
194 case DRIVE_REMOTE:
195 GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
196 if (strlen(label) + 1 > *cbRemoteName)
198 *cbRemoteName = strlen(label) + 1;
199 return WN16_MORE_DATA;
201 strcpy( lpRemoteName, label );
202 *cbRemoteName = strlen(lpRemoteName) + 1;
203 return WN16_SUCCESS;
204 case DRIVE_REMOVABLE:
205 case DRIVE_FIXED:
206 case DRIVE_CDROM:
207 TRACE("file is local\n");
208 return WN16_NOT_CONNECTED;
209 default:
210 return WN16_BAD_LOCALNAME;
214 /**************************************************************************
215 * WNetRestoreConnection [USER.523]
217 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
219 FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
220 return WN16_NOT_SUPPORTED;
225 * Capabilities
228 /**************************************************************************
229 * WNetGetCaps [USER.513]
231 WORD WINAPI WNetGetCaps16( WORD capability )
233 switch (capability)
235 case WNNC16_SPEC_VERSION:
236 return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
238 case WNNC16_NET_TYPE:
239 /* hi byte = network type,
240 lo byte = network vendor (Netware = 0x03) [15 types] */
241 return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
243 case WNNC16_DRIVER_VERSION:
244 /* driver version of vendor */
245 return 0x100; /* WfW 3.11 */
247 case WNNC16_USER:
248 /* 1 = WNetGetUser is supported */
249 return 1;
251 case WNNC16_CONNECTION:
252 /* returns mask of the supported connection functions */
253 return WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
254 | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
255 | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
257 case WNNC16_PRINTING:
258 /* returns mask of the supported printing functions */
259 return WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
260 | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
261 | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
262 | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
263 | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
264 | WNNC16_PRT_WriteJob;
266 case WNNC16_DIALOG:
267 /* returns mask of the supported dialog functions */
268 return WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
269 | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
270 | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
271 | WNNC16_DLG_ConnectionDialog
272 /* | WNNC16_DLG_PrinterConnectDialog
273 | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
275 case WNNC16_ADMIN:
276 /* returns mask of the supported administration functions */
277 /* not sure if long file names is a good idea */
278 return WNNC16_ADM_GetDirectoryType
279 /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
280 | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
282 case WNNC16_ERROR:
283 /* returns mask of the supported error functions */
284 return WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
286 case WNNC16_PRINTMGREXT:
287 /* returns the Print Manager version in major and
288 minor format if Print Manager functions are available */
289 return 0x30e; /* printman version of WfW 3.11 */
291 case 0xffff:
292 /* Win 3.11 returns HMODULE of network driver here
293 FIXME: what should we return ?
294 logonoff.exe needs it, msmail crashes with wrong value */
295 return 0;
297 default:
298 return 0;
304 * Get User
307 /**************************************************************************
308 * WNetGetUser [USER.516]
310 WORD WINAPI WNetGetUser16( LPSTR szUser, LPINT16 nBufferSize )
312 DWORD lpBufferSize, ret;
314 if(!szUser || !nBufferSize) return WN16_BAD_POINTER;
316 lpBufferSize = *nBufferSize;
317 ret = WNetGetUserA( NULL, szUser, &lpBufferSize );
318 *nBufferSize = lpBufferSize;
320 switch (ret)
322 case NO_ERROR:
323 return WN16_SUCCESS;
324 case ERROR_MORE_DATA:
325 return WN16_MORE_DATA;
326 default:
327 FIXME("Untranslated return value %d\n", ret);
329 return ret;
334 * Browsing
337 /**************************************************************************
338 * WNetDeviceMode [USER.514]
340 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
342 FIXME( "(%04x): stub\n", hWndOwner );
343 return WN16_NOT_SUPPORTED;
346 /**************************************************************************
347 * WNetBrowseDialog [USER.515]
349 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
351 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
352 return WN16_NOT_SUPPORTED;
355 /********************************************************************
356 * WNetConnectDialog [USER.525]
358 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
360 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
361 return WN16_SUCCESS;
364 /**************************************************************************
365 * WNetDisconnectDialog [USER.526]
367 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
369 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
370 return WN16_NOT_SUPPORTED;
373 /**************************************************************************
374 * WNetConnectionDialog [USER.527]
376 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
378 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
379 return WN16_SUCCESS;
382 /**************************************************************************
383 * WNetViewQueueDialog [USER.528]
385 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
387 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
388 return WN16_NOT_SUPPORTED;
391 /**************************************************************************
392 * WNetPropertyDialog [USER.529]
394 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
395 WORD nPropSel, LPSTR lpszName, WORD nType )
397 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
398 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
399 return WN16_NOT_SUPPORTED;
402 /**************************************************************************
403 * WNetGetPropertyText [USER.532]
405 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
406 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
408 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
409 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
410 return WN16_NOT_SUPPORTED;
415 * Admin
418 /*********************************************************************
419 * WNetGetDirectoryType [USER.530] Decides whether resource is local
421 * RETURNS
422 * on success, puts one of the following in *lpType:
423 * - WNDT_NETWORK on a network
424 * - WNDT_LOCAL local
426 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
428 UINT type = GetDriveTypeA(lpName);
429 if ( type == DRIVE_NO_ROOT_DIR )
430 type = GetDriveTypeA(NULL);
432 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
434 TRACE( "%s is %s\n", debugstr_a(lpName),
435 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
436 return WN16_SUCCESS;
439 /**************************************************************************
440 * WNetDirectoryNotify [USER.531]
442 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
444 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
445 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
446 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
447 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
448 return WN16_NOT_SUPPORTED;
453 * Error handling
456 /**************************************************************************
457 * WNetGetError [USER.519]
459 WORD WINAPI WNetGetError16( LPINT16 nError )
461 FIXME( "(%p): stub\n", nError );
462 return WN16_NOT_SUPPORTED;
465 /**************************************************************************
466 * WNetGetErrorText [USER.520]
468 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
470 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
471 return WN16_NET_ERROR;
474 /**************************************************************************
475 * WNetErrorText [USER.499]
477 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
479 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );
480 return FALSE;