Convert MRULists to Unicode.
[wine/testsucceed.git] / dlls / user / network.c
blob03a7b6e58854bbcbc09906edfd834f9f741fa072
1 /*
2 * USER Windows Network functions
3 */
5 #include <ctype.h>
6 #include <string.h>
7 #include <sys/types.h>
8 #include <pwd.h>
9 #include <unistd.h>
11 #include "winbase.h"
12 #include "wine/winnet16.h"
13 #include "winnetwk.h"
14 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(wnet);
19 * Remote printing
22 /**************************************************************************
23 * WNetOpenJob [USER.501]
25 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
27 FIXME( "(%s, %s, %d, %p): stub\n",
28 debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
29 return WN16_NET_ERROR;
32 /**************************************************************************
33 * WNetCloseJob [USER.502]
35 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
37 FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
38 return WN16_NET_ERROR;
41 /**************************************************************************
42 * WNetWriteJob [USER.524]
44 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
46 FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
47 return WN16_NET_ERROR;
50 /**************************************************************************
51 * WNetAbortJob [USER.503]
53 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
55 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
56 return WN16_NET_ERROR;
59 /**************************************************************************
60 * WNetHoldJob [USER.504]
62 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
64 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
65 return WN16_NET_ERROR;
68 /**************************************************************************
69 * WNetReleaseJob [USER.505]
71 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
73 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
74 return WN16_NET_ERROR;
77 /**************************************************************************
78 * WNetCancelJob [USER.506]
80 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
82 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
83 return WN16_NET_ERROR;
86 /**************************************************************************
87 * WNetSetJobCopies [USER.507]
89 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
91 FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
92 return WN16_NET_ERROR;
95 /**************************************************************************
96 * WNetWatchQueue [USER.508]
98 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
100 FIXME( "(%04x, %s, %s, %d): stub\n",
101 hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
102 return WN16_NET_ERROR;
105 /**************************************************************************
106 * WNetUnwatchQueue [USER.509]
108 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
110 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
111 return WN16_NET_ERROR;
114 /**************************************************************************
115 * WNetLockQueueData [USER.510]
117 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
118 LPQUEUESTRUCT16 *lplpQueueStruct )
120 FIXME( "(%s, %s, %p): stub\n",
121 debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
122 return WN16_NET_ERROR;
125 /**************************************************************************
126 * WNetUnlockQueueData [USER.511]
128 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
130 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
131 return WN16_NET_ERROR;
136 * Connections
139 /********************************************************************
140 * WNetAddConnection [USER.517] Directs a local device to net
142 * Redirects a local device (either a disk drive or printer port)
143 * to a shared device on a remote server.
145 WORD WINAPI WNetAddConnection16( LPSTR lpNetPath, LPSTR lpPassWord,
146 LPSTR lpLocalName )
148 FIXME( "(%s, %p, %s): stub\n",
149 debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
150 return WN16_NET_ERROR;
153 /********************************************************************
154 * WNetCancelConnection [USER.518] undirects a local device
156 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
158 FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
159 return WN16_NOT_SUPPORTED;
162 /********************************************************************
163 * WNetGetConnection [USER.512] reverse-resolves a local device
165 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
166 LPSTR lpRemoteName, UINT16 *cbRemoteName )
168 char label[32];
170 TRACE( "local %s\n", lpLocalName );
171 switch(GetDriveTypeA(lpLocalName))
173 case DRIVE_REMOTE:
174 GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
175 if (strlen(label) + 1 > *cbRemoteName)
177 *cbRemoteName = strlen(label) + 1;
178 return WN16_MORE_DATA;
180 strcpy( lpRemoteName, label );
181 *cbRemoteName = strlen(lpRemoteName) + 1;
182 return WN16_SUCCESS;
183 case DRIVE_REMOVABLE:
184 case DRIVE_FIXED:
185 case DRIVE_CDROM:
186 TRACE("file is local\n");
187 return WN16_NOT_CONNECTED;
188 default:
189 return WN16_BAD_LOCALNAME;
193 /**************************************************************************
194 * WNetRestoreConnection [USER.523]
196 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
198 FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
199 return WN16_NOT_SUPPORTED;
204 * Capabilities
207 /**************************************************************************
208 * WNetGetCaps [USER.513]
210 WORD WINAPI WNetGetCaps16( WORD capability )
212 switch (capability)
214 case WNNC16_SPEC_VERSION:
215 return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
217 case WNNC16_NET_TYPE:
218 /* hi byte = network type,
219 lo byte = network vendor (Netware = 0x03) [15 types] */
220 return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
222 case WNNC16_DRIVER_VERSION:
223 /* driver version of vendor */
224 return 0x100; /* WfW 3.11 */
226 case WNNC16_USER:
227 /* 1 = WNetGetUser is supported */
228 return 1;
230 case WNNC16_CONNECTION:
231 /* returns mask of the supported connection functions */
232 return WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
233 | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
234 | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
236 case WNNC16_PRINTING:
237 /* returns mask of the supported printing functions */
238 return WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
239 | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
240 | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
241 | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
242 | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
243 | WNNC16_PRT_WriteJob;
245 case WNNC16_DIALOG:
246 /* returns mask of the supported dialog functions */
247 return WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
248 | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
249 | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
250 | WNNC16_DLG_ConnectionDialog
251 /* | WNNC16_DLG_PrinterConnectDialog
252 | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
254 case WNNC16_ADMIN:
255 /* returns mask of the supported administration functions */
256 /* not sure if long file names is a good idea */
257 return WNNC16_ADM_GetDirectoryType
258 /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
259 | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
261 case WNNC16_ERROR:
262 /* returns mask of the supported error functions */
263 return WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
265 case WNNC16_PRINTMGREXT:
266 /* returns the Print Manager version in major and
267 minor format if Print Manager functions are available */
268 return 0x30e; /* printman version of WfW 3.11 */
270 case 0xffff:
271 /* Win 3.11 returns HMODULE of network driver here
272 FIXME: what should we return ?
273 logonoff.exe needs it, msmail crashes with wrong value */
274 return 0;
276 default:
277 return 0;
283 * Get User
286 /**************************************************************************
287 * WNetGetUser [USER.516]
289 WORD WINAPI WNetGetUser16( LPCSTR lpName, LPSTR szUser, LPINT16 nBufferSize )
291 FIXME( "(%p, %p, %p): stub\n", lpName, szUser, nBufferSize );
292 return WN16_NOT_SUPPORTED;
297 * Browsing
300 /**************************************************************************
301 * WNetDeviceMode [USER.514]
303 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
305 FIXME( "(%04x): stub\n", hWndOwner );
306 return WN16_NOT_SUPPORTED;
309 /**************************************************************************
310 * WNetBrowseDialog [USER.515]
312 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
314 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
315 return WN16_NOT_SUPPORTED;
318 /********************************************************************
319 * WNetConnectDialog [USER.525]
321 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
323 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
324 return WN16_SUCCESS;
327 /**************************************************************************
328 * WNetDisconnectDialog [USER.526]
330 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
332 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
333 return WN16_NOT_SUPPORTED;
336 /**************************************************************************
337 * WNetConnectionDialog [USER.527]
339 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
341 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
342 return WN16_SUCCESS;
345 /**************************************************************************
346 * WNetViewQueueDialog [USER.528]
348 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
350 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
351 return WN16_NOT_SUPPORTED;
354 /**************************************************************************
355 * WNetPropertyDialog [USER.529]
357 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
358 WORD nPropSel, LPSTR lpszName, WORD nType )
360 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
361 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
362 return WN16_NOT_SUPPORTED;
365 /**************************************************************************
366 * WNetGetPropertyText [USER.532]
368 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
369 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
371 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
372 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
373 return WN16_NOT_SUPPORTED;
378 * Admin
381 /*********************************************************************
382 * WNetGetDirectoryType [USER.530] Decides whether resource is local
384 * RETURNS
385 * on success, puts one of the following in *lpType:
386 * - WNDT_NETWORK on a network
387 * - WNDT_LOCAL local
389 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
391 UINT type = GetDriveTypeA(lpName);
392 if ( type == DRIVE_NO_ROOT_DIR )
393 type = GetDriveTypeA(NULL);
395 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
397 TRACE( "%s is %s\n", debugstr_a(lpName),
398 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
399 return WN16_SUCCESS;
402 /**************************************************************************
403 * WNetDirectoryNotify [USER.531]
405 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
407 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
408 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
409 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
410 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
411 return WN16_NOT_SUPPORTED;
416 * Error handling
419 /**************************************************************************
420 * WNetGetError [USER.519]
422 WORD WINAPI WNetGetError16( LPINT16 nError )
424 FIXME( "(%p): stub\n", nError );
425 return WN16_NOT_SUPPORTED;
428 /**************************************************************************
429 * WNetGetErrorText [USER.520]
431 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
433 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
434 return WN16_NET_ERROR;
437 /**************************************************************************
438 * WNetErrorText [USER.499]
440 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
442 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );
443 return FALSE;