mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 15:52:57 +00:00

GetUserName based on Winehq sources to get Dependancy Walker working again. svn path=/trunk/; revision=8392
170 lines
3 KiB
C
170 lines
3 KiB
C
/* $Id: misc.c,v 1.10 2004/02/25 23:54:13 sedwards Exp $
|
|
*
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
* PROJECT: ReactOS system libraries
|
|
* FILE: lib/advapi32/sec/misc.c
|
|
* PURPOSE: Miscellaneous security functions
|
|
*/
|
|
|
|
#include <debug.h>
|
|
#define NTOS_MODE_USER
|
|
#include <ntos.h>
|
|
#include <windows.h>
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOL STDCALL
|
|
AreAllAccessesGranted(DWORD GrantedAccess,
|
|
DWORD DesiredAccess)
|
|
{
|
|
return((BOOL)RtlAreAllAccessesGranted(GrantedAccess,
|
|
DesiredAccess));
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOL STDCALL
|
|
AreAnyAccessesGranted(DWORD GrantedAccess,
|
|
DWORD DesiredAccess)
|
|
{
|
|
return((BOOL)RtlAreAnyAccessesGranted(GrantedAccess,
|
|
DesiredAccess));
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOL 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);
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
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);
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
VOID STDCALL
|
|
MapGenericMask(PDWORD AccessMask,
|
|
PGENERIC_MAPPING GenericMapping)
|
|
{
|
|
RtlMapGenericMask(AccessMask,
|
|
GenericMapping);
|
|
}
|
|
|
|
|
|
/*
|
|
* @unimplemented
|
|
*/
|
|
BOOL STDCALL
|
|
ImpersonateLoggedOnUser(HANDLE hToken)
|
|
{
|
|
return FALSE;
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
BOOL STDCALL
|
|
ImpersonateSelf(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
|
|
{
|
|
NTSTATUS Status;
|
|
|
|
Status = RtlImpersonateSelf(ImpersonationLevel);
|
|
if (!NT_SUCCESS(Status))
|
|
{
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
return(FALSE);
|
|
}
|
|
return(TRUE);
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
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);
|
|
}
|
|
|
|
|
|
/******************************************************************************
|
|
* GetUserNameA [ADVAPI32.@]
|
|
*
|
|
* Get the current user name.
|
|
*
|
|
* PARAMS
|
|
* lpszName [O] Destination for the user name.
|
|
* lpSize [I/O] Size of lpszName.
|
|
*
|
|
* RETURNS
|
|
* Success: The length of the user name, including terminating NUL.
|
|
* Failure: ERROR_MORE_DATA if *lpSize is too small.
|
|
*/
|
|
BOOL STDCALL
|
|
GetUserNameA( LPSTR lpszName, LPDWORD lpSize )
|
|
{
|
|
DPRINT1("GetUserNameA - Unimplemented\n");
|
|
return 1;
|
|
}
|
|
|
|
/* EOF */
|
|
|