Implemented VideoCapDriverDescAndVer.
[wine/testsucceed.git] / dlls / user / network.c
blob06fc9ebf818202966ba37a1d1668fed0fafcb9e8
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"
15 #include "heap.h"
17 DEFAULT_DEBUG_CHANNEL(wnet);
20 * Remote printing
23 /**************************************************************************
24 * WNetOpenJob16 [USER.501]
26 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
28 FIXME( "(%s, %s, %d, %p): stub\n",
29 debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
30 return WN16_NET_ERROR;
33 /**************************************************************************
34 * WNetCloseJob16 [USER.502]
36 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
38 FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
39 return WN16_NET_ERROR;
42 /**************************************************************************
43 * WNetWriteJob16 [USER.524]
45 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
47 FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
48 return WN16_NET_ERROR;
51 /**************************************************************************
52 * WNetAbortJob16 [USER.503]
54 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
56 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
57 return WN16_NET_ERROR;
60 /**************************************************************************
61 * WNetHoldJob16 [USER.504]
63 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
65 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
66 return WN16_NET_ERROR;
69 /**************************************************************************
70 * WNetReleaseJob16 [USER.505]
72 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
74 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
75 return WN16_NET_ERROR;
78 /**************************************************************************
79 * WNetCancelJob16 [USER.506]
81 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
83 FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
84 return WN16_NET_ERROR;
87 /**************************************************************************
88 * WNetSetJobCopies16 [USER.507]
90 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
92 FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
93 return WN16_NET_ERROR;
96 /**************************************************************************
97 * WNetWatchQueue16 [USER.508]
99 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
101 FIXME( "(%04x, %s, %s, %d): stub\n",
102 hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
103 return WN16_NET_ERROR;
106 /**************************************************************************
107 * WNetUnwatchQueue16 [USER.509]
109 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
111 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
112 return WN16_NET_ERROR;
115 /**************************************************************************
116 * WNetLockQueueData16 [USER.510]
118 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
119 LPQUEUESTRUCT16 *lplpQueueStruct )
121 FIXME( "(%s, %s, %p): stub\n",
122 debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
123 return WN16_NET_ERROR;
126 /**************************************************************************
127 * WNetUnlockQueueData16 [USER.511]
129 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
131 FIXME( "(%s): stub\n", debugstr_a(szQueue) );
132 return WN16_NET_ERROR;
137 * Connections
140 /********************************************************************
141 * WNetAddConnection16 [USER.517] Directs a local device to net
143 * Redirects a local device (either a disk drive or printer port)
144 * to a shared device on a remote server.
146 WORD WINAPI WNetAddConnection16( LPSTR lpNetPath, LPSTR lpPassWord,
147 LPSTR lpLocalName )
149 FIXME( "(%s, %p, %s): stub\n",
150 debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
151 return WN16_NET_ERROR;
154 /********************************************************************
155 * WNetCancelConnection16 [USER.518] undirects a local device
157 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
159 FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
160 return WN16_NOT_SUPPORTED;
163 /********************************************************************
164 * WNetGetConnection16 [USER.512] reverse-resolves a local device
166 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
167 LPSTR lpRemoteName, UINT16 *cbRemoteName )
169 char label[32];
171 TRACE( "local %s\n", lpLocalName );
172 switch(GetDriveTypeA(lpLocalName))
174 case DRIVE_REMOTE:
175 GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
176 if (strlen(label) + 1 > *cbRemoteName)
178 *cbRemoteName = strlen(label) + 1;
179 return WN16_MORE_DATA;
181 strcpy( lpRemoteName, label );
182 *cbRemoteName = strlen(lpRemoteName) + 1;
183 return WN16_SUCCESS;
184 case DRIVE_REMOVABLE:
185 case DRIVE_FIXED:
186 case DRIVE_CDROM:
187 TRACE("file is local\n");
188 return WN16_NOT_CONNECTED;
189 default:
190 return WN16_BAD_LOCALNAME;
194 /**************************************************************************
195 * WNetRestoreConnection16 [USER.523]
197 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
199 FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
200 return WN16_NOT_SUPPORTED;
205 * Capabilities
208 /**************************************************************************
209 * WNetGetCaps16 [USER.513]
211 WORD WINAPI WNetGetCaps16( WORD capability )
213 switch (capability)
215 case WNNC16_SPEC_VERSION:
216 return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
218 case WNNC16_NET_TYPE:
219 /* hi byte = network type,
220 lo byte = network vendor (Netware = 0x03) [15 types] */
221 return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
223 case WNNC16_DRIVER_VERSION:
224 /* driver version of vendor */
225 return 0x100; /* WfW 3.11 */
227 case WNNC16_USER:
228 /* 1 = WNetGetUser is supported */
229 return 1;
231 case WNNC16_CONNECTION:
232 /* returns mask of the supported connection functions */
233 return WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
234 | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
235 | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
237 case WNNC16_PRINTING:
238 /* returns mask of the supported printing functions */
239 return WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
240 | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
241 | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
242 | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
243 | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
244 | WNNC16_PRT_WriteJob;
246 case WNNC16_DIALOG:
247 /* returns mask of the supported dialog functions */
248 return WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
249 | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
250 | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
251 | WNNC16_DLG_ConnectionDialog
252 /* | WNNC16_DLG_PrinterConnectDialog
253 | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
255 case WNNC16_ADMIN:
256 /* returns mask of the supported administration functions */
257 /* not sure if long file names is a good idea */
258 return WNNC16_ADM_GetDirectoryType
259 /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
260 | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
262 case WNNC16_ERROR:
263 /* returns mask of the supported error functions */
264 return WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
266 case WNNC16_PRINTMGREXT:
267 /* returns the Print Manager version in major and
268 minor format if Print Manager functions are available */
269 return 0x30e; /* printman version of WfW 3.11 */
271 case 0xffff:
272 /* Win 3.11 returns HMODULE of network driver here
273 FIXME: what should we return ?
274 logonoff.exe needs it, msmail crashes with wrong value */
275 return 0;
277 default:
278 return 0;
284 * Get User
287 /**************************************************************************
288 * WNetGetUser16 [USER.516]
290 WORD WINAPI WNetGetUser16( LPCSTR lpName, LPSTR szUser, LPINT16 nBufferSize )
292 FIXME( "(%p, %p, %p): stub\n", lpName, szUser, nBufferSize );
293 return WN16_NOT_SUPPORTED;
298 * Browsing
301 /**************************************************************************
302 * WNetDeviceMode16 [USER.514]
304 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
306 FIXME( "(%04x): stub\n", hWndOwner );
307 return WN16_NOT_SUPPORTED;
310 /**************************************************************************
311 * WNetBrowseDialog16 [USER.515]
313 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
315 FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
316 return WN16_NOT_SUPPORTED;
319 /********************************************************************
320 * WNetConnectDialog [USER.525]
322 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
324 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
325 return WN16_SUCCESS;
328 /**************************************************************************
329 * WNetDisconnectDialog16 [USER.526]
331 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
333 FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
334 return WN16_NOT_SUPPORTED;
337 /**************************************************************************
338 * WNetConnectionDialog16 [USER.527]
340 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
342 FIXME( "(%04x, %x): stub\n", hWndParent, iType );
343 return WN16_SUCCESS;
346 /**************************************************************************
347 * WNetViewQueueDialog16 [USER.528]
349 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
351 FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
352 return WN16_NOT_SUPPORTED;
355 /**************************************************************************
356 * WNetPropertyDialog16 [USER.529]
358 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
359 WORD nPropSel, LPSTR lpszName, WORD nType )
361 FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
362 hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
363 return WN16_NOT_SUPPORTED;
366 /**************************************************************************
367 * WNetGetPropertyText16 [USER.532]
369 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
370 LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
372 FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
373 iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
374 return WN16_NOT_SUPPORTED;
379 * Admin
382 /*********************************************************************
383 * WNetGetDirectoryType16 [USER.530] Decides whether resource is local
385 * RETURNS
386 * on success, puts one of the following in *lpType:
387 * - WNDT_NETWORK on a network
388 * - WNDT_LOCAL local
390 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
392 UINT type = GetDriveTypeA(lpName);
393 if ( type == DRIVE_NO_ROOT_DIR )
394 type = GetDriveTypeA(NULL);
396 *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
398 TRACE( "%s is %s\n", debugstr_a(lpName),
399 (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
400 return WN16_SUCCESS;
403 /**************************************************************************
404 * WNetDirectoryNotify16 [USER.531]
406 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
408 FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
409 (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
410 (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
411 (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
412 return WN16_NOT_SUPPORTED;
417 * Error handling
420 /**************************************************************************
421 * WNetGetError16 [USER.519]
423 WORD WINAPI WNetGetError16( LPINT16 nError )
425 FIXME( "(%p): stub\n", nError );
426 return WN16_NOT_SUPPORTED;
429 /**************************************************************************
430 * WNetGetErrorText16 [USER.520]
432 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
434 FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
435 return WN16_NET_ERROR;
438 /**************************************************************************
439 * WNetErrorText16 [USER.499]
441 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
443 FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );
444 return FALSE;