#pragma once

//#include <ntddk.h>
//#include <wdm.h>
#include <ntifs.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct _SEP_TOKEN_PRIVILEGES
{
	UINT64 Present;
	UINT64 Enabled;
	UINT64 EnabledByDefault;
} SEP_TOKEN_PRIVILEGES, *PSEP_TOKEN_PRIVILEGES;

typedef enum _PRIVILEGES
{
	//1000000000000000000000000000000000000 - 36
	SeDelegateSessionUserImpersonatePrivilege = 0x1000000000,
	//0100000000000000000000000000000000000 - 35
	SeCreateSymbolicLinkPrivilege = 0x800000000,
	//0010000000000000000000000000000000000 - 34
	SeTimeZonePrivilege = 0x400000000,
	//0001000000000000000000000000000000000 - 33
	SeIncreaseWorkingSetPrivilege = 0x200000000,
	//0000100000000000000000000000000000000 - 32
	SeRelabelPrivilege = 0x100000000,
	//0000010000000000000000000000000000000 - 31
	SeTrustedCredManAccessPrivilege = 0x80000000,
	//0000001000000000000000000000000000000 - 30
	SeCreateGlobalPrivilege = 0x40000000,
	//0000000100000000000000000000000000000 - 29
	SeImpersonatePrivilege = 0x20000000,
	//0000000010000000000000000000000000000 - 28
	SeManageVolumePrivilege = 0x10000000,
	//0000000001000000000000000000000000000 - 27
	SeEnableDelegationPrivilege = 0x8000000,
	//0000000000100000000000000000000000000 - 26
	SeSyncAgentPrivilege = 0x4000000,
	//0000000000010000000000000000000000000 - 25
	SeUndockPrivilege = 0x2000000,
	//0000000000001000000000000000000000000 - 24
	SeRemoteShutdownPrivilege = 0x1000000,
	//0000000000000100000000000000000000000 - 23
	SeChangeNotifyPrivilege = 0x800000,
	//0000000000000010000000000000000000000 - 22
	SeSystemEnvironmentPrivilege = 0x400000,
	//0000000000000001000000000000000000000 - 21
	SeAuditPrivilege = 0x200000,
	//0000000000000000100000000000000000000 - 20
	SeDebugPrivilege = 0x100000,
	//0000000000000000010000000000000000000 - 19
	SeShutdownPrivilege = 0x80000,
	//0000000000000000001000000000000000000 - 18
	SeRestorePrivilege = 0x40000,
	//0000000000000000000100000000000000000 - 17
	SeBackupPrivilege = 0x20000,
	//0000000000000000000010000000000000000 - 16
	SeCreatePermanentPrivilege = 0x10000,
	//0000000000000000000001000000000000000 - 15
	SeCreatePagefilePrivilege = 0x8000,
	//0000000000000000000000100000000000000 - 14
	SeIncreaseBasePriorityPrivilege = 0x4000,
	//0000000000000000000000010000000000000 - 13
	SeProfileSingleProcessPrivilege = 0x2000,
	//0000000000000000000000001000000000000 - 12
	SeSystemtimePrivilege = 0x1000,
	//0000000000000000000000000100000000000 - 11
	SeSystemProfilePrivilege = 0x800,
	//0000000000000000000000000010000000000 - 10
	SeLoadDriverPrivilege = 0x400,
	//0000000000000000000000000001000000000 - 09
	SeTakeOwnershipPrivilege = 0x200,
	//0000000000000000000000000000100000000 - 08
	SeSecurityPrivilege = 0x100,
	//0000000000000000000000000000010000000 - 07
	SeTcbPrivilege = 0x80,
	//0000000000000000000000000000001000000 - 06
	SeUnsolicitedInputPrivilege = 0x40,
	//0000000000000000000000000000000100000 - 05
	SeIncreaseQuotaPrivilege = 0x20,
	//0000000000000000000000000000000010000 - 04
	SeLockMemoryPrivilege = 0x10,
	//0000000000000000000000000000000001000 - 03
	SeAssignPrimaryTokenPrivilege = 0x8,
	//0000000000000000000000000000000000100 - 02
	SeCreateTokenPrivilege = 0x4
} PRIVILEGES;

VOID UnFreezeToken(ULONGLONG*);
VOID UnFreezeTokenByPid(ULONG, ULONGLONG*);
VOID _UnfreezeToken(PEPROCESS, ULONGLONG*);

VOID AddTokenPrivilege(enum PRIVILEGES, ULONGLONG*);
VOID AddTokenPrivilegeByPid(ULONG, enum PRIVILEGES, ULONGLONG*);
VOID _AddTokenPrivilege(PEPROCESS, enum PRIVILEGES, ULONGLONG*);