xref: /aosp_15_r20/external/lzma/CPP/Windows/MemoryLock.h (revision f6dc9357d832569d4d1f5d24eacdb3935a1ae8e6)
1 // Windows/MemoryLock.h
2 
3 #ifndef ZIP7_INC_WINDOWS_MEMORY_LOCK_H
4 #define ZIP7_INC_WINDOWS_MEMORY_LOCK_H
5 
6 #include "../Common/MyWindows.h"
7 
8 namespace NWindows {
9 namespace NSecurity {
10 
11 #ifndef UNDER_CE
12 
13 bool EnablePrivilege(LPCTSTR privilegeName, bool enable = true);
14 
15 inline bool EnablePrivilege_LockMemory(bool enable = true)
16 {
17   return EnablePrivilege(SE_LOCK_MEMORY_NAME, enable);
18 }
19 
EnablePrivilege_SymLink()20 inline void EnablePrivilege_SymLink()
21 {
22   /* Probably we do not to set any Privilege for junction points.
23      But we need them for Symbolic links */
24   NSecurity::EnablePrivilege(SE_RESTORE_NAME);
25 
26   /* Probably we need only SE_RESTORE_NAME, but there is also
27      SE_CREATE_SYMBOLIC_LINK_NAME. So we set it also. Do we need it? */
28 
29   NSecurity::EnablePrivilege(TEXT("SeCreateSymbolicLinkPrivilege")); // SE_CREATE_SYMBOLIC_LINK_NAME
30 
31   // Do we need to set SE_BACKUP_NAME ?
32 }
33 
34 unsigned Get_LargePages_RiskLevel();
35 
36 #endif
37 
38 }}
39 
40 #endif
41