精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● Delphi>>Windows API函数>>如何自己编程添加NT用户?

主题:如何自己编程添加NT用户?
发信人: hxchxc()
整理人: teleme(2000-12-06 17:31:40), 站内信件
【 在 zhboy (song) 的大作中提到: 】
: 谢谢!

给你源程序。
type USER_INFO_1=record
       usri1_name:pwidechar;
       usri1_password:pwidechar;
       usri1_password_age:dword;
       usri1_priv:dword;
       usri1_home_dir:pwidechar;
       usri1_comment:pwidechar;
       usri1_flags:dword;
       usri1_script_path:pwidechar;
     end;
    buffer=^USER_INFO_1;
var
  Form1: TForm1;

implementation

{$R *.DFM}
function NetUserAdd(Server:PWideChar;Level:DWORD;Buf:pointer;ParmError
:dword):LongInt;
   stdcall; external 'netapi32.dll'

procedure TForm1.Button1Click(Sender: TObject);
var buf:buffer;
    error:pchar;
begin
getmem(buf,sizeof(USER_INFO_1));
 with buf^ do
 begin
  usri1_name:='123e';
  usri1_password:='123456789';
  usri1_password_age:=0;
  usri1_priv:=1;
  usri1_home_dir:=nil;
  usri1_comment:=nil;
  usri1_flags:=1;
  usri1_script_path:=nil;
 end;
  netuseradd(nil,1,pointer(buf),
 // showmessage(inttostr(netuseradd(nil,1,pointer(buf),0)));
  freemem(buf);
end;


--
※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.107.208.67]

[关闭][返回]