Moin Chris,
nein, muss es nicht.
So hab' ich das gemacht
Delphi-Quellcode:
function NetUserEnum(
const servername: LPCWSTR;
const level: DWORD;
const filter: DWORD;
const bufptr: Pointer;
const prefmaxlen: DWORD;
var entriesread: DWORD;
var totalentries: DWORD;
const resume_handle: PDWORD
): NET_API_STATUS; stdcall; external 'netapi32.dll';
function NetApiBufferFree(const pBuffer : Pointer): NET_API_STATUS; stdcall; external 'netapi32.dll';
procedure TfrmMAIN.miFileOpenClick(Sender: TObject);
var
rui0Work : PUSER_INFO_0;
rui0Save : PUSER_INFO_0;
dwEntriesRead : DWORD;
i : integer;
begin
if NetUserEnum(nil, 0, FILTER_NORMAL_ACCOUNT, @rui0Work, MAX_PREFERRED_LENGTH,
dwEntriesRead, dwEntriesRead, nil) = NERR_SUCCESS then begin
rui0Save := rui0Work;
for i:=1 to dwEntriesRead do
begin
ListBox1.Items.Add(rui0Work.usri0_name);
[color=red]inc(rui0Work);[/color]
end;
end;
NetAPIBufferFree(rui0Save);
end;
und es funktioniert einwandfrei.
(Ich hab' sogar mal die Funktionsdeklarationen benutzt, wie es die Jedis machen)