为什么用 NetUserSetInfo 总是出错!!!(100分)

  • 主题发起人 主题发起人 paf
  • 开始时间 开始时间
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;


是不是我定议出错了,还是哪里出错了!

帮忙啊!!!!!!!

 
我的积分快没了,请帮忙啊!!!!
 
有谁可以说说为什么吗? 我急着要用啊!!!!
 
我也想知道这个问题的解决方法.
继续关注中.
 
后退
顶部