Ist ja auch klar, nachdem du nur den Pointer kopierst, aber nicht dessen Inhalt..
hab mal ein bisschen rumprobiert und mit 2 einfachen Typecasts geht es:
Delphi-Quellcode:
function GetUserInfo(Server, User: string): TUserInfo3;
var
ui3: Pointer;
NetError: DWORD;
begin
if User <> '' then
begin
try
NetError := NetUserGetInfo(PWideChar(WideString(Server)),
PWideChar(WideString(User)), 3, ui3);
if NetError = NERR_SUCCESS then
begin
result.usri3_name := LPWSTR(WideString(PUserInfo3(ui3)^.usri3_name));
result.usri3_full_name := LPWSTR(WideString(PUserInfo3(ui3)^.usri3_full_name));
result.usri3_comment := LPWSTR(WideString(PUserInfo3(ui3)^.usri3_comment));
result.usri3_home_dir := LPWSTR(WideString(PUserInfo3(ui3)^.usri3_home_dir));
result.usri3_password_age := PUserInfo3(ui3)^.usri3_password_age;
result.usri3_last_logon := PUserInfo3(ui3)^.usri3_last_logon;
result.usri3_num_logons := PUserInfo3(ui3)^.usri3_num_logons;
result.usri3_password_expired :=
PUserInfo3(ui3)^.usri3_password_expired;
result.usri3_flags := DWORD(PUserInfo3(ui3)^.usri3_flags and
UF_PASSWD_CANT_CHANGE = UF_PASSWD_CANT_CHANGE);
result.usri3_flags := DWORD(PUserInfo3(ui3)^.usri3_flags and
UF_DONT_EXPIRE_PASSWD = UF_DONT_EXPIRE_PASSWD);
result.usri3_flags := DWORD(PUserInfo3(ui3)^.usri3_flags and
UF_ACCOUNTDISABLE = UF_ACCOUNTDISABLE);
end;
finally
NetApiBufferFree(ui3);
end;
end;
end;