unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
ListBox1: TListBox;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
type
TUser =
packed record
Name: WideString;
UserGroups: TStringArray;
end;
TUsers =
array of TUser;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses MpuWinNT.pas;
function GetUsers(
const Computer: WideString): TUsers;
var
Users : TStringArray;
i, j : Integer;
ui3 : TUserInfo3;
UserGroups : TStringArray;
begin
Users := EnumUsers(Computer, FILTER_NORMAL_ACCOUNT);
SetLength(Result, Length(Users));
for i := 0
to Length(Users) - 1
do
begin
// reset array -> delete old values
SetLength(UserGroups, 0);
//GetUserInfo(Computer, Users[i], ui3);
Result[i].
Name := ui3.usri3_name;
//UserGroups := GetUserGroups(Computer, Users[i]);
SetLength(Result[i].UserGroups, Length(UserGroups));
for j := 0
to Length(UserGroups) - 1
do
Result[i].UserGroups[j] := UserGroups[j];
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Listbox1.Items.Add(GetUsers,'
192.168.0.10');
end;
end.