EqualDomainSid function (securitybaseapi.h)

The EqualDomainSid function determines whether two SIDs are from the same domain.

Syntax

BOOL EqualDomainSid(
  [in]  PSID pSid1,
  [in]  PSID pSid2,
  [out] BOOL *pfEqual
);

Parameters

[in] pSid1

A pointer to one of the two SIDs to compare. This SID must be either an account domain SID or a BUILTIN SID.

[in] pSid2

A pointer to one of the two SIDs to compare. This SID must be either an account domain SID or a BUILTIN SID.

[out] pfEqual

A pointer to a BOOL that EqualDomainSid sets to TRUE if the domains of the two SIDs are equal or FALSE if they are not equal. This value cannot be NULL.

Return value

If both SIDs are account domain SIDs and/or BUILTIN SIDs, the return value is nonzero. In addition, *pfEqual is set to TRUE if the domains of the two SIDs are equal; otherwise *pfEqual is set to FALSE.

If one or more of the SIDS is neither an account domain SID nor a BUILTIN SID, then the return value is FALSE. To get extended error information, call GetLastError. GetLastError returns ERROR_NON_DOMAIN_SID if either SID is not an account domain SID or BUILTIN SID.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header securitybaseapi.h (include Windows.h)
Library Advapi32.lib
DLL Advapi32.dll

See also

EqualPrefixSid

EqualSid