mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Added some security/access functions.
svn path=/trunk/; revision=2389
This commit is contained in:
parent
396df5ce12
commit
3c7c6e909d
4 changed files with 179 additions and 48 deletions
|
@ -1,4 +1,4 @@
|
|||
; $Id: advapi32.edf,v 1.14 2001/09/01 19:39:23 rex Exp $
|
||||
; $Id: advapi32.edf,v 1.15 2001/11/22 02:37:05 ekohl Exp $
|
||||
;
|
||||
; advapi32.def
|
||||
;
|
||||
|
@ -21,8 +21,8 @@ AdjustTokenGroups=AdjustTokenGroups@24
|
|||
AdjustTokenPrivileges=AdjustTokenPrivileges@24
|
||||
AllocateAndInitializeSid=AllocateAndInitializeSid@44
|
||||
AllocateLocallyUniqueId=AllocateLocallyUniqueId@4
|
||||
;AreAllAccessesGranted=AreAllAccessesGranted@8
|
||||
;AreAnyAccessesGranted=AreAnyAccessesGranted@8
|
||||
AreAllAccessesGranted=AreAllAccessesGranted@8
|
||||
AreAnyAccessesGranted=AreAnyAccessesGranted@8
|
||||
;BackupEventLogA=BackupEventLogA@8
|
||||
;BackupEventLogW=BackupEventLogW@8
|
||||
;BuildAccessRequestA=BuildAccessRequestA@12
|
||||
|
@ -135,7 +135,7 @@ GetAclInformation=GetAclInformation@16
|
|||
;GetExplicitEntriesFromAclW=GetExplicitEntriesFromAclW@12
|
||||
;GetFileSecurityA=GetFileSecurityA@20
|
||||
;GetFileSecurityW=GetFileSecurityW@20
|
||||
;GetKernelObjectSecurity=GetKernelObjectSecurity@20
|
||||
GetKernelObjectSecurity=GetKernelObjectSecurity@20
|
||||
GetLengthSid=GetLengthSid@4
|
||||
;GetMultipleTrusteeA=GetMultipleTrusteeA@4
|
||||
;GetMultipleTrusteeOperationA=GetMultipleTrusteeOperationA@4
|
||||
|
@ -176,7 +176,7 @@ GetUserNameW=GetUserNameW@8
|
|||
;I_ScSetServiceBitsW=I_ScSetServiceBitsW@20
|
||||
;ImpersonateLoggedOnUser=ImpersonateLoggedOnUser@4
|
||||
;ImpersonateNamedPipeClient=ImpersonateNamedPipeClient@4
|
||||
;ImpersonateSelf=ImpersonateSelf@4
|
||||
ImpersonateSelf=ImpersonateSelf@4
|
||||
InitializeAcl=InitializeAcl@12
|
||||
InitializeSecurityDescriptor=InitializeSecurityDescriptor@8
|
||||
InitializeSid=InitializeSid@12
|
||||
|
@ -191,8 +191,8 @@ IsValidSid=IsValidSid@4
|
|||
LockServiceDatabase=LockServiceDatabase@4
|
||||
;LogonUserA=LogonUserA@24
|
||||
;LogonUserW=LogonUserW@24
|
||||
;LookupAccountNameA=LookupAccountNameA@28
|
||||
;LookupAccountNameW=LookupAccountNameW@28
|
||||
LookupAccountNameA=LookupAccountNameA@28
|
||||
LookupAccountNameW=LookupAccountNameW@28
|
||||
LookupAccountSidA=LookupAccountSidA@28
|
||||
LookupAccountSidW=LookupAccountSidW@28
|
||||
LookupPrivilegeDisplayNameA=LookupPrivilegeDisplayNameA@20
|
||||
|
@ -252,7 +252,7 @@ LookupPrivilegeValueW=LookupPrivilegeValueW@12
|
|||
;LsaStorePrivateData=LsaStorePrivateData@12
|
||||
MakeAbsoluteSD=MakeAbsoluteSD@44
|
||||
MakeSelfRelativeSD=MakeSelfRelativeSD@12
|
||||
;MapGenericMask=MapGenericMask@8
|
||||
MapGenericMask=MapGenericMask@8
|
||||
;NTAccessMaskToProvAccessRights=NTAccessMaskToProvAccessRights@12
|
||||
;NotifyBootConfigStatus=NotifyBootConfigStatus@4
|
||||
;NotifyChangeEventLog=NotifyChangeEventLog@8
|
||||
|
@ -342,7 +342,7 @@ RegisterServiceCtrlHandlerW=RegisterServiceCtrlHandlerW@8
|
|||
;ReplaceAllAccessRightsW
|
||||
;ReportEventA=ReportEventA@36
|
||||
;ReportEventW=ReportEventW@36
|
||||
;RevertToSelf=RevertToSelf@0
|
||||
RevertToSelf=RevertToSelf@0
|
||||
;RevokeExplicitAccessRightsA=RevokeExplicitAccessRightsA@16
|
||||
;RevokeExplicitAccessRightsW=RevokeExplicitAccessRightsW@16
|
||||
;SetAccessRightsA=SetAccessRightsA@16
|
||||
|
@ -352,7 +352,7 @@ SetAclInformation=SetAclInformation@16
|
|||
;SetEntriesInAclW=SetEntriesInAclW@16
|
||||
;SetFileSecurityA=SetFileSecurityA@12
|
||||
;SetFileSecurityW=SetFileSecurityW@12
|
||||
;SetKernelObjectSecurity=SetKernelObjectSecurity@12
|
||||
SetKernelObjectSecurity=SetKernelObjectSecurity@12
|
||||
;SetNamedSecurityInfoA=SetNamedSecurityInfoA@28
|
||||
;SetNamedSecurityInfoW=SetNamedSecurityInfoW@28
|
||||
;SetPrivateObjectSecurity=SetPrivateObjectSecurity@20
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: makefile,v 1.20 2001/10/21 19:06:42 chorns Exp $
|
||||
# $Id: makefile,v 1.21 2001/11/22 02:37:06 ekohl Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -21,9 +21,10 @@ REGISTRY_OBJECTS=\
|
|||
reg/reg.o
|
||||
|
||||
SECURITY_OBJECTS=\
|
||||
sec/lsa.o \
|
||||
sec/sec.o \
|
||||
sec/ac.o \
|
||||
sec/lsa.o \
|
||||
sec/misc.o \
|
||||
sec/sec.o \
|
||||
sec/sid.o
|
||||
|
||||
SERVICE_OBJECTS=\
|
||||
|
|
111
reactos/lib/advapi32/sec/misc.c
Normal file
111
reactos/lib/advapi32/sec/misc.c
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
*/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <ntdll/rtl.h>
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
WINBOOL STDCALL
|
||||
AreAllAccessesGranted(DWORD GrantedAccess,
|
||||
DWORD DesiredAccess)
|
||||
{
|
||||
return((BOOL)RtlAreAllAccessesGranted(GrantedAccess,
|
||||
DesiredAccess));
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL
|
||||
AreAnyAccessesGranted(DWORD GrantedAccess,
|
||||
DWORD DesiredAccess)
|
||||
{
|
||||
return((BOOL)RtlAreAnyAccessesGranted(GrantedAccess,
|
||||
DesiredAccess));
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL
|
||||
GetKernelObjectSecurity(HANDLE Handle,
|
||||
SECURITY_INFORMATION RequestedInformation,
|
||||
PSECURITY_DESCRIPTOR pSecurityDescriptor,
|
||||
DWORD nLength,
|
||||
LPDWORD lpnLengthNeeded)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtQuerySecurityObject(Handle,
|
||||
RequestedInformation,
|
||||
pSecurityDescriptor,
|
||||
nLength,
|
||||
lpnLengthNeeded);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
SetKernelObjectSecurity(HANDLE Handle,
|
||||
SECURITY_INFORMATION SecurityInformation,
|
||||
PSECURITY_DESCRIPTOR SecurityDescriptor)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtSetSecurityObject(Handle,
|
||||
SecurityInformation,
|
||||
SecurityDescriptor);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
MapGenericMask(PDWORD AccessMask,
|
||||
PGENERIC_MAPPING GenericMapping)
|
||||
{
|
||||
RtlMapGenericMask(AccessMask,
|
||||
GenericMapping);
|
||||
}
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = RtlImpersonateSelf(ImpersonationLevel);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
BOOL STDCALL
|
||||
RevertToSelf(VOID)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
HANDLE Token = NULL;
|
||||
|
||||
Status = NtSetInformationThread(NtCurrentThread(),
|
||||
ThreadImpersonationToken,
|
||||
&Token,
|
||||
sizeof(HANDLE));
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastError(RtlNtStatusToDosError(Status));
|
||||
return(FALSE);
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: sid.c,v 1.3 2001/06/17 20:19:45 ekohl Exp $
|
||||
/* $Id: sid.c,v 1.4 2001/11/22 02:37:32 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -181,44 +181,63 @@ InitializeSid (
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
IsValidSid (
|
||||
PSID pSid
|
||||
)
|
||||
{
|
||||
return (WINBOOL)RtlValidSid (pSid);
|
||||
}
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
LookupAccountSidA (
|
||||
LPCSTR lpSystemName,
|
||||
PSID Sid,
|
||||
LPSTR Name,
|
||||
LPDWORD cbName,
|
||||
LPSTR ReferencedDomainName,
|
||||
LPDWORD cbReferencedDomainName,
|
||||
PSID_NAME_USE peUse
|
||||
)
|
||||
WINBOOL STDCALL
|
||||
IsValidSid(PSID pSid)
|
||||
{
|
||||
return (FALSE);
|
||||
return((WINBOOL)RtlValidSid(pSid));
|
||||
}
|
||||
|
||||
|
||||
WINBOOL
|
||||
STDCALL
|
||||
LookupAccountSidW (
|
||||
LPCWSTR lpSystemName,
|
||||
PSID Sid,
|
||||
LPWSTR Name,
|
||||
LPDWORD cbName,
|
||||
LPWSTR ReferencedDomainName,
|
||||
LPDWORD cbReferencedDomainName,
|
||||
PSID_NAME_USE peUse
|
||||
)
|
||||
WINBOOL STDCALL
|
||||
LookupAccountNameA(LPCSTR lpSystemName,
|
||||
LPCSTR lpAccountName,
|
||||
PSID Sid,
|
||||
LPDWORD cbSid,
|
||||
LPSTR DomainName,
|
||||
LPDWORD cbDomainName,
|
||||
PSID_NAME_USE peUse)
|
||||
{
|
||||
return (FALSE);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL
|
||||
LookupAccountNameW(LPCWSTR lpSystemName,
|
||||
LPCWSTR lpAccountName,
|
||||
PSID Sid,
|
||||
LPDWORD cbSid,
|
||||
LPWSTR DomainName,
|
||||
LPDWORD cbDomainName,
|
||||
PSID_NAME_USE peUse)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL
|
||||
LookupAccountSidA(LPCSTR lpSystemName,
|
||||
PSID Sid,
|
||||
LPSTR Name,
|
||||
LPDWORD cbName,
|
||||
LPSTR ReferencedDomainName,
|
||||
LPDWORD cbReferencedDomainName,
|
||||
PSID_NAME_USE peUse)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
WINBOOL STDCALL
|
||||
LookupAccountSidW(LPCWSTR lpSystemName,
|
||||
PSID Sid,
|
||||
LPWSTR Name,
|
||||
LPDWORD cbName,
|
||||
LPWSTR ReferencedDomainName,
|
||||
LPDWORD cbReferencedDomainName,
|
||||
PSID_NAME_USE peUse)
|
||||
{
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue