Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cOSUser.h
Go to the documentation of this file.
1 //
4 //
5 
6 #ifndef _INC_cOSUser_H
7 #define _INC_cOSUser_H
8 #ifndef NO_PRAGMA_ONCE
9 #pragma once
10 #endif
11 
12 #include "cOSHandle.h"
13 #include "FileName.h"
14 
16 #ifndef SECURITY_MANDATORY_UNTRUSTED_RID
17 #define SECURITY_MANDATORY_UNTRUSTED_RID (0x00000000L)
18 #define SECURITY_MANDATORY_LOW_RID (0x00001000L) // Low Integrity
19 #define SECURITY_MANDATORY_MEDIUM_RID (0x00002000L) // Normal User
20 #define SECURITY_MANDATORY_HIGH_RID (0x00003000L) // Admin
21 #define SECURITY_MANDATORY_SYSTEM_RID (0x00004000L)
22 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID (0x00005000L)
23 #endif
24 #if defined(_WIN32) && ! defined(UNDER_CE)
25 struct _TOKEN_STATISTICS;
26 #endif
27 
28 namespace Gray
29 {
30 #if defined(_WIN32) && ! defined(UNDER_CE)
31  class cSecurityId;
32 
33  class GRAYCORE_LINK cOSUserToken : public cOSHandle
34  {
39  public:
40  cOSUserToken();
41  cOSUserToken(DWORD dwDesiredAccess, HANDLE hProcess = INVALID_HANDLE_VALUE);
42 
43  HRESULT OpenProcessToken(DWORD dwDesiredAccess, HANDLE hProcess = INVALID_HANDLE_VALUE);
44  HRESULT LogonUserX(const char* pszName, const char* pszPass);
45 
46  bool SetPrivilege(const GChar_t* pszToken, DWORD dwAttr);
47  bool SetPrivilege(const FILECHAR_t* pszToken);
48  bool RemovePrivilege(const FILECHAR_t* pszToken);
49 
50  HRESULT GetIntegrityLevel();
51  int get_IntegrityLevel();
52 
53  HRESULT GetSID(cSecurityId& sid);
54  HRESULT GetStatistics(struct _TOKEN_STATISTICS* pStats);
55  };
56 #endif
57 }
58 
59 #endif
#define GRAYCORE_LINK
Definition: GrayCore.h:47
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
< The main namespace for all Core functions.
Definition: GrayCore.cpp:14
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
char GChar_t
My version of TCHAR, _TCHAR.
Definition: StrConst.h:26