1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* Security functions
|
|
|
|
*
|
|
|
|
* Copyright 1996-1998 Marcus Meissner
|
2003-11-11 23:03:24 +01:00
|
|
|
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
|
2002-08-09 03:07:29 +02:00
|
|
|
#include "config.h"
|
2002-08-29 01:42:34 +02:00
|
|
|
#include "wine/port.h"
|
2002-08-09 03:07:29 +02:00
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1999-03-09 18:47:51 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <math.h>
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2002-05-09 22:30:52 +02:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2000-09-29 02:31:57 +02:00
|
|
|
#include "wine/exception.h"
|
1999-03-09 18:47:51 +01:00
|
|
|
#include "winnls.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
#include "winreg.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winternl.h"
|
2000-06-02 00:47:13 +02:00
|
|
|
#include "ntdll_misc.h"
|
2002-12-13 00:34:01 +01:00
|
|
|
#include "excpt.h"
|
2003-11-17 21:31:29 +01:00
|
|
|
#include "wine/library.h"
|
|
|
|
#include "wine/debug.h"
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
#define NT_SUCCESS(status) (status == STATUS_SUCCESS)
|
|
|
|
|
2000-09-29 02:31:57 +02:00
|
|
|
/* filter for page-fault exceptions */
|
|
|
|
static WINE_EXCEPTION_FILTER(page_fault)
|
|
|
|
{
|
|
|
|
if (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION)
|
|
|
|
return EXCEPTION_EXECUTE_HANDLER;
|
|
|
|
return EXCEPTION_CONTINUE_SEARCH;
|
|
|
|
}
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* SID FUNCTIONS
|
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlAllocateAndInitializeSid [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
BOOLEAN WINAPI RtlAllocateAndInitializeSid (
|
|
|
|
PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
|
|
|
|
BYTE nSubAuthorityCount,
|
|
|
|
DWORD nSubAuthority0, DWORD nSubAuthority1,
|
|
|
|
DWORD nSubAuthority2, DWORD nSubAuthority3,
|
|
|
|
DWORD nSubAuthority4, DWORD nSubAuthority5,
|
|
|
|
DWORD nSubAuthority6, DWORD nSubAuthority7,
|
|
|
|
PSID *pSid )
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
TRACE("(%p, 0x%04x,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p)\n",
|
|
|
|
pIdentifierAuthority,nSubAuthorityCount,
|
|
|
|
nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3,
|
|
|
|
nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, pSid);
|
|
|
|
|
2004-03-12 02:59:35 +01:00
|
|
|
if (!(*pSid = RtlAllocateHeap( GetProcessHeap(), 0,
|
2003-03-15 00:16:46 +01:00
|
|
|
RtlLengthRequiredSid(nSubAuthorityCount))))
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
(*pSid)->Revision = SID_REVISION;
|
|
|
|
|
|
|
|
if (pIdentifierAuthority)
|
|
|
|
memcpy(&(*pSid)->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthorityCountSid(*pSid) = nSubAuthorityCount;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
if (nSubAuthorityCount > 0)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 0) = nSubAuthority0;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
if (nSubAuthorityCount > 1)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 1) = nSubAuthority1;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
if (nSubAuthorityCount > 2)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 2) = nSubAuthority2;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
if (nSubAuthorityCount > 3)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 3) = nSubAuthority3;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
if (nSubAuthorityCount > 4)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 4) = nSubAuthority4;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
if (nSubAuthorityCount > 5)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 5) = nSubAuthority5;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
if (nSubAuthorityCount > 6)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 6) = nSubAuthority6;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
if (nSubAuthorityCount > 7)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(*pSid, 7) = nSubAuthority7;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlEqualSid [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Determine if two SIDs are equal.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid1 [I] Source SID
|
|
|
|
* pSid2 [I] SID to compare with
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE, if pSid1 is equal to pSid2,
|
|
|
|
* FALSE otherwise.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
BOOL WINAPI RtlEqualSid( PSID pSid1, PSID pSid2 )
|
|
|
|
{
|
|
|
|
if (!RtlValidSid(pSid1) || !RtlValidSid(pSid2))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (*RtlSubAuthorityCountSid(pSid1) != *RtlSubAuthorityCountSid(pSid2))
|
|
|
|
return FALSE;
|
|
|
|
|
2000-07-25 17:10:52 +02:00
|
|
|
if (memcmp(pSid1, pSid2, RtlLengthSid(pSid1)) != 0)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-07-02 21:59:40 +02:00
|
|
|
* RtlEqualPrefixSid [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI RtlEqualPrefixSid (PSID pSid1, PSID pSid2)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
|
|
|
if (!RtlValidSid(pSid1) || !RtlValidSid(pSid2))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (*RtlSubAuthorityCountSid(pSid1) != *RtlSubAuthorityCountSid(pSid2))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (memcmp(pSid1, pSid2, RtlLengthRequiredSid(pSid1->SubAuthorityCount - 1)) != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlFreeSid [NTDLL.@]
|
2003-03-17 22:21:00 +01:00
|
|
|
*
|
|
|
|
* Free the resources used by a SID.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid [I] SID to Free.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* STATUS_SUCCESS.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
DWORD WINAPI RtlFreeSid(PSID pSid)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
TRACE("(%p)\n", pSid);
|
2004-03-12 02:59:35 +01:00
|
|
|
RtlFreeHeap( GetProcessHeap(), 0, pSid );
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return STATUS_SUCCESS;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlLengthRequiredSid [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Determine the amount of memory a SID will use
|
|
|
|
*
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
* PARAMS
|
2003-03-17 22:21:00 +01:00
|
|
|
* nrofsubauths [I] Number of Sub Authorities in the SID.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* The size, in bytes, of a SID with nrofsubauths Sub Authorities.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
DWORD WINAPI RtlLengthRequiredSid(DWORD nrofsubauths)
|
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return (nrofsubauths-1)*sizeof(DWORD) + sizeof(SID);
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlLengthSid [NTDLL.@]
|
2003-03-17 22:21:00 +01:00
|
|
|
*
|
|
|
|
* Determine the amount of memory a SID is using
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid [I] SID to ge the size of.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* The size, in bytes, of pSid.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
DWORD WINAPI RtlLengthSid(PSID pSid)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
TRACE("sid=%p\n",pSid);
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!pSid) return 0;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return RtlLengthRequiredSid(*RtlSubAuthorityCountSid(pSid));
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlInitializeSid [NTDLL.@]
|
2003-03-17 22:21:00 +01:00
|
|
|
*
|
|
|
|
* Initialise a SID.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* pSid [I] SID to initialise
|
|
|
|
* pIdentifierAuthority [I] Identifier Authority
|
|
|
|
* nSubAuthorityCount [I] Number of Sub Authorities
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: TRUE. pSid is initialised withe the details given.
|
|
|
|
* Failure: FALSE, if nSubAuthorityCount is >= SID_MAX_SUB_AUTHORITIES.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
BOOL WINAPI RtlInitializeSid(
|
|
|
|
PSID pSid,
|
|
|
|
PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
|
|
|
|
BYTE nSubAuthorityCount)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
int i;
|
|
|
|
if (nSubAuthorityCount >= SID_MAX_SUB_AUTHORITIES)
|
|
|
|
return FALSE;
|
1999-03-09 18:47:51 +01:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
pSid->Revision = SID_REVISION;
|
|
|
|
pSid->SubAuthorityCount = nSubAuthorityCount;
|
|
|
|
if (pIdentifierAuthority)
|
|
|
|
memcpy(&pSid->IdentifierAuthority, pIdentifierAuthority, sizeof (SID_IDENTIFIER_AUTHORITY));
|
|
|
|
|
|
|
|
for (i = 0; i < nSubAuthorityCount; i++)
|
2000-07-25 17:10:52 +02:00
|
|
|
*RtlSubAuthoritySid(pSid, i) = 0;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
return TRUE;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlSubAuthoritySid [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Return the Sub Authority of a SID
|
|
|
|
*
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
* PARAMS
|
2003-03-17 22:21:00 +01:00
|
|
|
* pSid [I] SID to get the Sub Authority from.
|
|
|
|
* nSubAuthority [I] Sub Authority number.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* A pointer to The Sub Authority value of pSid.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
LPDWORD WINAPI RtlSubAuthoritySid( PSID pSid, DWORD nSubAuthority )
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return &(pSid->SubAuthority[nSubAuthority]);
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlIdentifierAuthoritySid [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Return the Identifier Authority of a SID.
|
|
|
|
*
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
* PARAMS
|
2003-03-17 22:21:00 +01:00
|
|
|
* pSid [I] SID to get the Identifier Authority from.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* A pointer to the Identifier Authority value of pSid.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
PSID_IDENTIFIER_AUTHORITY WINAPI RtlIdentifierAuthoritySid( PSID pSid )
|
|
|
|
{
|
|
|
|
return &(pSid->IdentifierAuthority);
|
|
|
|
}
|
1999-03-09 18:47:51 +01:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlSubAuthorityCountSid [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Get the number of Sub Authorities in a SID.
|
|
|
|
*
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
* PARAMS
|
2003-03-17 22:21:00 +01:00
|
|
|
* pSid [I] SID to get the count from.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* A pointer to the Sub Authority count of pSid.
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
|
|
|
LPBYTE WINAPI RtlSubAuthorityCountSid(PSID pSid)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return &(pSid->SubAuthorityCount);
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlCopySid [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
DWORD WINAPI RtlCopySid( DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid )
|
|
|
|
{
|
|
|
|
if (!pSourceSid || !RtlValidSid(pSourceSid) ||
|
|
|
|
(nDestinationSidLength < RtlLengthSid(pSourceSid)))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (nDestinationSidLength < (pSourceSid->SubAuthorityCount*4+8))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
memmove(pDestinationSid, pSourceSid, pSourceSid->SubAuthorityCount*4+8);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlValidSid [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Determine if a SID is valid.
|
|
|
|
*
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
* PARAMS
|
2003-03-17 22:21:00 +01:00
|
|
|
* pSid [I] SID to check
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE if pSid is valid,
|
|
|
|
* FALSE otherwise.
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
2003-05-01 02:29:26 +02:00
|
|
|
BOOLEAN WINAPI RtlValidSid( PSID pSid )
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
2000-09-29 02:31:57 +02:00
|
|
|
BOOL ret;
|
|
|
|
__TRY
|
|
|
|
{
|
|
|
|
ret = TRUE;
|
|
|
|
if (!pSid || pSid->Revision != SID_REVISION ||
|
|
|
|
pSid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES)
|
|
|
|
{
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__EXCEPT(page_fault)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
|
|
|
WARN("(%p): invalid pointer!\n", pSid);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2000-09-29 02:31:57 +02:00
|
|
|
__ENDTRY
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* security descriptor functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlCreateSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Initialise a SECURITY_DESCRIPTOR.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* lpsd [O] Descriptor to initialise.
|
|
|
|
* rev [I] Revision, must be set to SECURITY_DESCRIPTOR_REVISION.
|
|
|
|
*
|
1999-03-09 18:47:51 +01:00
|
|
|
* RETURNS:
|
2003-03-17 22:21:00 +01:00
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: STATUS_UNKNOWN_REVISION if rev is incorrect.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlCreateSecurityDescriptor(
|
|
|
|
PSECURITY_DESCRIPTOR lpsd,
|
|
|
|
DWORD rev)
|
|
|
|
{
|
|
|
|
if (rev!=SECURITY_DESCRIPTOR_REVISION)
|
|
|
|
return STATUS_UNKNOWN_REVISION;
|
|
|
|
memset(lpsd,'\0',sizeof(*lpsd));
|
|
|
|
lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlValidSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
2003-03-17 22:21:00 +01:00
|
|
|
* Determine if a SECURITY_DESCRIPTOR is valid.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* SecurityDescriptor [I] Descriptor to check.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: STATUS_SUCCESS.
|
|
|
|
* Failure: STATUS_INVALID_SECURITY_DESCR or STATUS_UNKNOWN_REVISION.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlValidSecurityDescriptor(
|
|
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
|
|
|
{
|
|
|
|
if ( ! SecurityDescriptor )
|
|
|
|
return STATUS_INVALID_SECURITY_DESCR;
|
|
|
|
if ( SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION )
|
|
|
|
return STATUS_UNKNOWN_REVISION;
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlLengthSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
ULONG WINAPI RtlLengthSecurityDescriptor(
|
|
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
|
|
|
{
|
2003-11-05 02:41:20 +01:00
|
|
|
ULONG offset = 0;
|
|
|
|
ULONG Size = SECURITY_DESCRIPTOR_MIN_LENGTH;
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
if ( SecurityDescriptor == NULL )
|
|
|
|
return 0;
|
|
|
|
|
2003-11-05 02:41:20 +01:00
|
|
|
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
|
|
|
offset = (ULONG) SecurityDescriptor;
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
if ( SecurityDescriptor->Owner != NULL )
|
2003-11-05 02:41:20 +01:00
|
|
|
Size += RtlLengthSid((PSID)((LPBYTE)SecurityDescriptor->Owner + offset));
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2003-11-05 02:41:20 +01:00
|
|
|
if ( SecurityDescriptor->Group != NULL )
|
|
|
|
Size += RtlLengthSid((PSID)((LPBYTE)SecurityDescriptor->Group + offset));
|
1999-03-09 18:47:51 +01:00
|
|
|
|
|
|
|
if ( SecurityDescriptor->Sacl != NULL )
|
2003-11-05 02:41:20 +01:00
|
|
|
Size += ((PACL)((LPBYTE)SecurityDescriptor->Sacl + offset))->AclSize;
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
if ( SecurityDescriptor->Dacl != NULL )
|
2003-11-05 02:41:20 +01:00
|
|
|
Size += ((PACL)((LPBYTE)SecurityDescriptor->Dacl + offset))->AclSize;
|
1999-03-09 18:47:51 +01:00
|
|
|
|
|
|
|
return Size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlGetDaclSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlGetDaclSecurityDescriptor(
|
|
|
|
IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
OUT PBOOLEAN lpbDaclPresent,
|
|
|
|
OUT PACL *pDacl,
|
|
|
|
OUT PBOOLEAN lpbDaclDefaulted)
|
|
|
|
{
|
1999-05-23 12:25:25 +02:00
|
|
|
TRACE("(%p,%p,%p,%p)\n",
|
1999-03-09 18:47:51 +01:00
|
|
|
pSecurityDescriptor, lpbDaclPresent, *pDacl, lpbDaclDefaulted);
|
|
|
|
|
|
|
|
if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
|
|
|
|
return STATUS_UNKNOWN_REVISION ;
|
|
|
|
|
|
|
|
if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
|
|
|
|
{
|
|
|
|
if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
|
|
|
|
{ *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ *pDacl = pSecurityDescriptor->Dacl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlSetDaclSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
|
|
|
|
PSECURITY_DESCRIPTOR lpsd,
|
|
|
|
BOOLEAN daclpresent,
|
|
|
|
PACL dacl,
|
|
|
|
BOOLEAN dacldefaulted )
|
|
|
|
{
|
|
|
|
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|
|
|
return STATUS_UNKNOWN_REVISION;
|
|
|
|
if (lpsd->Control & SE_SELF_RELATIVE)
|
|
|
|
return STATUS_INVALID_SECURITY_DESCR;
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
if (!daclpresent)
|
1999-03-09 18:47:51 +01:00
|
|
|
{ lpsd->Control &= ~SE_DACL_PRESENT;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
lpsd->Control |= SE_DACL_PRESENT;
|
|
|
|
lpsd->Dacl = dacl;
|
|
|
|
|
|
|
|
if (dacldefaulted)
|
|
|
|
lpsd->Control |= SE_DACL_DEFAULTED;
|
|
|
|
else
|
|
|
|
lpsd->Control &= ~SE_DACL_DEFAULTED;
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlGetSaclSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlGetSaclSecurityDescriptor(
|
|
|
|
IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
OUT PBOOLEAN lpbSaclPresent,
|
|
|
|
OUT PACL *pSacl,
|
|
|
|
OUT PBOOLEAN lpbSaclDefaulted)
|
|
|
|
{
|
1999-05-23 12:25:25 +02:00
|
|
|
TRACE("(%p,%p,%p,%p)\n",
|
1999-03-09 18:47:51 +01:00
|
|
|
pSecurityDescriptor, lpbSaclPresent, *pSacl, lpbSaclDefaulted);
|
|
|
|
|
|
|
|
if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
|
|
|
|
return STATUS_UNKNOWN_REVISION ;
|
|
|
|
|
|
|
|
if ( (*lpbSaclPresent = (SE_SACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
|
|
|
|
{
|
|
|
|
if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
|
|
|
|
{ *pSacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Sacl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ *pSacl = pSecurityDescriptor->Sacl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
*lpbSaclDefaulted = (( SE_SACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlSetSaclSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlSetSaclSecurityDescriptor (
|
|
|
|
PSECURITY_DESCRIPTOR lpsd,
|
|
|
|
BOOLEAN saclpresent,
|
|
|
|
PACL sacl,
|
|
|
|
BOOLEAN sacldefaulted)
|
|
|
|
{
|
|
|
|
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|
|
|
return STATUS_UNKNOWN_REVISION;
|
|
|
|
if (lpsd->Control & SE_SELF_RELATIVE)
|
|
|
|
return STATUS_INVALID_SECURITY_DESCR;
|
|
|
|
if (!saclpresent) {
|
|
|
|
lpsd->Control &= ~SE_SACL_PRESENT;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
lpsd->Control |= SE_SACL_PRESENT;
|
|
|
|
lpsd->Sacl = sacl;
|
|
|
|
if (sacldefaulted)
|
|
|
|
lpsd->Control |= SE_SACL_DEFAULTED;
|
|
|
|
else
|
|
|
|
lpsd->Control &= ~SE_SACL_DEFAULTED;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlGetOwnerSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
|
|
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
PSID *Owner,
|
|
|
|
PBOOLEAN OwnerDefaulted)
|
|
|
|
{
|
|
|
|
if ( !SecurityDescriptor || !Owner || !OwnerDefaulted )
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
2003-11-05 02:41:20 +01:00
|
|
|
if (SecurityDescriptor->Owner != NULL)
|
|
|
|
{
|
|
|
|
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
|
|
|
*Owner = (PSID)((LPBYTE)SecurityDescriptor +
|
|
|
|
(ULONG)SecurityDescriptor->Owner);
|
|
|
|
else
|
|
|
|
*Owner = SecurityDescriptor->Owner;
|
|
|
|
|
|
|
|
if ( SecurityDescriptor->Control & SE_OWNER_DEFAULTED )
|
|
|
|
*OwnerDefaulted = TRUE;
|
|
|
|
else
|
|
|
|
*OwnerDefaulted = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*Owner = NULL;
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlSetOwnerSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
|
|
|
|
PSECURITY_DESCRIPTOR lpsd,
|
|
|
|
PSID owner,
|
|
|
|
BOOLEAN ownerdefaulted)
|
|
|
|
{
|
|
|
|
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|
|
|
return STATUS_UNKNOWN_REVISION;
|
|
|
|
if (lpsd->Control & SE_SELF_RELATIVE)
|
|
|
|
return STATUS_INVALID_SECURITY_DESCR;
|
|
|
|
|
|
|
|
lpsd->Owner = owner;
|
|
|
|
if (ownerdefaulted)
|
|
|
|
lpsd->Control |= SE_OWNER_DEFAULTED;
|
|
|
|
else
|
|
|
|
lpsd->Control &= ~SE_OWNER_DEFAULTED;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlSetGroupSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
|
|
|
|
PSECURITY_DESCRIPTOR lpsd,
|
|
|
|
PSID group,
|
|
|
|
BOOLEAN groupdefaulted)
|
|
|
|
{
|
|
|
|
if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
|
|
|
|
return STATUS_UNKNOWN_REVISION;
|
|
|
|
if (lpsd->Control & SE_SELF_RELATIVE)
|
|
|
|
return STATUS_INVALID_SECURITY_DESCR;
|
|
|
|
|
|
|
|
lpsd->Group = group;
|
|
|
|
if (groupdefaulted)
|
|
|
|
lpsd->Control |= SE_GROUP_DEFAULTED;
|
|
|
|
else
|
|
|
|
lpsd->Control &= ~SE_GROUP_DEFAULTED;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
/**************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlGetGroupSecurityDescriptor [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
|
|
|
|
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
PSID *Group,
|
|
|
|
PBOOLEAN GroupDefaulted)
|
|
|
|
{
|
|
|
|
if ( !SecurityDescriptor || !Group || !GroupDefaulted )
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
2003-11-05 02:41:20 +01:00
|
|
|
if (SecurityDescriptor->Group != NULL)
|
|
|
|
{
|
|
|
|
if (SecurityDescriptor->Control & SE_SELF_RELATIVE)
|
|
|
|
*Group = (PSID)((LPBYTE)SecurityDescriptor +
|
|
|
|
(ULONG)SecurityDescriptor->Group);
|
|
|
|
else
|
|
|
|
*Group = SecurityDescriptor->Group;
|
|
|
|
|
|
|
|
if ( SecurityDescriptor->Control & SE_GROUP_DEFAULTED )
|
|
|
|
*GroupDefaulted = TRUE;
|
|
|
|
else
|
|
|
|
*GroupDefaulted = FALSE;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
2003-11-05 02:41:20 +01:00
|
|
|
else
|
|
|
|
*Group = NULL;
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
return STATUS_SUCCESS;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
1999-03-09 18:47:51 +01:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/**************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlMakeSelfRelativeSD [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlMakeSelfRelativeSD(
|
|
|
|
IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
|
|
|
|
IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
|
|
|
|
IN OUT LPDWORD lpdwBufferLength)
|
|
|
|
{
|
2003-11-05 02:41:20 +01:00
|
|
|
ULONG offsetRel;
|
|
|
|
ULONG length;
|
|
|
|
PSECURITY_DESCRIPTOR pAbs = pAbsoluteSecurityDescriptor;
|
|
|
|
PSECURITY_DESCRIPTOR pRel = pSelfRelativeSecurityDescriptor;
|
|
|
|
|
|
|
|
TRACE(" %p %p %p(%ld)\n", pAbs, pRel, lpdwBufferLength,
|
|
|
|
lpdwBufferLength ? *lpdwBufferLength: -1);
|
|
|
|
|
|
|
|
if (!lpdwBufferLength || !pAbs)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
length = RtlLengthSecurityDescriptor(pAbs);
|
|
|
|
if (*lpdwBufferLength < length)
|
|
|
|
{
|
|
|
|
*lpdwBufferLength = length;
|
|
|
|
return STATUS_BUFFER_TOO_SMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pRel)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
if (pAbs->Control & SE_SELF_RELATIVE)
|
|
|
|
{
|
|
|
|
memcpy(pRel, pAbs, length);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
pRel->Revision = pAbs->Revision;
|
|
|
|
pRel->Sbz1 = pAbs->Sbz1;
|
|
|
|
pRel->Control = pAbs->Control | SE_SELF_RELATIVE;
|
|
|
|
|
|
|
|
offsetRel = sizeof(SECURITY_DESCRIPTOR);
|
|
|
|
pRel->Owner = (PSID) offsetRel;
|
|
|
|
length = RtlLengthSid(pAbs->Owner);
|
|
|
|
memcpy((LPBYTE)pRel + offsetRel, pAbs->Owner, length);
|
|
|
|
|
|
|
|
offsetRel += length;
|
|
|
|
pRel->Group = (PSID) offsetRel;
|
|
|
|
length = RtlLengthSid(pAbs->Group);
|
|
|
|
memcpy((LPBYTE)pRel + offsetRel, pAbs->Group, length);
|
|
|
|
|
|
|
|
if (pRel->Control & SE_SACL_PRESENT)
|
|
|
|
{
|
|
|
|
offsetRel += length;
|
|
|
|
pRel->Sacl = (PACL) offsetRel;
|
|
|
|
length = pAbs->Sacl->AclSize;
|
|
|
|
memcpy((LPBYTE)pRel + offsetRel, pAbs->Sacl, length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pRel->Sacl = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Control & SE_DACL_PRESENT)
|
|
|
|
{
|
|
|
|
offsetRel += length;
|
|
|
|
pRel->Dacl = (PACL) offsetRel;
|
|
|
|
length = pAbs->Dacl->AclSize;
|
|
|
|
memcpy((LPBYTE)pRel + offsetRel, pAbs->Dacl, length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pRel->Dacl = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
+ * RtlSelfRelativeToAbsoluteSD [NTDLL.@]
|
|
|
|
+ */
|
|
|
|
NTSTATUS WINAPI RtlSelfRelativeToAbsoluteSD(
|
|
|
|
IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor,
|
|
|
|
OUT PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor,
|
|
|
|
OUT LPDWORD lpdwAbsoluteSecurityDescriptorSize,
|
|
|
|
OUT PACL pDacl,
|
|
|
|
OUT LPDWORD lpdwDaclSize,
|
|
|
|
OUT PACL pSacl,
|
|
|
|
OUT LPDWORD lpdwSaclSize,
|
|
|
|
OUT PSID pOwner,
|
|
|
|
OUT LPDWORD lpdwOwnerSize,
|
|
|
|
OUT PSID pPrimaryGroup,
|
|
|
|
OUT LPDWORD lpdwPrimaryGroupSize)
|
|
|
|
{
|
|
|
|
NTSTATUS status = STATUS_SUCCESS;
|
|
|
|
PSECURITY_DESCRIPTOR pAbs = pAbsoluteSecurityDescriptor;
|
|
|
|
PSECURITY_DESCRIPTOR pRel = pSelfRelativeSecurityDescriptor;
|
|
|
|
|
|
|
|
if (!pRel ||
|
|
|
|
!lpdwAbsoluteSecurityDescriptorSize ||
|
|
|
|
!lpdwDaclSize ||
|
|
|
|
!lpdwSaclSize ||
|
|
|
|
!lpdwOwnerSize ||
|
|
|
|
!lpdwPrimaryGroupSize ||
|
|
|
|
~pRel->Control & SE_SELF_RELATIVE)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
/* Confirm buffers are sufficiently large */
|
|
|
|
if (*lpdwAbsoluteSecurityDescriptorSize < sizeof(SECURITY_DESCRIPTOR))
|
|
|
|
{
|
|
|
|
*lpdwAbsoluteSecurityDescriptorSize = sizeof(SECURITY_DESCRIPTOR);
|
|
|
|
status = STATUS_BUFFER_TOO_SMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Control & SE_DACL_PRESENT &&
|
|
|
|
*lpdwDaclSize < ((PACL)((LPBYTE)pRel->Dacl + (ULONG)pRel))->AclSize)
|
|
|
|
{
|
|
|
|
*lpdwDaclSize = ((PACL)((LPBYTE)pRel->Dacl + (ULONG)pRel))->AclSize;
|
|
|
|
status = STATUS_BUFFER_TOO_SMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Control & SE_SACL_PRESENT &&
|
|
|
|
*lpdwSaclSize < ((PACL)((LPBYTE)pRel->Sacl + (ULONG)pRel))->AclSize)
|
|
|
|
{
|
|
|
|
*lpdwSaclSize = ((PACL)((LPBYTE)pRel->Sacl + (ULONG)pRel))->AclSize;
|
|
|
|
status = STATUS_BUFFER_TOO_SMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Owner &&
|
|
|
|
*lpdwOwnerSize < RtlLengthSid((PSID)((LPBYTE)pRel->Owner + (ULONG)pRel)))
|
|
|
|
{
|
|
|
|
*lpdwOwnerSize = RtlLengthSid((PSID)((LPBYTE)pRel->Owner + (ULONG)pRel));
|
|
|
|
status = STATUS_BUFFER_TOO_SMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Group &&
|
|
|
|
*lpdwPrimaryGroupSize < RtlLengthSid((PSID)((LPBYTE)pRel->Group + (ULONG)pRel)))
|
|
|
|
{
|
|
|
|
*lpdwPrimaryGroupSize = RtlLengthSid((PSID)((LPBYTE)pRel->Group + (ULONG)pRel));
|
|
|
|
status = STATUS_BUFFER_TOO_SMALL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (status != STATUS_SUCCESS)
|
|
|
|
return status;
|
|
|
|
|
|
|
|
/* Copy structures */
|
|
|
|
pAbs->Revision = pRel->Revision;
|
|
|
|
pAbs->Control = pRel->Control & ~SE_SELF_RELATIVE;
|
|
|
|
|
|
|
|
if (pRel->Control & SE_SACL_PRESENT)
|
|
|
|
{
|
|
|
|
PACL pAcl = (PACL)((LPBYTE)pRel->Sacl + (ULONG)pRel);
|
|
|
|
|
|
|
|
memcpy(pSacl, pAcl, pAcl->AclSize);
|
|
|
|
pAbs->Sacl = pSacl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Control & SE_DACL_PRESENT)
|
|
|
|
{
|
|
|
|
PACL pAcl = (PACL)((LPBYTE)pRel->Dacl + (ULONG)pRel);
|
|
|
|
memcpy(pDacl, pAcl, pAcl->AclSize);
|
|
|
|
pAbs->Dacl = pDacl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Owner)
|
|
|
|
{
|
|
|
|
PSID psid = (PSID)((LPBYTE)pRel->Owner + (ULONG)pRel);
|
|
|
|
memcpy(pOwner, psid, RtlLengthSid(psid));
|
|
|
|
pAbs->Owner = pOwner;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pRel->Group)
|
|
|
|
{
|
|
|
|
PSID psid = (PSID)((LPBYTE)pRel->Group + (ULONG)pRel);
|
|
|
|
memcpy(pPrimaryGroup, psid, RtlLengthSid(psid));
|
|
|
|
pAbs->Group = pPrimaryGroup;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
}
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* access control list's
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlCreateAcl [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* This should return NTSTATUS
|
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
NTSTATUS WINAPI RtlCreateAcl(PACL acl,DWORD size,DWORD rev)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
TRACE("%p 0x%08lx 0x%08lx\n", acl, size, rev);
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
if (rev!=ACL_REVISION)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
if (size<sizeof(ACL))
|
|
|
|
return STATUS_BUFFER_TOO_SMALL;
|
|
|
|
if (size>0xFFFF)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
memset(acl,'\0',sizeof(ACL));
|
|
|
|
acl->AclRevision = rev;
|
|
|
|
acl->AclSize = size;
|
|
|
|
acl->AceCount = 0;
|
2003-03-17 22:21:00 +01:00
|
|
|
return STATUS_SUCCESS;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlFirstFreeAce [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
* looks for the AceCount+1 ACE, and if it is still within the alloced
|
|
|
|
* ACL, return a pointer to it
|
|
|
|
*/
|
|
|
|
BOOLEAN WINAPI RtlFirstFreeAce(
|
|
|
|
PACL acl,
|
|
|
|
PACE_HEADER *x)
|
|
|
|
{
|
|
|
|
PACE_HEADER ace;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
*x = 0;
|
|
|
|
ace = (PACE_HEADER)(acl+1);
|
|
|
|
for (i=0;i<acl->AceCount;i++) {
|
|
|
|
if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
|
|
|
|
return 0;
|
|
|
|
ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
|
|
|
|
}
|
|
|
|
if ((DWORD)ace>=(((DWORD)acl)+acl->AclSize))
|
|
|
|
return 0;
|
|
|
|
*x = ace;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlAddAce [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlAddAce(
|
|
|
|
PACL acl,
|
|
|
|
DWORD rev,
|
|
|
|
DWORD xnrofaces,
|
|
|
|
PACE_HEADER acestart,
|
|
|
|
DWORD acelen)
|
|
|
|
{
|
|
|
|
PACE_HEADER ace,targetace;
|
|
|
|
int nrofaces;
|
|
|
|
|
|
|
|
if (acl->AclRevision != ACL_REVISION)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
if (!RtlFirstFreeAce(acl,&targetace))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
nrofaces=0;ace=acestart;
|
|
|
|
while (((DWORD)ace-(DWORD)acestart)<acelen) {
|
|
|
|
nrofaces++;
|
|
|
|
ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
|
|
|
|
}
|
|
|
|
if ((DWORD)targetace+acelen>(DWORD)acl+acl->AclSize) /* too much aces */
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
memcpy((LPBYTE)targetace,acestart,acelen);
|
|
|
|
acl->AceCount+=nrofaces;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2003-11-11 23:03:24 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* RtlDeleteAce [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlDeleteAce(PACL pAcl, DWORD dwAceIndex)
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
PACE_HEADER pAce;
|
|
|
|
|
|
|
|
status = RtlGetAce(pAcl,dwAceIndex,(LPVOID*)&pAce);
|
|
|
|
|
|
|
|
if (STATUS_SUCCESS == status)
|
|
|
|
{
|
|
|
|
PACE_HEADER pcAce;
|
|
|
|
DWORD len = 0;
|
|
|
|
|
|
|
|
pcAce = (PACE_HEADER)(((BYTE*)pAce)+pAce->AceSize);
|
|
|
|
for (; dwAceIndex < pAcl->AceCount; dwAceIndex++)
|
|
|
|
{
|
|
|
|
len += pcAce->AceSize;
|
|
|
|
pcAce = (PACE_HEADER)(((BYTE*)pcAce) + pcAce->AceSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(pAce, ((BYTE*)pAce)+pAce->AceSize, len);
|
|
|
|
pAcl->AceCount--;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlAddAccessAllowedAce [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2003-05-01 02:29:26 +02:00
|
|
|
NTSTATUS WINAPI RtlAddAccessAllowedAce(
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
2003-06-16 21:44:06 +02:00
|
|
|
{
|
|
|
|
return RtlAddAccessAllowedAceEx( pAcl, dwAceRevision, 0, AccessMask, pSid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* RtlAddAccessAllowedAceEx [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlAddAccessAllowedAceEx(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AceFlags,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2003-05-01 02:29:26 +02:00
|
|
|
DWORD dwLengthSid;
|
|
|
|
ACCESS_ALLOWED_ACE * pAaAce;
|
|
|
|
DWORD dwSpaceLeft;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08lx,0x%08lx,%p)\n",
|
|
|
|
pAcl, dwAceRevision, AccessMask, pSid);
|
|
|
|
|
|
|
|
if (!RtlValidSid(pSid))
|
|
|
|
return STATUS_INVALID_SID;
|
|
|
|
if (!RtlValidAcl(pAcl))
|
|
|
|
return STATUS_INVALID_ACL;
|
|
|
|
|
|
|
|
dwLengthSid = RtlLengthSid(pSid);
|
|
|
|
if (!RtlFirstFreeAce(pAcl, (PACE_HEADER *) &pAaAce))
|
|
|
|
return STATUS_INVALID_ACL;
|
|
|
|
|
|
|
|
if (!pAaAce)
|
|
|
|
return STATUS_ALLOTTED_SPACE_EXCEEDED;
|
|
|
|
|
|
|
|
dwSpaceLeft = (DWORD)pAcl + pAcl->AclSize - (DWORD)pAaAce;
|
|
|
|
if (dwSpaceLeft < sizeof(*pAaAce) - sizeof(pAaAce->SidStart) + dwLengthSid)
|
|
|
|
return STATUS_ALLOTTED_SPACE_EXCEEDED;
|
|
|
|
|
|
|
|
pAaAce->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
|
2003-06-16 21:44:06 +02:00
|
|
|
pAaAce->Header.AceFlags = AceFlags;
|
2003-05-01 02:29:26 +02:00
|
|
|
pAaAce->Header.AceSize = sizeof(*pAaAce) - sizeof(pAaAce->SidStart) + dwLengthSid;
|
|
|
|
pAaAce->Mask = AccessMask;
|
|
|
|
pAcl->AceCount++;
|
|
|
|
RtlCopySid(dwLengthSid, (PSID)&pAaAce->SidStart, pSid);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* RtlAddAccessDeniedAce [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlAddAccessDeniedAce(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
2003-06-16 21:44:06 +02:00
|
|
|
{
|
|
|
|
return RtlAddAccessDeniedAceEx( pAcl, dwAceRevision, 0, AccessMask, pSid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* RtlAddAccessDeniedAceEx [NTDLL.@]
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlAddAccessDeniedAceEx(
|
|
|
|
IN OUT PACL pAcl,
|
|
|
|
IN DWORD dwAceRevision,
|
|
|
|
IN DWORD AceFlags,
|
|
|
|
IN DWORD AccessMask,
|
|
|
|
IN PSID pSid)
|
2003-05-01 02:29:26 +02:00
|
|
|
{
|
|
|
|
DWORD dwLengthSid;
|
|
|
|
DWORD dwSpaceLeft;
|
|
|
|
ACCESS_DENIED_ACE * pAdAce;
|
|
|
|
|
|
|
|
TRACE("(%p,0x%08lx,0x%08lx,%p)\n",
|
|
|
|
pAcl, dwAceRevision, AccessMask, pSid);
|
|
|
|
|
|
|
|
if (!RtlValidSid(pSid))
|
|
|
|
return STATUS_INVALID_SID;
|
|
|
|
if (!RtlValidAcl(pAcl))
|
|
|
|
return STATUS_INVALID_ACL;
|
|
|
|
|
|
|
|
dwLengthSid = RtlLengthSid(pSid);
|
|
|
|
if (!RtlFirstFreeAce(pAcl, (PACE_HEADER *) &pAdAce))
|
|
|
|
return STATUS_INVALID_ACL;
|
|
|
|
|
|
|
|
if (!pAdAce)
|
|
|
|
return STATUS_ALLOTTED_SPACE_EXCEEDED;
|
|
|
|
|
|
|
|
dwSpaceLeft = (DWORD)pAcl + pAcl->AclSize - (DWORD)pAdAce;
|
|
|
|
if (dwSpaceLeft < sizeof(*pAdAce) - sizeof(pAdAce->SidStart) + dwLengthSid)
|
|
|
|
return STATUS_ALLOTTED_SPACE_EXCEEDED;
|
|
|
|
|
|
|
|
pAdAce->Header.AceType = ACCESS_DENIED_ACE_TYPE;
|
2003-06-16 21:44:06 +02:00
|
|
|
pAdAce->Header.AceFlags = AceFlags;
|
2003-05-01 02:29:26 +02:00
|
|
|
pAdAce->Header.AceSize = sizeof(*pAdAce) - sizeof(pAdAce->SidStart) + dwLengthSid;
|
|
|
|
pAdAce->Mask = AccessMask;
|
|
|
|
pAcl->AceCount++;
|
|
|
|
RtlCopySid(dwLengthSid, (PSID)&pAdAce->SidStart, pSid);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* RtlValidAcl [NTDLL.@]
|
|
|
|
*/
|
|
|
|
BOOLEAN WINAPI RtlValidAcl(PACL pAcl)
|
|
|
|
{
|
|
|
|
BOOLEAN ret;
|
|
|
|
TRACE("(%p)\n", pAcl);
|
|
|
|
|
|
|
|
__TRY
|
|
|
|
{
|
|
|
|
PACE_HEADER ace;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (pAcl->AclRevision != ACL_REVISION)
|
|
|
|
ret = FALSE;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ace = (PACE_HEADER)(pAcl+1);
|
|
|
|
ret = TRUE;
|
|
|
|
for (i=0;i<=pAcl->AceCount;i++)
|
|
|
|
{
|
|
|
|
if ((char *)ace > (char *)pAcl + pAcl->AclSize)
|
|
|
|
{
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
__EXCEPT(page_fault)
|
|
|
|
{
|
|
|
|
WARN("(%p): invalid pointer!\n", pAcl);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
__ENDTRY
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlGetAce [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce )
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2003-05-01 02:29:26 +02:00
|
|
|
PACE_HEADER ace;
|
|
|
|
|
|
|
|
TRACE("(%p,%ld,%p)\n",pAcl,dwAceIndex,pAce);
|
|
|
|
|
|
|
|
if ((dwAceIndex < 0) || (dwAceIndex > pAcl->AceCount))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
ace = (PACE_HEADER)(pAcl + 1);
|
|
|
|
for (;dwAceIndex;dwAceIndex--)
|
|
|
|
ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
|
|
|
|
|
|
|
|
*pAce = (LPVOID) ace;
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* misc
|
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlAdjustPrivilege [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
1999-05-23 12:25:25 +02:00
|
|
|
FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
|
1999-03-09 18:47:51 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* RtlImpersonateSelf [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
RtlImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
|
|
|
|
{
|
|
|
|
FIXME("(%08x), stub\n", ImpersonationLevel);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtAccessCheck [NTDLL.@]
|
2003-03-17 22:21:00 +01:00
|
|
|
* ZwAccessCheck [NTDLL.@]
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
NTSTATUS WINAPI
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
NtAccessCheck(
|
|
|
|
IN PSECURITY_DESCRIPTOR SecurityDescriptor,
|
|
|
|
IN HANDLE ClientToken,
|
|
|
|
IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN PGENERIC_MAPPING GenericMapping,
|
|
|
|
OUT PPRIVILEGE_SET PrivilegeSet,
|
|
|
|
OUT PULONG ReturnLength,
|
|
|
|
OUT PULONG GrantedAccess,
|
|
|
|
OUT PBOOLEAN AccessStatus)
|
|
|
|
{
|
2002-11-21 04:45:01 +01:00
|
|
|
FIXME("(%p, %p, %08lx, %p, %p, %p, %p, %p), stub\n",
|
2002-06-01 01:06:46 +02:00
|
|
|
SecurityDescriptor, ClientToken, DesiredAccess, GenericMapping,
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
PrivilegeSet, ReturnLength, GrantedAccess, AccessStatus);
|
|
|
|
*AccessStatus = TRUE;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtSetSecurityObject [NTDLL.@]
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
NTSTATUS WINAPI
|
|
|
|
NtSetSecurityObject(
|
|
|
|
IN HANDLE Handle,
|
|
|
|
IN SECURITY_INFORMATION SecurityInformation,
|
2002-06-01 01:06:46 +02:00
|
|
|
IN PSECURITY_DESCRIPTOR SecurityDescriptor)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
2002-12-05 20:56:15 +01:00
|
|
|
FIXME("%p 0x%08lx %p\n", Handle, SecurityInformation, SecurityDescriptor);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlGetControlSecurityDescriptor (NTDLL.@)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
NTSTATUS WINAPI RtlGetControlSecurityDescriptor(
|
|
|
|
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
|
|
|
PSECURITY_DESCRIPTOR_CONTROL pControl,
|
|
|
|
LPDWORD lpdwRevision)
|
|
|
|
{
|
|
|
|
FIXME("(%p,%p,%p),stub!\n",pSecurityDescriptor,pControl,lpdwRevision);
|
|
|
|
return STATUS_SUCCESS;
|
2002-06-01 01:06:46 +02:00
|
|
|
}
|
2000-06-02 00:47:13 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* RtlConvertSidToUnicodeString (NTDLL.@)
|
2002-05-09 22:30:52 +02:00
|
|
|
*
|
|
|
|
* The returned SID is used to access the USER registry hive usually
|
|
|
|
*
|
|
|
|
* the native function returns something like
|
|
|
|
* "S-1-5-21-0000000000-000000000-0000000000-500";
|
2000-06-02 00:47:13 +02:00
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlConvertSidToUnicodeString(
|
2002-05-09 22:30:52 +02:00
|
|
|
PUNICODE_STRING String,
|
|
|
|
PSID Sid,
|
|
|
|
BOOLEAN AllocateString)
|
2000-06-02 00:47:13 +02:00
|
|
|
{
|
2004-05-07 06:01:28 +02:00
|
|
|
const char *user = wine_get_user_name();
|
|
|
|
int len = ntdll_umbstowcs( 0, user, strlen(user)+1, NULL, 0 ) * sizeof(WCHAR);
|
2000-06-02 00:47:13 +02:00
|
|
|
|
2004-05-07 06:01:28 +02:00
|
|
|
FIXME("(%p %p %u)\n", String, Sid, AllocateString);
|
2000-06-02 00:47:13 +02:00
|
|
|
|
2004-05-07 06:01:28 +02:00
|
|
|
String->Length = len - sizeof(WCHAR);
|
|
|
|
if (AllocateString)
|
|
|
|
{
|
|
|
|
String->MaximumLength = len;
|
|
|
|
if (!(String->Buffer = RtlAllocateHeap( GetProcessHeap(), 0, len )))
|
|
|
|
return STATUS_NO_MEMORY;
|
|
|
|
}
|
|
|
|
else if (len > String->MaximumLength) return STATUS_BUFFER_OVERFLOW;
|
2000-06-02 00:47:13 +02:00
|
|
|
|
2004-05-07 06:01:28 +02:00
|
|
|
ntdll_umbstowcs( 0, user, strlen(user)+1, String->Buffer, len/sizeof(WCHAR) );
|
|
|
|
return STATUS_SUCCESS;
|
2000-06-02 00:47:13 +02:00
|
|
|
}
|
2003-11-11 23:03:24 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* RtlQueryInformationAcl (NTDLL.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI RtlQueryInformationAcl(
|
|
|
|
PACL pAcl,
|
|
|
|
LPVOID pAclInformation,
|
|
|
|
DWORD nAclInformationLength,
|
|
|
|
ACL_INFORMATION_CLASS dwAclInformationClass)
|
|
|
|
{
|
|
|
|
NTSTATUS status = STATUS_SUCCESS;
|
|
|
|
|
|
|
|
TRACE("pAcl=%p pAclInfo=%p len=%ld, class=%d\n",
|
|
|
|
pAcl, pAclInformation, nAclInformationLength, dwAclInformationClass);
|
|
|
|
|
|
|
|
switch (dwAclInformationClass)
|
|
|
|
{
|
|
|
|
case AclRevisionInformation:
|
|
|
|
{
|
|
|
|
PACL_REVISION_INFORMATION paclrev = (PACL_REVISION_INFORMATION) pAclInformation;
|
|
|
|
|
|
|
|
if (nAclInformationLength < sizeof(ACL_REVISION_INFORMATION))
|
|
|
|
status = STATUS_INVALID_PARAMETER;
|
|
|
|
else
|
|
|
|
paclrev->AclRevision = pAcl->AclRevision;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case AclSizeInformation:
|
|
|
|
{
|
|
|
|
PACL_SIZE_INFORMATION paclsize = (PACL_SIZE_INFORMATION) pAclInformation;
|
|
|
|
|
|
|
|
if (nAclInformationLength < sizeof(ACL_SIZE_INFORMATION))
|
|
|
|
status = STATUS_INVALID_PARAMETER;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
INT i;
|
|
|
|
PACE_HEADER ace;
|
|
|
|
|
|
|
|
paclsize->AceCount = pAcl->AceCount;
|
|
|
|
|
|
|
|
paclsize->AclBytesInUse = 0;
|
|
|
|
ace = (PACE_HEADER) (pAcl + 1);
|
|
|
|
|
|
|
|
for (i = 0; i < pAcl->AceCount; i++)
|
|
|
|
{
|
|
|
|
paclsize->AclBytesInUse += ace->AceSize;
|
|
|
|
ace = (PACE_HEADER)(((BYTE*)ace)+ace->AceSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pAcl->AclSize < paclsize->AclBytesInUse)
|
|
|
|
{
|
|
|
|
WARN("Acl has %ld bytes free\n", pAcl->AclSize - paclsize->AclBytesInUse);
|
|
|
|
paclsize->AclBytesFree = 0;
|
|
|
|
paclsize->AclBytesInUse = pAcl->AclSize;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
paclsize->AclBytesFree = pAcl->AclSize - paclsize->AclBytesInUse;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
WARN("Unknown AclInformationClass value: %d\n", dwAclInformationClass);
|
|
|
|
status = STATUS_INVALID_PARAMETER;
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|