H
hxchxc
Unregistered / Unconfirmed
GUEST, unregistred user!
要求有例程。我自己写了一个但是有问题。
...
type USER_INFO_1=record
usri1_namechar;
usri1_passwordchar;
usri1_password_age:dword;
usri1_priv:dword;
usri1_home_dirchar;
usri1_commentchar;
usri1_flags:dword;
usri1_script_pathchar;
end;
buffer=^USER_INFO_1;
...
function NetUserAdd(ServerWideChar;LevelWORD;Buf:buffer;ParmErrorChar):LongInt;
stdcall; external 'netapi32.dll'
procedure TForm1.Button1Click(Sender: TObject);
var buf:buffer;
errorchar;
begin
getmem(buf,sizeof(USER_INFO_1));
with buf^ do
begin
usri1_name:='guest';
usri1_password:='123';
usri1_password_age:=20000;
usri1_priv:=1;
usri1_home_dir:=nil;
usri1_comment:=nil;
usri1_flags:=0;
usri1_script_path:=nil;
end;
showmessage(inttostr(netuseradd(nil,2,buf,nil)));
showmessage(string(error));
freemem(buf);
end;
...
type USER_INFO_1=record
usri1_namechar;
usri1_passwordchar;
usri1_password_age:dword;
usri1_priv:dword;
usri1_home_dirchar;
usri1_commentchar;
usri1_flags:dword;
usri1_script_pathchar;
end;
buffer=^USER_INFO_1;
...
function NetUserAdd(ServerWideChar;LevelWORD;Buf:buffer;ParmErrorChar):LongInt;
stdcall; external 'netapi32.dll'
procedure TForm1.Button1Click(Sender: TObject);
var buf:buffer;
errorchar;
begin
getmem(buf,sizeof(USER_INFO_1));
with buf^ do
begin
usri1_name:='guest';
usri1_password:='123';
usri1_password_age:=20000;
usri1_priv:=1;
usri1_home_dir:=nil;
usri1_comment:=nil;
usri1_flags:=0;
usri1_script_path:=nil;
end;
showmessage(inttostr(netuseradd(nil,2,buf,nil)));
showmessage(string(error));
freemem(buf);
end;