ReactOS  0.4.14-dev-358-gbef841c
wnet.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
#include "winioctl.h"
#include "winnetwk.h"
#include "npapi.h"
#include "winreg.h"
#include "winuser.h"
#include "ddk/mountmgr.h"
#include "wine/debug.h"
#include "mprres.h"
#include "wnetpriv.h"
Include dependency graph for wnet.c:

Go to the source code of this file.

Classes

struct  _WNetProvider
 
struct  _WNetProviderTable
 
struct  _WNetEnumerator
 
struct  use_connection_context
 

Macros

#define WINE_MOUNTMGR_EXTENSIONS
 
#define WNET_ENUMERATOR_TYPE_GLOBAL   0
 
#define WNET_ENUMERATOR_TYPE_PROVIDER   1
 
#define WNET_ENUMERATOR_TYPE_CONTEXT   2
 
#define WNET_ENUMERATOR_TYPE_CONNECTED   3
 
#define WNET_ENUMERATOR_TYPE_REMEMBERED   4
 
#define BAD_PROVIDER_INDEX   (DWORD)0xffffffff
 
#define MPR_GETPROC(proc)   ((PF_##proc)GetProcAddress(hLib, #proc))
 

Typedefs

typedef struct _WNetProvider WNetProvider
 
typedef struct _WNetProviderPWNetProvider
 
typedef struct _WNetProviderTable WNetProviderTable
 
typedef struct _WNetProviderTablePWNetProviderTable
 
typedef struct _WNetEnumerator WNetEnumerator
 
typedef struct _WNetEnumeratorPWNetEnumerator
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (mpr)
 
static DWORD _findProviderIndexW (LPCWSTR lpProvider)
 
static void _tryLoadProvider (PCWSTR provider)
 
void wnetInit (HINSTANCE hInstDll)
 
void wnetFree (void)
 
static LPNETRESOURCEW _copyNetResourceForEnumW (LPNETRESOURCEW lpNet)
 
static void _freeEnumNetResource (LPNETRESOURCEW lpNet)
 
static PWNetEnumerator _createGlobalEnumeratorW (DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEW lpNet)
 
static PWNetEnumerator _createProviderEnumerator (DWORD dwScope, DWORD dwType, DWORD dwUsage, DWORD index, HANDLE handle)
 
static PWNetEnumerator _createContextEnumerator (DWORD dwScope, DWORD dwType, DWORD dwUsage)
 
static PWNetEnumerator _createConnectedEnumerator (DWORD dwScope, DWORD dwType, DWORD dwUsage)
 
static PWNetEnumerator _createRememberedEnumerator (DWORD dwScope, DWORD dwType, HKEY remembered)
 
static DWORD _thunkNetResourceArrayWToA (const NETRESOURCEW *lpNetArrayIn, const DWORD *lpcCount, LPVOID lpBuffer, const DWORD *lpBufferSize)
 
static DWORD _thunkNetResourceArrayAToW (const NETRESOURCEA *lpNetArrayIn, const DWORD *lpcCount, LPVOID lpBuffer, const DWORD *lpBufferSize)
 
DWORD WINAPI WNetOpenEnumA (DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEA lpNet, LPHANDLE lphEnum)
 
DWORD WINAPI WNetOpenEnumW (DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEW lpNet, LPHANDLE lphEnum)
 
DWORD WINAPI WNetEnumResourceA (HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
static DWORD _countProviderBytesW (PWNetProvider provider)
 
static DWORD _enumerateProvidersW (PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, const DWORD *lpBufferSize)
 
static DWORD _globalEnumeratorAdvance (PWNetEnumerator enumerator)
 
static DWORD _enumerateGlobalPassthroughW (PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
static DWORD _enumerateGlobalW (PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
static DWORD _enumerateProviderW (PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
static DWORD _enumerateContextW (PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
static DWORD _copyStringToEnumW (const WCHAR *source, DWORD *left, void **end)
 
static DWORD _enumerateConnectedW (PWNetEnumerator enumerator, DWORD *user_count, void *user_buffer, DWORD *user_size)
 
static WCHARget_reg_str (HKEY hkey, const WCHAR *value, DWORD *len)
 
static DWORD _enumeratorRememberedW (PWNetEnumerator enumerator, DWORD *user_count, void *user_buffer, DWORD *user_size)
 
DWORD WINAPI WNetEnumResourceW (HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetCloseEnum (HANDLE hEnum)
 
DWORD WINAPI WNetGetResourceInformationA (LPNETRESOURCEA lpNetResource, LPVOID lpBuffer, LPDWORD cbBuffer, LPSTR *lplpSystem)
 
DWORD WINAPI WNetGetResourceInformationW (LPNETRESOURCEW lpNetResource, LPVOID lpBuffer, LPDWORD cbBuffer, LPWSTR *lplpSystem)
 
DWORD WINAPI WNetGetResourceParentA (LPNETRESOURCEA lpNetResource, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetGetResourceParentW (LPNETRESOURCEW lpNetResource, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetAddConnectionA (LPCSTR lpRemoteName, LPCSTR lpPassword, LPCSTR lpLocalName)
 
DWORD WINAPI WNetAddConnectionW (LPCWSTR lpRemoteName, LPCWSTR lpPassword, LPCWSTR lpLocalName)
 
DWORD WINAPI WNetAddConnection2A (LPNETRESOURCEA lpNetResource, LPCSTR lpPassword, LPCSTR lpUserID, DWORD dwFlags)
 
DWORD WINAPI WNetAddConnection2W (LPNETRESOURCEW lpNetResource, LPCWSTR lpPassword, LPCWSTR lpUserID, DWORD dwFlags)
 
DWORD WINAPI WNetAddConnection3A (HWND hwndOwner, LPNETRESOURCEA lpNetResource, LPCSTR lpPassword, LPCSTR lpUserID, DWORD dwFlags)
 
DWORD WINAPI WNetAddConnection3W (HWND hwndOwner, LPNETRESOURCEW lpNetResource, LPCWSTR lpPassword, LPCWSTR lpUserID, DWORD dwFlags)
 
static DWORD use_connection_pre_set_accessnameW (struct use_connection_context *ctxt, WCHAR *local_name)
 
static void use_connection_set_accessnameW (struct use_connection_context *ctxt, WCHAR *local_name)
 
static DWORD wnet_use_provider (struct use_connection_context *ctxt, NETRESOURCEW *netres, WNetProvider *provider, BOOLEAN redirect)
 
static DWORD wnet_use_connection (struct use_connection_context *ctxt)
 
DWORD WINAPI WNetUseConnectionW (HWND hwndOwner, NETRESOURCEW *resource, LPCWSTR password, LPCWSTR userid, DWORD flags, LPWSTR accessname, DWORD *buffer_size, DWORD *result)
 
static DWORD use_connection_pre_set_accessnameA (struct use_connection_context *ctxt, WCHAR *local_name)
 
static void use_connection_set_accessnameA (struct use_connection_context *ctxt, WCHAR *local_name)
 
static LPWSTR strdupAtoW (LPCSTR str)
 
static void netresource_a_to_w (NETRESOURCEA *resourceA, NETRESOURCEW *resourceW)
 
static void free_netresourceW (NETRESOURCEW *resource)
 
DWORD WINAPI WNetUseConnectionA (HWND hwndOwner, NETRESOURCEA *resource, LPCSTR password, LPCSTR userid, DWORD flags, LPSTR accessname, DWORD *buffer_size, DWORD *result)
 
DWORD WINAPI WNetCancelConnectionA (LPCSTR lpName, BOOL fForce)
 
DWORD WINAPI WNetCancelConnectionW (LPCWSTR lpName, BOOL fForce)
 
DWORD WINAPI WNetCancelConnection2A (LPCSTR lpName, DWORD dwFlags, BOOL fForce)
 
DWORD WINAPI WNetCancelConnection2W (LPCWSTR lpName, DWORD dwFlags, BOOL fForce)
 
DWORD WINAPI WNetRestoreConnectionA (HWND hwndOwner, LPCSTR lpszDevice)
 
DWORD WINAPI WNetRestoreConnectionW (HWND hwndOwner, LPCWSTR lpszDevice)
 
DWORD WINAPI WNetGetConnectionA (LPCSTR lpLocalName, LPSTR lpRemoteName, LPDWORD lpBufferSize)
 
static DWORD get_drive_connection (WCHAR letter, LPWSTR remote, LPDWORD size)
 
DWORD WINAPI WNetGetConnectionW (LPCWSTR lpLocalName, LPWSTR lpRemoteName, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetSetConnectionA (LPCSTR lpName, DWORD dwProperty, LPVOID pvValue)
 
DWORD WINAPI WNetSetConnectionW (LPCWSTR lpName, DWORD dwProperty, LPVOID pvValue)
 
DWORD WINAPI WNetGetUniversalNameA (LPCSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetGetUniversalNameW (LPCWSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetClearConnections (HWND owner)
 
DWORD WINAPI WNetGetUserA (LPCSTR lpName, LPSTR lpUserID, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetGetUserW (LPCWSTR lpName, LPWSTR lpUserID, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetConnectionDialog (HWND hwnd, DWORD dwType)
 
DWORD WINAPI WNetConnectionDialog1A (LPCONNECTDLGSTRUCTA lpConnDlgStruct)
 
DWORD WINAPI WNetConnectionDialog1W (LPCONNECTDLGSTRUCTW lpConnDlgStruct)
 
DWORD WINAPI WNetDisconnectDialog (HWND hwnd, DWORD dwType)
 
DWORD WINAPI WNetDisconnectDialog1A (LPDISCDLGSTRUCTA lpConnDlgStruct)
 
DWORD WINAPI WNetDisconnectDialog1W (LPDISCDLGSTRUCTW lpConnDlgStruct)
 
DWORD WINAPI WNetGetLastErrorA (LPDWORD lpError, LPSTR lpErrorBuf, DWORD nErrorBufSize, LPSTR lpNameBuf, DWORD nNameBufSize)
 
DWORD WINAPI WNetGetLastErrorW (LPDWORD lpError, LPWSTR lpErrorBuf, DWORD nErrorBufSize, LPWSTR lpNameBuf, DWORD nNameBufSize)
 
DWORD WINAPI WNetGetNetworkInformationA (LPCSTR lpProvider, LPNETINFOSTRUCT lpNetInfoStruct)
 
DWORD WINAPI WNetGetNetworkInformationW (LPCWSTR lpProvider, LPNETINFOSTRUCT lpNetInfoStruct)
 
DWORD WINAPI WNetGetProviderNameA (DWORD dwNetType, LPSTR lpProvider, LPDWORD lpBufferSize)
 
DWORD WINAPI WNetGetProviderNameW (DWORD dwNetType, LPWSTR lpProvider, LPDWORD lpBufferSize)
 

Variables

static PWNetProviderTable providerTable
 
static const WCHAR connectionType [] = { 'C','o','n','n','e','c','t','i','o','n','T','y','p','e',0 }
 
static const WCHAR providerName [] = { 'P','r','o','v','i','d','e','r','N','a','m','e',0 }
 
static const WCHAR remotePath [] = { 'R','e','m','o','t','e','P','a','t','h',0 }
 
static const WCHAR providerType [] = { 'P','r','o','v','i','d','e','r','T','y','p','e',0 }
 
static const WCHAR userName [] = { 'U','s','e','r','N','a','m','e',0 }
 

Macro Definition Documentation

◆ BAD_PROVIDER_INDEX

#define BAD_PROVIDER_INDEX   (DWORD)0xffffffff

Definition at line 120 of file wnet.c.

◆ MPR_GETPROC

#define MPR_GETPROC (   proc)    ((PF_##proc)GetProcAddress(hLib, #proc))

◆ WINE_MOUNTMGR_EXTENSIONS

#define WINE_MOUNTMGR_EXTENSIONS

Definition at line 33 of file wnet.c.

◆ WNET_ENUMERATOR_TYPE_CONNECTED

#define WNET_ENUMERATOR_TYPE_CONNECTED   3

Definition at line 81 of file wnet.c.

◆ WNET_ENUMERATOR_TYPE_CONTEXT

#define WNET_ENUMERATOR_TYPE_CONTEXT   2

Definition at line 80 of file wnet.c.

◆ WNET_ENUMERATOR_TYPE_GLOBAL

#define WNET_ENUMERATOR_TYPE_GLOBAL   0

Definition at line 78 of file wnet.c.

◆ WNET_ENUMERATOR_TYPE_PROVIDER

#define WNET_ENUMERATOR_TYPE_PROVIDER   1

Definition at line 79 of file wnet.c.

◆ WNET_ENUMERATOR_TYPE_REMEMBERED

#define WNET_ENUMERATOR_TYPE_REMEMBERED   4

Definition at line 82 of file wnet.c.

Typedef Documentation

◆ PWNetEnumerator

◆ PWNetProvider

◆ PWNetProviderTable

◆ WNetEnumerator

◆ WNetProvider

◆ WNetProviderTable

Function Documentation

◆ _copyNetResourceForEnumW()

static LPNETRESOURCEW _copyNetResourceForEnumW ( LPNETRESOURCEW  lpNet)
static

Definition at line 527 of file wnet.c.

528 {
530 
531  if (lpNet)
532  {
533  ret = HeapAlloc(GetProcessHeap(), 0, sizeof(NETRESOURCEW));
534  if (ret)
535  {
536  size_t len;
537 
538  *ret = *lpNet;
539  ret->lpLocalName = ret->lpComment = ret->lpProvider = NULL;
540  if (lpNet->lpRemoteName)
541  {
542  len = lstrlenW(lpNet->lpRemoteName) + 1;
543  ret->lpRemoteName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
544  if (ret->lpRemoteName)
545  lstrcpyW(ret->lpRemoteName, lpNet->lpRemoteName);
546  }
547  }
548  }
549  else
550  ret = NULL;
551  return ret;
552 }
#define lstrlenW
Definition: compat.h:415
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
LPWSTR lpRemoteName
Definition: winnetwk.h:182
#define lstrcpyW
Definition: compat.h:414

Referenced by _createGlobalEnumeratorW().

◆ _copyStringToEnumW()

static DWORD _copyStringToEnumW ( const WCHAR source,
DWORD left,
void **  end 
)
static

Definition at line 1418 of file wnet.c.

1419 {
1420  DWORD len;
1421  WCHAR* local = *end;
1422 
1423  len = lstrlenW(source) + 1;
1424  len *= sizeof(WCHAR);
1425  if (*left < len)
1426  return WN_MORE_DATA;
1427 
1428  local -= (len / sizeof(WCHAR));
1429  memcpy(local, source, len);
1430  *left -= len;
1431  *end = local;
1432 
1433  return WN_SUCCESS;
1434 }
#define WN_SUCCESS
Definition: winnetwk.h:111
GLuint GLuint end
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:415
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint left
Definition: glext.h:7726
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define local
Definition: zutil.h:30
#define WN_MORE_DATA
Definition: winnetwk.h:117

Referenced by _enumerateConnectedW().

◆ _countProviderBytesW()

static DWORD _countProviderBytesW ( PWNetProvider  provider)
static

Definition at line 1102 of file wnet.c.

1103 {
1104  DWORD ret;
1105 
1106  if (provider)
1107  {
1108  ret = sizeof(NETRESOURCEW);
1109  ret += 2 * (lstrlenW(provider->name) + 1) * sizeof(WCHAR);
1110  }
1111  else
1112  ret = 0;
1113  return ret;
1114 }
struct _NETRESOURCEW NETRESOURCEW
PWSTR name
Definition: wnet.c:53
#define lstrlenW
Definition: compat.h:415
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret

Referenced by _enumerateProvidersW().

◆ _createConnectedEnumerator()

static PWNetEnumerator _createConnectedEnumerator ( DWORD  dwScope,
DWORD  dwType,
DWORD  dwUsage 
)
static

Definition at line 619 of file wnet.c.

621 {
623  if (ret)
624  {
626  ret->dwScope = dwScope;
627  ret->dwType = dwType;
628  ret->dwUsage = dwUsage;
629  ret->specific.handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HANDLE) * providerTable->numProviders);
630  if (!ret->specific.handles)
631  {
632  HeapFree(GetProcessHeap(), 0, ret);
633  ret = NULL;
634  }
635  }
636  return ret;
637 }
DWORD numProviders
Definition: wnet.c:74
static PWNetProviderTable providerTable
Definition: wnet.c:127
smooth NULL
Definition: ftsmooth.c:416
#define WNET_ENUMERATOR_TYPE_CONNECTED
Definition: wnet.c:81
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WNetOpenEnumW().

◆ _createContextEnumerator()

static PWNetEnumerator _createContextEnumerator ( DWORD  dwScope,
DWORD  dwType,
DWORD  dwUsage 
)
static

Definition at line 603 of file wnet.c.

605 {
608 
609  if (ret)
610  {
611  ret->enumType = WNET_ENUMERATOR_TYPE_CONTEXT;
612  ret->dwScope = dwScope;
613  ret->dwType = dwType;
614  ret->dwUsage = dwUsage;
615  }
616  return ret;
617 }
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define WNET_ENUMERATOR_TYPE_CONTEXT
Definition: wnet.c:80
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by WNetOpenEnumW().

◆ _createGlobalEnumeratorW()

static PWNetEnumerator _createGlobalEnumeratorW ( DWORD  dwScope,
DWORD  dwType,
DWORD  dwUsage,
LPNETRESOURCEW  lpNet 
)
static

Definition at line 563 of file wnet.c.

565 {
568 
569  if (ret)
570  {
571  ret->enumType = WNET_ENUMERATOR_TYPE_GLOBAL;
572  ret->dwScope = dwScope;
573  ret->dwType = dwType;
574  ret->dwUsage = dwUsage;
575  ret->specific.net = _copyNetResourceForEnumW(lpNet);
576  }
577  return ret;
578 }
static LPNETRESOURCEW _copyNetResourceForEnumW(LPNETRESOURCEW lpNet)
Definition: wnet.c:527
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by WNetOpenEnumW().

◆ _createProviderEnumerator()

static PWNetEnumerator _createProviderEnumerator ( DWORD  dwScope,
DWORD  dwType,
DWORD  dwUsage,
DWORD  index,
HANDLE  handle 
)
static

Definition at line 580 of file wnet.c.

582 {
584 
586  ret = NULL;
587  else
588  {
590  if (ret)
591  {
593  ret->providerIndex = index;
594  ret->dwScope = dwScope;
595  ret->dwType = dwType;
596  ret->dwUsage = dwUsage;
597  ret->handle = handle;
598  }
599  }
600  return ret;
601 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
DWORD numProviders
Definition: wnet.c:74
static PWNetProviderTable providerTable
Definition: wnet.c:127
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define index(s, c)
Definition: various.h:29
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define WNET_ENUMERATOR_TYPE_PROVIDER
Definition: wnet.c:79

Referenced by WNetOpenEnumW().

◆ _createRememberedEnumerator()

static PWNetEnumerator _createRememberedEnumerator ( DWORD  dwScope,
DWORD  dwType,
HKEY  remembered 
)
static

Definition at line 639 of file wnet.c.

641 {
643  if (ret)
644  {
646  ret->dwScope = dwScope;
647  ret->dwType = dwType;
648  ret->specific.remembered.registry = remembered;
649  }
650  return ret;
651 }
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int ret
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define WNET_ENUMERATOR_TYPE_REMEMBERED
Definition: wnet.c:82

Referenced by WNetOpenEnumW().

◆ _enumerateConnectedW()

static DWORD _enumerateConnectedW ( PWNetEnumerator  enumerator,
DWORD user_count,
void user_buffer,
DWORD user_size 
)
static

Definition at line 1436 of file wnet.c.

1438 {
1439  DWORD ret, index, count, total_count, size, i, left;
1440  void* end;
1441  NETRESOURCEW* curr, * buffer;
1442  HANDLE* handles;
1443 
1444  if (!enumerator)
1445  return WN_BAD_POINTER;
1446  if (enumerator->enumType != WNET_ENUMERATOR_TYPE_CONNECTED)
1447  return WN_BAD_VALUE;
1448  if (!user_count || !user_buffer || !user_size)
1449  return WN_BAD_POINTER;
1450  if (!providerTable)
1451  return WN_NO_NETWORK;
1452 
1453  handles = enumerator->specific.handles;
1454  left = *user_size;
1455  size = *user_size;
1456  buffer = HeapAlloc(GetProcessHeap(), 0, *user_size);
1457  if (!buffer)
1458  return WN_NO_NETWORK;
1459 
1460  curr = user_buffer;
1461  end = (char *)user_buffer + size;
1462  count = *user_count;
1463  total_count = 0;
1464 
1466  for (index = 0; index < providerTable->numProviders; index++)
1467  {
1469  {
1470  if (handles[index] == 0)
1471  {
1472  ret = providerTable->table[index].openEnum(enumerator->dwScope,
1473  enumerator->dwType,
1474  enumerator->dwUsage,
1475  NULL, &handles[index]);
1476  if (ret != WN_SUCCESS)
1477  continue;
1478  }
1479 
1481  &count, buffer,
1482  &size);
1483  total_count += count;
1484  if (ret == WN_MORE_DATA)
1485  break;
1486 
1487  if (ret == WN_SUCCESS)
1488  {
1489  for (i = 0; i < count; ++i)
1490  {
1491  if (left < sizeof(NETRESOURCEW))
1492  {
1493  ret = WN_MORE_DATA;
1494  break;
1495  }
1496 
1497  memcpy(curr, &buffer[i], sizeof(NETRESOURCEW));
1498  left -= sizeof(NETRESOURCEW);
1499 
1500  ret = _copyStringToEnumW(buffer[i].lpLocalName, &left, &end);
1501  if (ret == WN_MORE_DATA)
1502  break;
1503  curr->lpLocalName = end;
1504 
1505  ret = _copyStringToEnumW(buffer[i].lpRemoteName, &left, &end);
1506  if (ret == WN_MORE_DATA)
1507  break;
1508  curr->lpRemoteName = end;
1509 
1510  ret = _copyStringToEnumW(buffer[i].lpProvider, &left, &end);
1511  if (ret == WN_MORE_DATA)
1512  break;
1513  curr->lpProvider = end;
1514 
1515  ++curr;
1516  }
1517 
1518  size = left;
1519  }
1520 
1521  if (*user_count != -1)
1522  count = *user_count - total_count;
1523  else
1524  count = *user_count;
1525  }
1526  }
1527 
1528  if (total_count == 0)
1530 
1531  *user_count = total_count;
1532  if (ret != WN_MORE_DATA && ret != WN_NO_MORE_ENTRIES)
1533  ret = WN_SUCCESS;
1534 
1536 
1537  TRACE("Returning %d\n", ret);
1538  return ret;
1539 }
PF_NPOpenEnum openEnum
Definition: wnet.c:58
struct _NETRESOURCEW NETRESOURCEW
PF_NPEnumResource enumResource
Definition: wnet.c:59
DWORD dwScope
Definition: wnet.c:105
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
static DWORD _copyStringToEnumW(const WCHAR *source, DWORD *left, void **end)
Definition: wnet.c:1418
GLuint GLuint GLsizei count
Definition: gl.h:1545
DWORD enumType
Definition: wnet.c:101
GLuint buffer
Definition: glext.h:5915
GLuint GLuint end
Definition: gl.h:1545
DWORD dwUsage
Definition: wnet.c:107
#define WN_BAD_VALUE
Definition: winnetwk.h:119
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WNetProvider table[1]
Definition: wnet.c:75
smooth NULL
Definition: ftsmooth.c:416
#define WNET_ENUMERATOR_TYPE_CONNECTED
Definition: wnet.c:81
GLuint index
Definition: glext.h:6031
LPWSTR lpLocalName
Definition: winnetwk.h:181
HANDLE * handles
Definition: wnet.c:111
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static object_header_t ** handles
Definition: handle.c:46
#define WN_NO_NETWORK
Definition: winnetwk.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint left
Definition: glext.h:7726
union _WNetEnumerator::@458 specific
DWORD dwEnumScopes
Definition: wnet.c:57
int ret
#define index(s, c)
Definition: various.h:29
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define WN_BAD_POINTER
Definition: winnetwk.h:118
LPWSTR lpRemoteName
Definition: winnetwk.h:182
DWORD dwType
Definition: wnet.c:106
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
#define WN_MORE_DATA
Definition: winnetwk.h:117
LPWSTR lpProvider
Definition: winnetwk.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WNetEnumResourceW().

◆ _enumerateContextW()

static DWORD _enumerateContextW ( PWNetEnumerator  enumerator,
LPDWORD  lpcCount,
LPVOID  lpBuffer,
LPDWORD  lpBufferSize 
)
static

Definition at line 1341 of file wnet.c.

1343 {
1344  DWORD ret;
1345  size_t cchEntireNetworkLen, bytesNeeded;
1346 
1347  if (!enumerator)
1348  return WN_BAD_POINTER;
1349  if (enumerator->enumType != WNET_ENUMERATOR_TYPE_CONTEXT)
1350  return WN_BAD_VALUE;
1351  if (!lpcCount)
1352  return WN_BAD_POINTER;
1353  if (!lpBuffer)
1354  return WN_BAD_POINTER;
1355  if (!lpBufferSize)
1356  return WN_BAD_POINTER;
1357  if (!providerTable)
1358  return WN_NO_NETWORK;
1359 
1360  cchEntireNetworkLen = lstrlenW(providerTable->entireNetwork) + 1;
1361  bytesNeeded = sizeof(NETRESOURCEW) + cchEntireNetworkLen * sizeof(WCHAR);
1362  if (*lpBufferSize < bytesNeeded)
1363  {
1364  *lpBufferSize = bytesNeeded;
1365  ret = WN_MORE_DATA;
1366  }
1367  else
1368  {
1369  LPNETRESOURCEW lpNet = lpBuffer;
1370 
1371  lpNet->dwScope = RESOURCE_GLOBALNET;
1372  lpNet->dwType = enumerator->dwType;
1375  lpNet->lpLocalName = NULL;
1376  lpNet->lpRemoteName = NULL;
1377  lpNet->lpProvider = NULL;
1378  /* odd, but correct: put comment at end of buffer, so it won't get
1379  * overwritten by subsequent calls to a provider's enumResource
1380  */
1381  lpNet->lpComment = (LPWSTR)((LPBYTE)lpBuffer + *lpBufferSize -
1382  (cchEntireNetworkLen * sizeof(WCHAR)));
1384  ret = WN_SUCCESS;
1385  }
1386  if (ret == WN_SUCCESS)
1387  {
1388  DWORD bufferSize = *lpBufferSize - bytesNeeded;
1389 
1390  /* "Entire Network" entry enumerated--morph this into a global
1391  * enumerator. enumerator->lpNet continues to be NULL, since it has
1392  * no meaning when the scope isn't RESOURCE_GLOBALNET.
1393  */
1394  enumerator->enumType = WNET_ENUMERATOR_TYPE_GLOBAL;
1395  ret = _enumerateGlobalW(enumerator, lpcCount,
1396  (LPBYTE)lpBuffer + bytesNeeded, &bufferSize);
1397  if (ret == WN_SUCCESS)
1398  {
1399  /* reflect the fact that we already enumerated "Entire Network" */
1400  (*lpcCount)++;
1401  *lpBufferSize = bufferSize + bytesNeeded;
1402  }
1403  else
1404  {
1405  /* the provider enumeration failed, but we already succeeded in
1406  * enumerating "Entire Network"--leave type as global to allow a
1407  * retry, but indicate success with a count of one.
1408  */
1409  ret = WN_SUCCESS;
1410  *lpcCount = 1;
1411  *lpBufferSize = bytesNeeded;
1412  }
1413  }
1414  TRACE("Returning %d\n", ret);
1415  return ret;
1416 }
struct _NETRESOURCEW NETRESOURCEW
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
DWORD enumType
Definition: wnet.c:101
#define lstrlenW
Definition: compat.h:415
#define WN_BAD_VALUE
Definition: winnetwk.h:119
#define RESOURCEUSAGE_CONTAINER
Definition: winnetwk.h:69
#define RESOURCE_GLOBALNET
Definition: winnetwk.h:59
unsigned char * LPBYTE
Definition: typedefs.h:52
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
LPWSTR entireNetwork
Definition: wnet.c:72
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
DWORD dwDisplayType
Definition: winnetwk.h:179
LPWSTR lpLocalName
Definition: winnetwk.h:181
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WN_NO_NETWORK
Definition: winnetwk.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD _enumerateGlobalW(PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: wnet.c:1274
int ret
#define WNET_ENUMERATOR_TYPE_CONTEXT
Definition: wnet.c:80
#define WN_BAD_POINTER
Definition: winnetwk.h:118
LPWSTR lpComment
Definition: winnetwk.h:183
LPWSTR lpRemoteName
Definition: winnetwk.h:182
DWORD dwType
Definition: wnet.c:106
DWORD dwUsage
Definition: winnetwk.h:180
#define lstrcpyW
Definition: compat.h:414
DWORD dwScope
Definition: winnetwk.h:177
#define WN_MORE_DATA
Definition: winnetwk.h:117
DWORD dwType
Definition: winnetwk.h:178
LPWSTR lpProvider
Definition: winnetwk.h:184
#define RESOURCEDISPLAYTYPE_ROOT
Definition: winnetwk.h:82
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by WNetEnumResourceW().

◆ _enumerateGlobalPassthroughW()

static DWORD _enumerateGlobalPassthroughW ( PWNetEnumerator  enumerator,
LPDWORD  lpcCount,
LPVOID  lpBuffer,
LPDWORD  lpBufferSize 
)
static

Definition at line 1236 of file wnet.c.

1238 {
1239  DWORD ret;
1240 
1241  if (!enumerator)
1242  return WN_BAD_POINTER;
1243  if (enumerator->enumType != WNET_ENUMERATOR_TYPE_GLOBAL)
1244  return WN_BAD_VALUE;
1245  if (!lpcCount)
1246  return WN_BAD_POINTER;
1247  if (!lpBuffer)
1248  return WN_BAD_POINTER;
1249  if (!lpBufferSize)
1250  return WN_BAD_POINTER;
1251  if (*lpBufferSize < sizeof(NETRESOURCEW))
1252  return WN_MORE_DATA;
1253 
1254  ret = _globalEnumeratorAdvance(enumerator);
1255  if (ret == WN_SUCCESS)
1256  {
1257  ret = providerTable->table[enumerator->providerIndex].
1258  openEnum(enumerator->dwScope, enumerator->dwType,
1259  enumerator->dwUsage, enumerator->specific.net,
1260  &enumerator->handle);
1261  if (ret == WN_SUCCESS)
1262  {
1263  ret = providerTable->table[enumerator->providerIndex].
1264  enumResource(enumerator->handle, lpcCount, lpBuffer,
1265  lpBufferSize);
1266  if (ret != WN_MORE_DATA)
1267  enumerator->providerDone = TRUE;
1268  }
1269  }
1270  TRACE("Returning %d\n", ret);
1271  return ret;
1272 }
#define TRUE
Definition: types.h:120
DWORD dwScope
Definition: wnet.c:105
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
DWORD providerIndex
Definition: wnet.c:102
NETRESOURCEW * net
Definition: wnet.c:110
DWORD enumType
Definition: wnet.c:101
DWORD dwUsage
Definition: wnet.c:107
#define WN_BAD_VALUE
Definition: winnetwk.h:119
WNetProvider table[1]
Definition: wnet.c:75
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define TRACE(s)
Definition: solgame.cpp:4
BOOL providerDone
Definition: wnet.c:104
unsigned long DWORD
Definition: ntddk_ex.h:95
union _WNetEnumerator::@458 specific
int ret
#define WN_BAD_POINTER
Definition: winnetwk.h:118
DWORD dwType
Definition: wnet.c:106
HANDLE handle
Definition: wnet.c:103
static DWORD _globalEnumeratorAdvance(PWNetEnumerator enumerator)
Definition: wnet.c:1192
#define WN_MORE_DATA
Definition: winnetwk.h:117

Referenced by _enumerateGlobalW().

◆ _enumerateGlobalW()

static DWORD _enumerateGlobalW ( PWNetEnumerator  enumerator,
LPDWORD  lpcCount,
LPVOID  lpBuffer,
LPDWORD  lpBufferSize 
)
static

Definition at line 1274 of file wnet.c.

1276 {
1277  DWORD ret;
1278 
1279  if (!enumerator)
1280  return WN_BAD_POINTER;
1281  if (enumerator->enumType != WNET_ENUMERATOR_TYPE_GLOBAL)
1282  return WN_BAD_VALUE;
1283  if (!lpcCount)
1284  return WN_BAD_POINTER;
1285  if (!lpBuffer)
1286  return WN_BAD_POINTER;
1287  if (!lpBufferSize)
1288  return WN_BAD_POINTER;
1289  if (*lpBufferSize < sizeof(NETRESOURCEW))
1290  return WN_MORE_DATA;
1291  if (!providerTable)
1292  return WN_NO_NETWORK;
1293 
1294  switch (enumerator->dwScope)
1295  {
1296  case RESOURCE_GLOBALNET:
1297  if (enumerator->specific.net)
1298  ret = _enumerateGlobalPassthroughW(enumerator, lpcCount,
1299  lpBuffer, lpBufferSize);
1300  else
1301  ret = _enumerateProvidersW(enumerator, lpcCount, lpBuffer,
1302  lpBufferSize);
1303  break;
1304  case RESOURCE_CONTEXT:
1305  ret = _enumerateGlobalPassthroughW(enumerator, lpcCount, lpBuffer,
1306  lpBufferSize);
1307  break;
1308  default:
1309  WARN("unexpected scope 0x%08x\n", enumerator->dwScope);
1311  }
1312  TRACE("Returning %d\n", ret);
1313  return ret;
1314 }
DWORD dwScope
Definition: wnet.c:105
static PWNetProviderTable providerTable
Definition: wnet.c:127
#define WARN(fmt,...)
Definition: debug.h:111
NETRESOURCEW * net
Definition: wnet.c:110
DWORD enumType
Definition: wnet.c:101
#define WN_BAD_VALUE
Definition: winnetwk.h:119
#define RESOURCE_GLOBALNET
Definition: winnetwk.h:59
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD _enumerateProvidersW(PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, const DWORD *lpBufferSize)
Definition: wnet.c:1116
#define WN_NO_NETWORK
Definition: winnetwk.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RESOURCE_CONTEXT
Definition: winnetwk.h:62
union _WNetEnumerator::@458 specific
int ret
#define WN_BAD_POINTER
Definition: winnetwk.h:118
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
static DWORD _enumerateGlobalPassthroughW(PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: wnet.c:1236
#define WN_MORE_DATA
Definition: winnetwk.h:117

Referenced by _enumerateContextW(), and WNetEnumResourceW().

◆ _enumerateProvidersW()

static DWORD _enumerateProvidersW ( PWNetEnumerator  enumerator,
LPDWORD  lpcCount,
LPVOID  lpBuffer,
const DWORD lpBufferSize 
)
static

Definition at line 1116 of file wnet.c.

1118 {
1119  DWORD ret;
1120 
1121  if (!enumerator)
1122  return WN_BAD_POINTER;
1123  if (enumerator->enumType != WNET_ENUMERATOR_TYPE_GLOBAL)
1124  return WN_BAD_VALUE;
1125  if (!lpcCount)
1126  return WN_BAD_POINTER;
1127  if (!lpBuffer)
1128  return WN_BAD_POINTER;
1129  if (!lpBufferSize)
1130  return WN_BAD_POINTER;
1131  if (*lpBufferSize < sizeof(NETRESOURCEA))
1132  return WN_MORE_DATA;
1133 
1134  if (!providerTable || enumerator->providerIndex >=
1137  else
1138  {
1139  DWORD bytes = 0, count = 0, countLimit, i;
1141  LPWSTR strNext;
1142 
1143  countLimit = *lpcCount == -1 ?
1144  providerTable->numProviders - enumerator->providerIndex : *lpcCount;
1145  while (count < countLimit && bytes < *lpBufferSize)
1146  {
1147  DWORD bytesNext = _countProviderBytesW(
1148  &providerTable->table[count + enumerator->providerIndex]);
1149 
1150  if (bytes + bytesNext < *lpBufferSize)
1151  {
1152  bytes += bytesNext;
1153  count++;
1154  }
1155  }
1156  strNext = (LPWSTR)((LPBYTE)lpBuffer + count * sizeof(NETRESOURCEW));
1157  for (i = 0, resource = lpBuffer; i < count; i++, resource++)
1158  {
1159  resource->dwScope = RESOURCE_GLOBALNET;
1160  resource->dwType = RESOURCETYPE_ANY;
1161  resource->dwDisplayType = RESOURCEDISPLAYTYPE_NETWORK;
1162  resource->dwUsage = RESOURCEUSAGE_CONTAINER |
1164  resource->lpLocalName = NULL;
1165  resource->lpRemoteName = strNext;
1166  lstrcpyW(resource->lpRemoteName,
1167  providerTable->table[i + enumerator->providerIndex].name);
1168  strNext += lstrlenW(resource->lpRemoteName) + 1;
1169  resource->lpComment = NULL;
1170  resource->lpProvider = strNext;
1171  lstrcpyW(resource->lpProvider,
1172  providerTable->table[i + enumerator->providerIndex].name);
1173  strNext += lstrlenW(resource->lpProvider) + 1;
1174  }
1175  enumerator->providerIndex += count;
1176  *lpcCount = count;
1177  ret = count > 0 ? WN_SUCCESS : WN_MORE_DATA;
1178  }
1179  TRACE("Returning %d\n", ret);
1180  return ret;
1181 }
struct _NETRESOURCEW NETRESOURCEW
PWSTR name
Definition: wnet.c:53
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
DWORD providerIndex
Definition: wnet.c:102
GLuint GLuint GLsizei count
Definition: gl.h:1545
DWORD enumType
Definition: wnet.c:101
#define RESOURCEUSAGE_RESERVED
Definition: winnetwk.h:74
int resource
Definition: rdpsnd_sgi.c:44
#define lstrlenW
Definition: compat.h:415
#define WN_BAD_VALUE
Definition: winnetwk.h:119
#define RESOURCEUSAGE_CONTAINER
Definition: winnetwk.h:69
#define RESOURCE_GLOBALNET
Definition: winnetwk.h:59
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WNetProvider table[1]
Definition: wnet.c:75
static DWORD _countProviderBytesW(PWNetProvider provider)
Definition: wnet.c:1102
unsigned char * LPBYTE
Definition: typedefs.h:52
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define RESOURCEDISPLAYTYPE_NETWORK
Definition: winnetwk.h:81
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define WN_BAD_POINTER
Definition: winnetwk.h:118
#define lstrcpyW
Definition: compat.h:414
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define RESOURCETYPE_ANY
Definition: winnetwk.h:63
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by _enumerateGlobalW().

◆ _enumerateProviderW()

static DWORD _enumerateProviderW ( PWNetEnumerator  enumerator,
LPDWORD  lpcCount,
LPVOID  lpBuffer,
LPDWORD  lpBufferSize 
)
static

Definition at line 1316 of file wnet.c.

1318 {
1319  if (!enumerator)
1320  return WN_BAD_POINTER;
1321  if (enumerator->enumType != WNET_ENUMERATOR_TYPE_PROVIDER)
1322  return WN_BAD_VALUE;
1323  if (!enumerator->handle)
1324  return WN_BAD_VALUE;
1325  if (!lpcCount)
1326  return WN_BAD_POINTER;
1327  if (!lpBuffer)
1328  return WN_BAD_POINTER;
1329  if (!lpBufferSize)
1330  return WN_BAD_POINTER;
1331  if (!providerTable)
1332  return WN_NO_NETWORK;
1333  if (enumerator->providerIndex >= providerTable->numProviders)
1334  return WN_NO_MORE_ENTRIES;
1335  if (!providerTable->table[enumerator->providerIndex].enumResource)
1336  return WN_BAD_VALUE;
1337  return providerTable->table[enumerator->providerIndex].enumResource(
1338  enumerator->handle, lpcCount, lpBuffer, lpBufferSize);
1339 }
PF_NPEnumResource enumResource
Definition: wnet.c:59
DWORD numProviders
Definition: wnet.c:74
static PWNetProviderTable providerTable
Definition: wnet.c:127
DWORD providerIndex
Definition: wnet.c:102
DWORD enumType
Definition: wnet.c:101
#define WN_BAD_VALUE
Definition: winnetwk.h:119
WNetProvider table[1]
Definition: wnet.c:75
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define WN_BAD_POINTER
Definition: winnetwk.h:118
HANDLE handle
Definition: wnet.c:103
#define WNET_ENUMERATOR_TYPE_PROVIDER
Definition: wnet.c:79
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146

Referenced by WNetEnumResourceW().

◆ _enumeratorRememberedW()

static DWORD _enumeratorRememberedW ( PWNetEnumerator  enumerator,
DWORD user_count,
void user_buffer,
DWORD user_size 
)
static

Definition at line 1559 of file wnet.c.

1561 {
1562  HKEY registry, connection;
1563  WCHAR buffer[255];
1564  LONG size_left;
1565  DWORD index, ret, type, len, size, registry_size, full_size = 0, total_count;
1566  NETRESOURCEW * net_buffer = user_buffer;
1567  WCHAR * str, * registry_string;
1568 
1569  /* we will do the work in a single loop, so here is some things:
1570  * we write netresource at the begin of the user buffer
1571  * we write strings at the end of the user buffer
1572  */
1573  size_left = *user_size;
1574  total_count = 0;
1575  type = enumerator->dwType;
1576  registry = enumerator->specific.remembered.registry;
1577  str = (WCHAR *)((ULONG_PTR)user_buffer + *user_size - sizeof(WCHAR));
1578  for (index = enumerator->specific.remembered.index; ; ++index)
1579  {
1580  enumerator->specific.remembered.index = index;
1581 
1582  if (*user_count != -1 && total_count == *user_count)
1583  {
1584  ret = WN_SUCCESS;
1585  break;
1586  }
1587 
1588  len = ARRAY_SIZE(buffer);
1590  if (ret != ERROR_SUCCESS)
1591  {
1593  break;
1594  }
1595 
1596  if (RegOpenKeyExW(registry, buffer, 0, KEY_READ, &connection) != ERROR_SUCCESS)
1597  {
1598  continue;
1599  }
1600 
1601  full_size = sizeof(NETRESOURCEW);
1602  size_left -= sizeof(NETRESOURCEW);
1603 
1604  if (size_left > 0)
1605  {
1606  size = sizeof(DWORD);
1607  RegQueryValueExW(connection, connectionType, NULL, NULL, (BYTE *)&net_buffer->dwType, &size);
1608  if (type != RESOURCETYPE_ANY && net_buffer->dwType != type)
1609  {
1610  size_left += sizeof(NETRESOURCEW);
1611  RegCloseKey(connection);
1612  continue;
1613  }
1614 
1615  net_buffer->dwScope = RESOURCE_REMEMBERED;
1617  net_buffer->dwUsage = RESOURCEUSAGE_CONNECTABLE;
1618  }
1619  else
1620  ret = WN_MORE_DATA;
1621 
1622  /* FIXME: this only supports drive letters */
1623  full_size += 3 * sizeof(WCHAR);
1624  size_left -= 3 * sizeof(WCHAR);
1625  if (size_left > 0)
1626  {
1627  str -= 3;
1628  str[0] = buffer[0];
1629  str[1] = ':';
1630  str[2] = 0;
1631  net_buffer->lpLocalName = str;
1632  }
1633 
1634  registry_size = 0;
1635  registry_string = get_reg_str(connection, providerName, &registry_size);
1636  if (registry_string)
1637  {
1638  full_size += registry_size;
1639  size_left -= registry_size;
1640 
1641  if (size_left > 0)
1642  {
1643  str -= (registry_size / sizeof(WCHAR));
1644  lstrcpyW(str, registry_string);
1645  net_buffer->lpProvider = str;
1646  }
1647  else
1648  ret = WN_MORE_DATA;
1649 
1650  HeapFree(GetProcessHeap(), 0, registry_string);
1651  }
1652 
1653  registry_size = 0;
1654  registry_string = get_reg_str(connection, remotePath, &registry_size);
1655  if (registry_string)
1656  {
1657  full_size += registry_size;
1658  size_left -= registry_size;
1659 
1660  if (size_left > 0)
1661  {
1662  str -= (registry_size / sizeof(WCHAR));
1663  lstrcpyW(str, registry_string);
1664  net_buffer->lpRemoteName = str;
1665  }
1666  else
1667  ret = WN_MORE_DATA;
1668 
1669  HeapFree(GetProcessHeap(), 0, registry_string);
1670  }
1671 
1672  RegCloseKey(connection);
1673 
1674  net_buffer->lpComment = NULL;
1675 
1676  if (size_left < 0)
1677  break;
1678 
1679  ++total_count;
1680  ++net_buffer;
1681  }
1682 
1683  if (total_count == 0)
1685 
1686  *user_count = total_count;
1687 
1688  if (ret != WN_MORE_DATA && ret != WN_NO_MORE_ENTRIES)
1689  ret = WN_SUCCESS;
1690 
1691  if (ret == WN_MORE_DATA)
1692  *user_size = *user_size + full_size;
1693 
1694  return ret;
1695 }
struct _NETRESOURCEW NETRESOURCEW
#define RESOURCEUSAGE_CONNECTABLE
Definition: winnetwk.h:68
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define WN_SUCCESS
Definition: winnetwk.h:111
static const WCHAR remotePath[]
Definition: wnet.c:1543
#define KEY_READ
Definition: nt_native.h:1023
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
#define DWORD
Definition: nt_native.h:44
uint32_t ULONG_PTR
Definition: typedefs.h:63
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
DWORD dwDisplayType
Definition: winnetwk.h:179
struct _WNetEnumerator::@458::@459 remembered
const char ** registry
Definition: cffdrivr.c:690
GLuint index
Definition: glext.h:6031
static WCHAR * get_reg_str(HKEY hkey, const WCHAR *value, DWORD *len)
Definition: wnet.c:1545
static const WCHAR connectionType[]
Definition: wnet.c:1541
LPWSTR lpLocalName
Definition: winnetwk.h:181
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define RESOURCEDISPLAYTYPE_GENERIC
Definition: winnetwk.h:75
unsigned long DWORD
Definition: ntddk_ex.h:95
union _WNetEnumerator::@458 specific
int ret
#define index(s, c)
Definition: various.h:29
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
LPWSTR lpComment
Definition: winnetwk.h:183
LPWSTR lpRemoteName
Definition: winnetwk.h:182
DWORD dwType
Definition: wnet.c:106
DWORD dwUsage
Definition: winnetwk.h:180
#define RESOURCE_REMEMBERED
Definition: winnetwk.h:60
#define lstrcpyW
Definition: compat.h:414
#define ARRAY_SIZE(a)
Definition: main.h:24
DWORD dwScope
Definition: winnetwk.h:177
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
#define WN_MORE_DATA
Definition: winnetwk.h:117
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
DWORD dwType
Definition: winnetwk.h:178
#define RESOURCETYPE_ANY
Definition: winnetwk.h:63
LPWSTR lpProvider
Definition: winnetwk.h:184
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
static const WCHAR providerName[]
Definition: wnet.c:1542
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WNetEnumResourceW().

◆ _findProviderIndexW()

static DWORD _findProviderIndexW ( LPCWSTR  lpProvider)
static

Definition at line 507 of file wnet.c.

508 {
510 
512  {
513  DWORD i;
514 
515  for (i = 0; i < providerTable->numProviders &&
516  ret == BAD_PROVIDER_INDEX; i++)
517  if (!lstrcmpW(lpProvider, providerTable->table[i].name))
518  ret = i;
519  }
520  return ret;
521 }
PWSTR name
Definition: wnet.c:53
DWORD numProviders
Definition: wnet.c:74
static PWNetProviderTable providerTable
Definition: wnet.c:127
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WNetProvider table[1]
Definition: wnet.c:75
#define BAD_PROVIDER_INDEX
Definition: wnet.c:120
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret

Referenced by wnet_use_connection(), WNetGetNetworkInformationW(), and WNetOpenEnumW().

◆ _freeEnumNetResource()

static void _freeEnumNetResource ( LPNETRESOURCEW  lpNet)
static

Definition at line 554 of file wnet.c.

555 {
556  if (lpNet)
557  {
558  HeapFree(GetProcessHeap(), 0, lpNet->lpRemoteName);
559  HeapFree(GetProcessHeap(), 0, lpNet);
560  }
561 }
#define GetProcessHeap()
Definition: compat.h:403
LPWSTR lpRemoteName
Definition: winnetwk.h:182
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WNetCloseEnum().

◆ _globalEnumeratorAdvance()

static DWORD _globalEnumeratorAdvance ( PWNetEnumerator  enumerator)
static

Definition at line 1192 of file wnet.c.

1193 {
1194  if (!enumerator)
1195  return WN_BAD_POINTER;
1196  if (enumerator->enumType != WNET_ENUMERATOR_TYPE_GLOBAL)
1197  return WN_BAD_VALUE;
1198  if (!providerTable || enumerator->providerIndex >=
1200  return WN_NO_MORE_ENTRIES;
1201 
1202  if (enumerator->providerDone)
1203  {
1204  DWORD dwEnum = 0;
1205  enumerator->providerDone = FALSE;
1206  if (enumerator->handle)
1207  {
1209  enumerator->handle);
1210  enumerator->handle = NULL;
1211  enumerator->providerIndex++;
1212  }
1213  if (enumerator->dwScope == RESOURCE_CONNECTED)
1214  dwEnum = WNNC_ENUM_LOCAL;
1215  else if (enumerator->dwScope == RESOURCE_GLOBALNET)
1216  dwEnum = WNNC_ENUM_GLOBAL;
1217  else if (enumerator->dwScope == RESOURCE_CONTEXT)
1218  dwEnum = WNNC_ENUM_CONTEXT;
1219  for (; enumerator->providerIndex < providerTable->numProviders &&
1221  & dwEnum); enumerator->providerIndex++)
1222  ;
1223  }
1224  return enumerator->providerIndex < providerTable->numProviders ?
1226 }
DWORD dwScope
Definition: wnet.c:105
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
DWORD providerIndex
Definition: wnet.c:102
DWORD enumType
Definition: wnet.c:101
#define WN_BAD_VALUE
Definition: winnetwk.h:119
#define RESOURCE_GLOBALNET
Definition: winnetwk.h:59
#define RESOURCE_CONNECTED
Definition: winnetwk.h:58
WNetProvider table[1]
Definition: wnet.c:75
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
smooth NULL
Definition: ftsmooth.c:416
PF_NPCloseEnum closeEnum
Definition: wnet.c:60
BOOL providerDone
Definition: wnet.c:104
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WNNC_ENUM_LOCAL
Definition: npapi.h:53
#define RESOURCE_CONTEXT
Definition: winnetwk.h:62
DWORD dwEnumScopes
Definition: wnet.c:57
#define WN_BAD_POINTER
Definition: winnetwk.h:118
HANDLE handle
Definition: wnet.c:103
#define WN_NO_MORE_ENTRIES
Definition: winnetwk.h:146
#define WNNC_ENUM_GLOBAL
Definition: npapi.h:52
#define WNNC_ENUM_CONTEXT
Definition: npapi.h:54

Referenced by _enumerateGlobalPassthroughW().

◆ _thunkNetResourceArrayAToW()

static DWORD _thunkNetResourceArrayAToW ( const NETRESOURCEA lpNetArrayIn,
const DWORD lpcCount,
LPVOID  lpBuffer,
const DWORD lpBufferSize 
)
static

Definition at line 745 of file wnet.c.

747 {
748  DWORD i, numToThunk, totalBytes, ret;
749  LPWSTR strNext;
750 
751  if (!lpNetArrayIn)
752  return WN_BAD_POINTER;
753  if (!lpcCount)
754  return WN_BAD_POINTER;
755  if (*lpcCount == -1)
756  return WN_BAD_VALUE;
757  if (!lpBuffer)
758  return WN_BAD_POINTER;
759  if (!lpBufferSize)
760  return WN_BAD_POINTER;
761 
762  for (i = 0, numToThunk = 0, totalBytes = 0; i < *lpcCount; i++)
763  {
764  const NETRESOURCEA *lpNet = lpNetArrayIn + i;
765 
766  totalBytes += sizeof(NETRESOURCEW);
767  if (lpNet->lpLocalName)
768  totalBytes += MultiByteToWideChar(CP_ACP, 0, lpNet->lpLocalName,
769  -1, NULL, 0) * sizeof(WCHAR);
770  if (lpNet->lpRemoteName)
771  totalBytes += MultiByteToWideChar(CP_ACP, 0, lpNet->lpRemoteName,
772  -1, NULL, 0) * sizeof(WCHAR);
773  if (lpNet->lpComment)
774  totalBytes += MultiByteToWideChar(CP_ACP, 0, lpNet->lpComment,
775  -1, NULL, 0) * sizeof(WCHAR);
776  if (lpNet->lpProvider)
777  totalBytes += MultiByteToWideChar(CP_ACP, 0, lpNet->lpProvider,
778  -1, NULL, 0) * sizeof(WCHAR);
779  if (totalBytes < *lpBufferSize)
780  numToThunk = i + 1;
781  }
782  strNext = (LPWSTR)((LPBYTE)lpBuffer + numToThunk * sizeof(NETRESOURCEW));
783  for (i = 0; i < numToThunk; i++)
784  {
785  LPNETRESOURCEW lpNetOut = (LPNETRESOURCEW)lpBuffer + i;
786  const NETRESOURCEA *lpNetIn = lpNetArrayIn + i;
787 
788  memcpy(lpNetOut, lpNetIn, sizeof(NETRESOURCEW));
789  /* lie about string lengths, we already verified how many
790  * we have space for above
791  */
792  if (lpNetIn->lpLocalName)
793  {
794  lpNetOut->lpLocalName = strNext;
795  strNext += MultiByteToWideChar(CP_ACP, 0, lpNetIn->lpLocalName,
796  -1, lpNetOut->lpLocalName, *lpBufferSize);
797  }
798  if (lpNetIn->lpRemoteName)
799  {
800  lpNetOut->lpRemoteName = strNext;
801  strNext += MultiByteToWideChar(CP_ACP, 0, lpNetIn->lpRemoteName,
802  -1, lpNetOut->lpRemoteName, *lpBufferSize);
803  }
804  if (lpNetIn->lpComment)
805  {
806  lpNetOut->lpComment = strNext;
807  strNext += MultiByteToWideChar(CP_ACP, 0, lpNetIn->lpComment,
808  -1, lpNetOut->lpComment, *lpBufferSize);
809  }
810  if (lpNetIn->lpProvider)
811  {
812  lpNetOut->lpProvider = strNext;
813  strNext += MultiByteToWideChar(CP_ACP, 0, lpNetIn->lpProvider,
814  -1, lpNetOut->lpProvider, *lpBufferSize);
815  }
816  }
817  ret = numToThunk < *lpcCount ? WN_MORE_DATA : WN_SUCCESS;
818  TRACE("numToThunk is %d, *lpcCount is %d, returning %d\n", numToThunk,
819  *lpcCount, ret);
820  return ret;
821 }
struct _NETRESOURCEW NETRESOURCEW
#define WN_SUCCESS
Definition: winnetwk.h:111
#define CP_ACP
Definition: compat.h:99
LPSTR lpLocalName
Definition: winnetwk.h:171
#define WN_BAD_VALUE
Definition: winnetwk.h:119
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char * LPBYTE
Definition: typedefs.h:52
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
struct _NETRESOURCEW * LPNETRESOURCEW
smooth NULL
Definition: ftsmooth.c:416
LPSTR lpProvider
Definition: winnetwk.h:174
LPWSTR lpLocalName
Definition: winnetwk.h:181
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR lpComment
Definition: winnetwk.h:173
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define WN_BAD_POINTER
Definition: winnetwk.h:118
LPWSTR lpComment
Definition: winnetwk.h:183
LPWSTR lpRemoteName
Definition: winnetwk.h:182
LPSTR lpRemoteName
Definition: winnetwk.h:172
#define MultiByteToWideChar
Definition: compat.h:100
#define WN_MORE_DATA
Definition: winnetwk.h:117
LPWSTR lpProvider
Definition: winnetwk.h:184
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by WNetGetResourceInformationA(), and WNetOpenEnumA().

◆ _thunkNetResourceArrayWToA()

static DWORD _thunkNetResourceArrayWToA ( const NETRESOURCEW lpNetArrayIn,
const DWORD lpcCount,
LPVOID  lpBuffer,
const DWORD lpBufferSize 
)
static

Definition at line 660 of file wnet.c.

662 {
663  DWORD i, numToThunk, totalBytes, ret;
664  LPSTR strNext;
665 
666  if (!lpNetArrayIn)
667  return WN_BAD_POINTER;
668  if (!lpcCount)
669  return WN_BAD_POINTER;
670  if (*lpcCount == -1)
671  return WN_BAD_VALUE;
672  if (!lpBuffer)
673  return WN_BAD_POINTER;
674  if (!lpBufferSize)
675  return WN_BAD_POINTER;
676 
677  for (i = 0, numToThunk = 0, totalBytes = 0; i < *lpcCount; i++)
678  {
679  const NETRESOURCEW *lpNet = lpNetArrayIn + i;
680 
681  totalBytes += sizeof(NETRESOURCEA);
682  if (lpNet->lpLocalName)
683  totalBytes += WideCharToMultiByte(CP_ACP, 0, lpNet->lpLocalName,
684  -1, NULL, 0, NULL, NULL);
685  if (lpNet->lpRemoteName)
686  totalBytes += WideCharToMultiByte(CP_ACP, 0, lpNet->lpRemoteName,
687  -1, NULL, 0, NULL, NULL);
688  if (lpNet->lpComment)
689  totalBytes += WideCharToMultiByte(CP_ACP, 0, lpNet->lpComment,
690  -1, NULL, 0, NULL, NULL);
691  if (lpNet->lpProvider)
692  totalBytes += WideCharToMultiByte(CP_ACP, 0, lpNet->lpProvider,
693  -1, NULL, 0, NULL, NULL);
694  if (totalBytes < *lpBufferSize)
695  numToThunk = i + 1;
696  }
697  strNext = (LPSTR)((LPBYTE)lpBuffer + numToThunk * sizeof(NETRESOURCEA));
698  for (i = 0; i < numToThunk; i++)
699  {
700  LPNETRESOURCEA lpNetOut = (LPNETRESOURCEA)lpBuffer + i;
701  const NETRESOURCEW *lpNetIn = lpNetArrayIn + i;
702 
703  memcpy(lpNetOut, lpNetIn, sizeof(NETRESOURCEA));
704  /* lie about string lengths, we already verified how many
705  * we have space for above
706  */
707  if (lpNetIn->lpLocalName)
708  {
709  lpNetOut->lpLocalName = strNext;
710  strNext += WideCharToMultiByte(CP_ACP, 0, lpNetIn->lpLocalName, -1,
711  lpNetOut->lpLocalName, *lpBufferSize, NULL, NULL);
712  }
713  if (lpNetIn->lpRemoteName)
714  {
715  lpNetOut->lpRemoteName = strNext;
716  strNext += WideCharToMultiByte(CP_ACP, 0, lpNetIn->lpRemoteName, -1,
717  lpNetOut->lpRemoteName, *lpBufferSize, NULL, NULL);
718  }
719  if (lpNetIn->lpComment)
720  {
721  lpNetOut->lpComment = strNext;
722  strNext += WideCharToMultiByte(CP_ACP, 0, lpNetIn->lpComment, -1,
723  lpNetOut->lpComment, *lpBufferSize, NULL, NULL);
724  }
725  if (lpNetIn->lpProvider)
726  {
727  lpNetOut->lpProvider = strNext;
728  strNext += WideCharToMultiByte(CP_ACP, 0, lpNetIn->lpProvider, -1,
729  lpNetOut->lpProvider, *lpBufferSize, NULL, NULL);
730  }
731  }
732  ret = numToThunk < *lpcCount ? WN_MORE_DATA : WN_SUCCESS;
733  TRACE("numToThunk is %d, *lpcCount is %d, returning %d\n", numToThunk,
734  *lpcCount, ret);
735  return ret;
736 }
#define WideCharToMultiByte
Definition: compat.h:101
#define WN_SUCCESS
Definition: winnetwk.h:111
#define CP_ACP
Definition: compat.h:99
LPSTR lpLocalName
Definition: winnetwk.h:171
struct _NETRESOURCEA * LPNETRESOURCEA
struct _NETRESOURCEA NETRESOURCEA
char * LPSTR
Definition: xmlstorage.h:182
#define WN_BAD_VALUE
Definition: winnetwk.h:119
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned char * LPBYTE
Definition: typedefs.h:52
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
LPSTR lpProvider
Definition: winnetwk.h:174
LPWSTR lpLocalName
Definition: winnetwk.h:181
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR lpComment
Definition: winnetwk.h:173
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define WN_BAD_POINTER
Definition: winnetwk.h:118
LPWSTR lpComment
Definition: winnetwk.h:183
LPWSTR lpRemoteName
Definition: winnetwk.h:182
LPSTR lpRemoteName
Definition: winnetwk.h:172
#define WN_MORE_DATA
Definition: winnetwk.h:117
LPWSTR lpProvider
Definition: winnetwk.h:184

Referenced by WNetEnumResourceA(), and WNetGetResourceInformationA().

◆ _tryLoadProvider()

static void _tryLoadProvider ( PCWSTR  provider)
static

Definition at line 133 of file wnet.c.

134 {
135  static const WCHAR servicePrefix[] = { 'S','y','s','t','e','m','\\',
136  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
137  'S','e','r','v','i','c','e','s','\\',0 };
138  static const WCHAR serviceFmt[] = { '%','s','%','s','\\',
139  'N','e','t','w','o','r','k','P','r','o','v','i','d','e','r',0 };
141  HKEY hKey;
142 
143  TRACE("%s\n", debugstr_w(provider));
144  swprintf(serviceName, serviceFmt, servicePrefix, provider);
145  serviceName[ARRAY_SIZE(serviceName) - 1] = '\0';
148  {
149  static const WCHAR szProviderPath[] = { 'P','r','o','v','i','d','e','r',
150  'P','a','t','h',0 };
151  WCHAR providerPath[MAX_PATH];
152  DWORD type, size = sizeof(providerPath);
153 
154  if (RegQueryValueExW(hKey, szProviderPath, NULL, &type,
155  (LPBYTE)providerPath, &size) == ERROR_SUCCESS && (type == REG_SZ || type == REG_EXPAND_SZ))
156  {
157  static const WCHAR szProviderName[] = { 'N','a','m','e',0 };
158  PWSTR name = NULL;
159 
160  if (type == REG_EXPAND_SZ)
161  {
163  if (ExpandEnvironmentStringsW(providerPath, path, MAX_PATH)) lstrcpyW( providerPath, path );
164  }
165 
166  size = 0;
167  RegQueryValueExW(hKey, szProviderName, NULL, NULL, NULL, &size);
168  if (size)
169  {
171  if (RegQueryValueExW(hKey, szProviderName, NULL, &type,
172  (LPBYTE)name, &size) != ERROR_SUCCESS || type != REG_SZ)
173  {
175  name = NULL;
176  }
177  }
178  if (name)
179  {
180  HMODULE hLib = LoadLibraryW(providerPath);
181 
182  if (hLib)
183  {
184 #define MPR_GETPROC(proc) ((PF_##proc)GetProcAddress(hLib, #proc))
185 
187 
188  TRACE("loaded lib %p\n", hLib);
189  if (getCaps)
190  {
191  DWORD connectCap;
192  PWNetProvider provider =
194 
195  provider->hLib = hLib;
196  provider->name = name;
197  TRACE("name is %s\n", debugstr_w(name));
198  provider->getCaps = getCaps;
199  provider->dwSpecVersion = getCaps(WNNC_SPEC_VERSION);
200  provider->dwNetType = getCaps(WNNC_NET_TYPE);
201  TRACE("net type is 0x%08x\n", provider->dwNetType);
202  provider->dwEnumScopes = getCaps(WNNC_ENUMERATION);
203  if (provider->dwEnumScopes)
204  {
205  TRACE("supports enumeration\n");
206  provider->openEnum = MPR_GETPROC(NPOpenEnum);
207  TRACE("NPOpenEnum %p\n", provider->openEnum);
209  TRACE("NPEnumResource %p\n", provider->enumResource);
210  provider->closeEnum = MPR_GETPROC(NPCloseEnum);
211  TRACE("NPCloseEnum %p\n", provider->closeEnum);
213  TRACE("NPGetResourceInformation %p\n", provider->getResourceInformation);
214  if (!provider->openEnum ||
215  !provider->enumResource ||
216  !provider->closeEnum)
217  {
218  provider->openEnum = NULL;
219  provider->enumResource = NULL;
220  provider->closeEnum = NULL;
221  provider->dwEnumScopes = 0;
222  WARN("Couldn't load enumeration functions\n");
223  }
224  }
225  connectCap = getCaps(WNNC_CONNECTION);
226  if (connectCap & WNNC_CON_ADDCONNECTION)
228  if (connectCap & WNNC_CON_ADDCONNECTION3)
230  if (connectCap & WNNC_CON_CANCELCONNECTION)
232 #ifdef __REACTOS__
233  if (connectCap & WNNC_CON_GETCONNECTIONS)
234  provider->getConnection = MPR_GETPROC(NPGetConnection);
235 #endif
236  TRACE("NPAddConnection %p\n", provider->addConnection);
237  TRACE("NPAddConnection3 %p\n", provider->addConnection3);
238  TRACE("NPCancelConnection %p\n", provider->cancelConnection);
240  }
241  else
242  {
243  WARN("Provider %s didn't export NPGetCaps\n",
244  debugstr_w(provider));
246  FreeLibrary(hLib);
247  }
248 
249 #undef MPR_GETPROC
250  }
251  else
252  {
253  WARN("Couldn't load library %s for provider %s\n",
254  debugstr_w(providerPath), debugstr_w(provider));
256  }
257  }
258  else
259  {
260  WARN("Couldn't get provider name for provider %s\n",
261  debugstr_w(provider));
262  }
263  }
264  else
265  WARN("Couldn't open value %s\n", debugstr_w(szProviderPath));
266  RegCloseKey(hKey);
267  }
268  else
269  WARN("Couldn't open service key for provider %s\n",
270  debugstr_w(provider));
271 }
PF_NPOpenEnum openEnum
Definition: wnet.c:58
DWORD APIENTRY NPGetResourceInformation(__in LPNETRESOURCE lpNetResource, __out_bcount(*lpBufferSize) LPVOID lpBuffer, __inout LPDWORD lpBufferSize, __deref_out LPWSTR *lplpSystem)
Definition: nfs41_np.c:898
#define WNNC_CON_ADDCONNECTION3
Definition: npapi.h:36
PWSTR name
Definition: wnet.c:53
PF_NPEnumResource enumResource
Definition: wnet.c:59
#define WNNC_SPEC_VERSION
Definition: npapi.h:22
#define ERROR_SUCCESS
Definition: deptool.c:10
PF_NPAddConnection addConnection
Definition: wnet.c:62
DWORD numProviders
Definition: wnet.c:74
static PWNetProviderTable providerTable
Definition: wnet.c:127
#define KEY_READ
Definition: nt_native.h:1023
#define WNNC_ENUMERATION
Definition: npapi.h:51
uint16_t * PWSTR
Definition: typedefs.h:54
#define WARN(fmt,...)
Definition: debug.h:111
#define WNNC_CON_ADDCONNECTION
Definition: npapi.h:33
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
DWORD APIENTRY NPOpenEnum(DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCE lpNetResource, LPHANDLE lphEnum)
Definition: nfs41_np.c:727
#define WNNC_NET_TYPE
Definition: npapi.h:24
WNetProvider table[1]
Definition: wnet.c:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
DWORD APIENTRY NPCancelConnection(__in LPWSTR lpName, __in BOOL fForce)
Definition: nfs41_np.c:578
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
DWORD APIENTRY NPEnumResource(HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: nfs41_np.c:771
PF_NPCancelConnection cancelConnection
Definition: wnet.c:64
PF_NPGetCaps getCaps
Definition: wnet.c:54
char serviceName[]
Definition: tftpd.cpp:34
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:413
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
PF_NPCloseEnum closeEnum
Definition: wnet.c:60
__wchar_t WCHAR
Definition: xmlstorage.h:180
HMODULE hLib
Definition: wnet.c:52
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwSpecVersion
Definition: wnet.c:55
#define WNNC_CONNECTION
Definition: npapi.h:32
DWORD(APIENTRY * PF_NPGetCaps)(DWORD ndex)
Definition: npapi.h:59
PF_NPGetResourceInformation getResourceInformation
Definition: wnet.c:61
DWORD dwEnumScopes
Definition: wnet.c:57
DWORD APIENTRY NPGetConnection(__in LPWSTR lpLocalName, __out_bcount(*lpBufferSize) LPWSTR lpRemoteName, __inout LPDWORD lpBufferSize)
Definition: nfs41_np.c:672
PF_NPAddConnection3 addConnection3
Definition: wnet.c:63
#define MPR_GETPROC(proc)
#define WNNC_CON_CANCELCONNECTION
Definition: npapi.h:34
#define lstrcpyW
Definition: compat.h:414
#define ARRAY_SIZE(a)
Definition: main.h:24
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
DWORD APIENTRY NPAddConnection3(__in HWND hwndOwner, __in LPNETRESOURCE lpNetResource, __in_opt LPWSTR lpPassword, __in_opt LPWSTR lpUserName, __in DWORD dwFlags)
Definition: nfs41_np.c:426
Definition: services.c:325
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
Definition: name.c:36
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
DWORD dwNetType
Definition: wnet.c:56
DWORD APIENTRY NPAddConnection(__in LPNETRESOURCE lpNetResource, __in_opt LPWSTR lpPassword, __in_opt LPWSTR lpUserName)
Definition: nfs41_np.c:417
DWORD APIENTRY NPCloseEnum(HANDLE hEnum)
Definition: nfs41_np.c:879
#define HeapFree(x, y, z)
Definition: compat.h:402
DWORD APIENTRY NPGetCaps(DWORD nIndex)
Definition: nfs41_np.c:327
#define WNNC_CON_GETCONNECTIONS
Definition: npapi.h:35
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by wnetInit().

◆ free_netresourceW()

static void free_netresourceW ( NETRESOURCEW resource)
static

Definition at line 2338 of file wnet.c.

2339 {
2340  HeapFree(GetProcessHeap(), 0, resource->lpLocalName);
2341  HeapFree(GetProcessHeap(), 0, resource->lpRemoteName);
2342  HeapFree(GetProcessHeap(), 0, resource->lpComment);
2343  HeapFree(GetProcessHeap(), 0, resource->lpProvider);
2344 }
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WNetUseConnectionA().

◆ get_drive_connection()

static DWORD get_drive_connection ( WCHAR  letter,
LPWSTR  remote,
LPDWORD  size 
)
static

Definition at line 2581 of file wnet.c.

2582 {
2583 #ifndef __REACTOS__
2584  char buffer[1024];
2585  struct mountmgr_unix_drive *data = (struct mountmgr_unix_drive *)buffer;
2586  HANDLE mgr;
2588  DWORD bytes_returned;
2589 
2592  0, 0 )) == INVALID_HANDLE_VALUE)
2593  {
2594  ERR( "failed to open mount manager err %u\n", GetLastError() );
2595  return ret;
2596  }
2597  memset( data, 0, sizeof(*data) );
2598  data->letter = letter;
2600  data, sizeof(buffer), &bytes_returned, NULL ))
2601  {
2602  char *p, *mount_point = buffer + data->mount_point_offset;
2603  DWORD len;
2604 
2605  if (data->mount_point_offset && !strncmp( mount_point, "unc/", 4 ))
2606  {
2607  mount_point += 2;
2608  mount_point[0] = '\\';
2609  for (p = mount_point; *p; p++) if (*p == '/') *p = '\\';
2610 
2611  len = MultiByteToWideChar( CP_UNIXCP, 0, mount_point, -1, NULL, 0 );
2612  if (len > *size)
2613  {
2614  *size = len;
2615  ret = WN_MORE_DATA;
2616  }
2617  else
2618  {
2619  *size = MultiByteToWideChar( CP_UNIXCP, 0, mount_point, -1, remote, *size);
2620  ret = WN_SUCCESS;
2621  }
2622  }
2623  }
2624  CloseHandle( mgr );
2625  return ret;
2626 #else
2628  DWORD index;
2629  WCHAR local[3] = {letter, ':', 0};
2630 
2631  if (providerTable != NULL)
2632  {
2633  for (index = 0; index < providerTable->numProviders; index++)
2634  {
2637  {
2638  if (providerTable->table[index].getConnection)
2639  ret = providerTable->table[index].getConnection(
2640  local, remote, size);
2641  else
2642  ret = WN_NO_NETWORK;
2643  if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
2644  break;
2645  }
2646  }
2647  }
2648  if (ret)
2649  SetLastError(ret);
2650  return ret;
2651 #endif
2652 }
#define CloseHandle
Definition: compat.h:406
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
GLuint buffer
Definition: glext.h:5915
#define WN_NOT_CONNECTED
Definition: winnetwk.h:132
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
#define IOCTL_MOUNTMGR_QUERY_UNIX_DRIVE
Definition: mountmgr.h:16
WNetProvider table[1]
Definition: wnet.c:75
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define MOUNTMGR_DOS_DEVICE_NAME
Definition: mountmgr.h:11
GLuint index
Definition: glext.h:6031
#define OPEN_EXISTING
Definition: compat.h:434
PF_NPGetCaps getCaps
Definition: wnet.c:54
GLsizeiptr size
Definition: glext.h:5919
#define CP_UNIXCP
Definition: compat.h:69
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WN_NO_NETWORK
Definition: winnetwk.h:126
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WNNC_CONNECTION
Definition: npapi.h:32
#define SetLastError(x)
Definition: compat.h:417
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
int ret
#define index(s, c)
Definition: various.h:29
GLenum GLsizei len
Definition: glext.h:6722
#define GENERIC_READ
Definition: compat.h:124
#define local
Definition: zutil.h:30
#define ERR(fmt,...)
Definition: debug.h:109
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define MultiByteToWideChar
Definition: compat.h:100
#define CreateFileW
Definition: compat.h:408
#define WN_MORE_DATA
Definition: winnetwk.h:117
GLfloat GLfloat p
Definition: glext.h:8902
#define memset(x, y, z)
Definition: compat.h:39
#define WNNC_CON_GETCONNECTIONS
Definition: npapi.h:35

Referenced by WNetGetConnectionW().

◆ get_reg_str()

static WCHAR* get_reg_str ( HKEY  hkey,
const WCHAR value,
DWORD len 
)
static

Definition at line 1545 of file wnet.c.

1546 {
1547  DWORD type;
1548  WCHAR *ret = NULL;
1549 
1550  if (!RegQueryValueExW(hkey, value, NULL, &type, NULL, len) && type == REG_SZ)
1551  {
1552  if (!(ret = HeapAlloc(GetProcessHeap(), 0, *len))) return NULL;
1553  RegQueryValueExW(hkey, value, 0, 0, (BYTE *)ret, len);
1554  }
1555 
1556  return ret;
1557 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
#define REG_SZ
Definition: layer.c:22

Referenced by _enumeratorRememberedW().

◆ netresource_a_to_w()

static void netresource_a_to_w ( NETRESOURCEA resourceA,
NETRESOURCEW resourceW 
)
static

Definition at line 2326 of file wnet.c.

2327 {
2328  resourceW->dwScope = resourceA->dwScope;
2329  resourceW->dwType = resourceA->dwType;
2330  resourceW->dwDisplayType = resourceA->dwDisplayType;
2331  resourceW->dwUsage = resourceA->dwUsage;
2332  resourceW->lpLocalName = strdupAtoW(resourceA->lpLocalName);
2333  resourceW->lpRemoteName = strdupAtoW(resourceA->lpRemoteName);
2334  resourceW->lpComment = strdupAtoW(resourceA->lpComment);
2335  resourceW->lpProvider = strdupAtoW(resourceA->lpProvider);
2336 }
DWORD dwType
Definition: winnetwk.h:168
LPSTR lpLocalName
Definition: winnetwk.h:171
DWORD dwDisplayType
Definition: winnetwk.h:169
DWORD dwDisplayType
Definition: winnetwk.h:179
LPSTR lpProvider
Definition: winnetwk.h:174
DWORD dwScope
Definition: winnetwk.h:167
LPWSTR lpLocalName
Definition: winnetwk.h:181
LPSTR lpComment
Definition: winnetwk.h:173
DWORD dwUsage
Definition: winnetwk.h:170
LPWSTR lpComment
Definition: winnetwk.h:183
LPWSTR lpRemoteName
Definition: winnetwk.h:182
DWORD dwUsage
Definition: winnetwk.h:180
static LPWSTR strdupAtoW(LPCSTR str)
Definition: wnet.c:2314
DWORD dwScope
Definition: winnetwk.h:177
LPSTR lpRemoteName
Definition: winnetwk.h:172
DWORD dwType
Definition: winnetwk.h:178
LPWSTR lpProvider
Definition: winnetwk.h:184

Referenced by WNetUseConnectionA().

◆ strdupAtoW()

static LPWSTR strdupAtoW ( LPCSTR  str)
static

Definition at line 2314 of file wnet.c.

2315 {
2316  LPWSTR ret;
2317  INT len;
2318 
2319  if (!str) return NULL;
2320  len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
2321  ret = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
2322  if (ret) MultiByteToWideChar( CP_ACP, 0, str, -1, ret, len );
2323  return ret;
2324 }
#define CP_ACP
Definition: compat.h:99
int32_t INT
Definition: typedefs.h:56
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by netresource_a_to_w(), WNetCancelConnection2A(), and WNetUseConnectionA().

◆ use_connection_pre_set_accessnameA()

static DWORD use_connection_pre_set_accessnameA ( struct use_connection_context ctxt,
WCHAR local_name 
)
static

Definition at line 2278 of file wnet.c.

2279 {
2280  if (ctxt->accessname && ctxt->buffer_size && *ctxt->buffer_size)
2281  {
2282  DWORD len;
2283 
2284  if (local_name)
2285  len = WideCharToMultiByte(CP_ACP, 0, local_name, -1, NULL, 0, NULL, NULL) - 1;
2286  else
2287  len = strlen(ctxt->resourceA->lpRemoteName);
2288 
2289  if (++len > *ctxt->buffer_size)
2290  {
2291  *ctxt->buffer_size = len;
2292  return ERROR_MORE_DATA;
2293  }
2294  }
2295  else
2296  ctxt->accessname = NULL;
2297 
2298  return ERROR_SUCCESS;
2299 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define WideCharToMultiByte
Definition: compat.h:101
DWORD * buffer_size
Definition: wnet.c:2085
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_MORE_DATA
Definition: dderror.h:13
LPSTR lpRemoteName
Definition: winnetwk.h:172
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187
NETRESOURCEA * resourceA
Definition: wnet.c:2080

Referenced by WNetUseConnectionA().

◆ use_connection_pre_set_accessnameW()

static DWORD use_connection_pre_set_accessnameW ( struct use_connection_context ctxt,
WCHAR local_name 
)
static

Definition at line 2091 of file wnet.c.

2092 {
2093  if (ctxt->accessname && ctxt->buffer_size && *ctxt->buffer_size)
2094  {
2095  DWORD len;
2096 
2097  if (local_name)
2098  len = lstrlenW(local_name);
2099  else
2100  len = lstrlenW(ctxt->resource->lpRemoteName);
2101 
2102  if (++len > *ctxt->buffer_size)
2103  {
2104  *ctxt->buffer_size = len;
2105  return ERROR_MORE_DATA;
2106  }
2107  }
2108  else
2109  ctxt->accessname = NULL;
2110 
2111  return ERROR_SUCCESS;
2112 }
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD * buffer_size
Definition: wnet.c:2085
#define lstrlenW
Definition: compat.h:415
smooth NULL
Definition: ftsmooth.c:416
NETRESOURCEW * resource
Definition: wnet.c:2079
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
LPWSTR lpRemoteName
Definition: winnetwk.h:182
#define ERROR_MORE_DATA
Definition: dderror.h:13
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187

Referenced by WNetUseConnectionW().

◆ use_connection_set_accessnameA()

static void use_connection_set_accessnameA ( struct use_connection_context ctxt,
WCHAR local_name 
)
static

Definition at line 2301 of file wnet.c.

2302 {
2303  char *accessname = ctxt->accessname;
2304  if (local_name)
2305  {
2306  WideCharToMultiByte(CP_ACP, 0, local_name, -1, accessname, *ctxt->buffer_size, NULL, NULL);
2307  if (ctxt->result)
2308  *ctxt->result = CONNECT_LOCALDRIVE;
2309  }
2310  else
2311  strcpy(accessname, ctxt->resourceA->lpRemoteName);
2312 }
#define WideCharToMultiByte
Definition: compat.h:101
DWORD * buffer_size
Definition: wnet.c:2085
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
LPSTR lpRemoteName
Definition: winnetwk.h:172
#define CONNECT_LOCALDRIVE
Definition: winnetwk.h:95
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187
NETRESOURCEA * resourceA
Definition: wnet.c:2080

Referenced by WNetUseConnectionA().

◆ use_connection_set_accessnameW()

static void use_connection_set_accessnameW ( struct use_connection_context ctxt,
WCHAR local_name 
)
static

Definition at line 2114 of file wnet.c.

2115 {
2116  WCHAR *accessname = ctxt->accessname;
2117  if (local_name)
2118  {
2119  lstrcpyW(accessname, local_name);
2120  if (ctxt->result)
2121  *ctxt->result = CONNECT_LOCALDRIVE;
2122  }
2123  else
2124  lstrcpyW(accessname, ctxt->resource->lpRemoteName);
2125 }
NETRESOURCEW * resource
Definition: wnet.c:2079
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR lpRemoteName
Definition: winnetwk.h:182
#define lstrcpyW
Definition: compat.h:414
#define CONNECT_LOCALDRIVE
Definition: winnetwk.h:95
static BSTR local_name(call_frame_t *frame, int ref)
Definition: engine.c:187

Referenced by WNetUseConnectionW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( mpr  )

◆ wnet_use_connection()

static DWORD wnet_use_connection ( struct use_connection_context ctxt)
static

Definition at line 2156 of file wnet.c.

2157 {
2158  WNetProvider *provider = NULL;
2160  BOOL redirect = FALSE;
2161  WCHAR letter[3] = {'Z', ':', 0};
2162  NETRESOURCEW netres;
2163 
2165  return WN_NO_NETWORK;
2166 
2167  if (!ctxt->resource)
2168  return ERROR_INVALID_PARAMETER;
2169  netres = *ctxt->resource;
2170 
2171  if (!netres.lpLocalName && (ctxt->flags & CONNECT_REDIRECT))
2172  {
2173  if (netres.dwType != RESOURCETYPE_DISK && netres.dwType != RESOURCETYPE_PRINT)
2174  return ERROR_BAD_DEV_TYPE;
2175 
2176  if (netres.dwType == RESOURCETYPE_PRINT)
2177  {
2178  FIXME("Local device selection is not implemented for printers.\n");
2179  return WN_NO_NETWORK;
2180  }
2181 
2182  redirect = TRUE;
2183  netres.lpLocalName = letter;
2184  }
2185 
2186  if (ctxt->flags & CONNECT_INTERACTIVE)
2187  return ERROR_BAD_NET_NAME;
2188 
2189  if ((ret = ctxt->pre_set_accessname(ctxt, netres.lpLocalName)))
2190  return ret;
2191 
2192  if (netres.lpProvider)
2193  {
2195  if (index == BAD_PROVIDER_INDEX)
2196  return ERROR_BAD_PROVIDER;
2197 
2198  provider = &providerTable->table[index];
2199  ret = wnet_use_provider(ctxt, &netres, provider, redirect);
2200  }
2201  else
2202  {
2203  for (index = 0; index < providerTable->numProviders; index++)
2204  {
2205  provider = &providerTable->table[index];
2206  ret = wnet_use_provider(ctxt, &netres, provider, redirect);
2207  if (ret == WN_SUCCESS || ret == WN_ALREADY_CONNECTED)
2208  break;
2209  }
2210  }
2211 
2212  if (ret == WN_SUCCESS && ctxt->flags & CONNECT_UPDATE_PROFILE)
2213  {
2214  HKEY user_profile;
2215 
2216  if (netres.dwType == RESOURCETYPE_PRINT)
2217  {
2218  FIXME("Persistent connection are not supported for printers\n");
2219  return ret;
2220  }
2221 
2222  if (RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
2223  {
2224  HKEY network;
2225  WCHAR subkey[10] = {'N', 'e', 't', 'w', 'o', 'r', 'k', '\\', netres.lpLocalName[0], 0};
2226 
2227  if (RegCreateKeyExW(user_profile, subkey, 0, NULL, REG_OPTION_NON_VOLATILE,
2229  {
2230  DWORD dword_arg = RESOURCETYPE_DISK;
2231  DWORD len = (lstrlenW(provider->name) + 1) * sizeof(WCHAR);
2232  static const WCHAR empty[1] = {0};
2233 
2234  RegSetValueExW(network, connectionType, 0, REG_DWORD, (const BYTE *)&dword_arg, sizeof(DWORD));
2235  RegSetValueExW(network, providerName, 0, REG_SZ, (const BYTE *)provider->name, len);
2236  RegSetValueExW(network, providerType, 0, REG_DWORD, (const BYTE *)&provider->dwNetType, sizeof(DWORD));
2237  len = (lstrlenW(netres.lpRemoteName) + 1) * sizeof(WCHAR);
2238  RegSetValueExW(network, remotePath, 0, REG_SZ, (const BYTE *)netres.lpRemoteName, len);
2239  len = sizeof(empty);
2240  RegSetValueExW(network, userName, 0, REG_SZ, (const BYTE *)empty, len);
2242  }
2243 
2244  RegCloseKey(user_profile);
2245  }
2246  }
2247 
2248  return ret;
2249 }
static const WCHAR providerType[]
Definition: wnet.c:2153
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_BAD_PROVIDER
Definition: winerror.h:707
PWSTR name
Definition: wnet.c:53
#define TRUE
Definition: types.h:120
#define CONNECT_UPDATE_PROFILE
Definition: winnetwk.h:87
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
static const WCHAR remotePath[]
Definition: wnet.c:1543
#define ERROR_BAD_NET_NAME
Definition: winerror.h:159
#define lstrlenW
Definition: compat.h:415
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1091
#define WN_ALREADY_CONNECTED
Definition: winnetwk.h:137
WNetProvider table[1]
Definition: wnet.c:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define CONNECT_INTERACTIVE
Definition: winnetwk.h:90
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BAD_PROVIDER_INDEX
Definition: wnet.c:120
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
data1 network
Definition: tftpd.cpp:49
static const WCHAR connectionType[]
Definition: wnet.c:1541
static DWORD _findProviderIndexW(LPCWSTR lpProvider)
Definition: wnet.c:507
NETRESOURCEW * resource
Definition: wnet.c:2079
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define ERROR_BAD_DEV_TYPE
Definition: winerror.h:158
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
LPWSTR lpLocalName
Definition: winnetwk.h:181
#define CONNECT_REDIRECT
Definition: winnetwk.h:94
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD(* pre_set_accessname)(struct use_connection_context *, WCHAR *)
Definition: wnet.c:2087
#define WN_NO_NETWORK
Definition: winnetwk.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define index(s, c)
Definition: various.h:29
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
LPWSTR lpRemoteName
Definition: winnetwk.h:182
#define RESOURCETYPE_DISK
Definition: winnetwk.h:64
#define RESOURCETYPE_PRINT
Definition: winnetwk.h:65
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
BOOL empty
Definition: button.c:170
static DWORD wnet_use_provider(struct use_connection_context *ctxt, NETRESOURCEW *netres, WNetProvider *provider, BOOLEAN redirect)
Definition: wnet.c:2127
static const WCHAR userName[]
Definition: wnet.c:2154
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3232
DWORD dwType
Definition: winnetwk.h:178
DWORD dwNetType
Definition: wnet.c:56
LPWSTR lpProvider
Definition: winnetwk.h:184
static const WCHAR providerName[]
Definition: wnet.c:1542
#define REG_DWORD
Definition: sdbapi.c:596
#define REG_SZ
Definition: layer.c:22

Referenced by WNetUseConnectionA(), and WNetUseConnectionW().

◆ wnet_use_provider()

static DWORD wnet_use_provider ( struct use_connection_context ctxt,
NETRESOURCEW netres,
WNetProvider provider,
BOOLEAN  redirect 
)
static

Definition at line 2127 of file wnet.c.

2128 {
2129  DWORD caps, ret;
2130 
2131  caps = provider->getCaps(WNNC_CONNECTION);
2133  return ERROR_BAD_PROVIDER;
2134 
2136  do
2137  {
2138  if ((caps & WNNC_CON_ADDCONNECTION3) && provider->addConnection3)
2139  ret = provider->addConnection3(ctxt->hwndOwner, netres, ctxt->password, ctxt->userid, ctxt->flags);
2140  else if ((caps & WNNC_CON_ADDCONNECTION) && provider->addConnection)
2141  ret = provider->addConnection(netres, ctxt->password, ctxt->userid);
2142 
2143  if (ret == WN_ALREADY_CONNECTED && redirect)
2144  netres->lpLocalName[0] -= 1;
2145  } while (redirect && ret == WN_ALREADY_CONNECTED && netres->lpLocalName[0] >= 'C');
2146 
2147  if (ret == WN_SUCCESS && ctxt->accessname)
2148  ctxt->set_accessname(ctxt, netres->lpLocalName);
2149 
2150  return ret;
2151 }
#define WNNC_CON_ADDCONNECTION3
Definition: npapi.h:36
#define ERROR_BAD_PROVIDER
Definition: winerror.h:707
PF_NPAddConnection addConnection
Definition: wnet.c:62
#define WN_SUCCESS
Definition: winnetwk.h:111
#define WNNC_CON_ADDCONNECTION
Definition: npapi.h:33
#define WN_ALREADY_CONNECTED
Definition: winnetwk.h:137
PF_NPGetCaps getCaps
Definition: wnet.c:54
LPWSTR lpLocalName
Definition: winnetwk.h:181
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WNNC_CONNECTION
Definition: npapi.h:32
int ret
#define WN_ACCESS_DENIED
Definition: winnetwk.h:122
PF_NPAddConnection3 addConnection3
Definition: wnet.c:63
void(* set_accessname)(struct use_connection_context *, WCHAR *)
Definition: wnet.c:2088

Referenced by wnet_use_connection().

◆ WNetAddConnection2A()

DWORD WINAPI WNetAddConnection2A ( LPNETRESOURCEA  lpNetResource,
LPCSTR  lpPassword,
LPCSTR  lpUserID,
DWORD  dwFlags 
)

Definition at line 2035 of file wnet.c.

2038 {
2039  return WNetUseConnectionA(NULL, lpNetResource, lpPassword, lpUserID, dwFlags,
2040  NULL, 0, NULL);
2041 }
DWORD WINAPI WNetUseConnectionA(HWND hwndOwner, NETRESOURCEA *resource, LPCSTR password, LPCSTR userid, DWORD flags, LPSTR accessname, DWORD *buffer_size, DWORD *result)
Definition: wnet.c:2349
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ WNetAddConnection2W()

DWORD WINAPI WNetAddConnection2W ( LPNETRESOURCEW  lpNetResource,
LPCWSTR  lpPassword,
LPCWSTR  lpUserID,
DWORD  dwFlags 
)

Definition at line 2046 of file wnet.c.

2049 {
2050  return WNetUseConnectionW(NULL, lpNetResource, lpPassword, lpUserID, dwFlags,
2051  NULL, 0, NULL);
2052 }
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD WINAPI WNetUseConnectionW(HWND hwndOwner, NETRESOURCEW *resource, LPCWSTR password, LPCWSTR userid, DWORD flags, LPWSTR accessname, DWORD *buffer_size, DWORD *result)
Definition: wnet.c:2254

◆ WNetAddConnection3A()

DWORD WINAPI WNetAddConnection3A ( HWND  hwndOwner,
LPNETRESOURCEA  lpNetResource,
LPCSTR  lpPassword,
LPCSTR  lpUserID,
DWORD  dwFlags 
)

Definition at line 2057 of file wnet.c.

2060 {
2061  return WNetUseConnectionA(hwndOwner, lpNetResource, lpPassword, lpUserID,
2062  dwFlags, NULL, 0, NULL);
2063 }
DWORD WINAPI WNetUseConnectionA(HWND hwndOwner, NETRESOURCEA *resource, LPCSTR password, LPCSTR userid, DWORD flags, LPSTR accessname, DWORD *buffer_size, DWORD *result)
Definition: wnet.c:2349
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ WNetAddConnection3W()

DWORD WINAPI WNetAddConnection3W ( HWND  hwndOwner,
LPNETRESOURCEW  lpNetResource,
LPCWSTR  lpPassword,
LPCWSTR  lpUserID,
DWORD  dwFlags 
)

Definition at line 2068 of file wnet.c.

2071 {
2072  return WNetUseConnectionW(hwndOwner, lpNetResource, lpPassword, lpUserID,
2073  dwFlags, NULL, 0, NULL);
2074 }
smooth NULL
Definition: ftsmooth.c:416
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD WINAPI WNetUseConnectionW(HWND hwndOwner, NETRESOURCEW *resource, LPCWSTR password, LPCWSTR userid, DWORD flags, LPWSTR accessname, DWORD *buffer_size, DWORD *result)
Definition: wnet.c:2254

◆ WNetAddConnectionA()

DWORD WINAPI WNetAddConnectionA ( LPCSTR  lpRemoteName,
LPCSTR  lpPassword,
LPCSTR  lpLocalName 
)

Definition at line 2007 of file wnet.c.

2009 {
2010  NETRESOURCEA resourcesA;
2011 
2012  memset(&resourcesA, 0, sizeof(resourcesA));
2013  resourcesA.lpRemoteName = (LPSTR)lpRemoteName;
2014  resourcesA.lpLocalName = (LPSTR)lpLocalName;
2015  return WNetUseConnectionA(NULL, &resourcesA, lpPassword, NULL, 0, NULL, 0, NULL);
2016 }
DWORD WINAPI WNetUseConnectionA(HWND hwndOwner, NETRESOURCEA *resource, LPCSTR password, LPCSTR userid, DWORD flags, LPSTR accessname, DWORD *buffer_size, DWORD *result)
Definition: wnet.c:2349
LPSTR lpLocalName
Definition: winnetwk.h:171
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
LPSTR lpRemoteName
Definition: winnetwk.h:172
#define memset(x, y, z)
Definition: compat.h:39

◆ WNetAddConnectionW()

DWORD WINAPI WNetAddConnectionW ( LPCWSTR  lpRemoteName,
LPCWSTR  lpPassword,
LPCWSTR  lpLocalName 
)

Definition at line 2021 of file wnet.c.

2023 {
2024  NETRESOURCEW resourcesW;
2025 
2026  memset(&resourcesW, 0, sizeof(resourcesW));
2027  resourcesW.lpRemoteName = (LPWSTR)lpRemoteName;
2028  resourcesW.lpLocalName = (LPWSTR)lpLocalName;
2029  return WNetUseConnectionW(NULL, &resourcesW, lpPassword, NULL, 0, NULL, 0, NULL);
2030 }
smooth NULL
Definition: ftsmooth.c:416
LPWSTR lpLocalName
Definition: winnetwk.h:181
LPWSTR lpRemoteName
Definition: winnetwk.h:182
DWORD WINAPI WNetUseConnectionW(HWND hwndOwner, NETRESOURCEW *resource, LPCWSTR password, LPCWSTR userid, DWORD flags, LPWSTR accessname, DWORD *buffer_size, DWORD *result)
Definition: wnet.c:2254
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39

◆ WNetCancelConnection2A()

DWORD WINAPI WNetCancelConnection2A ( LPCSTR  lpName,
DWORD  dwFlags,
BOOL  fForce 
)

Definition at line 2402 of file wnet.c.

2403 {
2404  DWORD ret;
2405  WCHAR * name = strdupAtoW(lpName);
2406  if (!name)
2407  return ERROR_NOT_CONNECTED;
2408 
2409  ret = WNetCancelConnection2W(name, dwFlags, fForce);
2410  HeapFree(GetProcessHeap(), 0, name);
2411 
2412  return ret;
2413 }
_In_ LPCSTR lpName
Definition: winbase.h:2736
#define ERROR_NOT_CONNECTED
Definition: winerror.h:1201
#define GetProcessHeap()
Definition: compat.h:403
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
DWORD WINAPI WNetCancelConnection2W(LPCWSTR lpName, DWORD dwFlags, BOOL fForce)
Definition: wnet.c:2418
static LPWSTR strdupAtoW(LPCSTR str)
Definition: wnet.c:2314
Definition: name.c:36
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by WNetCancelConnectionA().

◆ WNetCancelConnection2W()

DWORD WINAPI WNetCancelConnection2W ( LPCWSTR  lpName,
DWORD  dwFlags,
BOOL  fForce 
)

Definition at line 2418 of file wnet.c.

2419 {
2421  DWORD index;
2422 
2423  if (providerTable != NULL)
2424  {
2425  for (index = 0; index < providerTable->numProviders; index++)
2426  {
2429  {
2432  else
2433  ret = WN_NO_NETWORK;
2434  if (ret == WN_SUCCESS || ret == WN_OPEN_FILES)
2435  break;
2436  }
2437  }
2438  }
2439 
2441  {
2442  HKEY user_profile;
2443 
2444  /* FIXME: Only remove it if that's a drive letter */
2445  if (iswalpha(lpName[0]) && lpName[1] == ':' &&
2446  RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
2447  {
2448  WCHAR subkey[10] = {'N', 'e', 't', 'w', 'o', 'r', 'k', '\\', lpName[0], 0};
2449 
2450  RegDeleteKeyW(user_profile, subkey);
2451 
2452  RegCloseKey(user_profile);
2453  }
2454  }
2455 
2456  return ret;
2457 }
#define CONNECT_UPDATE_PROFILE
Definition: winnetwk.h:87
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
_In_ LPCSTR lpName
Definition: winbase.h:2736
#define iswalpha(_c)
Definition: ctype.h:664
WNetProvider table[1]
Definition: wnet.c:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
PF_NPCancelConnection cancelConnection
Definition: wnet.c:64
PF_NPGetCaps getCaps
Definition: wnet.c:54
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WN_NO_NETWORK
Definition: winnetwk.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WNNC_CONNECTION
Definition: npapi.h:32
int ret
#define index(s, c)
Definition: various.h:29
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define WN_OPEN_FILES
Definition: winnetwk.h:133
#define WNNC_CON_CANCELCONNECTION
Definition: npapi.h:34
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3232
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by DrivesContextMenuCallback(), WNetCancelConnection2A(), WNetCancelConnectionW(), and WNetClearConnections().

◆ WNetCancelConnectionA()

DWORD WINAPI WNetCancelConnectionA ( LPCSTR  lpName,
BOOL  fForce 
)

Definition at line 2386 of file wnet.c.

2387 {
2388  return WNetCancelConnection2A(lpName, 0, fForce);
2389 }
_In_ LPCSTR lpName
Definition: winbase.h:2736
DWORD WINAPI WNetCancelConnection2A(LPCSTR lpName, DWORD dwFlags, BOOL fForce)
Definition: wnet.c:2402

Referenced by test_WNetUseConnection().

◆ WNetCancelConnectionW()

DWORD WINAPI WNetCancelConnectionW ( LPCWSTR  lpName,
BOOL  fForce 
)

Definition at line 2394 of file wnet.c.

2395 {
2396  return WNetCancelConnection2W(lpName, 0, fForce);
2397 }
_In_ LPCSTR lpName
Definition: winbase.h:2736
DWORD WINAPI WNetCancelConnection2W(LPCWSTR lpName, DWORD dwFlags, BOOL fForce)
Definition: wnet.c:2418

◆ WNetClearConnections()

DWORD WINAPI WNetClearConnections ( HWND  owner)

Definition at line 2825 of file wnet.c.

2826 {
2827  HANDLE connected;
2828  PWSTR connection;
2829  DWORD ret, size, count;
2830  NETRESOURCEW * resources, * iter;
2831 
2833  if (ret != WN_SUCCESS)
2834  {
2835  if (ret != WN_NO_NETWORK)
2836  {
2837  return ret;
2838  }
2839 
2840  /* Means no provider, then, clearing is OK */
2841  return WN_SUCCESS;
2842  }
2843 
2844  size = 0x1000;
2846  if (!resources)
2847  {
2849  return WN_OUT_OF_MEMORY;
2850  }
2851 
2852  for (;;)
2853  {
2854  size = 0x1000;
2855  count = -1;
2856 
2857  memset(resources, 0, size);
2859  if (ret == WN_SUCCESS || ret == WN_MORE_DATA)
2860  {
2861  for (iter = resources; count; count--, iter++)
2862  {
2863  if (iter->lpLocalName && iter->lpLocalName[0])
2864  connection = iter->lpLocalName;
2865  else
2866  connection = iter->lpRemoteName;
2867 
2868  WNetCancelConnection2W(connection, 0, TRUE);
2869  }
2870  }
2871  else
2872  break;
2873  }
2874 
2877 
2878  return ret;
2879 }
#define TRUE
Definition: types.h:120
#define WN_SUCCESS
Definition: winnetwk.h:111
uint16_t * PWSTR
Definition: typedefs.h:54
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define RESOURCE_CONNECTED
Definition: winnetwk.h:58
static struct resource resources[16]
smooth NULL
Definition: ftsmooth.c:416
LPWSTR lpLocalName
Definition: winnetwk.h:181
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define WN_NO_NETWORK
Definition: winnetwk.h:126
DWORD WINAPI WNetEnumResourceW(HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: wnet.c:1700
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
DWORD WINAPI WNetCloseEnum(HANDLE hEnum)
Definition: wnet.c:1760
LPWSTR lpRemoteName
Definition: winnetwk.h:182
DWORD WINAPI WNetCancelConnection2W(LPCWSTR lpName, DWORD dwFlags, BOOL fForce)
Definition: wnet.c:2418
int connected
Definition: main.c:61
DWORD WINAPI WNetOpenEnumW(DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCEW lpNet, LPHANDLE lphEnum)
Definition: wnet.c:920
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define RESOURCETYPE_ANY
Definition: winnetwk.h:63
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by LogoffShutdownThread().

◆ WNetCloseEnum()

DWORD WINAPI WNetCloseEnum ( HANDLE  hEnum)

Definition at line 1760 of file wnet.c.

1761 {
1762  DWORD ret, index;
1763  HANDLE *handles;
1764 
1765  TRACE( "(%p)\n", hEnum );
1766 
1767  if (hEnum)
1768  {
1769  PWNetEnumerator enumerator = (PWNetEnumerator)hEnum;
1770 
1771  switch (enumerator->enumType)
1772  {
1774  if (enumerator->specific.net)
1775  _freeEnumNetResource(enumerator->specific.net);
1776  if (enumerator->handle)
1777  providerTable->table[enumerator->providerIndex].
1778  closeEnum(enumerator->handle);
1779  ret = WN_SUCCESS;
1780  break;
1782  if (enumerator->handle)
1783  providerTable->table[enumerator->providerIndex].
1784  closeEnum(enumerator->handle);
1785  ret = WN_SUCCESS;
1786  break;
1788  handles = enumerator->specific.handles;
1789  for (index = 0; index < providerTable->numProviders; index++)
1790  {
1793  }
1795  ret = WN_SUCCESS;
1796  break;
1798  RegCloseKey(enumerator->specific.remembered.registry);
1799  ret = WN_SUCCESS;
1800  break;
1801  default:
1802  WARN("bogus enumerator type!\n");
1803  ret = WN_BAD_HANDLE;
1804  }
1805  HeapFree(GetProcessHeap(), 0, hEnum);
1806  }
1807  else
1808  ret = WN_BAD_HANDLE;
1809  if (ret)
1810  SetLastError(ret);
1811  TRACE("Returning %d\n", ret);
1812  return ret;
1813 }
static void _freeEnumNetResource(LPNETRESOURCEW lpNet)
Definition: wnet.c:554
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
struct _WNetEnumerator * PWNetEnumerator
DWORD providerIndex
Definition: wnet.c:102
#define WARN(fmt,...)
Definition: debug.h:111
NETRESOURCEW * net
Definition: wnet.c:110
DWORD enumType
Definition: wnet.c:101
WNetProvider table[1]
Definition: wnet.c:75
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
struct _WNetEnumerator::@458::@459 remembered
#define WNET_ENUMERATOR_TYPE_CONNECTED
Definition: wnet.c:81
GLuint index
Definition: glext.h:6031
HANDLE * handles
Definition: wnet.c:111
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
static object_header_t ** handles
Definition: handle.c:46
PF_NPCloseEnum closeEnum
Definition: wnet.c:60
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
union _WNetEnumerator::@458 specific
DWORD dwEnumScopes
Definition: wnet.c:57
int ret
#define index(s, c)
Definition: various.h:29
HANDLE handle
Definition: wnet.c:103
#define WNET_ENUMERATOR_TYPE_PROVIDER
Definition: wnet.c:79
#define WN_BAD_HANDLE
Definition: winnetwk.h:129
#define HeapFree(x, y, z)
Definition: compat.h:402
#define WNET_ENUMERATOR_TYPE_REMEMBERED
Definition: wnet.c:82

Referenced by EnumerateConnectedDrives(), EnumerateConnections(), CNetFolderEnum::EnumerateRec(), np_enum(), RestoreAllConnections(), and WNetClearConnections().

◆ WNetConnectionDialog()

DWORD WINAPI WNetConnectionDialog ( HWND  hwnd,
DWORD  dwType 
)

Definition at line 2911 of file wnet.c.

2912 {
2913  CONNECTDLGSTRUCTW conn_dlg;
2914  NETRESOURCEW net_res;
2915 
2916  ZeroMemory(&conn_dlg, sizeof(conn_dlg));
2917  ZeroMemory(&net_res, sizeof(net_res));
2918 
2919  conn_dlg.cbStructure = sizeof(conn_dlg);
2920  conn_dlg.lpConnRes = &net_res;
2921  conn_dlg.hwndOwner = hwnd;
2922  net_res.dwType = dwType;
2923 
2924  return WNetConnectionDialog1W(&conn_dlg);
2925 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define ZeroMemory
Definition: winbase.h:1642
LPNETRESOURCEW lpConnRes
Definition: winnetwk.h:196
DWORD WINAPI WNetConnectionDialog1W(LPCONNECTDLGSTRUCTW lpConnDlgStruct)
Definition: wnet.c:2941
DWORD dwType
Definition: winnetwk.h:178

Referenced by FrameWndProc(), and CShellBrowser::OnMapNetworkDrive().

◆ WNetConnectionDialog1A()

DWORD WINAPI WNetConnectionDialog1A ( LPCONNECTDLGSTRUCTA  lpConnDlgStruct)

Definition at line 2930 of file wnet.c.

2931 {
2932  FIXME( "(%p): stub\n", lpConnDlgStruct );
2933 
2935  return WN_NO_NETWORK;
2936 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define SetLastError(x)
Definition: compat.h:417

◆ WNetConnectionDialog1W()

DWORD WINAPI WNetConnectionDialog1W ( LPCONNECTDLGSTRUCTW  lpConnDlgStruct)

Definition at line 2941 of file wnet.c.

2942 {
2943  FIXME( "(%p): stub\n", lpConnDlgStruct );
2944 
2946  return WN_NO_NETWORK;
2947 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define SetLastError(x)
Definition: compat.h:417

Referenced by WNetConnectionDialog().

◆ WNetDisconnectDialog()

DWORD WINAPI WNetDisconnectDialog ( HWND  hwnd,
DWORD  dwType 
)

Definition at line 2952 of file wnet.c.

2953 {
2954 #ifdef __REACTOS__
2955  DWORD dwRet;
2956  HMODULE hDll = LoadLibraryW(L"netplwiz.dll");
2957  static BOOL (WINAPI *pSHDisconnectNetDrives)(PVOID);
2958  pSHDisconnectNetDrives = (VOID *) GetProcAddress(hDll, "SHDisconnectNetDrives");
2959 
2960  dwRet = pSHDisconnectNetDrives(NULL);
2961 
2962  FreeLibrary(hDll);
2963  return dwRet;
2964 #else
2965  FIXME( "(%p, %08X): stub\n", hwnd, dwType );
2966 
2968  return WN_NO_NETWORK;
2969 #endif
2970 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define BOOL
Definition: nt_native.h:43
#define FIXME(fmt,...)
Definition: debug.h:110
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
#define FreeLibrary(x)
Definition: compat.h:413
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
static const WCHAR L[]
Definition: oid.c:1250
#define GetProcAddress(x, y)
Definition: compat.h:418

Referenced by FrameWndProc(), and CShellBrowser::OnDisconnectNetworkDrive().

◆ WNetDisconnectDialog1A()

DWORD WINAPI WNetDisconnectDialog1A ( LPDISCDLGSTRUCTA  lpConnDlgStruct)

Definition at line 2975 of file wnet.c.

2976 {
2977  FIXME( "(%p): stub\n", lpConnDlgStruct );
2978 
2980  return WN_NO_NETWORK;
2981 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define SetLastError(x)
Definition: compat.h:417

◆ WNetDisconnectDialog1W()

DWORD WINAPI WNetDisconnectDialog1W ( LPDISCDLGSTRUCTW  lpConnDlgStruct)

Definition at line 2986 of file wnet.c.

2987 {
2988  FIXME( "(%p): stub\n", lpConnDlgStruct );
2989 
2991  return WN_NO_NETWORK;
2992 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define SetLastError(x)
Definition: compat.h:417

◆ WNetEnumResourceA()

DWORD WINAPI WNetEnumResourceA ( HANDLE  hEnum,
LPDWORD  lpcCount,
LPVOID  lpBuffer,
LPDWORD  lpBufferSize 
)

Definition at line 1050 of file wnet.c.

1052 {
1053  DWORD ret;
1054 
1055  TRACE( "(%p, %p, %p, %p)\n", hEnum, lpcCount, lpBuffer, lpBufferSize );
1056 
1057  if (!hEnum)
1058  ret = WN_BAD_POINTER;
1059  else if (!lpcCount)
1060  ret = WN_BAD_POINTER;
1061  else if (!lpBuffer)
1062  ret = WN_BAD_POINTER;
1063  else if (!lpBufferSize)
1064  ret = WN_BAD_POINTER;
1065  else if (*lpBufferSize < sizeof(NETRESOURCEA))
1066  {
1067  *lpBufferSize = sizeof(NETRESOURCEA);
1068  ret = WN_MORE_DATA;
1069  }
1070  else
1071  {
1072  DWORD localCount = *lpcCount, localSize = *lpBufferSize;
1073  LPVOID localBuffer = HeapAlloc(GetProcessHeap(), 0, localSize);
1074 
1075  if (localBuffer)
1076  {
1077  ret = WNetEnumResourceW(hEnum, &localCount, localBuffer,
1078  &localSize);
1079  if (ret == WN_SUCCESS || (ret == WN_MORE_DATA && localCount != -1))
1080  {
1081  /* FIXME: this isn't necessarily going to work in the case of
1082  * WN_MORE_DATA, because our enumerator may have moved on to
1083  * the next provider. MSDN states that a large (16KB) buffer
1084  * size is the appropriate usage of this function, so
1085  * hopefully it won't be an issue.
1086  */
1087  ret = _thunkNetResourceArrayWToA(localBuffer, &localCount,
1088  lpBuffer, lpBufferSize);
1089  *lpcCount = localCount;
1090  }
1091  HeapFree(GetProcessHeap(), 0, localBuffer);
1092  }
1093  else
1095  }
1096  if (ret)
1097  SetLastError(ret);
1098  TRACE("Returning %d\n", ret);
1099  return ret;
1100 }
#define WN_SUCCESS
Definition: winnetwk.h:111
struct _NETRESOURCEA NETRESOURCEA
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
DWORD WINAPI WNetEnumResourceW(HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: wnet.c:1700
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
#define WN_BAD_POINTER
Definition: winnetwk.h:118
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define HeapFree(x, y, z)
Definition: compat.h:402
static DWORD _thunkNetResourceArrayWToA(const NETRESOURCEW *lpNetArrayIn, const DWORD *lpcCount, LPVOID lpBuffer, const DWORD *lpBufferSize)
Definition: wnet.c:660

◆ WNetEnumResourceW()

DWORD WINAPI WNetEnumResourceW ( HANDLE  hEnum,
LPDWORD  lpcCount,
LPVOID  lpBuffer,
LPDWORD  lpBufferSize 
)

Definition at line 1700 of file wnet.c.

1702 {
1703  DWORD ret;
1704 
1705  TRACE( "(%p, %p, %p, %p)\n", hEnum, lpcCount, lpBuffer, lpBufferSize );
1706 
1707  if (!hEnum)
1708  ret = WN_BAD_POINTER;
1709  else if (!lpcCount)
1710  ret = WN_BAD_POINTER;
1711  else if (!lpBuffer)
1712  ret = WN_BAD_POINTER;
1713  else if (!lpBufferSize)
1714  ret = WN_BAD_POINTER;
1715  else if (*lpBufferSize < sizeof(NETRESOURCEW))
1716  {
1717  *lpBufferSize = sizeof(NETRESOURCEW);
1718  ret = WN_MORE_DATA;
1719  }
1720  else
1721  {
1722  PWNetEnumerator enumerator = (PWNetEnumerator)hEnum;
1723 
1724  switch (enumerator->enumType)
1725  {
1727  ret = _enumerateGlobalW(enumerator, lpcCount, lpBuffer,
1728  lpBufferSize);
1729  break;
1731  ret = _enumerateProviderW(enumerator, lpcCount, lpBuffer,
1732  lpBufferSize);
1733  break;
1735  ret = _enumerateContextW(enumerator, lpcCount, lpBuffer,
1736  lpBufferSize);
1737  break;
1739  ret = _enumerateConnectedW(enumerator, lpcCount, lpBuffer,
1740  lpBufferSize);
1741  break;
1743  ret = _enumeratorRememberedW(enumerator, lpcCount, lpBuffer,
1744  lpBufferSize);
1745  break;
1746  default:
1747  WARN("bogus enumerator type!\n");
1748  ret = WN_NO_NETWORK;
1749  }
1750  }
1751  if (ret)
1752  SetLastError(ret);
1753  TRACE("Returning %d\n", ret);
1754  return ret;
1755 }
struct _NETRESOURCEW NETRESOURCEW
struct _WNetEnumerator * PWNetEnumerator
#define WARN(fmt,...)
Definition: debug.h:111
DWORD enumType
Definition: wnet.c:101
static DWORD _enumerateContextW(PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: wnet.c:1341
#define WNET_ENUMERATOR_TYPE_GLOBAL
Definition: wnet.c:78
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
static DWORD _enumerateProviderW(PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: wnet.c:1316
#define WNET_ENUMERATOR_TYPE_CONNECTED
Definition: wnet.c:81
#define TRACE(s)
Definition: solgame.cpp:4
#define WN_NO_NETWORK
Definition: winnetwk.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
static DWORD _enumerateGlobalW(PWNetEnumerator enumerator, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
Definition: wnet.c:1274
#define SetLastError(x)
Definition: compat.h:417
int ret
#define WNET_ENUMERATOR_TYPE_CONTEXT
Definition: wnet.c:80
#define WN_BAD_POINTER
Definition: winnetwk.h:118
static DWORD _enumeratorRememberedW(PWNetEnumerator enumerator, DWORD *user_count, void *user_buffer, DWORD *user_size)
Definition: wnet.c:1559
static DWORD _enumerateConnectedW(PWNetEnumerator enumerator, DWORD *user_count, void *user_buffer, DWORD *user_size)
Definition: wnet.c:1436
#define WNET_ENUMERATOR_TYPE_PROVIDER
Definition: wnet.c:79
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define WNET_ENUMERATOR_TYPE_REMEMBERED
Definition: wnet.c:82

Referenced by WNetClearConnections(), and WNetEnumResourceA().

◆ wnetFree()

void wnetFree ( void  )

Definition at line 490 of file wnet.c.

491 {
492  if (providerTable)
493  {
494  DWORD i;
495 
496  for (i = 0; i < providerTable->numProviders; i++)
497  {
500  }
504  }
505 }
PWSTR name
Definition: wnet.c:53
DWORD numProviders
Definition: wnet.c:74
static PWNetProviderTable providerTable
Definition: wnet.c:127
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
WNetProvider table[1]
Definition: wnet.c:75
LPWSTR entireNetwork
Definition: wnet.c:72
smooth NULL
Definition: ftsmooth.c:416
#define FreeModule(m)
Definition: winbase.h:1979
#define GetProcessHeap()
Definition: compat.h:403
HMODULE hLib
Definition: wnet.c:52
unsigned long DWORD
Definition: ntddk_ex.h:95
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by DllMain().

◆ WNetGetConnectionA()

DWORD WINAPI WNetGetConnectionA ( LPCSTR  lpLocalName,
LPSTR  lpRemoteName,
LPDWORD  lpBufferSize 
)

Definition at line 2492 of file wnet.c.

2494 {
2495  DWORD ret;
2496 
2497  if (!lpLocalName)
2498  ret = WN_BAD_POINTER;
2499  else if (!lpBufferSize)
2500  ret = WN_BAD_POINTER;
2501  else if (!lpRemoteName && *lpBufferSize)
2502  ret = WN_BAD_POINTER;
2503  else
2504  {
2505  int len = MultiByteToWideChar(CP_ACP, 0, lpLocalName, -1, NULL, 0);
2506 
2507  if (len)
2508  {
2509  PWSTR wideLocalName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
2510 
2511  if (wideLocalName)
2512  {
2513  WCHAR wideRemoteStatic[MAX_PATH];
2514  DWORD wideRemoteSize = ARRAY_SIZE(wideRemoteStatic);
2515 
2516  MultiByteToWideChar(CP_ACP, 0, lpLocalName, -1, wideLocalName, len);
2517 
2518  /* try once without memory allocation */
2519  ret = WNetGetConnectionW(wideLocalName, wideRemoteStatic,
2520  &wideRemoteSize);
2521  if (ret == WN_SUCCESS)
2522  {
2523  int len = WideCharToMultiByte(CP_ACP, 0, wideRemoteStatic,
2524  -1, NULL, 0, NULL, NULL);
2525 
2526  if (len <= *lpBufferSize)
2527  {
2528  WideCharToMultiByte(CP_ACP, 0, wideRemoteStatic, -1,
2529  lpRemoteName, *lpBufferSize, NULL, NULL);
2530  ret = WN_SUCCESS;
2531  }
2532  else
2533  {
2534  *lpBufferSize = len;
2535  ret = WN_MORE_DATA;
2536  }
2537  }
2538  else if (ret == WN_MORE_DATA)
2539  {
2540  PWSTR wideRemote = HeapAlloc(GetProcessHeap(), 0,
2541  wideRemoteSize * sizeof(WCHAR));
2542 
2543  if (wideRemote)
2544  {
2545  ret = WNetGetConnectionW(wideLocalName, wideRemote,
2546  &wideRemoteSize);
2547  if (ret == WN_SUCCESS)
2548  {
2549  if (len <= *lpBufferSize)
2550  {
2551  WideCharToMultiByte(CP_ACP, 0, wideRemoteStatic,
2552  -1, lpRemoteName, *lpBufferSize, NULL, NULL);
2553  ret = WN_SUCCESS;
2554  }
2555  else
2556  {
2557  *lpBufferSize = len;
2558  ret = WN_MORE_DATA;
2559  }
2560  }
2561  HeapFree(GetProcessHeap(), 0, wideRemote);
2562  }
2563  else
2565  }
2566  HeapFree(GetProcessHeap(), 0, wideLocalName);
2567  }
2568  else
2570  }
2571  else
2573  }
2574  if (ret)
2575  SetLastError(ret);
2576  TRACE("Returning %d\n", ret);
2577  return ret;
2578 }
DWORD WINAPI WNetGetConnectionW(LPCWSTR lpLocalName, LPWSTR lpRemoteName, LPDWORD lpBufferSize)
Definition: wnet.c:2659
#define WideCharToMultiByte
Definition: compat.h:101
#define WN_SUCCESS
Definition: winnetwk.h:111
uint16_t * PWSTR
Definition: typedefs.h:54
#define CP_ACP
Definition: compat.h:99
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define WN_BAD_POINTER
Definition: winnetwk.h:118
#define ARRAY_SIZE(a)
Definition: main.h:24
#define MultiByteToWideChar
Definition: compat.h:100
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
#define WN_MORE_DATA
Definition: winnetwk.h:117
#define HeapFree(x, y, z)
Definition: compat.h:402
#define WN_BAD_LOCALNAME
Definition: winnetwk.h:136

◆ WNetGetConnectionW()

DWORD WINAPI WNetGetConnectionW ( LPCWSTR  lpLocalName,
LPWSTR  lpRemoteName,
LPDWORD  lpBufferSize 
)

Definition at line 2659 of file wnet.c.

2661 {
2662  DWORD ret;
2663 
2664  TRACE("(%s, %p, %p)\n", debugstr_w(lpLocalName), lpRemoteName,
2665  lpBufferSize);
2666 
2667  if (!lpLocalName)
2668  ret = WN_BAD_POINTER;
2669  else if (!lpBufferSize)
2670  ret = WN_BAD_POINTER;
2671  else if (!lpRemoteName && *lpBufferSize)
2672  ret = WN_BAD_POINTER;
2673  else if (!lpLocalName[0])
2675  else
2676  {
2677  if (lpLocalName[1] == ':')
2678  {
2679  switch(GetDriveTypeW(lpLocalName))
2680  {
2681  case DRIVE_REMOTE:
2682  ret = get_drive_connection( lpLocalName[0], lpRemoteName, lpBufferSize );
2683  break;
2684  case DRIVE_REMOVABLE:
2685  case DRIVE_FIXED:
2686  case DRIVE_CDROM:
2687  TRACE("file is local\n");
2689  break;
2690  default:
2692  }
2693  }
2694  else
2696  }
2697  if (ret)
2698  SetLastError(ret);
2699  TRACE("Returning %d\n", ret);
2700  return ret;
2701 }
#define WN_NOT_CONNECTED
Definition: winnetwk.h:132
#define DRIVE_REMOVABLE
Definition: winbase.h:248
#define DRIVE_REMOTE
Definition: winbase.h:250
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
#define WN_BAD_POINTER
Definition: winnetwk.h:118
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
Definition: disk.c:497
#define DRIVE_FIXED
Definition: winbase.h:249
#define DRIVE_CDROM
Definition: winbase.h:251
static DWORD get_drive_connection(WCHAR letter, LPWSTR remote, LPDWORD size)
Definition: wnet.c:2581
#define WN_BAD_LOCALNAME
Definition: winnetwk.h:136

Referenced by WNetGetConnectionA().

◆ WNetGetLastErrorA()

DWORD WINAPI WNetGetLastErrorA ( LPDWORD  lpError,
LPSTR  lpErrorBuf,
DWORD  nErrorBufSize,
LPSTR  lpNameBuf,
DWORD  nNameBufSize 
)

Definition at line 2997 of file wnet.c.

3000 {
3001  FIXME( "(%p, %p, %d, %p, %d): stub\n",
3002  lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize );
3003 
3005  return WN_NO_NETWORK;
3006 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define SetLastError(x)
Definition: compat.h:417

◆ WNetGetLastErrorW()

DWORD WINAPI WNetGetLastErrorW ( LPDWORD  lpError,
LPWSTR  lpErrorBuf,
DWORD  nErrorBufSize,
LPWSTR  lpNameBuf,
DWORD  nNameBufSize 
)

Definition at line 3011 of file wnet.c.

3014 {
3015  FIXME( "(%p, %p, %d, %p, %d): stub\n",
3016  lpError, lpErrorBuf, nErrorBufSize, lpNameBuf, nNameBufSize );
3017 
3019  return WN_NO_NETWORK;
3020 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define WN_NO_NETWORK
Definition: winnetwk.h:126
#define SetLastError(x)
Definition: compat.h:417

Referenced by display_network_error(), and WNetGetLastErrorWrapW().

◆ WNetGetNetworkInformationA()

DWORD WINAPI WNetGetNetworkInformationA ( LPCSTR  lpProvider,
LPNETINFOSTRUCT  lpNetInfoStruct 
)

Definition at line 3025 of file wnet.c.

3027 {
3028  DWORD ret;
3029 
3030  TRACE( "(%s, %p)\n", debugstr_a(lpProvider), lpNetInfoStruct );
3031 
3032  if (!lpProvider)
3033  ret = WN_BAD_POINTER;
3034  else
3035  {
3036  int len;
3037 
3038  len = MultiByteToWideChar(CP_ACP, 0, lpProvider, -1, NULL, 0);
3039  if (len)
3040  {
3041  LPWSTR wideProvider = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
3042 
3043  if (wideProvider)
3044  {
3045  MultiByteToWideChar(CP_ACP, 0, lpProvider, -1, wideProvider,
3046  len);
3047  ret = WNetGetNetworkInformationW(wideProvider, lpNetInfoStruct);
3048  HeapFree(GetProcessHeap(), 0, wideProvider);
3049  }
3050  else
3052  }
3053  else
3054  ret = GetLastError();
3055  }
3056  if (ret)
3057  SetLastError(ret);
3058  TRACE("Returning %d\n", ret);
3059  return ret;
3060 }
#define CP_ACP
Definition: compat.h:99
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:417
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define WN_BAD_POINTER
Definition: winnetwk.h:118
DWORD WINAPI WNetGetNetworkInformationW(LPCWSTR lpProvider, LPNETINFOSTRUCT lpNetInfoStruct)
Definition: wnet.c:3065
#define MultiByteToWideChar
Definition: compat.h:100
#define WN_OUT_OF_MEMORY
Definition: winnetwk.h:125
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ WNetGetNetworkInformationW()

DWORD WINAPI WNetGetNetworkInformationW ( LPCWSTR  lpProvider,
LPNETINFOSTRUCT  lpNetInfoStruct 
)

Definition at line 3065 of file wnet.c.

3067 {
3068  DWORD ret;
3069 
3070  TRACE( "(%s, %p)\n", debugstr_w(lpProvider), lpNetInfoStruct );
3071 
3072  if (!lpProvider)
3073  ret = WN_BAD_POINTER;
3074  else if (!lpNetInfoStruct)
3075  ret = WN_BAD_POINTER;
3076  else if (lpNetInfoStruct->cbStructure < sizeof(NETINFOSTRUCT))
3077  ret = WN_BAD_VALUE;
3078  else
3079  {
3081  {
3082  DWORD providerIndex = _findProviderIndexW(lpProvider);
3083 
3084  if (providerIndex != BAD_PROVIDER_INDEX)
3085  {
3086  lpNetInfoStruct->cbStructure = sizeof(NETINFOSTRUCT);
3087  lpNetInfoStruct->dwProviderVersion =
3088  providerTable->table[providerIndex].dwSpecVersion;
3089  lpNetInfoStruct->dwStatus = NO_ERROR;
3090  lpNetInfoStruct->dwCharacteristics = 0;
3091  lpNetInfoStruct->dwHandle = 0;
3092  lpNetInfoStruct->wNetType =
3093  HIWORD(providerTable->table[providerIndex].dwNetType);
3094  lpNetInfoStruct->dwPrinters = -1;
3095  lpNetInfoStruct->dwDrives = -1;
3096  ret = WN_SUCCESS;
3097  }
3098  else
3099  ret = WN_BAD_PROVIDER;
3100  }
3101  else
3102  ret = WN_NO_NETWORK;
3103  }
3104  if (ret)
3105  SetLastError(ret);
3106  TRACE("Returning %d\n", ret);
3107  return ret;
3108 }
DWORD dwDrives
Definition: winnetwk.h:234
DWORD numProviders
Definition: wnet.c:74
#define WN_SUCCESS
Definition: winnetwk.h:111
static PWNetProviderTable providerTable
Definition: wnet.c:127
DWORD dwProviderVersion
Definition: winnetwk.h:228
#define NO_ERROR
Definition: dderror.h:5
#define WN_BAD_VALUE
Definition: winnetwk.h:119
DWORD dwPrinters
Definition: winnetwk.h:233
DWORD dwStatus
Definition: winnetwk.h:229
WNetProvider table[1]
Definition: wnet.c:75
#define BAD_PROVIDER_INDEX
Definition: wnet.c:120
#define debugstr_w
Definition: kernel32.h:32
DWORD dwCharacteristics
Definition: winnetwk.h:230
struct _NETINFOSTRUCT NETINFOSTRUCT
static DWORD _findProviderIndexW(LPCWSTR lpProvider)
Definition: wnet.c:507
#define TRACE(s)
Definition: solgame.cpp:4
#define WN_NO_NETWORK
Definition: winnetwk.h:126
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwSpecVersion
Definition: wnet.c:55
#define SetLastError(x)
Definition: compat.h:417
int ret
#define WN_BAD_POINTER
Definition: winnetwk.h:118
#define WN_BAD_PROVIDER
Definition: winnetwk.h:141
ULONG_PTR dwHandle
Definition: winnetwk.h:231
DWORD cbStructure
Definition: winnetwk.h:227
#define HIWORD(l)
Definition: typedefs.h:246
DWORD dwNetType
Definition: wnet.c:56

Referenced by WNetGetNetworkInformationA().

◆ WNetGetProviderNameA()

DWORD WINAPI WNetGetProviderNameA ( DWORD  dwNetType,
LPSTR  lpProvider,
LPDWORD  lpBufferSize 
)

Definition at line 3113 of file wnet.c.

3115 {
3116  DWORD ret;
3117 
3118  TRACE("(0x%08x, %s, %p)\n", dwNetType, debugstr_a(lpProvider),
3119  lpBufferSize);
3120 
3121  if (!lpProvider)
3122  ret = WN_BAD_POINTER;
3123  else if (!lpBufferSize)
3124  ret = WN_BAD_POINTER;
3125  else
3126  {
3127  if (providerTable)
3128  {
3129  DWORD i;
3130 
3131  ret = WN_NO_NETWORK;
3132  for (i = 0; i < providerTable->numProviders &&
3133  HIWORD(providerTable->table[i].dwNetType) != HIWORD(dwNetType);
3134  i++)
3135  ;
3136  if (i < providerTable->numProviders)
3137  {
3138  DWORD sizeNeeded = WideCharToMultiByte(CP_ACP, 0,
3139  providerTable->table[i].name, -1, NULL, 0, NULL, NULL);
3140 
3141  if (*lpBufferSize < sizeNeeded)
3142  {
3143  *lpBufferSize = sizeNeeded;
3144  ret = WN_MORE_DATA;
3145  }
3146  else
3147  {
3149  -1, lpProvider, *lpBufferSize, NULL, NULL);
3150  ret = WN_SUCCESS;
3151  /* FIXME: is *lpBufferSize set to the number of characters
3152  * copied? */
3153  }
3154  }
3155  }
3156  else
3157  ret = WN_NO_NETWORK;
3158  }
3159