ReactOS 0.4.15-dev-5666-gc548b97
security.c File Reference
#include "regedit.h"
#include <guiddef.h>
Include dependency graph for security.c:

Go to the source code of this file.

Classes

struct  _CHANGE_CONTEXT
 

Macros

#define INITGUID
 
#define impl_to_interface(impl, iface)   (struct iface *)(&(impl)->lp##iface##Vtbl)
 

Typedefs

typedef struct _CHANGE_CONTEXT CHANGE_CONTEXT
 
typedef struct _CHANGE_CONTEXTPCHANGE_CONTEXT
 
typedef BOOL(WINAPIPEDITSECURITY) (HWND hwndOwner, struct ISecurityInformation *psi)
 

Functions

 DEFINE_GUID (IID_IRegKeySecurity, 0x965fc360, 0x16ff, 0x11d0, 0x0091, 0xcb, 0x00, 0xaa, 0x00, 0xbb, 0xb7, 0x23)
 
 DEFINE_GUID (IID_IEffectivePermission, 0x3853dc76, 0x9f35, 0x407c, 0x0088, 0xa1, 0xd1, 0x93, 0x44, 0x36, 0x5f, 0xbc)
 
 DEFINE_GUID (IID_ISecurityObjectTypeInfo, 0xfc3066eb, 0x79ef, 0x444b, 0x0091, 0x11, 0xd1, 0x8a, 0x75, 0xeb, 0xf2, 0xfa)
 
static __inline PCRegKeySecurity impl_from_ISecurityInformation (struct ISecurityInformation *iface)
 
static __inline PCRegKeySecurity impl_from_ISecurityObjectTypeInfo (struct ISecurityObjectTypeInfo *iface)
 
static __inline PCRegKeySecurity impl_from_IEffectivePermission (struct IEffectivePermission *iface)
 
static __inline ULONG CRegKeySecurity_fnAddRef (PCRegKeySecurity obj)
 
static __inline ULONG CRegKeySecurity_fnRelease (PCRegKeySecurity obj)
 
static __inline HRESULT CRegKeySecurity_fnQueryInterface (PCRegKeySecurity obj, REFIID iid, PVOID *pvObject)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnQueryInterface (struct ISecurityInformation *this, REFIID iid, PVOID *pvObject)
 
static ULONG STDMETHODCALLTYPE ISecurityInformation_fnAddRef (struct ISecurityInformation *this)
 
static ULONG STDMETHODCALLTYPE ISecurityInformation_fnRelease (struct ISecurityInformation *this)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetObjectInformation (struct ISecurityInformation *this, PSI_OBJECT_INFO pObjectInfo)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetSecurity (struct ISecurityInformation *this, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR *ppSecurityDescriptor, BOOL fDefault)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnSetSecurity (struct ISecurityInformation *this, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetAccessRights (struct ISecurityInformation *this, const GUID *pguidObjectType, DWORD dwFlags, PSI_ACCESS *ppAccess, ULONG *pcAccesses, ULONG *piDefaultAccess)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnMapGeneric (struct ISecurityInformation *this, const GUID *pguidObjectType, UCHAR *pAceFlags, ACCESS_MASK *pMask)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetInheritTypes (struct ISecurityInformation *this, PSI_INHERIT_TYPE *ppInheritTypes, ULONG *pcInheritTypes)
 
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnPropertySheetPageCallback (struct ISecurityInformation *this, HWND hwnd, UINT uMsg, SI_PAGE_TYPE uPage)
 
static HRESULT STDMETHODCALLTYPE IEffectivePermission_fnQueryInterface (struct IEffectivePermission *this, REFIID iid, PVOID *pvObject)
 
static ULONG STDMETHODCALLTYPE IEffectivePermission_fnAddRef (struct IEffectivePermission *this)
 
static ULONG STDMETHODCALLTYPE IEffectivePermission_fnRelease (struct IEffectivePermission *this)
 
static HRESULT STDMETHODCALLTYPE IEffectivePermission_fnGetEffectivePermission (struct IEffectivePermission *this, const GUID *pguidObjectType, PSID pUserSid, LPCWSTR pszServerName, PSECURITY_DESCRIPTOR pSD, POBJECT_TYPE_LIST *ppObjectTypeList, ULONG *pcObjectTypeListLength, PACCESS_MASK *ppGrantedAccessList, ULONG *pcGrantedAccessListLength)
 
static HRESULT STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnQueryInterface (struct ISecurityObjectTypeInfo *this, REFIID iid, PVOID *pvObject)
 
static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnAddRef (struct ISecurityObjectTypeInfo *this)
 
static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnRelease (struct ISecurityObjectTypeInfo *this)
 
static HRESULT STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnGetInheritSource (struct ISecurityObjectTypeInfo *this, SECURITY_INFORMATION si, PACL pACL, PINHERITED_FROM *ppInheritArray)
 
static PCRegKeySecurity CRegKeySecurity_fnConstructor (LPWSTR lpRegKey, HKEY hRootKey, SI_OBJECT_INFO *ObjectInfo, BOOL *Btn)
 
BOOL InitializeAclUiDll (VOID)
 
VOID UnloadAclUiDll (VOID)
 
BOOL RegKeyEditPermissions (HWND hWndOwner, HKEY hKey, LPCWSTR lpMachine, LPCWSTR lpKeyName)
 

Variables

static const struct ifaceISecurityInformationVbtl vtblISecurityInformation
 
static const struct ifaceIEffectivePermissionVbtl vtblIEffectivePermission
 
static const struct ifaceISecurityObjectTypeInfoVbtl vtblISecurityObjectTypeInfo
 
static SI_ACCESS RegAccess []
 
static const DWORD RegDefaultAccess = 1
 
static GENERIC_MAPPING RegAccessMasks
 
static SI_INHERIT_TYPE RegInheritTypes []
 
static PEDITSECURITY pfnEditSecurity
 
static HMODULE hAclUiDll
 

Macro Definition Documentation

◆ impl_to_interface

#define impl_to_interface (   impl,
  iface 
)    (struct iface *)(&(impl)->lp##iface##Vtbl)

Definition at line 76 of file security.c.

◆ INITGUID

#define INITGUID

Definition at line 23 of file security.c.

Typedef Documentation

◆ CHANGE_CONTEXT

◆ PCHANGE_CONTEXT

◆ PEDITSECURITY

typedef BOOL(WINAPI * PEDITSECURITY) (HWND hwndOwner, struct ISecurityInformation *psi)

Definition at line 804 of file security.c.

Function Documentation

◆ CRegKeySecurity_fnAddRef()

static __inline ULONG CRegKeySecurity_fnAddRef ( PCRegKeySecurity  obj)
static

Definition at line 79 of file security.c.

80{
81 return (ULONG)InterlockedIncrement((LONG*)&obj->ref);
82}
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1
long LONG
Definition: pedump.c:60

Referenced by CRegKeySecurity_fnQueryInterface(), IEffectivePermission_fnAddRef(), ISecurityInformation_fnAddRef(), and ISecurityObjectTypeInfo_fnAddRef().

◆ CRegKeySecurity_fnConstructor()

static PCRegKeySecurity CRegKeySecurity_fnConstructor ( LPWSTR  lpRegKey,
HKEY  hRootKey,
SI_OBJECT_INFO ObjectInfo,
BOOL Btn 
)
static

Definition at line 762 of file security.c.

766{
768
772 szRegKey[wcslen(lpRegKey) + 1]));
773 if (obj != NULL)
774 {
775 obj->ref = 1;
776 obj->lpISecurityInformationVtbl = &vtblISecurityInformation;
777#if REGEDIT_IMPLEMENT_ISECURITYINFORMATION2
778 obj->lpISecurityInformation2Vtbl = &vtblISecurityInformation2;
779#endif
780 obj->lpIEffectivePermissionVtbl = &vtblIEffectivePermission;
781 obj->lpISecurityObjectTypeInfoVtbl = &vtblISecurityObjectTypeInfo;
782 obj->ObjectInfo = *ObjectInfo;
783 obj->Btn = Btn;
784 obj->hRootKey = hRootKey;
785 wcscpy(obj->szRegKey,
786 lpRegKey);
787 }
788 else
790
791 return obj;
792}
static const struct ifaceIEffectivePermissionVbtl vtblIEffectivePermission
Definition: security.c:288
static const struct ifaceISecurityInformationVbtl vtblISecurityInformation
Definition: security.c:202
static const struct ifaceISecurityObjectTypeInfoVbtl vtblISecurityObjectTypeInfo
Definition: security.c:322
struct _CRegKeySecurity * PCRegKeySecurity
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by RegKeyEditPermissions().

◆ CRegKeySecurity_fnQueryInterface()

static __inline HRESULT CRegKeySecurity_fnQueryInterface ( PCRegKeySecurity  obj,
REFIID  iid,
PVOID pvObject 
)
static

Definition at line 101 of file security.c.

104{
105 PVOID pvObj = NULL;
106
107 if (IsEqualGUID(iid,
108 &IID_IRegKeySecurity))
109 {
110 pvObj = (PVOID)impl_to_interface(obj,
111 ISecurityInformation);
112 }
113#if REGEDIT_IMPLEMENT_ISECURITYINFORMATION2
114 else if (IsEqualGUID(iid,
115 &IID_IRegKeySecurity2))
116 {
117 pvObj = (PVOID)impl_to_interface(obj,
118 ISecurityInformation2);
119 }
120#endif
121 else if (IsEqualGUID(iid,
122 &IID_IEffectivePermission))
123 {
124 pvObj = (PVOID)impl_to_interface(obj,
125 IEffectivePermission);
126 }
127 else if (IsEqualGUID(iid,
128 &IID_ISecurityObjectTypeInfo))
129 {
130 pvObj = (PVOID)impl_to_interface(obj,
131 ISecurityObjectTypeInfo);
132 }
133
134 if (pvObj == NULL)
135 {
136 return E_NOINTERFACE;
137 }
138
139 *pvObject = pvObj;
141
142 return S_OK;
143}
static __inline ULONG CRegKeySecurity_fnAddRef(PCRegKeySecurity obj)
Definition: security.c:79
#define impl_to_interface(impl, iface)
Definition: security.c:76
#define S_OK
Definition: intsafe.h:52
void * PVOID
Definition: retypes.h:9
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:2364

Referenced by IEffectivePermission_fnQueryInterface(), ISecurityInformation_fnQueryInterface(), and ISecurityObjectTypeInfo_fnQueryInterface().

◆ CRegKeySecurity_fnRelease()

static __inline ULONG CRegKeySecurity_fnRelease ( PCRegKeySecurity  obj)
static

Definition at line 85 of file security.c.

86{
87 ULONG Ret;
88
89 Ret = (ULONG)InterlockedDecrement((LONG*)&obj->ref);
90 if (Ret == 0)
91 {
93 0,
94 obj);
95 }
96
97 return Ret;
98}
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by IEffectivePermission_fnRelease(), ISecurityInformation_fnRelease(), ISecurityObjectTypeInfo_fnRelease(), and RegKeyEditPermissions().

◆ DEFINE_GUID() [1/3]

DEFINE_GUID ( IID_IEffectivePermission  ,
0x3853dc76  ,
0x9f35  ,
0x407c  ,
0x0088  ,
0xa1  ,
0xd1  ,
0x93  ,
0x44  ,
0x36  ,
0x5f  ,
0xbc   
)

◆ DEFINE_GUID() [2/3]

DEFINE_GUID ( IID_IRegKeySecurity  ,
0x965fc360  ,
0x16ff  ,
0x11d0  ,
0x0091  ,
0xcb  ,
0x00  ,
0xaa  ,
0x00  ,
0xbb  ,
0xb7  ,
0x23   
)

◆ DEFINE_GUID() [3/3]

DEFINE_GUID ( IID_ISecurityObjectTypeInfo  ,
0xfc3066eb  ,
0x79ef  ,
0x444b  ,
0x0091  ,
0x11  ,
0xd1  ,
0x8a  ,
0x75  ,
0xeb  ,
0xf2  ,
0xfa   
)

◆ IEffectivePermission_fnAddRef()

static ULONG STDMETHODCALLTYPE IEffectivePermission_fnAddRef ( struct IEffectivePermission *  this)
static

Definition at line 571 of file security.c.

572{
574}
static __inline PCRegKeySecurity impl_from_IEffectivePermission(struct IEffectivePermission *iface)
Definition: security.c:70

Referenced by IEffectivePermission_fnQueryInterface().

◆ IEffectivePermission_fnGetEffectivePermission()

static HRESULT STDMETHODCALLTYPE IEffectivePermission_fnGetEffectivePermission ( struct IEffectivePermission *  this,
const GUID pguidObjectType,
PSID  pUserSid,
LPCWSTR  pszServerName,
PSECURITY_DESCRIPTOR  pSD,
POBJECT_TYPE_LIST ppObjectTypeList,
ULONG pcObjectTypeListLength,
PACCESS_MASK ppGrantedAccessList,
ULONG pcGrantedAccessListLength 
)
static

Definition at line 583 of file security.c.

592{
593 PACL Dacl = NULL;
595 PACCESS_MASK GrantedAccessList;
597 TRUSTEE Trustee = {0};
598 static OBJECT_TYPE_LIST DefObjTypeList = {0};
599
600 *ppObjectTypeList = &DefObjTypeList;
601 *pcObjectTypeListLength = 1;
602
603 BuildTrusteeWithSid(&Trustee,
604 pUserSid);
605
608 &Dacl,
610 {
611 GrantedAccessList = (PACCESS_MASK)LocalAlloc(LMEM_FIXED,
612 sizeof(ACCESS_MASK));
613 if (GrantedAccessList == NULL)
614 {
615 goto Fail;
616 }
617
619 &Trustee,
620 GrantedAccessList);
622 {
623 *ppGrantedAccessList = GrantedAccessList;
624 *pcGrantedAccessListLength = 1;
625 }
626 else
627 LocalFree((HLOCAL)GrantedAccessList);
628 }
629 else
630Fail:
632
634}
#define BuildTrusteeWithSid
Definition: aclapi.h:230
#define GetEffectiveRightsFromAcl
Definition: aclapi.h:232
#define ERROR_SUCCESS
Definition: deptool.c:10
int Fail
Definition: ehthrow.cxx:24
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL Dacl
Definition: rtlfuncs.h:1593
_In_ BOOLEAN DaclPresent
Definition: rtlfuncs.h:1635
_In_ BOOLEAN _In_opt_ PACL _In_opt_ BOOLEAN DaclDefaulted
Definition: rtlfuncs.h:1638
ULONG ACCESS_MASK
Definition: nt_native.h:40
ACCESS_MASK * PACCESS_MASK
Definition: nt_native.h:41
BOOL WINAPI GetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, LPBOOL lpbDaclPresent, PACL *pDacl, LPBOOL lpbDaclDefaulted)
Definition: sec.c:45
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define LMEM_FIXED
Definition: winbase.h:368
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92

◆ IEffectivePermission_fnQueryInterface()

static HRESULT STDMETHODCALLTYPE IEffectivePermission_fnQueryInterface ( struct IEffectivePermission *  this,
REFIID  iid,
PVOID pvObject 
)
static

Definition at line 553 of file security.c.

556{
557 if (IsEqualGUID(iid,
558 &IID_IUnknown))
559 {
560 *pvObject = (PVOID)this;
562 return S_OK;
563 }
564
566 iid,
567 pvObject);
568}
static __inline HRESULT CRegKeySecurity_fnQueryInterface(PCRegKeySecurity obj, REFIID iid, PVOID *pvObject)
Definition: security.c:101
static ULONG STDMETHODCALLTYPE IEffectivePermission_fnAddRef(struct IEffectivePermission *this)
Definition: security.c:571
const GUID IID_IUnknown

◆ IEffectivePermission_fnRelease()

static ULONG STDMETHODCALLTYPE IEffectivePermission_fnRelease ( struct IEffectivePermission *  this)
static

Definition at line 577 of file security.c.

578{
580}
static __inline ULONG CRegKeySecurity_fnRelease(PCRegKeySecurity obj)
Definition: security.c:85

◆ impl_from_IEffectivePermission()

static __inline PCRegKeySecurity impl_from_IEffectivePermission ( struct IEffectivePermission *  iface)
static

Definition at line 70 of file security.c.

71{
73 lpIEffectivePermissionVtbl));
74}
#define ULONG_PTR
Definition: config.h:101

Referenced by IEffectivePermission_fnAddRef(), IEffectivePermission_fnQueryInterface(), and IEffectivePermission_fnRelease().

◆ impl_from_ISecurityInformation()

◆ impl_from_ISecurityObjectTypeInfo()

static __inline PCRegKeySecurity impl_from_ISecurityObjectTypeInfo ( struct ISecurityObjectTypeInfo *  iface)
static

◆ InitializeAclUiDll()

BOOL InitializeAclUiDll ( VOID  )

Definition at line 811 of file security.c.

812{
813 if (!(hAclUiDll = LoadLibraryW(L"aclui.dll")))
814 {
815 return FALSE;
816 }
817
819 "EditSecurity")))
820 {
822 hAclUiDll = NULL;
823 return FALSE;
824 }
825
826 return TRUE;
827}
BOOL(WINAPI * PEDITSECURITY)(HWND hwndOwner, struct ISecurityInformation *psi)
Definition: security.c:804
static PEDITSECURITY pfnEditSecurity
Definition: security.c:807
static HMODULE hAclUiDll
Definition: security.c:808
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
#define LoadLibraryW(x)
Definition: compat.h:747
#define L(x)
Definition: ntvdm.h:50

Referenced by InitInstance().

◆ ISecurityInformation_fnAddRef()

static ULONG STDMETHODCALLTYPE ISecurityInformation_fnAddRef ( struct ISecurityInformation *  this)
static

Definition at line 387 of file security.c.

388{
390}
static __inline PCRegKeySecurity impl_from_ISecurityInformation(struct ISecurityInformation *iface)
Definition: security.c:47

Referenced by ISecurityInformation_fnQueryInterface().

◆ ISecurityInformation_fnGetAccessRights()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetAccessRights ( struct ISecurityInformation *  this,
const GUID pguidObjectType,
DWORD  dwFlags,
PSI_ACCESS ppAccess,
ULONG pcAccesses,
ULONG piDefaultAccess 
)
static

Definition at line 442 of file security.c.

448{
449 *ppAccess = RegAccess;
450 *pcAccesses = ARRAY_SIZE(RegAccess);
451 *piDefaultAccess = RegDefaultAccess;
452 return S_OK;
453}
#define ARRAY_SIZE(a)
Definition: main.h:24
static SI_ACCESS RegAccess[]
Definition: security.c:338
static const DWORD RegDefaultAccess
Definition: security.c:353

◆ ISecurityInformation_fnGetInheritTypes()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetInheritTypes ( struct ISecurityInformation *  this,
PSI_INHERIT_TYPE ppInheritTypes,
ULONG pcInheritTypes 
)
static

Definition at line 468 of file security.c.

471{
473
474 /* FIXME */
475 if (obj->ObjectInfo.dwFlags & SI_CONTAINER)
476 {
477 *ppInheritTypes = RegInheritTypes;
478 *pcInheritTypes = ARRAY_SIZE(RegInheritTypes);
479 return S_OK;
480 }
481
482 return E_NOTIMPL;
483}
#define SI_CONTAINER
Definition: accctrl.h:116
static SI_INHERIT_TYPE RegInheritTypes[]
Definition: security.c:362
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ISecurityInformation_fnGetObjectInformation()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetObjectInformation ( struct ISecurityInformation *  this,
PSI_OBJECT_INFO  pObjectInfo 
)
static

Definition at line 399 of file security.c.

401{
403
404 *pObjectInfo = obj->ObjectInfo;
405 return S_OK;
406}

◆ ISecurityInformation_fnGetSecurity()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetSecurity ( struct ISecurityInformation *  this,
SECURITY_INFORMATION  RequestedInformation,
PSECURITY_DESCRIPTOR ppSecurityDescriptor,
BOOL  fDefault 
)
static

Definition at line 409 of file security.c.

413{
416
419 RequestedInformation,
420 NULL,
421 NULL,
422 NULL,
423 NULL,
424 ppSecurityDescriptor);
425
427}
@ SE_REGISTRY_KEY
Definition: accctrl.h:163
DWORD WINAPI GetNamedSecurityInfoW(LPWSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID *ppsidOwner, PSID *ppsidGroup, PACL *ppDacl, PACL *ppSacl, PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
Definition: misc.c:1147

◆ ISecurityInformation_fnMapGeneric()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnMapGeneric ( struct ISecurityInformation *  this,
const GUID pguidObjectType,
UCHAR pAceFlags,
ACCESS_MASK pMask 
)
static

Definition at line 456 of file security.c.

460{
461 MapGenericMask(pMask,
463 *pMask &= ~SYNCHRONIZE;
464 return S_OK;
465}
static GENERIC_MAPPING RegAccessMasks
Definition: security.c:355
VOID WINAPI MapGenericMask(PDWORD, PGENERIC_MAPPING)

◆ ISecurityInformation_fnPropertySheetPageCallback()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnPropertySheetPageCallback ( struct ISecurityInformation *  this,
HWND  hwnd,
UINT  uMsg,
SI_PAGE_TYPE  uPage 
)
static

Definition at line 486 of file security.c.

490{
491 return S_OK;
492}

◆ ISecurityInformation_fnQueryInterface()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnQueryInterface ( struct ISecurityInformation *  this,
REFIID  iid,
PVOID pvObject 
)
static

Definition at line 369 of file security.c.

372{
373 if (IsEqualGUID(iid,
374 &IID_IUnknown))
375 {
376 *pvObject = (PVOID)this;
378 return S_OK;
379 }
380
382 iid,
383 pvObject);
384}
static ULONG STDMETHODCALLTYPE ISecurityInformation_fnAddRef(struct ISecurityInformation *this)
Definition: security.c:387

◆ ISecurityInformation_fnRelease()

static ULONG STDMETHODCALLTYPE ISecurityInformation_fnRelease ( struct ISecurityInformation *  this)
static

Definition at line 393 of file security.c.

◆ ISecurityInformation_fnSetSecurity()

static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnSetSecurity ( struct ISecurityInformation *  this,
SECURITY_INFORMATION  RequestedInformation,
PSECURITY_DESCRIPTOR  pSecurityDescriptor 
)
static

Definition at line 430 of file security.c.

433{
435
436 /* FIXME */
437 *obj->Btn = TRUE;
438 return S_OK;
439}

◆ ISecurityObjectTypeInfo_fnAddRef()

static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnAddRef ( struct ISecurityObjectTypeInfo *  this)
static

Definition at line 659 of file security.c.

660{
662}
static __inline PCRegKeySecurity impl_from_ISecurityObjectTypeInfo(struct ISecurityObjectTypeInfo *iface)
Definition: security.c:63

Referenced by ISecurityObjectTypeInfo_fnQueryInterface().

◆ ISecurityObjectTypeInfo_fnGetInheritSource()

static HRESULT STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnGetInheritSource ( struct ISecurityObjectTypeInfo *  this,
SECURITY_INFORMATION  si,
PACL  pACL,
PINHERITED_FROM *  ppInheritArray 
)
static

Definition at line 671 of file security.c.

675{
677 PINHERITED_FROM pif, pif2;
678 SIZE_T pifSize;
680 LPWSTR lpBuf;
681
682 pifSize = pACL->AceCount * sizeof(INHERITED_FROM);
683 pif = (PINHERITED_FROM)HeapAlloc(GetProcessHeap(),
684 0,
685 pifSize);
686 if (pif == NULL)
687 {
688 return E_OUTOFMEMORY;
689 }
690
693 si,
694 (obj->ObjectInfo.dwFlags & SI_CONTAINER) != 0,
695 NULL,
696 0,
697 pACL,
698 NULL,
700 pif);
701
703 {
704 /* Calculate the size of the buffer to return */
705 for (i = 0;
706 i < pACL->AceCount;
707 i++)
708 {
709 if (pif[i].AncestorName != NULL)
710 {
711 pifSize += (wcslen(pif[i].AncestorName) + 1) * sizeof(WCHAR);
712 }
713 }
714
715 /* Allocate enough space for the array and the strings */
716 pif2 = (PINHERITED_FROM)LocalAlloc(LMEM_FIXED,
717 pifSize);
718 if (pif2 == NULL)
719 {
721 goto Cleanup;
722 }
723
724 /* copy the array and strings to the buffer */
725 lpBuf = (LPWSTR)((ULONG_PTR)pif2 + (pACL->AceCount * sizeof(INHERITED_FROM)));
726 for (i = 0;
727 i < pACL->AceCount;
728 i++)
729 {
730 pif2[i].GenerationGap = pif[i].GenerationGap;
731 if (pif[i].AncestorName != NULL)
732 {
733 pif2[i].AncestorName = lpBuf;
734 wcscpy(lpBuf,
735 pif[i].AncestorName);
736 lpBuf += wcslen(pif[i].AncestorName) + 1;
737 }
738 else
739 pif2[i].AncestorName = NULL;
740 }
741
742 /* return the newly allocated array */
743 *ppInheritArray = pif2;
744 }
745
746Cleanup:
748 pACL->AceCount,
749 NULL);
751 0,
752 pif);
753
755}
DWORD WINAPI GetInheritanceSourceW(LPWSTR pObjectName, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, BOOL Container, GUID **pObjectClassGuids OPTIONAL, DWORD GuidCount, PACL pAcl, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL, PGENERIC_MAPPING pGenericMapping, PINHERITED_FROMW pInheritArray)
Definition: ac.c:115
DWORD WINAPI FreeInheritedFromArray(PINHERITED_FROMW pInheritArray, USHORT AceCnt, PFN_OBJECT_MGR_FUNCTS pfnArray OPTIONAL)
Definition: ac.c:175
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const WCHAR Cleanup[]
Definition: register.c:80
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
USHORT AceCount
Definition: ms-dtyp.idl:297
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t ULONG_PTR
Definition: typedefs.h:65
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ ISecurityObjectTypeInfo_fnQueryInterface()

static HRESULT STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnQueryInterface ( struct ISecurityObjectTypeInfo *  this,
REFIID  iid,
PVOID pvObject 
)
static

Definition at line 641 of file security.c.

644{
645 if (IsEqualGUID(iid,
646 &IID_IUnknown))
647 {
648 *pvObject = (PVOID)this;
650 return S_OK;
651 }
652
654 iid,
655 pvObject);
656}
static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnAddRef(struct ISecurityObjectTypeInfo *this)
Definition: security.c:659

◆ ISecurityObjectTypeInfo_fnRelease()

static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnRelease ( struct ISecurityObjectTypeInfo *  this)
static

Definition at line 665 of file security.c.

◆ RegKeyEditPermissions()

BOOL RegKeyEditPermissions ( HWND  hWndOwner,
HKEY  hKey,
LPCWSTR  lpMachine,
LPCWSTR  lpKeyName 
)

Definition at line 839 of file security.c.

843{
844 BOOL Result = FALSE;
845 LPCWSTR lphKey = NULL;
846 LPWSTR lpKeyPath = NULL;
847 PCRegKeySecurity RegKeySecurity;
848 SI_OBJECT_INFO ObjectInfo;
849 size_t lnMachine = 0, lnKeyName = 0;
850
851 if (pfnEditSecurity == NULL)
852 {
853 return FALSE;
854 }
855
856 if (lpMachine != NULL)
857 lnMachine = wcslen(lpMachine);
858 if (lpKeyName != NULL)
859 lnKeyName = wcslen(lpKeyName);
860
861 /* build registry path */
862 if (lpMachine != NULL &&
863 (lpMachine[0] == L'\0' ||
864 (lpMachine[0] == L'.' && lpMachine[1] == L'.')))
865 {
866 lnMachine = 0;
867 }
868
869 if (hKey == HKEY_CLASSES_ROOT)
870 lphKey = L"CLASSES_ROOT";
871 else if (hKey == HKEY_CURRENT_USER)
872 lphKey = L"CURRENT_USER";
873 else if (hKey == HKEY_LOCAL_MACHINE)
874 lphKey = L"MACHINE";
875 else if (hKey == HKEY_USERS)
876 lphKey = L"USERS";
877 else if (hKey == HKEY_CURRENT_CONFIG)
878 lphKey = L"CONFIG";
879 else
880 goto Cleanup;
881
882 lpKeyPath = HeapAlloc(GetProcessHeap(),
883 0,
884 (2 + lnMachine + 1 + wcslen(lphKey) + 1 + lnKeyName) * sizeof(WCHAR));
885 if (lpKeyPath == NULL)
886 {
888 goto Cleanup;
889 }
890 lpKeyPath[0] = L'\0';
891
892 if (lnMachine != 0)
893 {
894 wcscat(lpKeyPath,
895 L"\\\\");
896 wcscat(lpKeyPath,
897 lpMachine);
898 wcscat(lpKeyPath,
899 L"\\");
900 }
901
902 wcscat(lpKeyPath,
903 lphKey);
904 if (lpKeyName != NULL && lpKeyName[0] != L'\0')
905 {
906 if (lpKeyName[0] != L'\\')
907 {
908 wcscat(lpKeyPath,
909 L"\\");
910 }
911
912 wcscat(lpKeyPath,
913 lpKeyName);
914 }
915
918 ObjectInfo.hInstance = hInst;
919 ObjectInfo.pszServerName = (LPWSTR)lpMachine;
920 ObjectInfo.pszObjectName = (LPWSTR)lpKeyName; /* FIXME */
921 ObjectInfo.pszPageTitle = (LPWSTR)lpKeyName; /* FIXME */
922
923 if (!(RegKeySecurity = CRegKeySecurity_fnConstructor(lpKeyPath,
924 hKey,
925 &ObjectInfo,
926 &Result)))
927 {
928 goto Cleanup;
929 }
930
931 /* display the security editor dialog */
932 pfnEditSecurity(hWndOwner,
933 impl_to_interface(RegKeySecurity,
934 ISecurityInformation));
935
936 /* dereference the interface, it should be destroyed here */
937 CRegKeySecurity_fnRelease(RegKeySecurity);
938
939Cleanup:
940 if (lpKeyPath != NULL)
941 {
943 0,
944 lpKeyPath);
945 }
946
947 return Result;
948}
#define SI_RESET_DACL_TREE
Definition: accctrl.h:127
#define SI_OWNER_RECURSE
Definition: accctrl.h:122
#define SI_EDIT_ALL
Definition: accctrl.h:136
#define SI_EDIT_PERMS
Definition: accctrl.h:113
#define SI_EDIT_EFFECTIVE
Definition: accctrl.h:130
#define SI_RESET_SACL_TREE
Definition: accctrl.h:128
#define SI_ADVANCED
Definition: accctrl.h:118
static PCRegKeySecurity CRegKeySecurity_fnConstructor(LPWSTR lpRegKey, HKEY hRootKey, SI_OBJECT_INFO *ObjectInfo, BOOL *Btn)
Definition: security.c:762
HINSTANCE hInst
Definition: dxdiag.c:13
FxAutoRegKey hKey
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
LPWSTR pszObjectName
Definition: accctrl.h:391
LPWSTR pszPageTitle
Definition: accctrl.h:392
DWORD dwFlags
Definition: accctrl.h:388
HINSTANCE hInstance
Definition: accctrl.h:389
LPWSTR pszServerName
Definition: accctrl.h:390
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define HKEY_CURRENT_CONFIG
Definition: winreg.h:15
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
#define HKEY_USERS
Definition: winreg.h:13
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by _CmdWndProc().

◆ UnloadAclUiDll()

VOID UnloadAclUiDll ( VOID  )

Definition at line 830 of file security.c.

831{
832 if (hAclUiDll != NULL)
833 {
835 }
836}

Referenced by ExitInstance().

Variable Documentation

◆ hAclUiDll

HMODULE hAclUiDll
static

Definition at line 808 of file security.c.

Referenced by InitializeAclUiDll(), and UnloadAclUiDll().

◆ pfnEditSecurity

PEDITSECURITY pfnEditSecurity
static

Definition at line 807 of file security.c.

Referenced by InitializeAclUiDll(), and RegKeyEditPermissions().

◆ RegAccess

SI_ACCESS RegAccess[]
static
Initial value:
= {
}
#define SI_ACCESS_SPECIFIC
Definition: accctrl.h:138
#define SI_ACCESS_GENERAL
Definition: accctrl.h:139
#define IDS_ACCESS_CREATELINK
Definition: resource.h:179
#define IDS_ACCESS_WRITEOWNER
Definition: resource.h:182
#define IDS_ACCESS_READ
Definition: resource.h:173
#define IDS_ACCESS_READCONTROL
Definition: resource.h:183
#define IDS_ACCESS_SETVALUE
Definition: resource.h:175
#define IDS_ACCESS_ENUMERATESUBKEYS
Definition: resource.h:177
#define IDS_ACCESS_NOTIFY
Definition: resource.h:178
#define IDS_ACCESS_FULLCONTROL
Definition: resource.h:172
#define IDS_ACCESS_QUERYVALUE
Definition: resource.h:174
#define IDS_ACCESS_WRITEDAC
Definition: resource.h:181
#define IDS_ACCESS_CREATESUBKEY
Definition: resource.h:176
#define IDS_ACCESS_DELETE
Definition: resource.h:180
#define GUID_NULL
Definition: ks.h:106
#define WRITE_DAC
Definition: nt_native.h:59
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_CREATE_SUB_KEY
Definition: nt_native.h:1018
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define KEY_ENUMERATE_SUB_KEYS
Definition: nt_native.h:1019
#define DELETE
Definition: nt_native.h:57
#define READ_CONTROL
Definition: nt_native.h:58
#define WRITE_OWNER
Definition: nt_native.h:60
#define KEY_CREATE_LINK
Definition: nt_native.h:1021
#define KEY_NOTIFY
Definition: nt_native.h:1020
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Definition at line 338 of file security.c.

Referenced by ISecurityInformation_fnGetAccessRights().

◆ RegAccessMasks

GENERIC_MAPPING RegAccessMasks
static
Initial value:
= {
}
#define KEY_EXECUTE
Definition: nt_native.h:1037
#define KEY_WRITE
Definition: nt_native.h:1031

Definition at line 355 of file security.c.

Referenced by ISecurityInformation_fnMapGeneric(), and ISecurityObjectTypeInfo_fnGetInheritSource().

◆ RegDefaultAccess

const DWORD RegDefaultAccess = 1
static

Definition at line 353 of file security.c.

Referenced by ISecurityInformation_fnGetAccessRights().

◆ RegInheritTypes

SI_INHERIT_TYPE RegInheritTypes[]
static
Initial value:

Definition at line 362 of file security.c.

Referenced by ISecurityInformation_fnGetInheritTypes().

◆ vtblIEffectivePermission

const struct ifaceIEffectivePermissionVbtl vtblIEffectivePermission
static
Initial value:
=
{
}
static HRESULT STDMETHODCALLTYPE IEffectivePermission_fnQueryInterface(struct IEffectivePermission *this, REFIID iid, PVOID *pvObject)
Definition: security.c:553
static HRESULT STDMETHODCALLTYPE IEffectivePermission_fnGetEffectivePermission(struct IEffectivePermission *this, const GUID *pguidObjectType, PSID pUserSid, LPCWSTR pszServerName, PSECURITY_DESCRIPTOR pSD, POBJECT_TYPE_LIST *ppObjectTypeList, ULONG *pcObjectTypeListLength, PACCESS_MASK *ppGrantedAccessList, ULONG *pcGrantedAccessListLength)
Definition: security.c:583
static ULONG STDMETHODCALLTYPE IEffectivePermission_fnRelease(struct IEffectivePermission *this)
Definition: security.c:577

Definition at line 288 of file security.c.

Referenced by CRegKeySecurity_fnConstructor().

◆ vtblISecurityInformation

const struct ifaceISecurityInformationVbtl vtblISecurityInformation
static
Initial value:
=
{
}
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnQueryInterface(struct ISecurityInformation *this, REFIID iid, PVOID *pvObject)
Definition: security.c:369
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetSecurity(struct ISecurityInformation *this, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR *ppSecurityDescriptor, BOOL fDefault)
Definition: security.c:409
static ULONG STDMETHODCALLTYPE ISecurityInformation_fnRelease(struct ISecurityInformation *this)
Definition: security.c:393
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnMapGeneric(struct ISecurityInformation *this, const GUID *pguidObjectType, UCHAR *pAceFlags, ACCESS_MASK *pMask)
Definition: security.c:456
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnSetSecurity(struct ISecurityInformation *this, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
Definition: security.c:430
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetObjectInformation(struct ISecurityInformation *this, PSI_OBJECT_INFO pObjectInfo)
Definition: security.c:399
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetInheritTypes(struct ISecurityInformation *this, PSI_INHERIT_TYPE *ppInheritTypes, ULONG *pcInheritTypes)
Definition: security.c:468
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnPropertySheetPageCallback(struct ISecurityInformation *this, HWND hwnd, UINT uMsg, SI_PAGE_TYPE uPage)
Definition: security.c:486
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetAccessRights(struct ISecurityInformation *this, const GUID *pguidObjectType, DWORD dwFlags, PSI_ACCESS *ppAccess, ULONG *pcAccesses, ULONG *piDefaultAccess)
Definition: security.c:442

Definition at line 202 of file security.c.

Referenced by CRegKeySecurity_fnConstructor().

◆ vtblISecurityObjectTypeInfo

const struct ifaceISecurityObjectTypeInfoVbtl vtblISecurityObjectTypeInfo
static
Initial value:
=
{
}
static HRESULT STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnQueryInterface(struct ISecurityObjectTypeInfo *this, REFIID iid, PVOID *pvObject)
Definition: security.c:641
static HRESULT STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnGetInheritSource(struct ISecurityObjectTypeInfo *this, SECURITY_INFORMATION si, PACL pACL, PINHERITED_FROM *ppInheritArray)
Definition: security.c:671
static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnRelease(struct ISecurityObjectTypeInfo *this)
Definition: security.c:665

Definition at line 322 of file security.c.

Referenced by CRegKeySecurity_fnConstructor().