SamOpenDomain - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTSAM_H

/**
 * The SamOpenDomain method obtains a handle to a domain, given a SID.
 *
 * \param ServerHandle A handle representing a server.
 * \param DesiredAccess The desired access to the domain.
 * \param DomainId A SID value of a domain hosted by the server.
 * \param DomainHandle A handle to the requested domain.
 * \return NTSTATUS Successful or errant status.
 * \sa https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/ba710c90-5b12-42f8-9e5a-d4aacc1329fa
 */
NTSYSAPI
NTSTATUS
NTAPI
SamOpenDomain(
    _In_ SAM_HANDLE ServerHandle,
    _In_ ACCESS_MASK DesiredAccess,
    _In_ PSID DomainId,
    _Out_ PSAM_HANDLE DomainHandle
    );

#endif

View code on GitHub

NtDoc

This function is a wrapper over an RPC method documented in the [MS-SAMR] specification.