我只是要读出用户名和密码,在98下可以读出,在2000和XP下返回许多*,下面的内容摘自MSDN,
The szPassword member of the RASDIALPARAMS structure does not return the actual password. Instead, szPassword contains a handle to the saved password. Substitute this handle for the saved password in subsequent calls to RasSetEntryDialParams and RasDial. When presented with this handle, RasDial retrieves and uses the saved password. The value of this handle may change in future versions of the operating system; do not develop code that depends on the contents or format of this value.
就是说得不到密码,这个隐藏的Handle在那里呢?
procedure Dial(const Name:string);
var return,ereturn,hRas:dword;
var dPara:TRASDIALPARAMS;
var error:array[0..255] of char;
begin
FillChar(dPara,sizeof(TRESDIALPARAMS),0);
dPara.dwSize:=sizeof(TRESDIALPARAMS);
strPCopy(dPara.szEntryName,Name);
hRas:=0;
return:=RasDial(nil,nil,dPara,0,nil,hRas);
if(rtn<>0)then exit;
if(hRas<>0)then RasHangUp(hRas);
RasGetErrorString(Return,error,sizeof(error);
raise Exception.Create(StrPas(Error));
end;