ReactOS 0.4.16-dev-321-g63bb46a
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 18 of file rasdial.c.

◆ PWS_ATTEMPT_AUTODIAL_NAME

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

Definition at line 24 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 27 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 */
142
143 /* Call the function in the helper */
144 return lpfnWSAttemptAutodialAddr(Name, NameLength);
145}
#define FALSE
Definition: types.h:117
PWS_ATTEMPT_AUTODIAL_ADDR lpfnWSAttemptAutodialAddr
Definition: rasdial.c:36
INT WSAAPI WsRasLoadHelperDll(VOID)
Definition: rasdial.c:71

◆ 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 */
153
154 /* Call the function in the helper */
155 return lpfnWSAttemptAutodialName(lpqsRestrictions);
156}
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}
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}
CRITICAL_SECTION WsRasHelperLock
Definition: rasdial.c:35
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751

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;
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 */
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 */
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 RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
#define TRUE
Definition: types.h:120
#define GetProcAddress(x, y)
Definition: compat.h:753
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define REG_SZ
Definition: layer.c:22
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
HINSTANCE WsRasDllHandle
Definition: rasdial.c:34
BOOLEAN WsRasInitialized
Definition: rasdial.c:33
#define WsRasUnlock()
Definition: rasdial.c:41
#define WsRasLock()
Definition: rasdial.c:40
unsigned char * LPBYTE
Definition: typedefs.h:53
void * PVOID
Definition: typedefs.h:50
int32_t INT
Definition: typedefs.h:58
#define LoadLibrary
Definition: winbase.h:3887
#define RegQueryValueEx
Definition: winreg.h:524
HKEY WSAAPI WsOpenRegistryRoot(VOID)
Definition: wsautil.c:17
char CHAR
Definition: xmlstorage.h:175

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 */
67}
#define NULL
Definition: types.h:112
#define FreeLibrary(x)
Definition: compat.h:748
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)

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().