~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/user32/network.c

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * USER Windows Network functions
  3  *
  4  * Copyright 1995 Martin von Loewis
  5  *
  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.
 10  *
 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.
 15  *
 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
 19  */
 20 
 21 #include "config.h"
 22 
 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
 30 
 31 #include "windef.h"
 32 #include "winbase.h"
 33 #include "wine/winnet16.h"
 34 #include "wine/debug.h"
 35 
 36 WINE_DEFAULT_DEBUG_CHANNEL(wnet);
 37 
 38 /*
 39  * Remote printing
 40  */
 41 
 42 /**************************************************************************
 43  *              WNetOpenJob       [USER.501]
 44  */
 45 WORD WINAPI WNetOpenJob16( LPSTR szQueue, LPSTR szJobTitle, WORD nCopies, LPINT16 pfh )
 46 {
 47     FIXME( "(%s, %s, %d, %p): stub\n",
 48            debugstr_a(szQueue), debugstr_a(szJobTitle), nCopies, pfh );
 49     return WN16_NET_ERROR;
 50 }
 51 
 52 /**************************************************************************
 53  *              WNetCloseJob      [USER.502]
 54  */
 55 WORD WINAPI WNetCloseJob16( WORD fh, LPINT16 pidJob, LPSTR szQueue )
 56 {
 57     FIXME( "(%d, %p, %s): stub\n", fh, pidJob, debugstr_a(szQueue) );
 58     return WN16_NET_ERROR;
 59 }
 60 
 61 /**************************************************************************
 62  *              WNetWriteJob      [USER.524]
 63  */
 64 WORD WINAPI WNetWriteJob16( HANDLE16 hJob, LPSTR lpData, LPINT16 lpcbData )
 65 {
 66     FIXME( "(%04x, %p, %p): stub\n", hJob, lpData, lpcbData );
 67     return WN16_NET_ERROR;
 68 }
 69 
 70 /**************************************************************************
 71  *              WNetAbortJob       [USER.503]
 72  */
 73 WORD WINAPI WNetAbortJob16( LPSTR szQueue, WORD wJobId )
 74 {
 75     FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
 76     return WN16_NET_ERROR;
 77 }
 78 
 79 /**************************************************************************
 80  *              WNetHoldJob       [USER.504]
 81  */
 82 WORD WINAPI WNetHoldJob16( LPSTR szQueue, WORD wJobId )
 83 {
 84     FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
 85     return WN16_NET_ERROR;
 86 }
 87 
 88 /**************************************************************************
 89  *              WNetReleaseJob       [USER.505]
 90  */
 91 WORD WINAPI WNetReleaseJob16( LPSTR szQueue, WORD wJobId )
 92 {
 93     FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
 94     return WN16_NET_ERROR;
 95 }
 96 
 97 /**************************************************************************
 98  *              WNetCancelJob       [USER.506]
 99  */
100 WORD WINAPI WNetCancelJob16( LPSTR szQueue, WORD wJobId )
101 {
102     FIXME( "(%s, %d): stub\n", debugstr_a(szQueue), wJobId );
103     return WN16_NET_ERROR;
104 }
105 
106 /**************************************************************************
107  *              WNetSetJobCopies     [USER.507]
108  */
109 WORD WINAPI WNetSetJobCopies16( LPSTR szQueue, WORD wJobId, WORD nCopies )
110 {
111     FIXME( "(%s, %d, %d): stub\n", debugstr_a(szQueue), wJobId, nCopies );
112     return WN16_NET_ERROR;
113 }
114 
115 /**************************************************************************
116  *              WNetWatchQueue       [USER.508]
117  */
118 WORD WINAPI WNetWatchQueue16( HWND16 hWnd, LPSTR szLocal, LPSTR szUser, WORD nQueue )
119 {
120     FIXME( "(%04x, %s, %s, %d): stub\n",
121            hWnd, debugstr_a(szLocal), debugstr_a(szUser), nQueue );
122     return WN16_NET_ERROR;
123 }
124 
125 /**************************************************************************
126  *              WNetUnwatchQueue     [USER.509]
127  */
128 WORD WINAPI WNetUnwatchQueue16( LPSTR szQueue )
129 {
130     FIXME( "(%s): stub\n", debugstr_a(szQueue) );
131     return WN16_NET_ERROR;
132 }
133 
134 /**************************************************************************
135  *              WNetLockQueueData       [USER.510]
136  */
137 WORD WINAPI WNetLockQueueData16( LPSTR szQueue, LPSTR szUser,
138                                  LPQUEUESTRUCT16 *lplpQueueStruct )
139 {
140     FIXME( "(%s, %s, %p): stub\n",
141            debugstr_a(szQueue), debugstr_a(szUser), lplpQueueStruct );
142     return WN16_NET_ERROR;
143 }
144 
145 /**************************************************************************
146  *              WNetUnlockQueueData       [USER.511]
147  */
148 WORD WINAPI WNetUnlockQueueData16( LPSTR szQueue )
149 {
150     FIXME( "(%s): stub\n", debugstr_a(szQueue) );
151     return WN16_NET_ERROR;
152 }
153 
154 
155 /*
156  * Connections
157  */
158 
159 /********************************************************************
160  *  WNetAddConnection [USER.517]  Directs a local device to net
161  *
162  * Redirects a local device (either a disk drive or printer port)
163  * to a shared device on a remote server.
164  */
165 WORD WINAPI WNetAddConnection16( LPCSTR lpNetPath, LPCSTR lpPassWord,
166                                  LPCSTR lpLocalName )
167 {
168     FIXME( "(%s, %p, %s): stub\n",
169            debugstr_a(lpNetPath), lpPassWord, debugstr_a(lpLocalName) );
170     return WN16_NET_ERROR;
171 }
172 
173 /********************************************************************
174  *   WNetCancelConnection [USER.518]  undirects a local device
175  */
176 WORD WINAPI WNetCancelConnection16( LPSTR lpName, BOOL16 bForce )
177 {
178     FIXME( "(%s, %04X): stub\n", debugstr_a(lpName), bForce);
179     return WN16_NOT_SUPPORTED;
180 }
181 
182 /********************************************************************
183  * WNetGetConnection [USER.512] reverse-resolves a local device
184  */
185 WORD WINAPI WNetGetConnection16( LPSTR lpLocalName,
186                                  LPSTR lpRemoteName, UINT16 *cbRemoteName )
187 {
188     char label[32];
189 
190     TRACE( "local %s\n", lpLocalName );
191     switch(GetDriveTypeA(lpLocalName))
192     {
193     case DRIVE_REMOTE:
194         GetVolumeInformationA( lpLocalName, label, sizeof(label), NULL, NULL, NULL, NULL, 0 );
195         if (strlen(label) + 1 > *cbRemoteName)
196         {
197             *cbRemoteName = strlen(label) + 1;
198             return WN16_MORE_DATA;
199         }
200         strcpy( lpRemoteName, label );
201         *cbRemoteName = strlen(lpRemoteName) + 1;
202         return WN16_SUCCESS;
203     case DRIVE_REMOVABLE:
204     case DRIVE_FIXED:
205     case DRIVE_CDROM:
206         TRACE("file is local\n");
207         return WN16_NOT_CONNECTED;
208     default:
209         return WN16_BAD_LOCALNAME;
210     }
211 }
212 
213 /**************************************************************************
214  *              WNetRestoreConnection       [USER.523]
215  */
216 WORD WINAPI WNetRestoreConnection16( HWND16 hwndOwner, LPSTR lpszDevice )
217 {
218     FIXME( "(%04x, %s): stub\n", hwndOwner, debugstr_a(lpszDevice) );
219     return WN16_NOT_SUPPORTED;
220 }
221 
222 
223 /*
224  * Capabilities
225  */
226 
227 /**************************************************************************
228  *              WNetGetCaps             [USER.513]
229  */
230 WORD WINAPI WNetGetCaps16( WORD capability )
231 {
232     switch (capability)
233     {
234     case WNNC16_SPEC_VERSION:
235         return 0x30a; /* WfW 3.11 (and apparently other 3.1x) */
236 
237     case WNNC16_NET_TYPE:
238         /* hi byte = network type,
239            lo byte = network vendor (Netware = 0x03) [15 types] */
240         return WNNC16_NET_MultiNet | WNNC16_SUBNET_WinWorkgroups;
241 
242     case WNNC16_DRIVER_VERSION:
243         /* driver version of vendor */
244         return 0x100; /* WfW 3.11 */
245 
246     case WNNC16_USER:
247         /* 1 = WNetGetUser is supported */
248         return 1;
249 
250     case WNNC16_CONNECTION:
251         /* returns mask of the supported connection functions */
252         return   WNNC16_CON_AddConnection | WNNC16_CON_CancelConnection
253                | WNNC16_CON_GetConnections /* | WNNC16_CON_AutoConnect */
254                | WNNC16_CON_BrowseDialog | WNNC16_CON_RestoreConnection;
255 
256     case WNNC16_PRINTING:
257         /* returns mask of the supported printing functions */
258         return   WNNC16_PRT_OpenJob | WNNC16_PRT_CloseJob | WNNC16_PRT_HoldJob
259                | WNNC16_PRT_ReleaseJob | WNNC16_PRT_CancelJob
260                | WNNC16_PRT_SetJobCopies | WNNC16_PRT_WatchQueue
261                | WNNC16_PRT_UnwatchQueue | WNNC16_PRT_LockQueueData
262                | WNNC16_PRT_UnlockQueueData | WNNC16_PRT_AbortJob
263                | WNNC16_PRT_WriteJob;
264 
265     case WNNC16_DIALOG:
266         /* returns mask of the supported dialog functions */
267         return   WNNC16_DLG_DeviceMode | WNNC16_DLG_BrowseDialog
268                | WNNC16_DLG_ConnectDialog | WNNC16_DLG_DisconnectDialog
269                | WNNC16_DLG_ViewQueueDialog | WNNC16_DLG_PropertyDialog
270                | WNNC16_DLG_ConnectionDialog
271             /* | WNNC16_DLG_PrinterConnectDialog
272                | WNNC16_DLG_SharesDialog | WNNC16_DLG_ShareAsDialog */;
273 
274     case WNNC16_ADMIN:
275         /* returns mask of the supported administration functions */
276         /* not sure if long file names is a good idea */
277         return   WNNC16_ADM_GetDirectoryType
278             /* | WNNC16_ADM_DirectoryNotify */ /*not yet supported*/
279                | WNNC16_ADM_LongNames /* | WNNC16_ADM_SetDefaultDrive */;
280 
281     case WNNC16_ERROR:
282         /* returns mask of the supported error functions */
283         return   WNNC16_ERR_GetError | WNNC16_ERR_GetErrorText;
284 
285     case WNNC16_PRINTMGREXT:
286         /* returns the Print Manager version in major and
287            minor format if Print Manager functions are available */
288         return 0x30e; /* printman version of WfW 3.11 */
289 
290     case 0xffff:
291         /* Win 3.11 returns HMODULE of network driver here
292            FIXME: what should we return ?
293            logonoff.exe needs it, msmail crashes with wrong value */
294         return 0;
295 
296     default:
297         return 0;
298     }
299 }
300 
301 
302 /*
303  * Get User
304  */
305 
306 /**************************************************************************
307  *              WNetGetUser                     [USER.516]
308  */
309 WORD WINAPI WNetGetUser16( LPCSTR lpName, LPSTR szUser, LPINT16 nBufferSize )
310 {
311     FIXME( "(%p, %p, %p): stub\n", lpName, szUser, nBufferSize );
312     return WN16_NOT_SUPPORTED;
313 }
314 
315 
316 /*
317  * Browsing
318  */
319 
320 /**************************************************************************
321  *              WNetDeviceMode       [USER.514]
322  */
323 WORD WINAPI WNetDeviceMode16( HWND16 hWndOwner )
324 {
325     FIXME( "(%04x): stub\n", hWndOwner );
326     return WN16_NOT_SUPPORTED;
327 }
328 
329 /**************************************************************************
330  *              WNetBrowseDialog       [USER.515]
331  */
332 WORD WINAPI WNetBrowseDialog16( HWND16 hParent, WORD nType, LPSTR szPath )
333 {
334     FIXME( "(%04x, %x, %s): stub\n", hParent, nType, szPath );
335     return WN16_NOT_SUPPORTED;
336 }
337 
338 /********************************************************************
339  *              WNetConnectDialog       [USER.525]
340  */
341 WORD WINAPI WNetConnectDialog( HWND16 hWndParent, WORD iType )
342 {
343     FIXME( "(%04x, %x): stub\n", hWndParent, iType );
344     return WN16_SUCCESS;
345 }
346 
347 /**************************************************************************
348  *              WNetDisconnectDialog       [USER.526]
349  */
350 WORD WINAPI WNetDisconnectDialog16( HWND16 hwndOwner, WORD iType )
351 {
352     FIXME( "(%04x, %x): stub\n", hwndOwner, iType );
353     return WN16_NOT_SUPPORTED;
354 }
355 
356 /**************************************************************************
357  *              WNetConnectionDialog     [USER.527]
358  */
359 WORD WINAPI WNetConnectionDialog16( HWND16 hWndParent, WORD iType )
360 {
361     FIXME( "(%04x, %x): stub\n", hWndParent, iType );
362     return WN16_SUCCESS;
363 }
364 
365 /**************************************************************************
366  *              WNetViewQueueDialog       [USER.528]
367  */
368 WORD WINAPI WNetViewQueueDialog16( HWND16 hwndOwner, LPSTR lpszQueue )
369 {
370     FIXME(" (%04x, %s): stub\n", hwndOwner, debugstr_a(lpszQueue) );
371     return WN16_NOT_SUPPORTED;
372 }
373 
374 /**************************************************************************
375  *              WNetPropertyDialog       [USER.529]
376  */
377 WORD WINAPI WNetPropertyDialog16( HWND16 hwndParent, WORD iButton,
378                                   WORD nPropSel, LPSTR lpszName, WORD nType )
379 {
380     FIXME( "(%04x, %x, %x, %s, %x ): stub\n",
381           hwndParent, iButton, nPropSel, debugstr_a(lpszName), nType );
382     return WN16_NOT_SUPPORTED;
383 }
384 
385 /**************************************************************************
386  *              WNetGetPropertyText       [USER.532]
387  */
388 WORD WINAPI WNetGetPropertyText16( WORD iButton, WORD nPropSel, LPSTR lpszName,
389                                    LPSTR lpszButtonName, WORD cbButtonName, WORD nType )
390 {
391     FIXME( "(%04x, %04x, %s, %s, %04x): stub\n",
392            iButton, nPropSel, debugstr_a(lpszName), debugstr_a(lpszButtonName), nType);
393     return WN16_NOT_SUPPORTED;
394 }
395 
396 
397 /*
398  * Admin
399  */
400 
401 /*********************************************************************
402  *  WNetGetDirectoryType [USER.530]  Decides whether resource is local
403  *
404  * RETURNS
405  *    on success,  puts one of the following in *lpType:
406  * - WNDT_NETWORK   on a network
407  * - WNDT_LOCAL     local
408  */
409 WORD WINAPI WNetGetDirectoryType16( LPSTR lpName, LPINT16 lpType )
410 {
411     UINT type = GetDriveTypeA(lpName);
412     if ( type == DRIVE_NO_ROOT_DIR )
413         type = GetDriveTypeA(NULL);
414 
415     *lpType = (type == DRIVE_REMOTE)? WNDT_NETWORK : WNDT_NORMAL;
416 
417     TRACE( "%s is %s\n", debugstr_a(lpName),
418            (*lpType == WNDT_NETWORK)? "WNDT_NETWORK" : "WNDT_NORMAL" );
419     return WN16_SUCCESS;
420 }
421 
422 /**************************************************************************
423  *              WNetDirectoryNotify       [USER.531]
424  */
425 WORD WINAPI WNetDirectoryNotify16( HWND16 hwndOwner, LPSTR lpDir, WORD wOper )
426 {
427     FIXME( "(%04x, %s, %s): stub\n", hwndOwner, debugstr_a(lpDir),
428            (wOper == WNDN_MKDIR)? "WNDN_MKDIR" :
429            (wOper == WNDN_MVDIR)? "WNDN_MVDIR" :
430            (wOper == WNDN_RMDIR)? "WNDN_RMDIR" : "unknown" );
431     return WN16_NOT_SUPPORTED;
432 }
433 
434 
435 /*
436  * Error handling
437  */
438 
439 /**************************************************************************
440  *              WNetGetError       [USER.519]
441  */
442 WORD WINAPI WNetGetError16( LPINT16 nError )
443 {
444     FIXME( "(%p): stub\n", nError );
445     return WN16_NOT_SUPPORTED;
446 }
447 
448 /**************************************************************************
449  *              WNetGetErrorText       [USER.520]
450  */
451 WORD WINAPI WNetGetErrorText16( WORD nError, LPSTR lpBuffer, LPINT16 nBufferSize )
452 {
453     FIXME( "(%x, %p, %p): stub\n", nError, lpBuffer, nBufferSize );
454     return WN16_NET_ERROR;
455 }
456 
457 /**************************************************************************
458  *              WNetErrorText       [USER.499]
459  */
460 WORD WINAPI WNetErrorText16( WORD nError, LPSTR lpszText, WORD cbText )
461 {
462     FIXME("(%x, %p, %x): stub\n", nError, lpszText, cbText );
463     return FALSE;
464 }
465 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.