gdi32: Use NtGdiPolyPolyDraw for PolylineTo implementation.
[wine.git] / dlls / user.exe16 / network.c
blobc137bb19f70ea5db8fc4be5b78e6cd348dcf2b05
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 <ctype.h>
22 #include <stdarg.h>
23 #include <string.h>
24 #include <sys/types.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winnetwk.h"
29 #include "wine/winnet16.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(wnet);
35 * Remote printing
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;
152 * Connections
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( LPCSTR lpNetPath, LPCSTR lpPassWord,
162 LPCSTR lpLocalName )
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 )
184 char label[32];
186 TRACE( "local %s\n", lpLocalName );
187 switch(GetDriveTypeA(lpLocalName))
189 case DRIVE_REMOTE:
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;
198 return WN16_SUCCESS;
199 case DRIVE_REMOVABLE:
200 case DRIVE_FIXED:
201 case DRIVE_CDROM:
202 TRACE("file is local\n");
203 return WN16_NOT_CONNECTED;
204 default:
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;
220 * Capabilities
223 /**************************************************************************
224 * WNetGetCaps [USER.513]
226 WORD WINAPI WNetGetCaps16( WORD capability )
228 switch (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 */
242 case WNNC16_USER:
243 /* 1 = WNetGetUser is supported */
244 return 1;
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;
261 case WNNC16_DIALOG:
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 */;
270 case WNNC16_ADMIN:
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 */;
277 case WNNC16_ERROR:
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 */
286 case 0xffff:
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 */
290 return 0;
292 default:
293 return 0;
299 * Get User
302 /**************************************************************************
303 * WNetGetUser [USER.516]
305 WORD WINAPI WNetGetUser16( LPSTR szUser, LPINT16 nBufferSize )
307 DWORD lpBufferSize, ret;
309 if(!szUser || !nBufferSize) return WN16_BAD_POINTER;
311 lpBufferSize = *nBufferSize;
312 ret = WNetGetUserA( NULL, szUser, &lpBufferSize );
313 *nBufferSize = lpBufferSize;
315 switch (ret)
317 case NO_ERROR:
318 return WN16_SUCCESS;
319 case ERROR_MORE_DATA:
320 return WN16_MORE_DATA;
321 default:
322 FIXME("Untranslated return value %d\n", ret);
324 return ret;
329 * Browsing
332 /**************************************************************************
333 * WNetDeviceMode [USER.514]
335 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
337 FIXME( "(%04x): stub\n", hWndOwner );
338 return WN16_NOT_SUPPORTED;
341 /**************************************************************************
342 * WNetBrowseDialog [USER.515]
344 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
346 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
347 return WN16_NOT_SUPPORTED;
350 /********************************************************************
351 * WNetConnectDialog [USER.525]
353 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
355 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
356 return WN16_SUCCESS;
359 /**************************************************************************
360 * WNetDisconnectDialog [USER.526]
362 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
364 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
365 return WN16_NOT_SUPPORTED;
368 /**************************************************************************
369 * WNetConnectionDialog [USER.527]
371 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
373 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
374 return WN16_SUCCESS;
377 /**************************************************************************
378 * WNetViewQueueDialog [USER.528]
380 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
382 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
383 return WN16_NOT_SUPPORTED;
386 /**************************************************************************
387 * WNetPropertyDialog [USER.529]
389 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
390 WORD nPropSel, LPSTR lpszName, WORD nType )
392 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
393 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
394 return WN16_NOT_SUPPORTED;
397 /**************************************************************************
398 * WNetGetPropertyText [USER.532]
400 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
401 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
403 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
404 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
405 return WN16_NOT_SUPPORTED;
410 * Admin
413 /*********************************************************************
414 * WNetGetDirectoryType [USER.530] Decides whether resource is local
416 * RETURNS
417 * on success, puts one of the following in *lpType:
418 * - WNDT_NETWORK on a network
419 * - WNDT_LOCAL local
421 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
423 UINT type = GetDriveTypeA(lpName);
424 if ( type == DRIVE_NO_ROOT_DIR )
425 type = GetDriveTypeA(NULL);
427 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
429 TRACE( "%s is %s\n", debugstr_a(lpName),
430 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
431 return WN16_SUCCESS;
434 /**************************************************************************
435 * WNetDirectoryNotify [USER.531]
437 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
439 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
440 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
441 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
442 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
443 return WN16_NOT_SUPPORTED;
448 * Error handling
451 /**************************************************************************
452 * WNetGetError [USER.519]
454 WORD WINAPI WNetGetError16( LPINT16 nError )
456 FIXME( "(%p): stub\n", nError );
457 return WN16_NOT_SUPPORTED;
460 /**************************************************************************
461 * WNetGetErrorText [USER.520]
463 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
465 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
466 return WN16_NET_ERROR;
469 /**************************************************************************
470 * WNetErrorText [USER.499]
472 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
474 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );
475 return FALSE;