[RAS] detecting installation

How do you detect a RAS installation?
The current method I'm using is to connect to the DLL, and see if a rasEnumDevices call returns ok.
But If I install and then un-install RAS on a system, this will method will still return "true", while it should return false.
Any ideas?
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

jhanceConnect With a Mentor Commented:
Under NT (which I assume you're talking about since Win95 uses DUN and not RAS), check for the existence of the following registry key:


If it's there, RAS there is an instance of the RAS service installed.  If not, it's not.  If you check:


you can tell if the RAS software has been installed but not configured.
lowlevelAuthor Commented:
I actually was looking for the win95 solution aswell..
anyway, with your help I was able to figure it out myself (took me about 30 minutes, that's why the D grade) and it now works.

just to be complete, a delphi function that'll do the trick:

function rasInstalled : boolean;
var osi : tOSVersionInfo;
    reg : tRegistry;
  getVersionEx (osi);

  case osi.dwPlatformID of    //
    VER_PLATFORM_WIN32S        : result:=false; //win32s = win 3 = no RAS
    VER_PLATFORM_WIN32_WINDOWS : result:=reg.openkey ('\system\currentcontrolset\services\remoteAccess\networkprovider',false);
    VER_PLATFORM_WIN32_NT      : result:=reg.openkey ('\system\currentcontrolset\services\remoteaccess',false);
  end;    //case

As you may know, on NT you may also configure your modems for Dialing out, Receiving calls, or both. In your Network control panel, click on the Services tab, select Remote Access Service, click properties, select a modem (you may have to add a modem, if there are none to select), then click Configure.  If your only modem is configured to Receive calls only, then any calls to rasDial could result in an unhandled exception.  RasEnumDevices still returns this modem as a valid device.  Thus, on NT, you may also have to check for keys under the registry key:
I would get a list of all of the subkeys (Some of them are DialinIP, DialoutIP, DialinoutIPX, DialoutNBF), and for any that contain the phrase "out" (you can use a strstr function to do this), check the value of that key.  If there are no "out" keys with their value set to TRUE, you can be pretty well assured that no modems are configured for dialing out using RAS. I have tested this using two different modems connected to two separate ports, and this works great on NT for detecting when neither modem is configured for dialing out.  Win95 is different, but as far as I know, you cannot configure your modem on Win95 to only receive calls.

Note: The information above represents my own opinions and knowlege based on my limited experience, and are not necessarily shared by Intel Corp.
All Courses

From novice to tech pro — start learning today.