Skip to content

Instantly share code, notes, and snippets.

@rbmm
Created April 19, 2024 00:17
Show Gist options
  • Save rbmm/60d0944b1bb19df5fa213edcf9732ed4 to your computer and use it in GitHub Desktop.
Save rbmm/60d0944b1bb19df5fa213edcf9732ed4 to your computer and use it in GitHub Desktop.
NTSTATUS BuildSupplementalCredential(_In_ MSV1_0_SUPPLEMENTAL_CREDENTIAL_V3* pmsc,
_Out_ PSECPKG_SUPPLEMENTAL_CRED_ARRAY* pSupplementalCredentials)
{
union {
PVOID buf;
PSECPKG_SUPPLEMENTAL_CRED_ARRAY SupplementalCredentials;
PUCHAR pc;
PMSV1_0_SUPPLEMENTAL_CREDENTIAL_V3 pmsvsc;
PWSTR psz;
};
if (buf = LSA(AllocateLsaHeap(sizeof(SECPKG_SUPPLEMENTAL_CRED_ARRAY) +
sizeof(MSV1_0_SUPPLEMENTAL_CREDENTIAL_V3) + sizeof(NTLMSP_NAME))))
{
*pSupplementalCredentials = SupplementalCredentials;
SupplementalCredentials->CredentialCount = 1;
PSECPKG_SUPPLEMENTAL_CRED Credentials = SupplementalCredentials++->Credentials;
Credentials->CredentialSize = sizeof(MSV1_0_SUPPLEMENTAL_CREDENTIAL_V3);
Credentials->Credentials = pc;
memcpy(pmsvsc++, pmsc, sizeof(MSV1_0_SUPPLEMENTAL_CREDENTIAL_V3));
RtlInitUnicodeString(&Credentials->PackageName, wcscpy(psz, NTLMSP_NAME));
return STATUS_SUCCESS;
}
return STATUS_NO_MEMORY;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment