关于dialup控件的问题。。。。 ( 积分: 100 )

  • 主题发起人 主题发起人 sbzldlb
  • 开始时间 开始时间
S

sbzldlb

Unregistered / Unconfirmed
GUEST, unregistred user!
在2000 和 xp 都能创建VPN连接

但是在XP 里 不能将 要求数据加密(没有断开) 这个选项去掉
而在2000里是可以的 不知道是什么原因
请大家帮忙啊

function TF_SystemSetFrm.CreateConn(ConnName,ServerIP:String;NeedDataEncrypt:Boolean):Boolean;
var
rasEntry : TRasEntry;
rasEntrySize :longInt;
dwResult : longInt;
begin
rasEntrySize := SizeOf(rasEntry);
fillchar(rasEntry,rasEntrySize,0);
rasEntry.dwSize := rasEntrySize;
rasEntry.szDeviceType := RASDT_VPN;

if NeedDataEncrypt then
rasEntry.dwfOptions := RASEO_RequireMsEncryptedPw or RASEO_RequireDataEncryption;

rasEntry.dwfOptions := rasEntry.dwfOptions or
RASEO_IpHeaderCompression or RASEO_RemoteDefaultGateway or
RASEO_RequireEncryptedPw or RASEO_SwCompression or
RASEO_NetworkLogon or RASEO_UseCountryAndAreaCodes;

strpcopy(rasEntry.szLocalPhoneNumber,ServerIP);

rasEntry.dwCountryID := 86;
rasEntry.dwCountryCode := 21;

rasEntry.dwfNetProtocols := RASNP_Ipx + RASNP_Ip + RASNP_NetBeui;
rasEntry.dwFramingProtocol := RASFP_ppp;

if (GetSystemVer = 'Windows 2000') or (GetSystemVer = 'Windows XP') then
rasEntry.szDeviceName := 'WAN 微型端口 (PPTP)'
else
rasEntry.szDeviceName := 'Microsoft VPN Adapter';
dwResult := RasSetEntryProperties(nil,PChar(ConnName),@rasEntry,sizeof(rasEntry),nil,0);
if dwResult <> 0 then
Result:=False
else Result:=True;
end;
 
if NeedDataEncrypt then
rasEntry.dwfOptions := RASEO_RequireMsEncryptedPw or RASEO_RequireDataEncryption;

rasEntry.dwfOptions := rasEntry.dwfOptions or
RASEO_IpHeaderCompression or RASEO_RemoteDefaultGateway or
RASEO_RequireEncryptedPw or RASEO_SwCompression or
RASEO_NetworkLogon or RASEO_UseCountryAndAreaCodes;

这个是选项的代码,在2000里
if NeedDataEncrypt then
rasEntry.dwfOptions := RASEO_RequireMsEncryptedPw or RASEO_RequireDataEncryption;
这个不加,就可以去掉 需要密码选项
但是在XP不行
 
常量这样的
(*RASAPI*)(* TRasEntry 'dwfOptions' bit flags. *)
(*RASAPI*) RASEO_UseCountryAndAreaCodes = $00000001;
(*RASAPI*) RASEO_SpecificIpAddr = $00000002;
(*RASAPI*) RASEO_SpecificNameServers = $00000004;
(*RASAPI*) RASEO_IpHeaderCompression = $00000008;
(*RASAPI*) RASEO_RemoteDefaultGateway = $00000010;
(*RASAPI*) RASEO_DisableLcpExtensions = $00000020;
(*RASAPI*) RASEO_TerminalBeforeDial = $00000040;
(*RASAPI*) RASEO_TerminalAfterDial = $00000080;
(*RASAPI*) RASEO_ModemLights = $00000100;
(*RASAPI*) RASEO_SwCompression = $00000200;
(*RASAPI*) RASEO_RequireEncryptedPw = $00000400;
(*RASAPI*) RASEO_RequireMsEncryptedPw = $00000800;
(*RASAPI*) RASEO_RequireDataEncryption = $00001000;
(*RASAPI*) RASEO_NetworkLogon = $00002000;
(*RASAPI*) RASEO_UseLogonCredentials = $00004000;
(*RASAPI*) RASEO_PromoteAlternates = $00008000;
 
晕,看不明,帮不到你……
 
多人接受答案了。
 
后退
顶部