mirror of https://github.com/tongzx/nt5src
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
1.0 KiB
83 lines
1.0 KiB
/*
|
|
* User.c
|
|
*
|
|
* Author: BreenH
|
|
*
|
|
* User account utilities.
|
|
*/
|
|
|
|
/*
|
|
* Includes
|
|
*/
|
|
|
|
#include "precomp.h"
|
|
#include "tsutil.h"
|
|
#include "tsutilnt.h"
|
|
|
|
/*
|
|
* Function Implementations
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
CreateAdminSid(
|
|
PSID *ppAdminSid
|
|
)
|
|
{
|
|
BOOL fRet;
|
|
NTSTATUS Status;
|
|
|
|
Status = NtCreateAdminSid(ppAdminSid);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
{
|
|
fRet = TRUE;
|
|
}
|
|
else
|
|
{
|
|
fRet = FALSE;
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
}
|
|
|
|
return(fRet);
|
|
}
|
|
|
|
BOOL WINAPI
|
|
CreateSystemSid(
|
|
PSID *ppSystemSid
|
|
)
|
|
{
|
|
BOOL fRet;
|
|
NTSTATUS Status;
|
|
|
|
Status = NtCreateSystemSid(ppSystemSid);
|
|
|
|
if (NT_SUCCESS(Status))
|
|
{
|
|
fRet = TRUE;
|
|
}
|
|
else
|
|
{
|
|
fRet = FALSE;
|
|
SetLastError(RtlNtStatusToDosError(Status));
|
|
}
|
|
|
|
return(fRet);
|
|
}
|
|
|
|
BOOL WINAPI
|
|
IsUserMember(
|
|
PSID pSid
|
|
)
|
|
{
|
|
BOOL fMember;
|
|
BOOL fRet;
|
|
|
|
ASSERT(pSid != NULL);
|
|
|
|
fMember = FALSE;
|
|
|
|
fRet = CheckTokenMembership(NULL, pSid, &fMember);
|
|
|
|
return(fRet && fMember);
|
|
}
|
|
|