Article ID: 181518 - Last Review: July 1, 2004 - Revision: 3.1

How To Programmatically Detect RAS Installation on Workstation

This article was previously published under Q181518

On This Page

Expand all | Collapse all

SUMMARY

This article shows how to programmatically detect if RAS is installed on a Workstation.

The sample code included in this article takes into account that RAS might not be installed, even if a copy of the Rasapi32.dll exists in the system directory. Also a valid phone book entry and an active modem are not required.

MORE INFORMATION

The way to detect programatically whether or not RAS is installed is to perform a LoadLibrary on the Rasapi32. If the LoadLibrary fails, RAS is not installed.

The following sample code demonstrates one way to do this. The function RasInstalled returns TRUE if RAS is installed and returns FALSE if RAS is not installed.

Sample Code

   #define WIN32_LEAN_AND_MEAN

   #include <stdio.h>
   #include <windows.h>
   #include <ras.h>
   #include <raserror.h>
   #include <string.h>
   #include <winbase.h>

   BOOL RasInstalled(void)
   {
      HINSTANCE hDLL;      // Handle to DLL.

      hDLL = LoadLibrary("rasapi32");
      if (hDLL != NULL)
      { // RAS is installed.
         return TRUE;
      }
      else
      { // RAS in not installed.
         return FALSE;
      }
   }
				

APPLIES TO
  • Microsoft Windows 95
  • Microsoft Windows NT Workstation 4.0 Developer Edition
Keywords: 
kbhowto kbapi kbnetwork KB181518
 

Article Translations