diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2021-12-27 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2022-03-18 15:35:13 +0500 |
commit | f19f813537c7aea1c20749c914e756b54a9c3cf5 (patch) | |
tree | 816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Windows/MemoryLock.h | |
parent | 98e06a519b63b81986abe76d28887f6984a7732b (diff) | |
download | 7zip-21.07.tar.gz 7zip-21.07.tar.bz2 7zip-21.07.zip |
'21.07'21.07
Diffstat (limited to '')
-rw-r--r-- | CPP/Windows/MemoryLock.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/CPP/Windows/MemoryLock.h b/CPP/Windows/MemoryLock.h new file mode 100644 index 0000000..dcaf182 --- /dev/null +++ b/CPP/Windows/MemoryLock.h | |||
@@ -0,0 +1,40 @@ | |||
1 | // Windows/MemoryLock.h | ||
2 | |||
3 | #ifndef __WINDOWS_MEMORY_LOCK_H | ||
4 | #define __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 | |||
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 | ||