BOOL STDCALL
AllocateLocallyUniqueId(PLUID Luid)
{
- NTSTATUS Status;
+ NTSTATUS Status;
- Status = NtAllocateLocallyUniqueId (Luid);
- if (!NT_SUCCESS (Status))
+ Status = NtAllocateLocallyUniqueId (Luid);
+ if (!NT_SUCCESS (Status))
{
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
* @implemented
*/
BOOL STDCALL
-AllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
- BYTE nSubAuthorityCount,
- DWORD dwSubAuthority0,
- DWORD dwSubAuthority1,
- DWORD dwSubAuthority2,
- DWORD dwSubAuthority3,
- DWORD dwSubAuthority4,
- DWORD dwSubAuthority5,
- DWORD dwSubAuthority6,
- DWORD dwSubAuthority7,
- PSID *pSid)
+AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
+ BYTE nSubAuthorityCount,
+ DWORD dwSubAuthority0,
+ DWORD dwSubAuthority1,
+ DWORD dwSubAuthority2,
+ DWORD dwSubAuthority3,
+ DWORD dwSubAuthority4,
+ DWORD dwSubAuthority5,
+ DWORD dwSubAuthority6,
+ DWORD dwSubAuthority7,
+ PSID *pSid)
{
- NTSTATUS Status;
-
- Status = RtlAllocateAndInitializeSid (pIdentifierAuthority,
- nSubAuthorityCount,
- dwSubAuthority0,
- dwSubAuthority1,
- dwSubAuthority2,
- dwSubAuthority3,
- dwSubAuthority4,
- dwSubAuthority5,
- dwSubAuthority6,
- dwSubAuthority7,
- pSid);
- if (!NT_SUCCESS (Status))
+ NTSTATUS Status;
+
+ Status = RtlAllocateAndInitializeSid(pIdentifierAuthority,
+ nSubAuthorityCount,
+ dwSubAuthority0,
+ dwSubAuthority1,
+ dwSubAuthority2,
+ dwSubAuthority3,
+ dwSubAuthority4,
+ dwSubAuthority5,
+ dwSubAuthority6,
+ dwSubAuthority7,
+ pSid);
+ if (!NT_SUCCESS(Status))
{
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
* @implemented
*/
BOOL STDCALL
-CopySid (DWORD nDestinationSidLength,
- PSID pDestinationSid,
- PSID pSourceSid)
+CopySid(DWORD nDestinationSidLength,
+ PSID pDestinationSid,
+ PSID pSourceSid)
{
- NTSTATUS Status;
+ NTSTATUS Status;
- Status = RtlCopySid (nDestinationSidLength,
- pDestinationSid,
- pSourceSid);
- if (!NT_SUCCESS (Status))
+ Status = RtlCopySid(nDestinationSidLength,
+ pDestinationSid,
+ pSourceSid);
+ if (!NT_SUCCESS (Status))
{
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
}
return TRUE;
}
+
+
/******************************************************************************
* ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@]
* @implemented
* @implemented
*/
BOOL STDCALL
-EqualPrefixSid (PSID pSid1,
- PSID pSid2)
+EqualPrefixSid(PSID pSid1,
+ PSID pSid2)
{
- return RtlEqualPrefixSid (pSid1, pSid2);
+ return RtlEqualPrefixSid (pSid1, pSid2);
}
* @implemented
*/
BOOL STDCALL
-EqualSid (PSID pSid1,
- PSID pSid2)
+EqualSid(PSID pSid1,
+ PSID pSid2)
{
- return RtlEqualSid (pSid1, pSid2);
+ return RtlEqualSid (pSid1, pSid2);
}
* even thou it's defined to return a PVOID...
*/
PVOID STDCALL
-FreeSid (PSID pSid)
+FreeSid(PSID pSid)
{
- return RtlFreeSid (pSid);
+ return RtlFreeSid(pSid);
}
* @implemented
*/
DWORD STDCALL
-GetLengthSid (PSID pSid)
+GetLengthSid(PSID pSid)
{
- return (DWORD)RtlLengthSid (pSid);
+ return (DWORD)RtlLengthSid(pSid);
}
* @implemented
*/
PSID_IDENTIFIER_AUTHORITY STDCALL
-GetSidIdentifierAuthority (PSID pSid)
+GetSidIdentifierAuthority(PSID pSid)
{
- return RtlIdentifierAuthoritySid (pSid);
+ return RtlIdentifierAuthoritySid(pSid);
}
* @implemented
*/
DWORD STDCALL
-GetSidLengthRequired (UCHAR nSubAuthorityCount)
+GetSidLengthRequired(UCHAR nSubAuthorityCount)
{
- return (DWORD)RtlLengthRequiredSid (nSubAuthorityCount);
+ return (DWORD)RtlLengthRequiredSid(nSubAuthorityCount);
}
* @implemented
*/
PDWORD STDCALL
-GetSidSubAuthority (PSID pSid,
- DWORD nSubAuthority)
+GetSidSubAuthority(PSID pSid,
+ DWORD nSubAuthority)
{
- return (PDWORD)RtlSubAuthoritySid (pSid, nSubAuthority);
+ return (PDWORD)RtlSubAuthoritySid(pSid, nSubAuthority);
}
* @implemented
*/
PUCHAR STDCALL
-GetSidSubAuthorityCount (PSID pSid)
+GetSidSubAuthorityCount(PSID pSid)
{
- return RtlSubAuthorityCountSid (pSid);
+ return RtlSubAuthorityCountSid(pSid);
}
* @implemented
*/
BOOL STDCALL
-InitializeSid (PSID Sid,
- PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
- BYTE nSubAuthorityCount)
+InitializeSid(PSID Sid,
+ PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
+ BYTE nSubAuthorityCount)
{
- NTSTATUS Status;
+ NTSTATUS Status;
- Status = RtlInitializeSid (Sid,
- pIdentifierAuthority,
- nSubAuthorityCount);
- if (!NT_SUCCESS (Status))
+ Status = RtlInitializeSid(Sid,
+ pIdentifierAuthority,
+ nSubAuthorityCount);
+ if (!NT_SUCCESS(Status))
{
- SetLastError (RtlNtStatusToDosError (Status));
- return FALSE;
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
}
- return TRUE;
+ return TRUE;
}
* @implemented
*/
BOOL STDCALL
-IsValidSid (PSID pSid)
+IsValidSid(PSID pSid)
{
- return (BOOL)RtlValidSid (pSid);
+ return (BOOL)RtlValidSid(pSid);
}
+
/*
* @implemented
*/
BOOL STDCALL
-ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
+ConvertSidToStringSidW(PSID Sid,
+ LPWSTR *StringSid)
{
- NTSTATUS Status;
- UNICODE_STRING UnicodeString;
- WCHAR FixedBuffer[64];
+ NTSTATUS Status;
+ UNICODE_STRING UnicodeString;
+ WCHAR FixedBuffer[64];
- if (! RtlValidSid(Sid))
+ if (!RtlValidSid(Sid))
{
- SetLastError(ERROR_INVALID_SID);
- return FALSE;
+ SetLastError(ERROR_INVALID_SID);
+ return FALSE;
}
- UnicodeString.Length = 0;
- UnicodeString.MaximumLength = sizeof(FixedBuffer);
- UnicodeString.Buffer = FixedBuffer;
- Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, FALSE);
- if (STATUS_BUFFER_TOO_SMALL == Status)
+ UnicodeString.Length = 0;
+ UnicodeString.MaximumLength = sizeof(FixedBuffer);
+ UnicodeString.Buffer = FixedBuffer;
+ Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, FALSE);
+ if (STATUS_BUFFER_TOO_SMALL == Status)
{
- Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, TRUE);
+ Status = RtlConvertSidToUnicodeString(&UnicodeString, Sid, TRUE);
}
- if (! NT_SUCCESS(Status))
+
+ if (!NT_SUCCESS(Status))
{
- SetLastError(RtlNtStatusToDosError(Status));
- return FALSE;
+ SetLastError(RtlNtStatusToDosError(Status));
+ return FALSE;
}
- *StringSid = LocalAlloc(LMEM_FIXED, UnicodeString.Length + sizeof(WCHAR));
- if (NULL == *StringSid)
+ *StringSid = LocalAlloc(LMEM_FIXED, UnicodeString.Length + sizeof(WCHAR));
+ if (NULL == *StringSid)
{
- if (UnicodeString.Buffer != FixedBuffer)
+ if (UnicodeString.Buffer != FixedBuffer)
{
- RtlFreeUnicodeString(&UnicodeString);
+ RtlFreeUnicodeString(&UnicodeString);
}
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
return FALSE;
}
- MoveMemory(*StringSid, UnicodeString.Buffer, UnicodeString.Length);
- ZeroMemory((PCHAR) *StringSid + UnicodeString.Length, sizeof(WCHAR));
- if (UnicodeString.Buffer != FixedBuffer)
+ MoveMemory(*StringSid, UnicodeString.Buffer, UnicodeString.Length);
+ ZeroMemory((PCHAR) *StringSid + UnicodeString.Length, sizeof(WCHAR));
+ if (UnicodeString.Buffer != FixedBuffer)
{
- RtlFreeUnicodeString(&UnicodeString);
+ RtlFreeUnicodeString(&UnicodeString);
}
- return TRUE;
+ return TRUE;
}
* @implemented
*/
BOOL STDCALL
-ConvertSidToStringSidA(PSID Sid, LPSTR *StringSid)
+ConvertSidToStringSidA(PSID Sid,
+ LPSTR *StringSid)
{
- LPWSTR StringSidW;
- int Len;
+ LPWSTR StringSidW;
+ int Len;
- if (! ConvertSidToStringSidW(Sid, &StringSidW))
+ if (!ConvertSidToStringSidW(Sid, &StringSidW))
{
- return FALSE;
+ return FALSE;
}
- Len = WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, NULL, 0, NULL, NULL);
- if (Len <= 0)
+ Len = WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, NULL, 0, NULL, NULL);
+ if (Len <= 0)
{
- LocalFree(StringSidW);
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return FALSE;
+ LocalFree(StringSidW);
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
}
- *StringSid = LocalAlloc(LMEM_FIXED, Len);
- if (NULL == *StringSid)
+
+ *StringSid = LocalAlloc(LMEM_FIXED, Len);
+ if (NULL == *StringSid)
{
- LocalFree(StringSidW);
- SetLastError(ERROR_NOT_ENOUGH_MEMORY);
- return FALSE;
+ LocalFree(StringSidW);
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return FALSE;
}
- if (! WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, *StringSid, Len, NULL, NULL))
+ if (!WideCharToMultiByte(CP_ACP, 0, StringSidW, -1, *StringSid, Len, NULL, NULL))
{
- LocalFree(StringSid);
- LocalFree(StringSidW);
- return FALSE;
+ LocalFree(StringSid);
+ LocalFree(StringSidW);
+ return FALSE;
}
- LocalFree(StringSidW);
+ LocalFree(StringSidW);
- return TRUE;
+ return TRUE;
}
int i;
TRACE("(%d, %s, %p, %p)\n", WellKnownSidType, debugstr_sid(DomainSid), pSid, cbSid);
- if (DomainSid != NULL) {
+ if (DomainSid != NULL)
+ {
FIXME("Only local computer supported!\n");
SetLastError(ERROR_INVALID_PARAMETER); /* FIXME */
return FALSE;
}
- if (cbSid == NULL || pSid == NULL) {
+ if (cbSid == NULL || pSid == NULL)
+ {
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
- for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++) {
- if (WellKnownSids[i].Type == WellKnownSidType) {
+ for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++)
+ {
+ if (WellKnownSids[i].Type == WellKnownSidType)
+ {
DWORD length = GetSidLengthRequired(WellKnownSids[i].Sid.SubAuthorityCount);
- if (*cbSid < length) {
+ if (*cbSid < length)
+ {
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
int i;
TRACE("(%s, %d)\n", debugstr_sid(pSid), WellKnownSidType);
- for (i = 0; i < sizeof(WellKnownSids)/sizeof(WellKnownSids[0]); i++)
+ for (i = 0; i < sizeof(WellKnownSids) / sizeof(WellKnownSids[0]); i++)
+ {
if (WellKnownSids[i].Type == WellKnownSidType)
+ {
if (EqualSid(pSid, (PSID)((ULONG_PTR)&WellKnownSids[i].Sid.Revision)))
return TRUE;
+ }
+ }
return FALSE;
}
* @implemented
*/
BOOL STDCALL
-ConvertStringSidToSidA(
- IN LPCSTR StringSid,
- OUT PSID* sid)
+ConvertStringSidToSidA(IN LPCSTR StringSid,
+ OUT PSID* sid)
{
BOOL bRetVal = FALSE;
return bRetVal;
}
+
/******************************************************************************
* ComputeStringSidSize
*/
-static DWORD ComputeStringSidSize(LPCWSTR StringSid)
+static DWORD
+ComputeStringSidSize(LPCWSTR StringSid)
{
DWORD size = sizeof(SID);
* @implemented
*/
BOOL WINAPI
-ConvertStringSidToSidW(
- IN LPCWSTR StringSid,
- OUT PSID* sid)
+ConvertStringSidToSidW(IN LPCWSTR StringSid,
+ OUT PSID* sid)
{
- DWORD size;
- DWORD i, cBytes, identAuth, csubauth;
- BOOL ret;
- SID* pisid;
+ DWORD size;
+ DWORD i, cBytes, identAuth, csubauth;
+ BOOL ret;
+ SID* pisid;
- TRACE("%s %p\n", debugstr_w(StringSid), sid);
+ TRACE("%s %p\n", debugstr_w(StringSid), sid);
if (!StringSid)
{