File tree Expand file tree Collapse file tree 2 files changed +71
-7
lines changed Expand file tree Collapse file tree 2 files changed +71
-7
lines changed Original file line number Diff line number Diff line change 1
1
#include " stdafx.h"
2
2
#include " SecurityAttribute.h"
3
3
#include < Sddl.h>
4
+ #include < VersionHelpers.hpp>
5
+
6
+ #ifndef SDDL_ALL_APP_PACKAGES
7
+ #define SDDL_ALL_APP_PACKAGES TEXT (" AC" )
8
+ #endif
9
+
10
+ #define LOW_INTEGRITY_SDDL_SACL SDDL_SACL \
11
+ SDDL_DELIMINATOR \
12
+ SDDL_ACE_BEGIN \
13
+ SDDL_MANDATORY_LABEL \
14
+ SDDL_SEPERATOR \
15
+ SDDL_SEPERATOR \
16
+ SDDL_NO_WRITE_UP \
17
+ SDDL_SEPERATOR \
18
+ SDDL_SEPERATOR \
19
+ SDDL_SEPERATOR \
20
+ SDDL_ML_LOW \
21
+ SDDL_ACE_END
22
+
23
+ #define LOCAL_SYSTEM_FILE_ACCESS SDDL_ACE_BEGIN \
24
+ SDDL_ACCESS_ALLOWED \
25
+ SDDL_SEPERATOR \
26
+ SDDL_SEPERATOR \
27
+ SDDL_FILE_ALL \
28
+ SDDL_SEPERATOR \
29
+ SDDL_SEPERATOR \
30
+ SDDL_SEPERATOR \
31
+ SDDL_LOCAL_SYSTEM \
32
+ SDDL_ACE_END
33
+
34
+ #define EVERYONE_FILE_ACCESS SDDL_ACE_BEGIN \
35
+ SDDL_ACCESS_ALLOWED \
36
+ SDDL_SEPERATOR \
37
+ SDDL_SEPERATOR \
38
+ SDDL_FILE_ALL \
39
+ SDDL_SEPERATOR \
40
+ SDDL_SEPERATOR \
41
+ SDDL_SEPERATOR \
42
+ SDDL_EVERYONE \
43
+ SDDL_ACE_END
44
+
45
+ #define ALL_APP_PACKAGES_FILE_ACCESS SDDL_ACE_BEGIN \
46
+ SDDL_ACCESS_ALLOWED \
47
+ SDDL_SEPERATOR \
48
+ SDDL_SEPERATOR \
49
+ SDDL_FILE_ALL \
50
+ SDDL_SEPERATOR \
51
+ SDDL_SEPERATOR \
52
+ SDDL_SEPERATOR \
53
+ SDDL_ALL_APP_PACKAGES \
54
+ SDDL_ACE_END
4
55
5
56
namespace weasel {
6
57
7
58
void SecurityAttribute::_Init ()
8
59
{
9
- // Privilages for UWP and IE protected mode
60
+ // Privileges for UWP and IE protected mode
10
61
// https://stackoverflow.com/questions/39138674/accessing-named-pipe-servers-from-within-ie-epm-bho
11
- ConvertStringSecurityDescriptorToSecurityDescriptorW (
12
- L" S:(ML;;NW;;;LW)D:(A;;FA;;;SY)(A;;FA;;;WD)(A;;FA;;;AC)" ,
13
- SDDL_REVISION_1,
14
- &pd,
15
- NULL );
62
+ if (IsWindowsVistaOrGreater ())
63
+ {
64
+ ConvertStringSecurityDescriptorToSecurityDescriptor (
65
+ IsWindows8OrGreater () ? LOW_INTEGRITY_SDDL_SACL
66
+ SDDL_DACL
67
+ SDDL_DELIMINATOR
68
+ LOCAL_SYSTEM_FILE_ACCESS
69
+ EVERYONE_FILE_ACCESS
70
+ ALL_APP_PACKAGES_FILE_ACCESS
71
+ : LOW_INTEGRITY_SDDL_SACL
72
+ SDDL_DACL
73
+ SDDL_DELIMINATOR
74
+ LOCAL_SYSTEM_FILE_ACCESS
75
+ EVERYONE_FILE_ACCESS,
76
+ SDDL_REVISION_1,
77
+ &pd,
78
+ NULL );
79
+ }
16
80
17
81
sa.nLength = sizeof (SECURITY_ATTRIBUTES);
18
82
sa.lpSecurityDescriptor = pd;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ namespace weasel {
9
9
SECURITY_ATTRIBUTES sa;
10
10
void _Init ();
11
11
public:
12
- SecurityAttribute () { _Init (); }
12
+ SecurityAttribute () : pd( NULL ) { _Init (); }
13
13
SECURITY_ATTRIBUTES *get_attr ();
14
14
};
15
15
};
You can’t perform that action at this time.
0 commit comments