ReactOS  0.4.14-dev-390-g34947ad
rasdial.c File Reference
#include <ws2_32.h>
#include <debug.h>
Include dependency graph for rasdial.c:

Go to the source code of this file.

Macros

#define NDEBUG
 
#define WsRasLock()   EnterCriticalSection(&WsRasHelperLock)
 
#define WsRasUnlock()   LeaveCriticalSection(&WsRasHelperLock)
 

Typedefs

typedef BOOL(WSAAPIPWS_ATTEMPT_AUTODIAL_ADDR) (IN CONST SOCKADDR FAR *Name, IN INT NameLength)
 
typedef BOOL(WSAAPIPWS_ATTEMPT_AUTODIAL_NAME) (IN CONST LPWSAQUERYSETW lpqsRestrictions)
 
typedef VOID(WSAAPIPWS_NOTE_SUCCESSFUL_HOSTENT_LOOKUP) (IN CONST CHAR FAR *Name, IN CONST ULONG Address)
 

Functions

VOID WSAAPI WsRasInitializeAutodial (VOID)
 
VOID WSAAPI WsRasUninitializeAutodial (VOID)
 
INT WSAAPI WsRasLoadHelperDll (VOID)
 
BOOL WSAAPI WSAttemptAutodialAddr (IN CONST SOCKADDR FAR *Name, IN INT NameLength)
 
BOOL WSAAPI WSAttemptAutodialName (IN CONST LPWSAQUERYSETW lpqsRestrictions)
 
VOID WSAAPI WSNoteSuccessfulHostentLookup (IN CONST CHAR FAR *Name, IN CONST ULONG Address)
 

Variables

BOOLEAN WsRasInitialized
 
HINSTANCE WsRasDllHandle
 
CRITICAL_SECTION WsRasHelperLock
 
PWS_ATTEMPT_AUTODIAL_ADDR lpfnWSAttemptAutodialAddr
 
PWS_ATTEMPT_AUTODIAL_NAME lpfnWSAttemptAutodialName
 
PWS_NOTE_SUCCESSFUL_HOSTENT_LOOKUP lpfnWSNoteSuccessfulHostentLookup
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file rasdial.c.

◆ WsRasLock

Definition at line 40 of file rasdial.c.

◆ WsRasUnlock

#define WsRasUnlock ( )    LeaveCriticalSection(&WsRasHelperLock)

Definition at line 41 of file rasdial.c.

Typedef Documentation

◆ PWS_ATTEMPT_AUTODIAL_ADDR

typedef BOOL(WSAAPI * PWS_ATTEMPT_AUTODIAL_ADDR) (IN CONST SOCKADDR FAR *Name, IN INT NameLength)

Definition at line 19 of file rasdial.c.

◆ PWS_ATTEMPT_AUTODIAL_NAME

typedef BOOL(WSAAPI * PWS_ATTEMPT_AUTODIAL_NAME) (IN CONST LPWSAQUERYSETW lpqsRestrictions)

Definition at line 25 of file rasdial.c.

◆ PWS_NOTE_SUCCESSFUL_HOSTENT_LOOKUP

typedef VOID(WSAAPI * PWS_NOTE_SUCCESSFUL_HOSTENT_LOOKUP) (IN CONST CHAR FAR *Name, IN CONST ULONG Address)

Definition at line 28 of file rasdial.c.

Function Documentation

◆ WSAttemptAutodialAddr()

BOOL WSAAPI WSAttemptAutodialAddr ( IN CONST SOCKADDR FAR Name,
IN INT  NameLength 
)

Definition at line 137 of file rasdial.c.

139 {
140  /* Load the helper DLL and make sure it exports this routine */
141  if (!(WsRasLoadHelperDll()) || !(lpfnWSAttemptAutodialAddr)) return FALSE;
142 
143  /* Call the function in the helper */
144  return lpfnWSAttemptAutodialAddr(Name, NameLength);
145 }
INT WSAAPI WsRasLoadHelperDll(VOID)
Definition: rasdial.c:71
PWS_ATTEMPT_AUTODIAL_ADDR lpfnWSAttemptAutodialAddr
Definition: rasdial.c:36

◆ WSAttemptAutodialName()

BOOL WSAAPI WSAttemptAutodialName ( IN CONST LPWSAQUERYSETW  lpqsRestrictions)

Definition at line 149 of file rasdial.c.

150 {
151  /* Load the helper DLL and make sure it exports this routine */
152  if (!(WsRasLoadHelperDll()) || !(lpfnWSAttemptAutodialName)) return FALSE;
153 
154  /* Call the function in the helper */
155  return lpfnWSAttemptAutodialName(lpqsRestrictions);
156 }
INT WSAAPI WsRasLoadHelperDll(VOID)
Definition: rasdial.c:71
PWS_ATTEMPT_AUTODIAL_NAME lpfnWSAttemptAutodialName
Definition: rasdial.c:37

◆ WSNoteSuccessfulHostentLookup()

VOID WSAAPI WSNoteSuccessfulHostentLookup ( IN CONST CHAR FAR Name,
IN CONST ULONG  Address 
)

Definition at line 160 of file rasdial.c.

162 {
163  /* Load the helper DLL and make sure it exports this routine */
165 
166  /* Call the function in the helper */
168 }
INT WSAAPI WsRasLoadHelperDll(VOID)
Definition: rasdial.c:71
static WCHAR Address[46]
Definition: ping.c:68
PWS_NOTE_SUCCESSFUL_HOSTENT_LOOKUP lpfnWSNoteSuccessfulHostentLookup
Definition: rasdial.c:38

◆ WsRasInitializeAutodial()

VOID WSAAPI WsRasInitializeAutodial ( VOID  )

Definition at line 47 of file rasdial.c.

48 {
49  /* Initialize the autodial lock */
51 }
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
CRITICAL_SECTION WsRasHelperLock
Definition: rasdial.c:35

Referenced by DllMain().

◆ WsRasLoadHelperDll()

INT WSAAPI WsRasLoadHelperDll ( VOID  )

Definition at line 71 of file rasdial.c.

72 {
73  CHAR HelperPath[MAX_PATH];
74  HKEY WinsockKey;
75  INT ErrorCode;
76  DWORD RegType = REG_SZ;
77  DWORD RegSize = MAX_PATH;
78 
79  /* Acquire the lock */
80  WsRasLock();
81 
82  /* Check if we were already initialized */
83  if (!WsRasInitialized)
84  {
85  /* Open the registry root key */
86  WinsockKey = WsOpenRegistryRoot();
87  if (WinsockKey)
88  {
89  /* Read the helper's location */
90  ErrorCode = RegQueryValueEx(WinsockKey,
91  "AutodialDLL",
92  0,
93  &RegType,
94  (LPBYTE)&HelperPath,
95  &RegSize);
96  RegCloseKey(WinsockKey);
97 
98  /* Make sure we read the path */
99  if (ErrorCode == ERROR_SUCCESS)
100  {
101  /* Now load it */
102  WsRasDllHandle = LoadLibrary(HelperPath);
103  }
104  }
105 
106  /* Check if we weren't able to load it and load the default */
107  if (!WsRasDllHandle) WsRasDllHandle = LoadLibrary("rasadhlp.dll");
108 
109  /* Check again if we loaded it */
110  if (WsRasDllHandle)
111  {
112  /* Get function pointers */
115  "WSAttemptAutodialAddr");
118  "WSAttemptAutodialName");
121  "WSNoteSuccessfulHostentLookup");
122  }
123 
124  /* Mark us as loaded */
126  }
127 
128  /* Release lock */
129  WsRasUnlock();
130 
131  /* Return status */
132  return WsRasInitialized;
133 }
#define RegQueryValueEx
Definition: winreg.h:524
HKEY WSAAPI WsOpenRegistryRoot(VOID)
Definition: wsautil.c:17
#define TRUE
Definition: types.h:120
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define WsRasLock()
Definition: rasdial.c:40
#define ERROR_SUCCESS
Definition: deptool.c:10
#define LoadLibrary
Definition: winbase.h:3686
char CHAR
Definition: xmlstorage.h:175
int32_t INT
Definition: typedefs.h:56
PWS_ATTEMPT_AUTODIAL_NAME lpfnWSAttemptAutodialName
Definition: rasdial.c:37
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
void * PVOID
Definition: retypes.h:9
#define MAX_PATH
Definition: compat.h:26
PWS_NOTE_SUCCESSFUL_HOSTENT_LOOKUP lpfnWSNoteSuccessfulHostentLookup
Definition: rasdial.c:38
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOLEAN WsRasInitialized
Definition: rasdial.c:33
#define GetProcAddress(x, y)
Definition: compat.h:418
#define WsRasUnlock()
Definition: rasdial.c:41
PWS_ATTEMPT_AUTODIAL_ADDR lpfnWSAttemptAutodialAddr
Definition: rasdial.c:36
HINSTANCE WsRasDllHandle
Definition: rasdial.c:34
#define REG_SZ
Definition: layer.c:22

Referenced by WSAttemptAutodialAddr(), WSAttemptAutodialName(), and WSNoteSuccessfulHostentLookup().

◆ WsRasUninitializeAutodial()

VOID WSAAPI WsRasUninitializeAutodial ( VOID  )

Definition at line 55 of file rasdial.c.

56 {
57  /* Acquire lock */
58  WsRasLock();
59 
60  /* Free the library if it's loaded */
63 
64  /* Release and delete lock */
65  WsRasUnlock();
67 }
#define WsRasLock()
Definition: rasdial.c:40
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:413
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
CRITICAL_SECTION WsRasHelperLock
Definition: rasdial.c:35
#define WsRasUnlock()
Definition: rasdial.c:41
HINSTANCE WsRasDllHandle
Definition: rasdial.c:34

Referenced by DllMain().

Variable Documentation

◆ lpfnWSAttemptAutodialAddr

PWS_ATTEMPT_AUTODIAL_ADDR lpfnWSAttemptAutodialAddr

Definition at line 36 of file rasdial.c.

Referenced by WSAttemptAutodialAddr(), and WsRasLoadHelperDll().

◆ lpfnWSAttemptAutodialName

PWS_ATTEMPT_AUTODIAL_NAME lpfnWSAttemptAutodialName

Definition at line 37 of file rasdial.c.

Referenced by WSAttemptAutodialName(), and WsRasLoadHelperDll().

◆ lpfnWSNoteSuccessfulHostentLookup

PWS_NOTE_SUCCESSFUL_HOSTENT_LOOKUP lpfnWSNoteSuccessfulHostentLookup

Definition at line 38 of file rasdial.c.

Referenced by WSNoteSuccessfulHostentLookup(), and WsRasLoadHelperDll().

◆ WsRasDllHandle

HINSTANCE WsRasDllHandle

Definition at line 34 of file rasdial.c.

Referenced by WsRasLoadHelperDll(), and WsRasUninitializeAutodial().

◆ WsRasHelperLock

CRITICAL_SECTION WsRasHelperLock

Definition at line 35 of file rasdial.c.

Referenced by WsRasInitializeAutodial(), and WsRasUninitializeAutodial().

◆ WsRasInitialized

BOOLEAN WsRasInitialized

Definition at line 33 of file rasdial.c.

Referenced by WsRasLoadHelperDll().