2005-09-08 00:09:32 +00:00
|
|
|
/* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS system libraries
|
2005-05-05 20:52:14 +00:00
|
|
|
* FILE: lib/rtl/access.c
|
|
|
|
* PURPOSE: Access rights handling functions
|
|
|
|
* PROGRAMMERS: Eric Kohl
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2005-07-26 08:39:07 +00:00
|
|
|
#include <rtl.h>
|
2005-05-05 20:52:14 +00:00
|
|
|
#define NDEBUG
|
|
|
|
#include <debug.h>
|
|
|
|
|
|
|
|
/* FUNCTIONS ***************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2005-10-19 17:03:38 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2012-10-04 16:55:53 +00:00
|
|
|
RtlAreAllAccessesGranted(IN ACCESS_MASK GrantedAccess,
|
|
|
|
IN ACCESS_MASK DesiredAccess)
|
2005-05-05 20:52:14 +00:00
|
|
|
{
|
2012-10-04 16:55:53 +00:00
|
|
|
PAGED_CODE_RTL();
|
|
|
|
|
|
|
|
/* Return if there's no leftover bits after granting all of them */
|
|
|
|
return !(~GrantedAccess & DesiredAccess);
|
2005-05-05 20:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2005-10-19 17:03:38 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2012-10-04 16:55:53 +00:00
|
|
|
RtlAreAnyAccessesGranted(IN ACCESS_MASK GrantedAccess,
|
|
|
|
IN ACCESS_MASK DesiredAccess)
|
2005-05-05 20:52:14 +00:00
|
|
|
{
|
2005-10-19 17:03:38 +00:00
|
|
|
PAGED_CODE_RTL();
|
2012-10-04 16:55:53 +00:00
|
|
|
|
|
|
|
/* Return if there's any leftover bits after granting all of them */
|
2012-10-07 21:36:50 +00:00
|
|
|
return ((GrantedAccess & DesiredAccess) != 0);
|
2005-05-05 20:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @implemented
|
|
|
|
*/
|
2005-10-19 17:03:38 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
2012-10-04 16:55:53 +00:00
|
|
|
RtlMapGenericMask(IN OUT PACCESS_MASK AccessMask,
|
|
|
|
IN PGENERIC_MAPPING GenericMapping)
|
2005-05-05 20:52:14 +00:00
|
|
|
{
|
2005-10-19 17:03:38 +00:00
|
|
|
PAGED_CODE_RTL();
|
2005-05-05 20:52:14 +00:00
|
|
|
|
2012-10-04 16:55:53 +00:00
|
|
|
/* Convert mappings */
|
2005-10-19 17:03:38 +00:00
|
|
|
if (*AccessMask & GENERIC_READ) *AccessMask |= GenericMapping->GenericRead;
|
|
|
|
if (*AccessMask & GENERIC_WRITE) *AccessMask |= GenericMapping->GenericWrite;
|
|
|
|
if (*AccessMask & GENERIC_EXECUTE) *AccessMask |= GenericMapping->GenericExecute;
|
|
|
|
if (*AccessMask & GENERIC_ALL) *AccessMask |= GenericMapping->GenericAll;
|
2005-05-05 20:52:14 +00:00
|
|
|
|
2012-10-04 16:55:53 +00:00
|
|
|
/* Clear generic flags */
|
2005-10-19 17:03:38 +00:00
|
|
|
*AccessMask &= ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL);
|
2005-05-05 20:52:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|