Author: ekohl
Date: Fri Nov 2 19:29:48 2012
New Revision: 57669
URL:
http://svn.reactos.org/svn/reactos?rev=57669&view=rev
Log:
[ADVAPI32]
Fix indentation and coding style. No code changes!
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] Fri Nov 2 19:29:48 2012
@@ -18,17 +18,17 @@
BOOL WINAPI
AddAuditAccessAceEx(PACL pAcl,
- DWORD dwAceRevision,
- DWORD AceFlags,
- DWORD dwAccessMask,
- PSID pSid,
- BOOL bAuditSuccess,
- BOOL bAuditFailure);
+ DWORD dwAceRevision,
+ DWORD AceFlags,
+ DWORD dwAccessMask,
+ PSID pSid,
+ BOOL bAuditSuccess,
+ BOOL bAuditFailure);
typedef struct RECORD
{
- LPCWSTR key;
- DWORD value;
+ LPCWSTR key;
+ DWORD value;
} RECORD;
@@ -794,6 +794,7 @@
{
LPWSTR wstr;
ULONG len;
+
if (ConvertSecurityDescriptorToStringSecurityDescriptorW(SecurityDescriptor,
SDRevision, Information, &wstr, &len))
{
int lenA;
@@ -971,15 +972,15 @@
while (*szAcl != '(')
{
if (*szAcl == 'P')
- {
+ {
flags |= SE_DACL_PROTECTED;
- }
+ }
else if (*szAcl == 'A')
{
szAcl++;
if (*szAcl == 'R')
flags |= SE_DACL_AUTO_INHERIT_REQ;
- else if (*szAcl == 'I')
+ else if (*szAcl == 'I')
flags |= SE_DACL_AUTO_INHERITED;
}
szAcl++;
@@ -1059,7 +1060,7 @@
if (!lpaf->wstr)
return 0;
- flags |= lpaf->value;
+ flags |= lpaf->value;
szAcl += len;
}
@@ -1081,15 +1082,15 @@
{
LPCWSTR p = szAcl;
- while (*p && *p != ';')
+ while (*p && *p != ';')
p++;
- if (p - szAcl <= 10 /* 8 hex digits + "0x" */ )
- {
- rights = strtoulW(szAcl, NULL, 16);
- szAcl = p;
- }
- else
+ if (p - szAcl <= 10 /* 8 hex digits + "0x" */ )
+ {
+ rights = strtoulW(szAcl, NULL, 16);
+ szAcl = p;
+ }
+ else
WARN("Invalid rights string format: %s\n", debugstr_wn(szAcl, p -
szAcl));
}
else
@@ -1099,16 +1100,16 @@
const ACEFLAG *lpaf = AceRights;
while (lpaf->wstr &&
- (len = strlenW(lpaf->wstr)) &&
- strncmpW(lpaf->wstr, szAcl, len))
- {
- lpaf++;
- }
+ (len = strlenW(lpaf->wstr)) &&
+ strncmpW(lpaf->wstr, szAcl, len))
+ {
+ lpaf++;
+ }
if (!lpaf->wstr)
return 0;
- rights |= lpaf->value;
+ rights |= lpaf->value;
szAcl += len;
}
}
@@ -1123,8 +1124,11 @@
*
* dacl_flags(string_ace1)(string_ace2)... (string_acen)
*/
-static BOOL ParseStringAclToAcl(LPCWSTR StringAcl, LPDWORD lpdwFlags,
- PACL pAcl, LPDWORD cBytes)
+static BOOL
+ParseStringAclToAcl(LPCWSTR StringAcl,
+ LPDWORD lpdwFlags,
+ PACL pAcl,
+ LPDWORD cBytes)
{
DWORD val;
DWORD sidlen;
@@ -1136,7 +1140,7 @@
TRACE("%s\n", debugstr_w(StringAcl));
if (!StringAcl)
- return FALSE;
+ return FALSE;
if (pAcl) /* pAce is only useful if we're setting values */
pAce = (PACCESS_ALLOWED_ACE) (pAcl + 1);
@@ -1151,23 +1155,23 @@
/* Parse ACE type */
val = ParseAceStringType(&StringAcl);
- if (pAce)
+ if (pAce)
pAce->Header.AceType = (BYTE) val;
if (*StringAcl != ';')
goto lerr;
StringAcl++;
/* Parse ACE flags */
- val = ParseAceStringFlags(&StringAcl);
- if (pAce)
+ val = ParseAceStringFlags(&StringAcl);
+ if (pAce)
pAce->Header.AceFlags = (BYTE) val;
if (*StringAcl != ';')
goto lerr;
StringAcl++;
/* Parse ACE rights */
- val = ParseAceStringRights(&StringAcl);
- if (pAce)
+ val = ParseAceStringRights(&StringAcl);
+ if (pAce)
pAce->Mask = val;
if (*StringAcl != ';')
goto lerr;
@@ -1191,10 +1195,10 @@
/* Parse ACE account sid */
if (ParseStringSidToSid(StringAcl, pAce ? &pAce->SidStart : NULL,
&sidlen))
- {
+ {
while (*StringAcl && *StringAcl != ')')
StringAcl++;
- }
+ }
if (*StringAcl != ')')
goto lerr;
@@ -1238,10 +1242,10 @@
/******************************************************************************
* ParseStringSecurityDescriptorToSecurityDescriptor
*/
-static BOOL ParseStringSecurityDescriptorToSecurityDescriptor(
- LPCWSTR StringSecurityDescriptor,
- SECURITY_DESCRIPTOR_RELATIVE* SecurityDescriptor,
- LPDWORD cBytes)
+static BOOL
+ParseStringSecurityDescriptorToSecurityDescriptor(LPCWSTR StringSecurityDescriptor,
+ SECURITY_DESCRIPTOR_RELATIVE*
SecurityDescriptor,
+ LPDWORD cBytes)
{
BOOL bret = FALSE;
WCHAR toktype;
@@ -1259,21 +1263,21 @@
{
toktype = *StringSecurityDescriptor;
- /* Expect char identifier followed by ':' */
- StringSecurityDescriptor++;
+ /* Expect char identifier followed by ':' */
+ StringSecurityDescriptor++;
if (*StringSecurityDescriptor != ':')
{
SetLastError(ERROR_INVALID_PARAMETER);
goto lend;
}
- StringSecurityDescriptor++;
-
- /* Extract token */
- lptoken = StringSecurityDescriptor;
- while (*lptoken && *lptoken != ':')
+ StringSecurityDescriptor++;
+
+ /* Extract token */
+ lptoken = StringSecurityDescriptor;
+ while (*lptoken && *lptoken != ':')
lptoken++;
- if (*lptoken)
+ if (*lptoken)
lptoken--;
len = lptoken - StringSecurityDescriptor;
@@ -1281,7 +1285,7 @@
tok[len] = 0;
switch (toktype)
- {
+ {
case 'O':
{
DWORD bytes;
@@ -1295,7 +1299,7 @@
lpNext += bytes; /* Advance to next token */
}
- *cBytes += bytes;
+ *cBytes += bytes;
break;
}
@@ -1313,13 +1317,13 @@
lpNext += bytes; /* Advance to next token */
}
- *cBytes += bytes;
+ *cBytes += bytes;
break;
}
case 'D':
- {
+ {
DWORD flags;
DWORD bytes;
@@ -1331,11 +1335,11 @@
SecurityDescriptor->Control |= SE_DACL_PRESENT | flags;
SecurityDescriptor->Dacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
- }
-
- *cBytes += bytes;
-
- break;
+ }
+
+ *cBytes += bytes;
+
+ break;
}
case 'S':
@@ -1351,18 +1355,18 @@
SecurityDescriptor->Control |= SE_SACL_PRESENT | flags;
SecurityDescriptor->Sacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
- }
-
- *cBytes += bytes;
-
- break;
+ }
+
+ *cBytes += bytes;
+
+ break;
}
default:
FIXME("Unknown token\n");
SetLastError(ERROR_INVALID_PARAMETER);
- goto lend;
- }
+ goto lend;
+ }
StringSecurityDescriptor = lptoken;
}
@@ -1378,11 +1382,11 @@
* ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@]
* @implemented
*/
-BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW(
- LPCWSTR StringSecurityDescriptor,
- DWORD StringSDRevision,
- PSECURITY_DESCRIPTOR* SecurityDescriptor,
- PULONG SecurityDescriptorSize)
+BOOL WINAPI
+ConvertStringSecurityDescriptorToSecurityDescriptorW(LPCWSTR StringSecurityDescriptor,
+ DWORD StringSDRevision,
+ PSECURITY_DESCRIPTOR*
SecurityDescriptor,
+ PULONG SecurityDescriptorSize)
{
DWORD cBytes;
SECURITY_DESCRIPTOR* psd;
@@ -1403,13 +1407,13 @@
else if (StringSDRevision != SID_REVISION)
{
SetLastError(ERROR_UNKNOWN_REVISION);
- goto lend;
+ goto lend;
}
/* Compute security descriptor length */
if (!ParseStringSecurityDescriptorToSecurityDescriptor(StringSecurityDescriptor,
NULL, &cBytes))
- goto lend;
+ goto lend;
psd = *SecurityDescriptor = LocalAlloc(GMEM_ZEROINIT, cBytes);
if (!psd) goto lend;
@@ -1421,14 +1425,14 @@
(SECURITY_DESCRIPTOR_RELATIVE *)psd, &cBytes))
{
LocalFree(psd);
- goto lend;
+ goto lend;
}
if (SecurityDescriptorSize)
*SecurityDescriptorSize = cBytes;
bret = TRUE;
-
+
lend:
TRACE(" ret=%d\n", bret);
return bret;
@@ -1440,11 +1444,12 @@
* ConvertStringSecurityDescriptorToSecurityDescriptorA [ADVAPI32.@]
* @implemented
*/
-BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA(
- LPCSTR StringSecurityDescriptor,
- DWORD StringSDRevision,
- PSECURITY_DESCRIPTOR* SecurityDescriptor,
- PULONG SecurityDescriptorSize)
+BOOL
+WINAPI
+ConvertStringSecurityDescriptorToSecurityDescriptorA(LPCSTR StringSecurityDescriptor,
+ DWORD StringSDRevision,
+ PSECURITY_DESCRIPTOR*
SecurityDescriptor,
+ PULONG SecurityDescriptorSize)
{
UINT len;
BOOL ret = FALSE;
@@ -1469,7 +1474,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
EqualPrefixSid(PSID pSid1,
PSID pSid2)
{
@@ -1480,7 +1486,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
EqualSid(PSID pSid1,
PSID pSid2)
{
@@ -1495,7 +1502,8 @@
* Docs says this function does NOT return a value
* even thou it's defined to return a PVOID...
*/
-PVOID WINAPI
+PVOID
+WINAPI
FreeSid(PSID pSid)
{
return RtlFreeSid(pSid);
@@ -1505,7 +1513,8 @@
/*
* @implemented
*/
-DWORD WINAPI
+DWORD
+WINAPI
GetLengthSid(PSID pSid)
{
return (DWORD)RtlLengthSid(pSid);
@@ -1515,7 +1524,8 @@
/*
* @implemented
*/
-PSID_IDENTIFIER_AUTHORITY WINAPI
+PSID_IDENTIFIER_AUTHORITY
+WINAPI
GetSidIdentifierAuthority(PSID pSid)
{
return RtlIdentifierAuthoritySid(pSid);
@@ -1525,7 +1535,8 @@
/*
* @implemented
*/
-DWORD WINAPI
+DWORD
+WINAPI
GetSidLengthRequired(UCHAR nSubAuthorityCount)
{
return (DWORD)RtlLengthRequiredSid(nSubAuthorityCount);
@@ -1535,7 +1546,8 @@
/*
* @implemented
*/
-PDWORD WINAPI
+PDWORD
+WINAPI
GetSidSubAuthority(PSID pSid,
DWORD nSubAuthority)
{
@@ -1546,7 +1558,8 @@
/*
* @implemented
*/
-PUCHAR WINAPI
+PUCHAR
+WINAPI
GetSidSubAuthorityCount(PSID pSid)
{
return RtlSubAuthorityCountSid(pSid);
@@ -1556,7 +1569,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
InitializeSid(PSID Sid,
PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
BYTE nSubAuthorityCount)
@@ -1579,7 +1593,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
IsValidSid(PSID pSid)
{
return (BOOL)RtlValidSid(pSid);
@@ -1589,7 +1604,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertSidToStringSidW(PSID Sid,
LPWSTR *StringSid)
{
@@ -1643,7 +1659,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertSidToStringSidA(PSID Sid,
LPSTR *StringSid)
{
@@ -1687,7 +1704,8 @@
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
EqualDomainSid(IN PSID pSid1,
IN PSID pSid2,
OUT BOOL* pfEqual)
@@ -1700,7 +1718,8 @@
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
GetWindowsAccountDomainSid(IN PSID pSid,
OUT PSID ppDomainSid,
IN OUT DWORD* cbSid)
@@ -1713,7 +1732,8 @@
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType,
IN PSID DomainSid OPTIONAL,
OUT PSID pSid,
@@ -1787,7 +1807,8 @@
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
IsWellKnownSid(IN PSID pSid,
IN WELL_KNOWN_SID_TYPE WellKnownSidType)
{
@@ -1810,7 +1831,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertStringSidToSidA(IN LPCSTR StringSid,
OUT PSID* sid)
{
@@ -1879,7 +1901,8 @@
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertStringSidToSidW(IN LPCWSTR StringSid,
OUT PSID* sid)
{
@@ -1890,43 +1913,43 @@
TRACE("%s %p\n", debugstr_w(StringSid), sid);
- if (!StringSid)
- {
- SetLastError(ERROR_INVALID_SID);
- return FALSE;
- }
- for (i = 0; i < sizeof(SidTable) / sizeof(SidTable[0]) - 1; i++)
- {
- if (wcscmp(StringSid, SidTable[i].key) == 0)
- {
- WELL_KNOWN_SID_TYPE knownSid = (WELL_KNOWN_SID_TYPE)SidTable[i].value;
- size = SECURITY_MAX_SID_SIZE;
- *sid = LocalAlloc(0, size);
- if (!*sid)
- {
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return FALSE;
- }
- ret = CreateWellKnownSid(
- knownSid,
- NULL,
- *sid,
- &size);
- if (!ret)
- {
- SetLastError(ERROR_INVALID_SID);
- LocalFree(*sid);
- }
- return ret;
- }
- }
-
- /* That's probably a string S-R-I-S-S... */
- if (StringSid[0] != 'S' || StringSid[1] != '-')
- {
- SetLastError(ERROR_INVALID_SID);
- return FALSE;
- }
+ if (!StringSid)
+ {
+ SetLastError(ERROR_INVALID_SID);
+ return FALSE;
+ }
+
+ for (i = 0; i < sizeof(SidTable) / sizeof(SidTable[0]) - 1; i++)
+ {
+ if (wcscmp(StringSid, SidTable[i].key) == 0)
+ {
+ WELL_KNOWN_SID_TYPE knownSid = (WELL_KNOWN_SID_TYPE)SidTable[i].value;
+ size = SECURITY_MAX_SID_SIZE;
+ *sid = LocalAlloc(0, size);
+ if (!*sid)
+ {
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
+ }
+ ret = CreateWellKnownSid(knownSid,
+ NULL,
+ *sid,
+ &size);
+ if (!ret)
+ {
+ SetLastError(ERROR_INVALID_SID);
+ LocalFree(*sid);
+ }
+ return ret;
+ }
+ }
+
+ /* That's probably a string S-R-I-S-S... */
+ if (StringSid[0] != 'S' || StringSid[1] != '-')
+ {
+ SetLastError(ERROR_INVALID_SID);
+ return FALSE;
+ }
cBytes = ComputeStringSidSize(StringSid);
pisid = (SID*)LocalAlloc( 0, cBytes );
@@ -2005,5 +2028,4 @@
return ret;
}
-
/* EOF */