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;
{
LPWSTR wstr;
ULONG len;
+
if (ConvertSecurityDescriptorToStringSecurityDescriptorW(SecurityDescriptor, SDRevision, Information, &wstr, &len))
{
int lenA;
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++;
if (!lpaf->wstr)
return 0;
- flags |= lpaf->value;
+ flags |= lpaf->value;
szAcl += len;
}
{
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
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;
}
}
*
* 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;
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);
/* 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;
/* Parse ACE account sid */
if (ParseStringSidToSid(StringAcl, pAce ? &pAce->SidStart : NULL, &sidlen))
- {
+ {
while (*StringAcl && *StringAcl != ')')
StringAcl++;
- }
+ }
if (*StringAcl != ')')
goto lerr;
/******************************************************************************
* 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;
{
toktype = *StringSecurityDescriptor;
- /* Expect char identifier followed by ':' */
- StringSecurityDescriptor++;
+ /* Expect char identifier followed by ':' */
+ StringSecurityDescriptor++;
if (*StringSecurityDescriptor != ':')
{
SetLastError(ERROR_INVALID_PARAMETER);
goto lend;
}
- StringSecurityDescriptor++;
+ StringSecurityDescriptor++;
- /* Extract token */
- lptoken = StringSecurityDescriptor;
- while (*lptoken && *lptoken != ':')
+ /* Extract token */
+ lptoken = StringSecurityDescriptor;
+ while (*lptoken && *lptoken != ':')
lptoken++;
- if (*lptoken)
+ if (*lptoken)
lptoken--;
len = lptoken - StringSecurityDescriptor;
tok[len] = 0;
switch (toktype)
- {
+ {
case 'O':
{
DWORD bytes;
lpNext += bytes; /* Advance to next token */
}
- *cBytes += bytes;
+ *cBytes += bytes;
break;
}
lpNext += bytes; /* Advance to next token */
}
- *cBytes += bytes;
+ *cBytes += bytes;
break;
}
case 'D':
- {
+ {
DWORD flags;
DWORD bytes;
SecurityDescriptor->Control |= SE_DACL_PRESENT | flags;
SecurityDescriptor->Dacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
- }
+ }
- *cBytes += bytes;
+ *cBytes += bytes;
- break;
+ break;
}
case 'S':
SecurityDescriptor->Control |= SE_SACL_PRESENT | flags;
SecurityDescriptor->Sacl = lpNext - (LPBYTE)SecurityDescriptor;
lpNext += bytes; /* Advance to next token */
- }
+ }
- *cBytes += bytes;
+ *cBytes += bytes;
- break;
+ break;
}
default:
FIXME("Unknown token\n");
SetLastError(ERROR_INVALID_PARAMETER);
- goto lend;
- }
+ goto lend;
+ }
StringSecurityDescriptor = lptoken;
}
* 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;
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;
(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;
* 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;
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
EqualPrefixSid(PSID pSid1,
PSID pSid2)
{
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
EqualSid(PSID pSid1,
PSID pSid2)
{
* 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);
/*
* @implemented
*/
-DWORD WINAPI
+DWORD
+WINAPI
GetLengthSid(PSID pSid)
{
return (DWORD)RtlLengthSid(pSid);
/*
* @implemented
*/
-PSID_IDENTIFIER_AUTHORITY WINAPI
+PSID_IDENTIFIER_AUTHORITY
+WINAPI
GetSidIdentifierAuthority(PSID pSid)
{
return RtlIdentifierAuthoritySid(pSid);
/*
* @implemented
*/
-DWORD WINAPI
+DWORD
+WINAPI
GetSidLengthRequired(UCHAR nSubAuthorityCount)
{
return (DWORD)RtlLengthRequiredSid(nSubAuthorityCount);
/*
* @implemented
*/
-PDWORD WINAPI
+PDWORD
+WINAPI
GetSidSubAuthority(PSID pSid,
DWORD nSubAuthority)
{
/*
* @implemented
*/
-PUCHAR WINAPI
+PUCHAR
+WINAPI
GetSidSubAuthorityCount(PSID pSid)
{
return RtlSubAuthorityCountSid(pSid);
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
InitializeSid(PSID Sid,
PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
BYTE nSubAuthorityCount)
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
IsValidSid(PSID pSid)
{
return (BOOL)RtlValidSid(pSid);
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertSidToStringSidW(PSID Sid,
LPWSTR *StringSid)
{
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertSidToStringSidA(PSID Sid,
LPSTR *StringSid)
{
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
EqualDomainSid(IN PSID pSid1,
IN PSID pSid2,
OUT BOOL* pfEqual)
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
GetWindowsAccountDomainSid(IN PSID pSid,
OUT PSID ppDomainSid,
IN OUT DWORD* cbSid)
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
CreateWellKnownSid(IN WELL_KNOWN_SID_TYPE WellKnownSidType,
IN PSID DomainSid OPTIONAL,
OUT PSID pSid,
/*
* @unimplemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
IsWellKnownSid(IN PSID pSid,
IN WELL_KNOWN_SID_TYPE WellKnownSidType)
{
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertStringSidToSidA(IN LPCSTR StringSid,
OUT PSID* sid)
{
/*
* @implemented
*/
-BOOL WINAPI
+BOOL
+WINAPI
ConvertStringSidToSidW(IN LPCWSTR StringSid,
OUT PSID* sid)
{
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 );
return ret;
}
-
/* EOF */