RasGetCredentials报632错也就是ERROR_INVALID_SIZE,请大侠帮忙看
代码如下
unit unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
tform1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TRasCredentialsA =packed record
dwSize:dword;
dwMask: dword;
szUserName: array[0..256] of AnsiChar;
szPassword: array[0..256] of AnsiChar;
szDomain: array[0..16] of AnsiChar;
end;
TRasCredentials=TRasCredentialsA;
var
form1: Tform1;
implementation
{$R *.dfm}
function RasGetCredentials(
lpszPhonebook :pchar;
lpszEntry:pchar;
lpCredentials:pointer
): dword;stdcall;external 'Rasapi32.dll' name 'RasGetCredentialsA';
procedure tform1.Button1Click(Sender: TObject);
var
rc:TRasCredentials;
nResult:hresult;
serror:array[0..255] of char;
begin
rc.dwSize := sizeof(rc);
//rc.dwMask := 11;
nResult:=RasGetCredentials(nil,pchar('Q700 Line'),@rc);
//这里nresult返回632
showmessage(inttostr(nResult));
end;
end.