mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
sync CreateWellKnownSid with wine 1.1.24
svn path=/trunk/; revision=41559
This commit is contained in:
parent
156d181a79
commit
4f96f16ac2
1 changed files with 18 additions and 5 deletions
|
@ -1664,7 +1664,8 @@ CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
TRACE("(%d, %s, %p, %p)\n", WellKnownSidType, debugstr_sid(DomainSid), pSid, cbSid);
|
TRACE("(%d, %s, %p, %p)\n", WellKnownSidType, debugstr_sid(DomainSid), pSid, cbSid);
|
||||||
|
|
||||||
if (cbSid == NULL || pSid == NULL || (DomainSid && !IsValidSid(DomainSid))) {
|
if (cbSid == NULL || (DomainSid && !IsValidSid(DomainSid)))
|
||||||
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1673,11 +1674,17 @@ CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType,
|
||||||
if (WellKnownSids[i].Type == WellKnownSidType) {
|
if (WellKnownSids[i].Type == WellKnownSidType) {
|
||||||
DWORD length = GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount);
|
DWORD length = GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount);
|
||||||
|
|
||||||
if (*cbSid < length) {
|
if (*cbSid < length)
|
||||||
|
{
|
||||||
|
*cbSid = length;
|
||||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (!pSid)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
CopyMemory(pSid, &WellKnownSids[i].Sid.Revision, length);
|
CopyMemory(pSid, &WellKnownSids[i].Sid.Revision, length);
|
||||||
*cbSid = length;
|
*cbSid = length;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1696,11 +1703,17 @@ CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType,
|
||||||
DWORD domain_sid_length = GetSidLengthRequired(domain_subauth);
|
DWORD domain_sid_length = GetSidLengthRequired(domain_subauth);
|
||||||
DWORD output_sid_length = GetSidLengthRequired(domain_subauth + 1);
|
DWORD output_sid_length = GetSidLengthRequired(domain_subauth + 1);
|
||||||
|
|
||||||
if (*cbSid < output_sid_length) {
|
if (*cbSid < output_sid_length)
|
||||||
|
{
|
||||||
|
*cbSid = output_sid_length;
|
||||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
if (!pSid)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
CopyMemory(pSid, DomainSid, domain_sid_length);
|
CopyMemory(pSid, DomainSid, domain_sid_length);
|
||||||
(*GetSidSubAuthorityCount(pSid))++;
|
(*GetSidSubAuthorityCount(pSid))++;
|
||||||
(*GetSidSubAuthority(pSid, domain_subauth)) = WellKnownRids[i].Rid;
|
(*GetSidSubAuthority(pSid, domain_subauth)) = WellKnownRids[i].Rid;
|
||||||
|
|
Loading…
Reference in a new issue