ReactOS  0.4.15-dev-1384-g878186b
wnetpriv.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void wnetInit (HINSTANCE hInstDll) DECLSPEC_HIDDEN
 
void wnetFree (void) DECLSPEC_HIDDEN
 

Function Documentation

◆ 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
WNetProvider table[1]
Definition: wnet.c:75
LPWSTR entireNetwork
Definition: wnet.c:72
#define FreeModule(m)
Definition: winbase.h:1985
#define GetProcessHeap()
Definition: compat.h:595
HMODULE hLib
Definition: wnet.c:52
unsigned long DWORD
Definition: ntddk_ex.h:95
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
#define NULL
Definition: types.h:112
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by DllMain().

◆ wnetInit()

void wnetInit ( HINSTANCE  hInstDll)

Definition at line 352 of file wnet.c.

353 {
354  static const WCHAR providerOrderKey[] = { 'S','y','s','t','e','m','\\',
355  'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
356  'C','o','n','t','r','o','l','\\',
357  'N','e','t','w','o','r','k','P','r','o','v','i','d','e','r','\\',
358  'O','r','d','e','r',0 };
359  static const WCHAR providerOrder[] = { 'P','r','o','v','i','d','e','r',
360  'O','r','d','e','r',0 };
361  HKEY hKey;
362 
363  if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, providerOrderKey, 0, KEY_READ, &hKey)
364  == ERROR_SUCCESS)
365  {
366  DWORD size = 0;
367 
368  RegQueryValueExW(hKey, providerOrder, NULL, NULL, NULL, &size);
369  if (size)
370  {
372 
373  if (providers)
374  {
375  DWORD type;
376 
377  if (RegQueryValueExW(hKey, providerOrder, NULL, &type,
379  {
380  PWSTR ptr;
381  DWORD numToAllocate;
382 
383  TRACE("provider order is %s\n", debugstr_w(providers));
384  /* first count commas as a heuristic for how many to
385  * allocate space for */
386  for (ptr = providers, numToAllocate = 1; ptr; )
387  {
388  ptr = wcschr(ptr, ',');
389  if (ptr) {
390  numToAllocate++;
391  ptr++;
392  }
393  }
394  providerTable =
396  sizeof(WNetProviderTable)
397  + (numToAllocate - 1) * sizeof(WNetProvider));
398  if (providerTable)
399  {
400  PWSTR ptrPrev;
401  int entireNetworkLen;
402  LPCWSTR stringresource;
403 
404  entireNetworkLen = LoadStringW(hInstDll,
405  IDS_ENTIRENETWORK, (LPWSTR)&stringresource, 0);
407  GetProcessHeap(), 0, (entireNetworkLen + 1) *
408  sizeof(WCHAR));
410  {
411  memcpy(providerTable->entireNetwork, stringresource, entireNetworkLen*sizeof(WCHAR));
412  providerTable->entireNetwork[entireNetworkLen] = 0;
413  }
414  providerTable->numAllocated = numToAllocate;
415  for (ptr = providers; ptr; )
416  {
417  ptrPrev = ptr;
418  ptr = wcschr(ptr, ',');
419  if (ptr)
420  *ptr++ = '\0';
421  _tryLoadProvider(ptrPrev);
422  }
423  }
424  }
426  }
427  }
428  RegCloseKey(hKey);
429  }
430 
431 #ifdef __REACTOS__
432  if (providerTable)
433  {
434  HKEY user_profile;
435 
436  if (RegOpenCurrentUser(KEY_ALL_ACCESS, &user_profile) == ERROR_SUCCESS)
437  {
438  HKEY network;
439  WCHAR subkey[8] = {'N', 'e', 't', 'w', 'o', 'r', 'k', 0};
440 
441  if (RegOpenKeyExW(user_profile, subkey, 0, KEY_READ, &network) == ERROR_SUCCESS)
442  {
443  DWORD size, max;
444 
445  TRACE("Enumerating remembered connections\n");
446 
448  {
449  WCHAR *local;
450 
451  TRACE("There are %lu connections\n", max);
452 
453  local = HeapAlloc(GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR));
454  if (local)
455  {
456  DWORD index;
457 
458  for (index = 0; index < max; ++index)
459  {
460  DWORD len = size + 1;
461  HKEY connection;
462 
463  TRACE("Trying connection %lu\n", index);
464 
466  continue;
467 
468  TRACE("It is %S\n", local);
469 
470  if (RegOpenKeyExW(network, local, 0, KEY_READ, &connection) != ERROR_SUCCESS)
471  continue;
472 
473  _restoreSavedConnection(connection, local);
474  RegCloseKey(connection);
475  }
476 
478  }
479  }
480 
482  }
483 
484  RegCloseKey(user_profile);
485  }
486  }
487 #endif
488 }
static struct list providers
Definition: sip.c:564
#define max(a, b)
Definition: svc.c:63
#define RegQueryInfoKey
Definition: winreg.h:521
#define ERROR_SUCCESS
Definition: deptool.c:10
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static PWNetProviderTable providerTable
Definition: wnet.c:127
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:56
#define IDS_ENTIRENETWORK
Definition: mprres.h:24
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
#define debugstr_w
Definition: kernel32.h:32
LPWSTR entireNetwork
Definition: wnet.c:72
static PVOID ptr
Definition: dispmode.c:27
GLuint index
Definition: glext.h:6031
data1 network
Definition: tftpd.cpp:49
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
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
#define index(s, c)
Definition: various.h:29
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define local
Definition: zutil.h:30
FxAutoRegKey hKey
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static void _tryLoadProvider(PCWSTR provider)
Definition: wnet.c:133
LONG WINAPI RegOpenCurrentUser(IN REGSAM samDesired, OUT PHKEY phkResult)
Definition: reg.c:3232
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
DWORD numAllocated
Definition: wnet.c:73
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by DllMain().