-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRegKeySecurityInfo.h
More file actions
103 lines (82 loc) · 2.75 KB
/
Copy pathRegKeySecurityInfo.h
File metadata and controls
103 lines (82 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
///
/// RegKeySecurityInfo.h:
/// Defines the signatures for the ISecurityInformation implementation for registry keys.
///
#pragma once
#include "preprocdefs.h"
#include <windows.h>
#include <aclui.h>
#include "mdichild.h"
#define iKeyDefAccess 10 // index of value in array siKeyAccesses
class RegKeySecurityInfo : ISecurityInformation, IEffectivePermission, ISecurityObjectTypeInfo
{
private:
LPTSTR lpKeyNameBuffer;
LONG m_refCount;
public:
RegKeySecurityInfo() : m_refCount(1), lpKeyNameBuffer(nullptr) {}
// IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
STDMETHODIMP_(ULONG) AddRef() override
{
return InterlockedIncrement(&m_refCount);
}
STDMETHODIMP_(ULONG) Release() override
{
ULONG count = InterlockedDecrement(&m_refCount);
if (count == 0)
delete this;
return count;
}
REGKEYTREEITEMINFO keyInfo{};
HRESULT STDMETHODCALLTYPE GetObjectInformation(PSI_OBJECT_INFO pObjectInfo);
HRESULT STDMETHODCALLTYPE GetAccessRights(
const GUID* pguidObjectType,
DWORD dwFlags,
PSI_ACCESS* ppAccess,
ULONG* pcAccesses,
ULONG* piDefaultAccess);
HRESULT STDMETHODCALLTYPE MapGeneric(
const GUID* pguidObjectType,
UCHAR* pAceFlags,
ACCESS_MASK* pMask);
HRESULT STDMETHODCALLTYPE GetInheritTypes(
PSI_INHERIT_TYPE* ppInheritTypes,
ULONG* pcInheritTypes);
STDMETHODIMP PropertySheetPageCallback(HWND hwnd, UINT uMsg, SI_PAGE_TYPE uPage) override
{
switch (uMsg)
{
case PSPCB_RELEASE:
Release();
break;
}
return S_OK;
}
STDMETHODIMP GetSecurity(SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR* ppSD, BOOL fDefault);
STDMETHODIMP SetSecurity(SECURITY_INFORMATION si, PSECURITY_DESCRIPTOR pSD);
STDMETHODIMP WriteObjectSecurity(LPCTSTR pszObject,
IN SECURITY_INFORMATION si,
IN PSECURITY_DESCRIPTOR pSD);
STDMETHODIMP WriteObjectSecurity(HKEY hkey,
IN SECURITY_INFORMATION si,
IN PSECURITY_DESCRIPTOR pSD);
HRESULT SetSubKeysSecurity(HKEY hkey,
SECURITY_INFORMATION si,
PSECURITY_DESCRIPTOR pSD,
LPBOOL pbNotAllApplied,
bool bFirstCall);
STDMETHODIMP GetEffectivePermission(const GUID* pguidObjectType,
PSID pUserSid,
LPCTSTR pszServerName,
PSECURITY_DESCRIPTOR pSD,
POBJECT_TYPE_LIST* ppObjectTypeList,
ULONG* pcObjectTypeListLength,
PACCESS_MASK* ppGrantedAccessList,
ULONG* pcGrantedAccessListLength);
STDMETHODIMP GetInheritSource(SECURITY_INFORMATION si,
PACL pACL,
PINHERITED_FROM* ppInheritArray);
HRESULT OpenKey(IN DWORD Permission, OUT PHKEY pKey);
LPTSTR GetCompleteName1();
};