Link to home
Start Free TrialLog in
Avatar of lowlevel
lowlevel

asked on

[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?
ASKER CERTIFIED SOLUTION
Avatar of jhance
jhance

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lowlevel
lowlevel

ASKER

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;
begin
  osi.dwOSVersionInfoSize:=sizeof(tOSVersionInfo);
  getVersionEx (osi);

  reg:=tRegistry.create;
  reg.rootkey:=hkey_local_machine;
  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
  reg.free;
end;

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:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AsyncMac\Parameters
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.