#ifndef _NTSAM_H
//
// Functions
//
/**
* The SamConnect function opens a SAM client context; NULL ServerName selects the local server.
* ObjectAttributes is an unused compatibility argument. Close the context with SamCloseHandle.
*
* \param ServerName The server name, or NULL for the local server.
* \param ServerHandle A handle representing a server.
* \param DesiredAccess The access requested for ServerHandle upon output.
* \param ObjectAttributes Unused compatibility argument; may be NULL.
* \return NTSTATUS Successful or errant status.
* \sa https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-samr/47492d59-e095-4398-b03e-8a062b989123
*/
NTSYSAPI
NTSTATUS
NTAPI
SamConnect(
_In_opt_ PCUNICODE_STRING ServerName,
_Out_ PSAM_HANDLE ServerHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_opt_ PCOBJECT_ATTRIBUTES ObjectAttributes
);
View code on GitHubThis function is a wrapper over an RPC method documented in the [MS-SAMR] specification.