Fixed minor bugs in RtlConvertSidToUnicodeString().

svn path=/trunk/; revision=4862
This commit is contained in:
Eric Kohl 2003-06-07 10:35:27 +00:00
parent ebabe56624
commit bdb2981529
2 changed files with 60 additions and 60 deletions

View file

@ -1,4 +1,4 @@
/* $Id: sid.c,v 1.6 2002/09/08 10:23:06 chorns Exp $
/* $Id: sid.c,v 1.7 2003/06/07 10:35:27 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -246,22 +246,22 @@ RtlConvertSidToUnicodeString(PUNICODE_STRING String,
WCHAR Buffer[256];
PWSTR wcs;
ULONG Length;
BYTE i;
ULONG i;
if (RtlValidSid (Sid) == FALSE)
return STATUS_INVALID_SID;
wcs = Buffer;
wcs += swprintf (wcs, L"S-%u-", Sid->Revision);
if (!Sid->IdentifierAuthority.Value[0] &&
!Sid->IdentifierAuthority.Value[1])
if (Sid->IdentifierAuthority.Value[0] == 0 &&
Sid->IdentifierAuthority.Value[1] == 0)
{
wcs += swprintf (wcs,
L"%u",
(DWORD)Sid->IdentifierAuthority.Value[2] << 24 |
(DWORD)Sid->IdentifierAuthority.Value[3] << 16 |
(DWORD)Sid->IdentifierAuthority.Value[4] << 8 |
(DWORD)Sid->IdentifierAuthority.Value[5]);
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
{
@ -279,7 +279,7 @@ RtlConvertSidToUnicodeString(PUNICODE_STRING String,
{
wcs += swprintf (wcs,
L"-%u",
Sid->SubAuthority[0]);
Sid->SubAuthority[i]);
}
Length = (wcs - Buffer) * sizeof(WCHAR);
@ -299,11 +299,11 @@ RtlConvertSidToUnicodeString(PUNICODE_STRING String,
}
String->Length = Length;
memmove (String->Buffer,
RtlCopyMemory (String->Buffer,
Buffer,
Length);
if (Length < String->MaximumLength)
String->Buffer[Length] = 0;
String->Buffer[Length / sizeof(WCHAR)] = 0;
return STATUS_SUCCESS;
}

View file

@ -1,4 +1,4 @@
/* $Id: sid.c,v 1.12 2002/09/08 10:23:43 chorns Exp $
/* $Id: sid.c,v 1.13 2003/06/07 10:34:47 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -661,7 +661,7 @@ RtlConvertSidToUnicodeString(PUNICODE_STRING String,
Buffer,
Length);
if (Length < String->MaximumLength)
String->Buffer[Length] = 0;
String->Buffer[Length/sizeof(WCHAR)] = 0;
return STATUS_SUCCESS;
}