Author: cwittich
Date: Tue Jun 23 00:08:05 2009
New Revision: 41559
URL:
http://svn.reactos.org/svn/reactos?rev=41559&view=rev
Log:
sync CreateWellKnownSid with wine 1.1.24
Modified:
trunk/reactos/dll/win32/advapi32/sec/sid.c
Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sid…
==============================================================================
--- trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] Tue Jun 23 00:08:05 2009
@@ -1664,7 +1664,8 @@
unsigned int i;
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);
return FALSE;
}
@@ -1673,11 +1674,17 @@
if (WellKnownSids[i].Type == WellKnownSidType) {
DWORD length = GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount);
- if (*cbSid < length) {
+ if (*cbSid < length)
+ {
+ *cbSid = length;
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
-
+ if (!pSid)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
CopyMemory(pSid, &WellKnownSids[i].Sid.Revision, length);
*cbSid = length;
return TRUE;
@@ -1696,11 +1703,17 @@
DWORD domain_sid_length = GetSidLengthRequired(domain_subauth);
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);
return FALSE;
}
-
+ if (!pSid)
+ {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
CopyMemory(pSid, DomainSid, domain_sid_length);
(*GetSidSubAuthorityCount(pSid))++;
(*GetSidSubAuthority(pSid, domain_subauth)) = WellKnownRids[i].Rid;