unit AHMTRasDefinition;

interface

uses Windows,AHMTRasManager;

type
  TRAS400DialParams = packed record
      dwSize           : DWORD;
      szEntryName      : array [0..RAS_MaxEntryName] of Char;
      szPhoneNumber    : array [0..RAS_MaxPhoneNumber] of Char;
      szCallbackNumber : array [0..RAS_MaxCallbackNumber] of Char;
      szUserName       : array [0..UNLEN] of Char;
      szPassword       : array [0..PWLEN] of Char;
      szDomain         : array [0..DNLEN] of Char;
      szPadding1 : array [0..2] of Char;
  end;
  TRAS401DialParams = packed record
     dwSize           : DWORD;
     szEntryName      : array [0..RAS_MaxEntryName] of Char;
     szPhoneNumber    : array [0..RAS_MaxPhoneNumber] of Char;
     szCallbackNumber : array [0..RAS_MaxCallbackNumber] of Char;
     szUserName       : array [0..UNLEN] of Char;
     szPassword       : array [0..PWLEN] of Char;
     szDomain         : array [0..DNLEN] of Char;
     dwSubEntry : DWORD;
     dwCallbackId : DWORD;
     szPadding2 : array [0..2] of Char;
  end;
  TRas400Entry = record
     dwSize 	: DWord;
     Options  	: DWord;
     dwCountryID    : DWord;
     dwCountryCode	: DWord;
     szAreaCode	: array[0..RAS_MaxAreaCode] of char;
     pLocalPhoneNumber	: array[0..RAS_MaxPhoneNumber] of char;
     AlternatesOffset	: DWord;
     IPAddr	    	: TRasIPAddr;
     IPAddrDns	    	: TRasIPAddr;
     IPAddrDnsAlt	: TRasIPAddr;
     IPAddrWins	    	: TRasIPAddr;
     IPAddrWinsAlt    	: TRasIPAddr;
     dwFrameSize        : DWord;
     dwNetProtocols     : DWord;
     dwFramingProtocol	: DWord;
     szScript	    	: array[0..MAX_PATH-1] of char;
     szAutodialDll  	: array[0..MAX_PATH-1] of char;
     szAutodialFunc 	: array[0..MAX_PATH-1] of char;
     szDeviceType      	: array[0..RAS_MaxDeviceType] of char;
     szDeviceName      	: array[0..RAS_MaxDeviceName] of char;
     szX25PadType      	: array[0..RAS_MaxPadType] of char;
     szX25Address      	: array[0..RAS_MaxX25Address] of char;
     szX25Facilities   	: array[0..RAS_MaxFacilities] of char;
     szX25UserData	: array[0..RAS_MaxUserData] of char;
     dwChannels	    	: DWord;
     Reserved1	        : DWord;
     Reserved2		: DWord;
  end;
  TRas401Entry = record
     dwSize 	: DWord;
     Options  	: DWord;
     dwCountryID    : DWord;
     dwCountryCode	: DWord;
     szAreaCode	: array[0..RAS_MaxAreaCode] of char;
     pLocalPhoneNumber	: array[0..RAS_MaxPhoneNumber] of char;
     AlternatesOffset	: DWord;
     IPAddr	    	: TRasIPAddr;
     IPAddrDns	    	: TRasIPAddr;
     IPAddrDnsAlt	: TRasIPAddr;
     IPAddrWins	    	: TRasIPAddr;
     IPAddrWinsAlt    	: TRasIPAddr;
     dwFrameSize        : DWord;
     dwNetProtocols     : DWord;
     dwFramingProtocol	: DWord;
     szScript	    	: array[0..MAX_PATH-1] of char;
     szAutodialDll  	: array[0..MAX_PATH-1] of char;
     szAutodialFunc 	: array[0..MAX_PATH-1] of char;
     szDeviceType      	: array[0..RAS_MaxDeviceType] of char;
     szDeviceName      	: array[0..RAS_MaxDeviceName] of char;
     szX25PadType      	: array[0..RAS_MaxPadType] of char;
     szX25Address      	: array[0..RAS_MaxX25Address] of char;
     szX25Facilities   	: array[0..RAS_MaxFacilities] of char;
     szX25UserData	: array[0..RAS_MaxUserData] of char;
     dwChannels	    	: DWord;
     Reserved1	        : DWord;
     Reserved2		: DWord;
     dwSubEntries   : DWord;
     dwDialMode	: DWord;
     dwDialExtraPercent 	: DWord;
     dwDialExtraSampleSeconds  : DWord;
     dwHangUpExtraPercent	: DWord;
     dwHangUpExtraSampleSeconds : DWord;
     dwIdleDisconnectSeconds : DWord;
  end;
  TRas500Entry = record
     dwSize 	: DWord;
     Options  	: DWord;
     dwCountryID    : DWord;
     dwCountryCode	: DWord;
     szAreaCode	: array[0..RAS_MaxAreaCode] of char;
     pLocalPhoneNumber	: array[0..RAS_MaxPhoneNumber] of char;
     AlternatesOffset	: DWord;
     IPAddr	    	: TRasIPAddr;
     IPAddrDns	    	: TRasIPAddr;
     IPAddrDnsAlt	: TRasIPAddr;
     IPAddrWins	    	: TRasIPAddr;
     IPAddrWinsAlt    	: TRasIPAddr;
     dwFrameSize        : DWord;
     dwNetProtocols     : DWord;
     dwFramingProtocol	: DWord;
     szScript	    	: array[0..MAX_PATH-1] of char;
     szAutodialDll  	: array[0..MAX_PATH-1] of char;
     szAutodialFunc 	: array[0..MAX_PATH-1] of char;
     szDeviceType      	: array[0..RAS_MaxDeviceType] of char;
     szDeviceName      	: array[0..RAS_MaxDeviceName] of char;
     szX25PadType      	: array[0..RAS_MaxPadType] of char;
     szX25Address      	: array[0..RAS_MaxX25Address] of char;
     szX25Facilities   	: array[0..RAS_MaxFacilities] of char;
     szX25UserData	: array[0..RAS_MaxUserData] of char;
     dwChannels	    	: DWord;
     Reserved1	        : DWord;
     Reserved2		: DWord;
     dwSubEntries   : DWord;
     dwDialMode	: DWord;
     dwDialExtraPercent 	: DWord;
     dwDialExtraSampleSeconds  : DWord;
     dwHangUpExtraPercent	: DWord;
     dwHangUpExtraSampleSeconds : DWord;
     dwIdleDisconnectSeconds : DWord;
     szPortName : array[0..RAS_MaxDeviceName] of char;
  end;


Function GetRasDialParamSize : DWord;
Function GetRasEntrySize: DWord;
function GetRasWinVer : Integer;

implementation

function GetRasWinVer : Integer;
Var OSVersionInfo : TOSVersionInfo;
begin
  result:=0;
  FillChar(OSVersionInfo,SizeOf(OSVersionInfo),0);
  OSVersionInfo.dwOSVersionInfoSize := sizeof(TOSVERSIONINFO);
  GetVersionEx(OSVersionInfo);
  case OSVersionInfo.dwPlatformID of
    VER_PLATFORM_WIN32s        : result:=0;
    VER_PLATFORM_WIN32_WINDOWS :
    begin
      result:=400;
    end;
    VER_PLATFORM_WIN32_NT	 :
    begin
      if OSVersionInfo.dwMajorVersion=4 then
      begin
        {validate the highorder of buildnumber}
        result:=401;
      end else
      if OSVersionInfo.dwMajorVersion=5 then result:=500;
    end;
  end;
end;

Function GetRasDialParamSize : DWord;
Var Ras400DialParams : TRas400DialParams;
    Ras401DialParams : TRas401DialParams;
begin
  FillChar(Ras400DialParams,Sizeof(Ras400DialParams),#0);
  FillChar(Ras401DialParams,Sizeof(Ras401DialParams),#0);
  case GetRasWinVer of
    400 : result:=SizeOf(Ras400DialParams);
    401 : result:=SizeOf(Ras401DialParams);
    else result:=0;
  end;
end;

Function GetRasEntrySize: DWord;
Var
  Ras400Entry : TRas400Entry;
  Ras401Entry : TRas401Entry;
begin
  FillChar(Ras400Entry,Sizeof(Ras400Entry),#0);
  FillChar(Ras401Entry,Sizeof(Ras401Entry),#0);
  case GetRasWinVer of
      400 : result:=SizeOf(Ras400Entry);
      401 : result:=SizeOf(Ras401Entry);
    else result:=0;
  end;
end;

end.
