I am using ::NetQueryDisplayInformation() API to retrieve local computer groups information. I am running the program elevated.
The problem is that it returns only “None” group name (one group only). I’ve successfully used the same API for retrieving user accounts from both local computer and Active Directory.
I use this for groups:
unsigned long index = 0, count = 0;
void *buffer = nullptr;
unsigned long result = 0;
result = ::NetQueryDisplayInformation (
/* serverName */NULL,
/*Level*/ 3,
/*Index*/index,
/*Entries requested*/100,
/*PreferredMaximumLength */MAX_PREFERRED_LENGTH,
/*ReturnedEntryCount*/&count,
/*SortedBuffer*/&buffer);
count is returned as being 1.
I was able to use NetQueryDisplayInformation for retrieving AD user group information though… (by setting server/name to smth different than NULL)