P
paf
Unregistered / Unconfirmed
GUEST, unregistred user!
我用 NetUserSetInfo 总是出错,错误:87 [参数错误]
function NetUserSetInfo(Server: PWideChar; UserName: PWideChar; Level: DWORD; var Buffer: Pointer;parm_err:LongInt): LongInt; stdcall; external 'netapi32.dll';
type USER_INFO_1 = record
usri1_name: LPWSTR;
usri1_password: LPWSTR;
usri1_password_age: DWORD;
usri1_priv: DWORD;
usri1_home_dir: LPWSTR;
usri1_comment: LPWSTR;
usri1_flags: DWORD;
usri1_script_path: LPWSTR;
end;
procedure TForm1.Button10Click(Sender: TObject);
type
buffer = ^USER_INFO_1;
var
buf: buffer;
re:integer;
err:longword;
begin
getmem(buf, sizeof(USER_INFO_1));
with buf^ do
begin
usri1_name := pwidechar(WideString('Guest'));
usri1_password := pwidechar(WideString('123'));
usri1_password_age := 0;
usri1_priv := 1;
usri1_home_dir := pwidechar(WideString(''));
usri1_comment := pwidechar(WideString('我的说明'));
usri1_flags := $10201;
usri1_script_path := pwidechar(WideString(''));
end;
re:=NetUserSetInfo(pwidechar(widestring(ip.text)), pwidechar(widestring('Guest')),1,Pointer(buf),err);
caption :=inttostr(re);
end;
是不是我定议出错了,还是哪里出错了!
帮忙啊!!!!!!!
function NetUserSetInfo(Server: PWideChar; UserName: PWideChar; Level: DWORD; var Buffer: Pointer;parm_err:LongInt): LongInt; stdcall; external 'netapi32.dll';
type USER_INFO_1 = record
usri1_name: LPWSTR;
usri1_password: LPWSTR;
usri1_password_age: DWORD;
usri1_priv: DWORD;
usri1_home_dir: LPWSTR;
usri1_comment: LPWSTR;
usri1_flags: DWORD;
usri1_script_path: LPWSTR;
end;
procedure TForm1.Button10Click(Sender: TObject);
type
buffer = ^USER_INFO_1;
var
buf: buffer;
re:integer;
err:longword;
begin
getmem(buf, sizeof(USER_INFO_1));
with buf^ do
begin
usri1_name := pwidechar(WideString('Guest'));
usri1_password := pwidechar(WideString('123'));
usri1_password_age := 0;
usri1_priv := 1;
usri1_home_dir := pwidechar(WideString(''));
usri1_comment := pwidechar(WideString('我的说明'));
usri1_flags := $10201;
usri1_script_path := pwidechar(WideString(''));
end;
re:=NetUserSetInfo(pwidechar(widestring(ip.text)), pwidechar(widestring('Guest')),1,Pointer(buf),err);
caption :=inttostr(re);
end;
是不是我定议出错了,还是哪里出错了!
帮忙啊!!!!!!!