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