ReactOS 0.4.16-dev-197-g92996da
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 63 of file security.c.

◆ INITGUID

#define INITGUID

Definition at line 10 of file security.c.

Typedef Documentation

◆ CHANGE_CONTEXT

◆ PCHANGE_CONTEXT

◆ PEDITSECURITY

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

Definition at line 758 of file security.c.

Function Documentation

◆ CRegKeySecurity_fnAddRef()

static __inline ULONG CRegKeySecurity_fnAddRef ( PCRegKeySecurity  obj)
static

Definition at line 66 of file security.c.

67{
68 return (ULONG)InterlockedIncrement((LONG*)&obj->ref);
69}
#define InterlockedIncrement
Definition: armddk.h:53
long LONG
Definition: pedump.c:60
uint32_t ULONG
Definition: typedefs.h:59

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 717 of file security.c.

721{
723
727 szRegKey[wcslen(lpRegKey) + 1]));
728 if (obj != NULL)
729 {
730 obj->ref = 1;
731 obj->lpISecurityInformationVtbl = &vtblISecurityInformation;
732#if REGEDIT_IMPLEMENT_ISECURITYINFORMATION2
733 obj->lpISecurityInformation2Vtbl = &vtblISecurityInformation2;
734#endif
735 obj->lpIEffectivePermissionVtbl = &vtblIEffectivePermission;
736 obj->lpISecurityObjectTypeInfoVtbl = &vtblISecurityObjectTypeInfo;
737 obj->ObjectInfo = *ObjectInfo;
738 obj->Btn = Btn;
739 obj->hRootKey = hRootKey;
740 StringCbCopyW(obj->szRegKey, sizeof(obj->szRegKey), lpRegKey);
741 }
742 else
744
745 return obj;
746}
static const struct ifaceIEffectivePermissionVbtl vtblIEffectivePermission
Definition: security.c:265
static const struct ifaceISecurityInformationVbtl vtblISecurityInformation
Definition: security.c:179
static const struct ifaceISecurityObjectTypeInfoVbtl vtblISecurityObjectTypeInfo
Definition: security.c:299
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)
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
#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 86 of file security.c.

89{
90 PVOID pvObj = NULL;
91
92 if (IsEqualGUID(iid, &IID_IRegKeySecurity))
93 {
94 pvObj = (PVOID)impl_to_interface(obj, ISecurityInformation);
95 }
96#if REGEDIT_IMPLEMENT_ISECURITYINFORMATION2
97 else if (IsEqualGUID(iid, &IID_IRegKeySecurity2))
98 {
99 pvObj = (PVOID)impl_to_interface(obj, ISecurityInformation2);
100 }
101#endif
102 else if (IsEqualGUID(iid, &IID_IEffectivePermission))
103 {
104 pvObj = (PVOID)impl_to_interface(obj, IEffectivePermission);
105 }
106 else if (IsEqualGUID(iid, &IID_ISecurityObjectTypeInfo))
107 {
108 pvObj = (PVOID)impl_to_interface(obj, ISecurityObjectTypeInfo);
109 }
110
111 if (pvObj == NULL)
112 {
113 return E_NOINTERFACE;
114 }
115
116 *pvObject = pvObj;
118
119 return S_OK;
120}
static __inline ULONG CRegKeySecurity_fnAddRef(PCRegKeySecurity obj)
Definition: security.c:66
#define impl_to_interface(impl, iface)
Definition: security.c:63
#define S_OK
Definition: intsafe.h:52
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
void * PVOID
Definition: typedefs.h:50
#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 72 of file security.c.

73{
74 ULONG Ret;
75
76 Ret = (ULONG)InterlockedDecrement((LONG*)&obj->ref);
77 if (Ret == 0)
78 {
80 }
81
82 return Ret;
83}
#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 544 of file security.c.

545{
547}
static __inline PCRegKeySecurity impl_from_IEffectivePermission(struct IEffectivePermission *iface)
Definition: security.c:57

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 556 of file security.c.

565{
566 PACL Dacl = NULL;
568 PACCESS_MASK GrantedAccessList;
570 TRUSTEE Trustee = {0};
571 static OBJECT_TYPE_LIST DefObjTypeList = {0};
572
573 *ppObjectTypeList = &DefObjTypeList;
574 *pcObjectTypeListLength = 1;
575
576 BuildTrusteeWithSid(&Trustee, pUserSid);
577
580 &Dacl,
582 {
583 GrantedAccessList = (PACCESS_MASK)LocalAlloc(LMEM_FIXED,
584 sizeof(ACCESS_MASK));
585 if (GrantedAccessList == NULL)
586 {
587 goto Fail;
588 }
589
591 &Trustee,
592 GrantedAccessList);
594 {
595 *ppGrantedAccessList = GrantedAccessList;
596 *pcGrantedAccessListLength = 1;
597 }
598 else
599 LocalFree((HLOCAL)GrantedAccessList);
600 }
601 else
602Fail:
604
606}
#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:1390
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
_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:1605
_In_ BOOLEAN DaclPresent
Definition: rtlfuncs.h:1647
_In_ BOOLEAN _In_opt_ PACL _In_opt_ BOOLEAN DaclDefaulted
Definition: rtlfuncs.h:1650
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:1042
#define LMEM_FIXED
Definition: winbase.h:393
#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 527 of file security.c.

530{
531 if (IsEqualGUID(iid, &IID_IUnknown))
532 {
533 *pvObject = (PVOID)this;
535 return S_OK;
536 }
537
539 iid,
540 pvObject);
541}
static __inline HRESULT CRegKeySecurity_fnQueryInterface(PCRegKeySecurity obj, REFIID iid, PVOID *pvObject)
Definition: security.c:86
static ULONG STDMETHODCALLTYPE IEffectivePermission_fnAddRef(struct IEffectivePermission *this)
Definition: security.c:544
const GUID IID_IUnknown

◆ IEffectivePermission_fnRelease()

static ULONG STDMETHODCALLTYPE IEffectivePermission_fnRelease ( struct IEffectivePermission *  this)
static

Definition at line 550 of file security.c.

551{
553}
static __inline ULONG CRegKeySecurity_fnRelease(PCRegKeySecurity obj)
Definition: security.c:72

◆ impl_from_IEffectivePermission()

static __inline PCRegKeySecurity impl_from_IEffectivePermission ( struct IEffectivePermission *  iface)
static

Definition at line 57 of file security.c.

58{
60 lpIEffectivePermissionVtbl));
61}
#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 765 of file security.c.

766{
767 if (!(hAclUiDll = LoadLibraryW(L"aclui.dll")))
768 {
769 return FALSE;
770 }
771
773 "EditSecurity")))
774 {
776 hAclUiDll = NULL;
777 return FALSE;
778 }
779
780 return TRUE;
781}
BOOL(WINAPI * PEDITSECURITY)(HWND hwndOwner, struct ISecurityInformation *psi)
Definition: security.c:758
static PEDITSECURITY pfnEditSecurity
Definition: security.c:761
static HMODULE hAclUiDll
Definition: security.c:762
#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 363 of file security.c.

364{
366}
static __inline PCRegKeySecurity impl_from_ISecurityInformation(struct ISecurityInformation *iface)
Definition: security.c:34

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 418 of file security.c.

424{
425 *ppAccess = RegAccess;
426 *pcAccesses = ARRAY_SIZE(RegAccess);
427 *piDefaultAccess = RegDefaultAccess;
428 return S_OK;
429}
#define ARRAY_SIZE(A)
Definition: main.h:20
static SI_ACCESS RegAccess[]
Definition: security.c:315
static const DWORD RegDefaultAccess
Definition: security.c:330

◆ ISecurityInformation_fnGetInheritTypes()

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

Definition at line 443 of file security.c.

446{
448
449 /* FIXME */
450 if (obj->ObjectInfo.dwFlags & SI_CONTAINER)
451 {
452 *ppInheritTypes = RegInheritTypes;
453 *pcInheritTypes = ARRAY_SIZE(RegInheritTypes);
454 return S_OK;
455 }
456
457 return E_NOTIMPL;
458}
#define SI_CONTAINER
Definition: accctrl.h:116
static SI_INHERIT_TYPE RegInheritTypes[]
Definition: security.c:339
#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 375 of file security.c.

377{
379
380 *pObjectInfo = obj->ObjectInfo;
381 return S_OK;
382}

◆ ISecurityInformation_fnGetSecurity()

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

Definition at line 385 of file security.c.

389{
392
395 RequestedInformation,
396 NULL,
397 NULL,
398 NULL,
399 NULL,
400 ppSecurityDescriptor);
401
403}
@ 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 432 of file security.c.

436{
438 *pMask &= ~SYNCHRONIZE;
439 return S_OK;
440}
static GENERIC_MAPPING RegAccessMasks
Definition: security.c:332
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 461 of file security.c.

465{
466 return S_OK;
467}

◆ ISecurityInformation_fnQueryInterface()

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

Definition at line 346 of file security.c.

349{
350 if (IsEqualGUID(iid, &IID_IUnknown))
351 {
352 *pvObject = (PVOID)this;
354 return S_OK;
355 }
356
358 iid,
359 pvObject);
360}
static ULONG STDMETHODCALLTYPE ISecurityInformation_fnAddRef(struct ISecurityInformation *this)
Definition: security.c:363

◆ ISecurityInformation_fnRelease()

static ULONG STDMETHODCALLTYPE ISecurityInformation_fnRelease ( struct ISecurityInformation *  this)
static

Definition at line 369 of file security.c.

◆ ISecurityInformation_fnSetSecurity()

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

Definition at line 406 of file security.c.

409{
411
412 /* FIXME */
413 *obj->Btn = TRUE;
414 return S_OK;
415}

◆ ISecurityObjectTypeInfo_fnAddRef()

static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnAddRef ( struct ISecurityObjectTypeInfo *  this)
static

Definition at line 630 of file security.c.

631{
633}
static __inline PCRegKeySecurity impl_from_ISecurityObjectTypeInfo(struct ISecurityObjectTypeInfo *iface)
Definition: security.c:50

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 642 of file security.c.

646{
648 PINHERITED_FROM pif, pif2;
649 SIZE_T pifSize;
651 LPWSTR lpBuf;
652
653 pifSize = pACL->AceCount * sizeof(INHERITED_FROM);
654 pif = (PINHERITED_FROM)HeapAlloc(GetProcessHeap(), 0, pifSize);
655 if (pif == NULL)
656 return E_OUTOFMEMORY;
657
660 si,
661 (obj->ObjectInfo.dwFlags & SI_CONTAINER) != 0,
662 NULL,
663 0,
664 pACL,
665 NULL,
667 pif);
669 {
670 /* Calculate the size of the buffer to return */
671 for (i = 0; i < pACL->AceCount; i++)
672 {
673 if (pif[i].AncestorName != NULL)
674 pifSize += (wcslen(pif[i].AncestorName) + 1) * sizeof(WCHAR);
675 }
676
677 /* Allocate enough space for the array and the strings */
678 pif2 = (PINHERITED_FROM)LocalAlloc(LMEM_FIXED, pifSize);
679 if (pif2 == NULL)
680 {
682 goto Cleanup;
683 }
684
685 /* copy the array and strings to the buffer */
686 lpBuf = (LPWSTR)((ULONG_PTR)pif2 + (pACL->AceCount * sizeof(INHERITED_FROM)));
687 for (i = 0; i < pACL->AceCount; i++)
688 {
689 pif2[i].GenerationGap = pif[i].GenerationGap;
690 if (pif[i].AncestorName != NULL)
691 {
692 pif2[i].AncestorName = lpBuf;
693 wcscpy(lpBuf,
694 pif[i].AncestorName);
695 lpBuf += wcslen(pif[i].AncestorName) + 1;
696 }
697 else
698 pif2[i].AncestorName = NULL;
699 }
700
701 /* return the newly allocated array */
702 *ppInheritArray = pif2;
703 }
704
705Cleanup:
707 HeapFree(GetProcessHeap(), 0, pif);
708
710}
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
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
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 613 of file security.c.

616{
617 if (IsEqualGUID(iid, &IID_IUnknown))
618 {
619 *pvObject = (PVOID)this;
621 return S_OK;
622 }
623
625 iid,
626 pvObject);
627}
static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnAddRef(struct ISecurityObjectTypeInfo *this)
Definition: security.c:630

◆ ISecurityObjectTypeInfo_fnRelease()

static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnRelease ( struct ISecurityObjectTypeInfo *  this)
static

Definition at line 636 of file security.c.

◆ RegKeyEditPermissions()

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

Definition at line 793 of file security.c.

797{
798 BOOL Result = FALSE;
799 LPCWSTR lphKey = NULL;
800 LPWSTR lpKeyPath = NULL;
801 PCRegKeySecurity RegKeySecurity;
802 SI_OBJECT_INFO ObjectInfo;
803 size_t lnMachine = 0, lnKeyName = 0;
804
805 if (pfnEditSecurity == NULL)
806 {
807 return FALSE;
808 }
809
810 if (lpMachine != NULL)
811 lnMachine = wcslen(lpMachine);
812 if (lpKeyName != NULL)
813 lnKeyName = wcslen(lpKeyName);
814
815 /* build registry path */
816 if (lpMachine != NULL &&
817 (lpMachine[0] == L'\0' ||
818 (lpMachine[0] == L'.' && lpMachine[1] == L'.')))
819 {
820 lnMachine = 0;
821 }
822
823 if (hKey == HKEY_CLASSES_ROOT)
824 lphKey = L"CLASSES_ROOT";
825 else if (hKey == HKEY_CURRENT_USER)
826 lphKey = L"CURRENT_USER";
827 else if (hKey == HKEY_LOCAL_MACHINE)
828 lphKey = L"MACHINE";
829 else if (hKey == HKEY_USERS)
830 lphKey = L"USERS";
831 else if (hKey == HKEY_CURRENT_CONFIG)
832 lphKey = L"CONFIG";
833 else
834 goto Cleanup;
835
836 lpKeyPath = HeapAlloc(GetProcessHeap(),
837 0,
838 (2 + lnMachine + 1 + wcslen(lphKey) + 1 + lnKeyName) * sizeof(WCHAR));
839 if (lpKeyPath == NULL)
840 {
842 goto Cleanup;
843 }
844 lpKeyPath[0] = L'\0';
845
846 if (lnMachine != 0)
847 {
848 wcscat(lpKeyPath, L"\\\\");
849 wcscat(lpKeyPath, lpMachine);
850 wcscat(lpKeyPath, L"\\");
851 }
852
853 wcscat(lpKeyPath, lphKey);
854 if (lpKeyName != NULL && lpKeyName[0] != L'\0')
855 {
856 if (lpKeyName[0] != L'\\')
857 wcscat(lpKeyPath, L"\\");
858
859 wcscat(lpKeyPath, lpKeyName);
860 }
861
864 ObjectInfo.hInstance = hInst;
865 ObjectInfo.pszServerName = (LPWSTR)lpMachine;
866 ObjectInfo.pszObjectName = (LPWSTR)lpKeyName; /* FIXME */
867 ObjectInfo.pszPageTitle = (LPWSTR)lpKeyName; /* FIXME */
868
869 if (!(RegKeySecurity = CRegKeySecurity_fnConstructor(lpKeyPath,
870 hKey,
871 &ObjectInfo,
872 &Result)))
873 {
874 goto Cleanup;
875 }
876
877 /* display the security editor dialog */
878 pfnEditSecurity(hWndOwner, impl_to_interface(RegKeySecurity, ISecurityInformation));
879
880 /* dereference the interface, it should be destroyed here */
881 CRegKeySecurity_fnRelease(RegKeySecurity);
882
883Cleanup:
884 if (lpKeyPath != NULL)
885 HeapFree(GetProcessHeap(), 0, lpKeyPath);
886
887 return Result;
888}
#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:717
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:409
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by _CmdWndProc().

◆ UnloadAclUiDll()

VOID UnloadAclUiDll ( VOID  )

Definition at line 784 of file security.c.

785{
786 if (hAclUiDll != NULL)
787 {
789 }
790}

Referenced by ExitInstance().

Variable Documentation

◆ hAclUiDll

HMODULE hAclUiDll
static

Definition at line 762 of file security.c.

Referenced by InitializeAclUiDll(), and UnloadAclUiDll().

◆ pfnEditSecurity

PEDITSECURITY pfnEditSecurity
static

Definition at line 761 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:134
#define IDS_ACCESS_WRITEOWNER
Definition: resource.h:137
#define IDS_ACCESS_READ
Definition: resource.h:128
#define IDS_ACCESS_READCONTROL
Definition: resource.h:138
#define IDS_ACCESS_SETVALUE
Definition: resource.h:130
#define IDS_ACCESS_ENUMERATESUBKEYS
Definition: resource.h:132
#define IDS_ACCESS_NOTIFY
Definition: resource.h:133
#define IDS_ACCESS_FULLCONTROL
Definition: resource.h:127
#define IDS_ACCESS_QUERYVALUE
Definition: resource.h:129
#define IDS_ACCESS_WRITEDAC
Definition: resource.h:136
#define IDS_ACCESS_CREATESUBKEY
Definition: resource.h:131
#define IDS_ACCESS_DELETE
Definition: resource.h:135
#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 315 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 332 of file security.c.

Referenced by ISecurityInformation_fnMapGeneric(), and ISecurityObjectTypeInfo_fnGetInheritSource().

◆ RegDefaultAccess

const DWORD RegDefaultAccess = 1
static

Definition at line 330 of file security.c.

Referenced by ISecurityInformation_fnGetAccessRights().

◆ RegInheritTypes

SI_INHERIT_TYPE RegInheritTypes[]
static
Initial value:

Definition at line 339 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:527
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:556
static ULONG STDMETHODCALLTYPE IEffectivePermission_fnRelease(struct IEffectivePermission *this)
Definition: security.c:550

Definition at line 265 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:346
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetSecurity(struct ISecurityInformation *this, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR *ppSecurityDescriptor, BOOL fDefault)
Definition: security.c:385
static ULONG STDMETHODCALLTYPE ISecurityInformation_fnRelease(struct ISecurityInformation *this)
Definition: security.c:369
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnMapGeneric(struct ISecurityInformation *this, const GUID *pguidObjectType, UCHAR *pAceFlags, ACCESS_MASK *pMask)
Definition: security.c:432
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnSetSecurity(struct ISecurityInformation *this, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor)
Definition: security.c:406
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetObjectInformation(struct ISecurityInformation *this, PSI_OBJECT_INFO pObjectInfo)
Definition: security.c:375
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetInheritTypes(struct ISecurityInformation *this, PSI_INHERIT_TYPE *ppInheritTypes, ULONG *pcInheritTypes)
Definition: security.c:443
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnPropertySheetPageCallback(struct ISecurityInformation *this, HWND hwnd, UINT uMsg, SI_PAGE_TYPE uPage)
Definition: security.c:461
static HRESULT STDMETHODCALLTYPE ISecurityInformation_fnGetAccessRights(struct ISecurityInformation *this, const GUID *pguidObjectType, DWORD dwFlags, PSI_ACCESS *ppAccess, ULONG *pcAccesses, ULONG *piDefaultAccess)
Definition: security.c:418

Definition at line 179 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:613
static HRESULT STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnGetInheritSource(struct ISecurityObjectTypeInfo *this, SECURITY_INFORMATION si, PACL pACL, PINHERITED_FROM *ppInheritArray)
Definition: security.c:642
static ULONG STDMETHODCALLTYPE ISecurityObjectTypeInfo_fnRelease(struct ISecurityObjectTypeInfo *this)
Definition: security.c:636

Definition at line 299 of file security.c.

Referenced by CRegKeySecurity_fnConstructor().