mirror of
https://github.com/reactos/reactos.git
synced 2024-08-08 04:08:29 +00:00
Added RtlCopyLuidAndAttributesArray() and RtlCopySidAndAttributesArray().
svn path=/trunk/; revision=3308
This commit is contained in:
parent
5295bac977
commit
4201812a7e
|
@ -1,4 +1,4 @@
|
|||
/* $Id: rtl.h,v 1.62 2002/07/25 13:15:08 ekohl Exp $
|
||||
/* $Id: rtl.h,v 1.63 2002/07/29 15:33:31 ekohl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -660,26 +660,36 @@ VOID STDCALL
|
|||
RtlCopyLuid(IN PLUID LuidDest,
|
||||
IN PLUID LuidSrc);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
RtlCopyString (
|
||||
PSTRING DestinationString,
|
||||
PSTRING SourceString
|
||||
);
|
||||
VOID STDCALL
|
||||
RtlCopyLuidAndAttributesArray(ULONG Count,
|
||||
PLUID_AND_ATTRIBUTES Src,
|
||||
PLUID_AND_ATTRIBUTES Dest);
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
RtlCopyUnicodeString (
|
||||
PUNICODE_STRING DestinationString,
|
||||
PUNICODE_STRING SourceString
|
||||
);
|
||||
NTSTATUS STDCALL
|
||||
RtlCopySid(ULONG BufferLength,
|
||||
PSID Dest,
|
||||
PSID Src);
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlCreateAtomTable (
|
||||
IN ULONG TableSize,
|
||||
IN OUT PRTL_ATOM_TABLE *AtomTable
|
||||
);
|
||||
NTSTATUS STDCALL
|
||||
RtlCopySidAndAttributesArray(ULONG Count,
|
||||
PSID_AND_ATTRIBUTES Src,
|
||||
ULONG SidAreaSize,
|
||||
PSID_AND_ATTRIBUTES Dest,
|
||||
PVOID SidArea,
|
||||
PVOID* RemainingSidArea,
|
||||
PULONG RemainingSidAreaSize);
|
||||
|
||||
VOID STDCALL
|
||||
RtlCopyString(PSTRING DestinationString,
|
||||
PSTRING SourceString);
|
||||
|
||||
VOID STDCALL
|
||||
RtlCopyUnicodeString(PUNICODE_STRING DestinationString,
|
||||
PUNICODE_STRING SourceString);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
RtlCreateAtomTable(IN ULONG TableSize,
|
||||
IN OUT PRTL_ATOM_TABLE *AtomTable);
|
||||
|
||||
HANDLE
|
||||
STDCALL
|
||||
|
@ -2021,7 +2031,6 @@ ULONG STDCALL RtlLengthRequiredSid (UCHAR SubAuthorityCount);
|
|||
PSID_IDENTIFIER_AUTHORITY STDCALL RtlIdentifierAuthoritySid (PSID Sid);
|
||||
NTSTATUS STDCALL RtlInitializeSid (PSID Sid, PSID_IDENTIFIER_AUTHORITY IdentifierAuthority, UCHAR SubAuthorityCount);
|
||||
PULONG STDCALL RtlSubAuthoritySid (PSID Sid, ULONG SubAuthority);
|
||||
NTSTATUS STDCALL RtlCopySid (ULONG BufferLength, PSID Dest, PSID Src);
|
||||
BOOLEAN STDCALL RtlEqualPrefixSid (PSID Sid1, PSID Sid2);
|
||||
BOOLEAN STDCALL RtlEqualSid(PSID Sid1, PSID Sid2);
|
||||
PSID STDCALL RtlFreeSid (PSID Sid);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.def,v 1.84 2002/07/25 16:58:58 ekohl Exp $
|
||||
; $Id: ntdll.def,v 1.85 2002/07/29 15:37:05 ekohl Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -322,10 +322,10 @@ RtlConvertSidToUnicodeString@12
|
|||
;RtlConvertUiListToApiList
|
||||
RtlConvertUlongToLargeInteger@4
|
||||
RtlCopyLuid@8
|
||||
;RtlCopyLuidAndAttributesArray
|
||||
RtlCopyLuidAndAttributesArray@12
|
||||
;RtlCopySecurityDescriptor
|
||||
RtlCopySid@12
|
||||
;RtlCopySidAndAttributesArray
|
||||
RtlCopySidAndAttributesArray@28
|
||||
RtlCopyString@8
|
||||
RtlCopyUnicodeString@8
|
||||
RtlCreateAcl@12
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntdll.edf,v 1.73 2002/07/25 16:58:58 ekohl Exp $
|
||||
; $Id: ntdll.edf,v 1.74 2002/07/29 15:37:06 ekohl Exp $
|
||||
;
|
||||
; ReactOS Operating System
|
||||
;
|
||||
|
@ -322,10 +322,10 @@ RtlConvertSidToUnicodeString=RtlConvertSidToUnicodeString@12
|
|||
;RtlConvertUiListToApiList
|
||||
RtlConvertUlongToLargeInteger=RtlConvertUlongToLargeInteger@4
|
||||
RtlCopyLuid=RtlCopyLuid@8
|
||||
;RtlCopyLuidAndAttributesArray
|
||||
RtlCopyLuidAndAttributesArray=RtlCopyLuidAndAttributesArray@12
|
||||
;RtlCopySecurityDescriptor
|
||||
RtlCopySid=RtlCopySid@12
|
||||
;RtlCopySidAndAttributesArray
|
||||
RtlCopySidAndAttributesArray=RtlCopySidAndAttributesArray@28
|
||||
RtlCopyString=RtlCopyString@8
|
||||
RtlCopyUnicodeString=RtlCopyUnicodeString@8
|
||||
RtlCreateAcl=RtlCreateAcl@12
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: luid.c,v 1.2 2000/06/29 23:35:31 dwelch Exp $
|
||||
/* $Id: luid.c,v 1.3 2002/07/29 15:36:20 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -15,32 +15,35 @@
|
|||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
VOID
|
||||
STDCALL
|
||||
RtlCopyLuid (
|
||||
PLUID LuidDest,
|
||||
PLUID LuidSrc
|
||||
)
|
||||
VOID STDCALL
|
||||
RtlCopyLuid(PLUID LuidDest,
|
||||
PLUID LuidSrc)
|
||||
{
|
||||
LuidDest->QuadPart = LuidSrc->QuadPart;
|
||||
LuidDest->QuadPart = LuidSrc->QuadPart;
|
||||
}
|
||||
|
||||
#if 0
|
||||
RtlCopyLuidAndAttributesArray (
|
||||
)
|
||||
{
|
||||
|
||||
VOID STDCALL
|
||||
RtlCopyLuidAndAttributesArray(ULONG Count,
|
||||
PLUID_AND_ATTRIBUTES Src,
|
||||
PLUID_AND_ATTRIBUTES Dest)
|
||||
{
|
||||
ULONG i;
|
||||
|
||||
for (i = 0; i < Count; i++)
|
||||
{
|
||||
RtlCopyMemory(&Dest[i],
|
||||
&Src[i],
|
||||
sizeof(LUID_AND_ATTRIBUTES));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
RtlEqualLuid (
|
||||
PLUID Luid1,
|
||||
PLUID Luid2
|
||||
)
|
||||
|
||||
BOOLEAN STDCALL
|
||||
RtlEqualLuid(PLUID Luid1,
|
||||
PLUID Luid2)
|
||||
{
|
||||
return ((Luid1->QuadPart == Luid2->QuadPart) ? TRUE : FALSE);
|
||||
return((Luid1->QuadPart == Luid2->QuadPart) ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sid.c,v 1.3 2002/06/15 10:10:19 ekohl Exp $
|
||||
/* $Id: sid.c,v 1.4 2002/07/29 15:36:20 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -18,87 +18,143 @@
|
|||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
BOOLEAN STDCALL RtlValidSid (PSID Sid)
|
||||
BOOLEAN STDCALL
|
||||
RtlValidSid(IN PSID Sid)
|
||||
{
|
||||
if ((Sid->Revision & 0xf) != 1)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if (Sid->SubAuthorityCount > 15)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
if ((Sid->Revision & 0xf) != 1)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if (Sid->SubAuthorityCount > 15)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
ULONG STDCALL RtlLengthRequiredSid (UCHAR SubAuthorityCount)
|
||||
|
||||
ULONG STDCALL
|
||||
RtlLengthRequiredSid(IN UCHAR SubAuthorityCount)
|
||||
{
|
||||
return(sizeof(SID) + (SubAuthorityCount - 1) * sizeof(ULONG));
|
||||
return(sizeof(SID) + (SubAuthorityCount - 1) * sizeof(ULONG));
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL RtlInitializeSid (PSID Sid,
|
||||
PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
||||
UCHAR SubAuthorityCount)
|
||||
|
||||
NTSTATUS STDCALL
|
||||
RtlInitializeSid(IN PSID Sid,
|
||||
IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
||||
IN UCHAR SubAuthorityCount)
|
||||
{
|
||||
Sid->Revision = 1;
|
||||
Sid->SubAuthorityCount = SubAuthorityCount;
|
||||
memcpy(&Sid->IdentifierAuthority, IdentifierAuthority,
|
||||
sizeof(SID_IDENTIFIER_AUTHORITY));
|
||||
return(STATUS_SUCCESS);
|
||||
Sid->Revision = 1;
|
||||
Sid->SubAuthorityCount = SubAuthorityCount;
|
||||
memcpy(&Sid->IdentifierAuthority,
|
||||
IdentifierAuthority,
|
||||
sizeof(SID_IDENTIFIER_AUTHORITY));
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
PULONG STDCALL RtlSubAuthoritySid (PSID Sid, ULONG SubAuthority)
|
||||
|
||||
PULONG STDCALL
|
||||
RtlSubAuthoritySid(IN PSID Sid,
|
||||
IN ULONG SubAuthority)
|
||||
{
|
||||
return(&Sid->SubAuthority[SubAuthority]);
|
||||
return(&Sid->SubAuthority[SubAuthority]);
|
||||
}
|
||||
|
||||
PUCHAR STDCALL RtlSubAuthorityCountSid (PSID Sid)
|
||||
|
||||
PUCHAR STDCALL
|
||||
RtlSubAuthorityCountSid(IN PSID Sid)
|
||||
{
|
||||
return(&Sid->SubAuthorityCount);
|
||||
return(&Sid->SubAuthorityCount);
|
||||
}
|
||||
|
||||
BOOLEAN STDCALL RtlEqualSid (PSID Sid1, PSID Sid2)
|
||||
|
||||
BOOLEAN STDCALL
|
||||
RtlEqualSid(IN PSID Sid1,
|
||||
IN PSID Sid2)
|
||||
{
|
||||
if (Sid1->Revision != Sid2->Revision)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if ((*RtlSubAuthorityCountSid(Sid1)) !=
|
||||
(*RtlSubAuthorityCountSid(Sid2)))
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if (Sid1->Revision != Sid2->Revision)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if ((*RtlSubAuthorityCountSid(Sid1)) != (*RtlSubAuthorityCountSid(Sid2)))
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
if (memcmp(Sid1, Sid2, RtlLengthSid(Sid1)) != 0)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
ULONG STDCALL RtlLengthSid (PSID Sid)
|
||||
|
||||
ULONG STDCALL
|
||||
RtlLengthSid(IN PSID Sid)
|
||||
{
|
||||
return(sizeof(SID) + (Sid->SubAuthorityCount-1)*4);
|
||||
return(sizeof(SID) + (Sid->SubAuthorityCount-1)*4);
|
||||
}
|
||||
|
||||
NTSTATUS STDCALL RtlCopySid (ULONG BufferLength, PSID Dest, PSID Src)
|
||||
|
||||
NTSTATUS STDCALL
|
||||
RtlCopySid(ULONG BufferLength,
|
||||
PSID Dest,
|
||||
PSID Src)
|
||||
{
|
||||
if (BufferLength < RtlLengthSid(Src))
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
memmove(Dest, Src, RtlLengthSid(Src));
|
||||
return(STATUS_SUCCESS);
|
||||
if (BufferLength < RtlLengthSid(Src))
|
||||
{
|
||||
return(STATUS_UNSUCCESSFUL);
|
||||
}
|
||||
memmove(Dest,
|
||||
Src,
|
||||
RtlLengthSid(Src));
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
PSID_IDENTIFIER_AUTHORITY
|
||||
STDCALL
|
||||
RtlIdentifierAuthoritySid (
|
||||
PSID Sid
|
||||
)
|
||||
|
||||
NTSTATUS STDCALL
|
||||
RtlCopySidAndAttributesArray(ULONG Count,
|
||||
PSID_AND_ATTRIBUTES Src,
|
||||
ULONG SidAreaSize,
|
||||
PSID_AND_ATTRIBUTES Dest,
|
||||
PVOID SidArea,
|
||||
PVOID* RemainingSidArea,
|
||||
PULONG RemainingSidAreaSize)
|
||||
{
|
||||
return (&Sid->IdentifierAuthority);
|
||||
ULONG SidLength;
|
||||
ULONG Length;
|
||||
ULONG i;
|
||||
|
||||
Length = SidAreaSize;
|
||||
|
||||
for (i=0; i<Count; i++)
|
||||
{
|
||||
if (RtlLengthSid(Src[i].Sid) > Length)
|
||||
{
|
||||
return(STATUS_BUFFER_TOO_SMALL);
|
||||
}
|
||||
SidLength = RtlLengthSid(Src[i].Sid);
|
||||
Length = Length - SidLength;
|
||||
Dest[i].Sid = SidArea;
|
||||
Dest[i].Attributes = Src[i].Attributes;
|
||||
RtlCopySid(SidLength,
|
||||
SidArea,
|
||||
Src[i].Sid);
|
||||
SidArea = SidArea + SidLength;
|
||||
}
|
||||
*RemainingSidArea = SidArea;
|
||||
*RemainingSidAreaSize = Length;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
PSID_IDENTIFIER_AUTHORITY STDCALL
|
||||
RtlIdentifierAuthoritySid(IN PSID Sid)
|
||||
{
|
||||
return(&Sid->IdentifierAuthority);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlAllocateAndInitializeSid (
|
||||
|
@ -162,37 +218,30 @@ RtlAllocateAndInitializeSid (
|
|||
}
|
||||
|
||||
|
||||
PSID
|
||||
STDCALL
|
||||
RtlFreeSid (
|
||||
PSID Sid
|
||||
)
|
||||
PSID STDCALL
|
||||
RtlFreeSid(IN PSID Sid)
|
||||
{
|
||||
RtlFreeHeap (RtlGetProcessHeap (), 0, Sid);
|
||||
return Sid;
|
||||
RtlFreeHeap(RtlGetProcessHeap(),
|
||||
0,
|
||||
Sid);
|
||||
return(Sid);
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
STDCALL
|
||||
RtlEqualPrefixSid (
|
||||
PSID Sid1,
|
||||
PSID Sid2
|
||||
)
|
||||
BOOLEAN STDCALL
|
||||
RtlEqualPrefixSid(IN PSID Sid1,
|
||||
IN PSID Sid2)
|
||||
{
|
||||
return (Sid1->SubAuthorityCount == Sid2->SubAuthorityCount &&
|
||||
!memcmp (Sid1, Sid2,
|
||||
(Sid1->SubAuthorityCount - 1) * sizeof(DWORD) + 8));
|
||||
return(Sid1->SubAuthorityCount == Sid2->SubAuthorityCount &&
|
||||
!memcmp(Sid1, Sid2,
|
||||
(Sid1->SubAuthorityCount - 1) * sizeof(DWORD) + 8));
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
STDCALL
|
||||
RtlConvertSidToUnicodeString (
|
||||
PUNICODE_STRING String,
|
||||
PSID Sid,
|
||||
BOOLEAN AllocateBuffer
|
||||
)
|
||||
NTSTATUS STDCALL
|
||||
RtlConvertSidToUnicodeString(PUNICODE_STRING String,
|
||||
PSID Sid,
|
||||
BOOLEAN AllocateBuffer)
|
||||
{
|
||||
WCHAR Buffer[256];
|
||||
PWSTR wcs;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sid.c,v 1.9 2002/06/15 10:10:43 ekohl Exp $
|
||||
/* $Id: sid.c,v 1.10 2002/07/29 15:34:22 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -513,7 +513,7 @@ RtlSubAuthoritySid(PSID Sid,
|
|||
|
||||
|
||||
PUCHAR STDCALL
|
||||
RtlSubAuthorityCountSid (PSID Sid)
|
||||
RtlSubAuthorityCountSid(PSID Sid)
|
||||
{
|
||||
return(&Sid->SubAuthorityCount);
|
||||
}
|
||||
|
@ -561,6 +561,38 @@ RtlCopySid(ULONG BufferLength,
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
RtlCopySidAndAttributesArray(ULONG Count,
|
||||
PSID_AND_ATTRIBUTES Src,
|
||||
ULONG SidAreaSize,
|
||||
PSID_AND_ATTRIBUTES Dest,
|
||||
PVOID SidArea,
|
||||
PVOID* RemainingSidArea,
|
||||
PULONG RemainingSidAreaSize)
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG i;
|
||||
|
||||
Length = SidAreaSize;
|
||||
|
||||
for (i=0; i<Count; i++)
|
||||
{
|
||||
if (RtlLengthSid(Src[i].Sid) > Length)
|
||||
{
|
||||
return(STATUS_BUFFER_TOO_SMALL);
|
||||
}
|
||||
Length = Length - RtlLengthSid(Src[i].Sid);
|
||||
Dest[i].Sid = SidArea;
|
||||
Dest[i].Attributes = Src[i].Attributes;
|
||||
RtlCopySid(RtlLengthSid(Src[i].Sid), SidArea, Src[i].Sid);
|
||||
SidArea = SidArea + RtlLengthSid(Src[i].Sid);
|
||||
}
|
||||
*RemainingSidArea = SidArea;
|
||||
*RemainingSidAreaSize = Length;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
RtlConvertSidToUnicodeString(PUNICODE_STRING String,
|
||||
PSID Sid,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: token.c,v 1.18 2002/07/04 19:56:36 dwelch Exp $
|
||||
/* $Id: token.c,v 1.19 2002/07/29 15:34:22 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -69,39 +69,6 @@ NTSTATUS SeExchangePrimaryToken(PEPROCESS Process,
|
|||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
RtlCopySidAndAttributesArray(ULONG Count, // ebp + 8
|
||||
PSID_AND_ATTRIBUTES Src, // ebp + C
|
||||
ULONG SidAreaSize, // ebp + 10
|
||||
PSID_AND_ATTRIBUTES Dest, // ebp + 14
|
||||
PVOID SidArea, // ebp + 18
|
||||
PVOID* RemainingSidArea, // ebp + 1C
|
||||
PULONG RemainingSidAreaSize) // ebp + 20
|
||||
{
|
||||
ULONG Length; // ebp - 4
|
||||
ULONG i;
|
||||
|
||||
Length = SidAreaSize;
|
||||
|
||||
for (i=0; i<Count; i++)
|
||||
{
|
||||
if (RtlLengthSid(Src[i].Sid) > Length)
|
||||
{
|
||||
return(STATUS_BUFFER_TOO_SMALL);
|
||||
}
|
||||
Length = Length - RtlLengthSid(Src[i].Sid);
|
||||
Dest[i].Sid = SidArea;
|
||||
Dest[i].Attributes = Src[i].Attributes;
|
||||
RtlCopySid(RtlLengthSid(Src[i].Sid), SidArea, Src[i].Sid);
|
||||
SidArea = SidArea + RtlLengthSid(Src[i].Sid);
|
||||
}
|
||||
*RemainingSidArea = SidArea;
|
||||
*RemainingSidAreaSize = Length;
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
static ULONG
|
||||
RtlLengthSidAndAttributes(ULONG Count,
|
||||
PSID_AND_ATTRIBUTES Src)
|
||||
|
|
Loading…
Reference in a new issue