Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 329 of file sid.c.
{ WCHAR Buffer[256]; PWSTR wcs; SIZE_T Length; ULONG i; PISID Sid = Sid_; PAGED_CODE_RTL(); if (RtlValidSid (Sid) == FALSE) return STATUS_INVALID_SID; wcs = Buffer; wcs += swprintf (wcs, L"S-%u-", Sid->Revision); if (Sid->IdentifierAuthority.Value[0] == 0 && Sid->IdentifierAuthority.Value[1] == 0) { wcs += swprintf (wcs, L"%lu", (ULONG)Sid->IdentifierAuthority.Value[2] << 24 | (ULONG)Sid->IdentifierAuthority.Value[3] << 16 | (ULONG)Sid->IdentifierAuthority.Value[4] << 8 | (ULONG)Sid->IdentifierAuthority.Value[5]); } else { wcs += swprintf (wcs, L"0x%02hx%02hx%02hx%02hx%02hx%02hx", Sid->IdentifierAuthority.Value[0], Sid->IdentifierAuthority.Value[1], Sid->IdentifierAuthority.Value[2], Sid->IdentifierAuthority.Value[3], Sid->IdentifierAuthority.Value[4], Sid->IdentifierAuthority.Value[5]); } for (i = 0; i < Sid->SubAuthorityCount; i++) { wcs += swprintf (wcs, L"-%u", Sid->SubAuthority[i]); } if (AllocateBuffer) { if (!RtlCreateUnicodeString(String, Buffer)) { return STATUS_NO_MEMORY; } } else { Length = (wcs - Buffer) * sizeof(WCHAR); if (Length > String->MaximumLength) return STATUS_BUFFER_TOO_SMALL; String->Length = (USHORT)Length; RtlCopyMemory (String->Buffer, Buffer, Length); if (Length < String->MaximumLength) String->Buffer[Length / sizeof(WCHAR)] = 0; } return STATUS_SUCCESS; }