Calling RAS API functions without linking to DLL 
Author Message
 Calling RAS API functions without linking to DLL

Hello,

I've got some code which calls the RasEnumConnections function from the
RAS api, but I don't want to link to the DLL, so I used the method of
getting the Module handle.

Here is the code I am using:

DWORD dwConnections;
RASCONN rasconn;
rasconn.dwSize = sizeof(RASCONN);
DWORD dwSize = rasconn.dwSize;
DWORD dwSuccess;

typedef DWORD (WINAPI *fp_RasEnunCons)(LPRASCONN lprasconn, LPDWORD lpcb,
LPDWORD lpcConnections );
fp_RasEnunCons fncptr1 = NULL;

HMODULE hModule = ::GetModuleHandle(TEXT("RASAPI32"));

fncptr1 = (fp_RasEnunCons)::GetProcAddress(hModule, "RasEnumConnectionsA");

if (fncptr1 != NULL)
{
 DWORD dwSuccess = (*fncptr1)(&rasconn, &dwSize, &dwConnections);

Quote:
}

else
{

Quote:
}

The Problem is, that fncptr1 ends up being NULL.

Can someone please tell me what I am doing wrong.

Thank you.
Nulogica



Wed, 17 Apr 2002 03:00:00 GMT  
 Calling RAS API functions without linking to DLL
I may be misunderstanding your question, but if you #include <rash.h> and
<raserror.h> and in the Linker options rasapi32.lib and tapi32.lib you can
statically link rhe RAS functions.


Quote:
> Hello,

> I've got some code which calls the RasEnumConnections function from the
> RAS api, but I don't want to link to the DLL, so I used the method of
> getting the Module handle.

> Here is the code I am using:

> DWORD dwConnections;
> RASCONN rasconn;
> rasconn.dwSize = sizeof(RASCONN);
> DWORD dwSize = rasconn.dwSize;
> DWORD dwSuccess;

> typedef DWORD (WINAPI *fp_RasEnunCons)(LPRASCONN lprasconn, LPDWORD lpcb,
> LPDWORD lpcConnections );
> fp_RasEnunCons fncptr1 = NULL;

> HMODULE hModule = ::GetModuleHandle(TEXT("RASAPI32"));

> fncptr1 = (fp_RasEnunCons)::GetProcAddress(hModule,

"RasEnumConnectionsA");

- Show quoted text -

Quote:

> if (fncptr1 != NULL)
> {
>  DWORD dwSuccess = (*fncptr1)(&rasconn, &dwSize, &dwConnections);
> }
> else
> {

> }

> The Problem is, that fncptr1 ends up being NULL.

> Can someone please tell me what I am doing wrong.

> Thank you.
> Nulogica



Thu, 18 Apr 2002 02:00:00 GMT  
 Calling RAS API functions without linking to DLL
Hi,

The whole point is that I don't want to be dependant on the RAS dlls being
installed on a system. If I link them, my program won't run without having
the RAS dlls.

Thanks,
Nulogica


Quote:
> I may be misunderstanding your question, but if you #include <rash.h> and
> <raserror.h> and in the Linker options rasapi32.lib and tapi32.lib you can
> statically link rhe RAS functions.



> > Hello,

> > I've got some code which calls the RasEnumConnections function from the
> > RAS api, but I don't want to link to the DLL, so I used the method of
> > getting the Module handle.

> > Here is the code I am using:

> > DWORD dwConnections;
> > RASCONN rasconn;
> > rasconn.dwSize = sizeof(RASCONN);
> > DWORD dwSize = rasconn.dwSize;
> > DWORD dwSuccess;

> > typedef DWORD (WINAPI *fp_RasEnunCons)(LPRASCONN lprasconn, LPDWORD
lpcb,
> > LPDWORD lpcConnections );
> > fp_RasEnunCons fncptr1 = NULL;

> > HMODULE hModule = ::GetModuleHandle(TEXT("RASAPI32"));

> > fncptr1 = (fp_RasEnunCons)::GetProcAddress(hModule,
> "RasEnumConnectionsA");

> > if (fncptr1 != NULL)
> > {
> >  DWORD dwSuccess = (*fncptr1)(&rasconn, &dwSize, &dwConnections);
> > }
> > else
> > {

> > }

> > The Problem is, that fncptr1 ends up being NULL.

> > Can someone please tell me what I am doing wrong.

> > Thank you.
> > Nulogica



Thu, 18 Apr 2002 02:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Calling DLL functions without known function name, parameter-list until run-time

2. RAS API calls in Win95

3. Linking error in calling a function exporting from a DLL

4. Link Error on RAS Function

5. RAS Function Link Error

6. importing a c++ class from a dll without linking with the dll's lib file

7. Getting dialog box color without using GetSysColor API function

8. Calling an exported function of a dll which are exported Stdcall calling convention

9. Call Back Functions call from within a DLL

10. On-the-fly linking to Windows API functions

11. Unable to link a Win32 API function

12. Unable to link a Win32 API function

 

 
Powered by phpBB® Forum Software