- Improvement of the security interfaces implementation in regedit.

- Fix winetests/advapi32
- Patch by Thomas Weidenmueller (w3seek)

svn path=/trunk/; revision=21247
This commit is contained in:
Aleksey Bragin 2006-03-08 12:57:21 +00:00
parent 95558d0f30
commit 66ef58378d
6 changed files with 1051 additions and 363 deletions

View file

@ -963,14 +963,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
CopyKeyName(hWnd, hKeyRoot, keyPath);
break;
case ID_EDIT_PERMISSIONS:
if(keyPath != NULL && _tcslen(keyPath) > 0)
{
RegKeyEditPermissions(hWnd, hKey, NULL, keyPath);
}
else
{
MessageBeep(MB_ICONASTERISK);
}
RegKeyEditPermissions(hWnd, hKeyRoot, NULL, keyPath);
break;
case ID_REGISTRY_PRINTERSETUP:
/*PRINTDLG pd;*/

View file

@ -16,6 +16,7 @@
#include <basetyps.h>
#include <unknwn.h>
#include <aclui.h>
#include <aclapi.h>
#include <commdlg.h>
#include <cderr.h>
#include <ole2.h>

File diff suppressed because it is too large Load diff

View file

@ -7,93 +7,152 @@ InitializeAclUiDll(VOID);
VOID
UnloadAclUiDll(VOID);
#define REGEDIT_IMPLEMENT_ISECURITYINFORMATION2 0
/******************************************************************************
ISecurityInformation
******************************************************************************/
typedef struct ISecurityInformation *LPSECURITYINFORMATION;
typedef struct ifaceISecuritInformationVbtl ifaceISecurityInformationVbtl;
struct ifaceISecurityInformationVbtl
{
/* IUnknown */
HRESULT (STDMETHODCALLTYPE *QueryInterface)(struct ISecurityInformation *this,
REFIID iid,
PVOID *pvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(struct ISecurityInformation *this);
ULONG (STDMETHODCALLTYPE *Release)(struct ISecurityInformation *this);
/* ISecurityInformation */
HRESULT (STDMETHODCALLTYPE *GetObjectInformation)(struct ISecurityInformation *this,
PSI_OBJECT_INFO pObjectInfo);
HRESULT (STDMETHODCALLTYPE *GetSecurity)(struct ISecurityInformation *this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor,
BOOL fDefault);
HRESULT (STDMETHODCALLTYPE *SetSecurity)(struct ISecurityInformation *this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor);
HRESULT (STDMETHODCALLTYPE *GetAccessRights)(struct ISecurityInformation *this,
const GUID* pguidObjectType,
DWORD dwFlags,
PSI_ACCESS* ppAccess,
ULONG* pcAccesses,
ULONG* piDefaultAccess);
HRESULT (STDMETHODCALLTYPE *MapGeneric)(struct ISecurityInformation *this,
const GUID* pguidObjectType,
UCHAR* pAceFlags,
ACCESS_MASK* pMask);
HRESULT (STDMETHODCALLTYPE *GetInheritTypes)(struct ISecurityInformation *this,
PSI_INHERIT_TYPE* ppInheritTypes,
ULONG* pcInheritTypes);
HRESULT (STDMETHODCALLTYPE *PropertySheetPageCallback)(struct ISecurityInformation *this,
HWND hwnd,
UINT uMsg,
SI_PAGE_TYPE uPage);
};
#if REGEDIT_IMPLEMENT_ISECURITYINFORMATION2
/******************************************************************************
ISecurityInformation2
******************************************************************************/
typedef struct ISecurityInformation2 *LPSECURITYINFORMATION2;
typedef struct ifaceISecurityInformation2Vbtl ifaceISecurityInformation2Vbtl;
struct ifaceISecurityInformation2Vbtl
{
/* IUnknown */
HRESULT (STDMETHODCALLTYPE *QueryInterface)(struct ISecurityInformation2 *this,
REFIID iid,
PVOID *pvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(struct ISecurityInformation2 *this);
ULONG (STDMETHODCALLTYPE *Release)(struct ISecurityInformation2 *this);
/* ISecurityInformation2 */
BOOL (STDMETHODCALLTYPE *IsDaclCanonical)(struct ISecurityInformation2 *this,
PACL pDacl);
HRESULT (STDMETHODCALLTYPE *LookupSids)(struct ISecurityInformation2 *this,
ULONG cSids,
PSID* rgpSids,
LPDATAOBJECT* ppdo);
};
#endif
/******************************************************************************
IEffectivePermission
******************************************************************************/
typedef struct IEffectivePermission *LPEFFECTIVEPERMISSION;
typedef struct ifaceIEffectivePermissionVbtl ifaceIEffectivePermissionVbtl;
struct ifaceIEffectivePermissionVbtl
{
/* IUnknown */
HRESULT (STDMETHODCALLTYPE *QueryInterface)(struct IEffectivePermission *this,
REFIID iid,
PVOID *pvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(struct IEffectivePermission *this);
ULONG (STDMETHODCALLTYPE *Release)(struct IEffectivePermission *this);
/* IEffectivePermission */
HRESULT (STDMETHODCALLTYPE *GetEffectivePermission)(struct IEffectivePermission *this,
const GUID* pguidObjectType,
PSID pUserSid,
LPCWSTR pszServerName,
PSECURITY_DESCRIPTOR pSD,
POBJECT_TYPE_LIST* ppObjectTypeList,
ULONG* pcObjectTypeListLength,
PACCESS_MASK* ppGrantedAccessList,
ULONG* pcGrantedAccessListLength);
};
/******************************************************************************
ISecurityObjectTypeInfo
******************************************************************************/
typedef struct ISecurityObjectTypeInfo *LPSECURITYOBJECTTYPEINFO;
typedef struct ifaceISecurityObjectTypeInfoVbtl ifaceISecurityObjectTypeInfoVbtl;
struct ifaceISecurityObjectTypeInfoVbtl
{
/* IUnknown */
HRESULT (STDMETHODCALLTYPE *QueryInterface)(struct ISecurityObjectTypeInfo *this,
REFIID iid,
PVOID *pvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(struct ISecurityObjectTypeInfo *this);
ULONG (STDMETHODCALLTYPE *Release)(struct ISecurityObjectTypeInfo *this);
/* ISecurityObjectTypeInfo */
HRESULT (STDMETHODCALLTYPE *GetInheritSource)(struct ISecurityObjectTypeInfo *this,
SECURITY_INFORMATION si,
PACL pACL,
PINHERITED_FROM* ppInheritArray);
};
/******************************************************************************
CRegKeySecurity
******************************************************************************/
typedef struct CRegKeySecurity *LPREGKEYSECURITY;
typedef struct ifaceCRegKeySecurityVbtl ifaceCRegKeySecurityVbtl;
struct ifaceCRegKeySecurityVbtl
typedef struct _CRegKeySecurity
{
/* IUnknown */
HRESULT (STDMETHODCALLTYPE *QueryInterface)(LPREGKEYSECURITY this,
REFIID iid,
PVOID *pvObject);
ULONG (STDMETHODCALLTYPE *AddRef)(LPREGKEYSECURITY this);
ULONG (STDMETHODCALLTYPE *Release)(LPREGKEYSECURITY this);
/* IUnknown fields and interfaces */
const struct ifaceISecurityInformationVbtl *lpISecurityInformationVtbl;
#if REGEDIT_IMPLEMENT_ISECURITYINFORMATION2
const struct ifaceISecurityInformation2Vbtl *lpISecurityInformation2Vtbl;
#endif
const struct ifaceIEffectivePermissionVbtl *lpIEffectivePermissionVtbl;
const struct ifaceISecurityObjectTypeInfoVbtl *lpISecurityObjectTypeInfoVtbl;
DWORD ref;
/* CRegKeySecurity */
HRESULT (STDMETHODCALLTYPE *GetObjectInformation)(LPREGKEYSECURITY this,
PSI_OBJECT_INFO pObjectInfo);
HRESULT (STDMETHODCALLTYPE *GetSecurity)(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor,
BOOL fDefault);
HRESULT (STDMETHODCALLTYPE *SetSecurity)(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor);
HRESULT (STDMETHODCALLTYPE *GetAccessRights)(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
DWORD dwFlags,
PSI_ACCESS* ppAccess,
ULONG* pcAccesses,
ULONG* piDefaultAccess);
HRESULT (STDMETHODCALLTYPE *MapGeneric)(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
UCHAR* pAceFlags,
ACCESS_MASK* pMask);
HRESULT (STDMETHODCALLTYPE *GetInheritTypes)(LPREGKEYSECURITY this,
PSI_INHERIT_TYPE* ppInheritTypes,
ULONG* pcInheritTypes);
HRESULT (STDMETHODCALLTYPE *PropertySheetPageCallback)(LPREGKEYSECURITY this,
HWND hwnd,
UINT uMsg,
SI_PAGE_TYPE uPage);
};
typedef struct CRegKeySecurity
{
/* IUnknown fields */
ifaceCRegKeySecurityVbtl* lpVtbl;
DWORD ref;
/* CRegKeySecurity fields */
HANDLE Handle;
SI_OBJECT_INFO ObjectInfo;
BOOL *Btn;
} REGKEYSECURITY;
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnQueryInterface(LPREGKEYSECURITY this,
REFIID iid,
PVOID *pvObject);
ULONG STDMETHODCALLTYPE CRegKeySecurity_fnAddRef(LPREGKEYSECURITY this);
ULONG STDMETHODCALLTYPE CRegKeySecurity_fnRelease(LPREGKEYSECURITY this);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetObjectInformation(LPREGKEYSECURITY this,
PSI_OBJECT_INFO pObjectInfo);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetSecurity(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR* ppSecurityDescriptor,
BOOL fDefault);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnSetSecurity(LPREGKEYSECURITY this,
SECURITY_INFORMATION RequestedInformation,
PSECURITY_DESCRIPTOR pSecurityDescriptor);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetAccessRights(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
DWORD dwFlags,
PSI_ACCESS* ppAccess,
ULONG* pcAccesses,
ULONG* piDefaultAccess);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnMapGeneric(LPREGKEYSECURITY this,
const GUID* pguidObjectType,
UCHAR* pAceFlags,
ACCESS_MASK* pMask);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnGetInheritTypes(LPREGKEYSECURITY this,
PSI_INHERIT_TYPE* ppInheritTypes,
ULONG* pcInheritTypes);
HRESULT STDMETHODCALLTYPE CRegKeySecurity_fnPropertySheetPageCallback(LPREGKEYSECURITY this,
HWND hwnd,
UINT uMsg,
SI_PAGE_TYPE uPage);
/* CRegKeySecurity fields */
SI_OBJECT_INFO ObjectInfo;
BOOL *Btn;
HKEY hRootKey;
TCHAR szRegKey[1];
} CRegKeySecurity, *PCRegKeySecurity;
#endif /* _REGEXP_SECURITY_H */

View file

@ -27,6 +27,7 @@ VOID WINAPI BuildTrusteeWithObjectsAndSidA(PTRUSTEE_A,POBJECTS_AND_SID,GUID*,GUI
VOID WINAPI BuildTrusteeWithObjectsAndSidW(PTRUSTEE_W,POBJECTS_AND_SID,GUID*,GUID*,PSID);
VOID WINAPI BuildTrusteeWithSidA(PTRUSTEE_A,PSID);
VOID WINAPI BuildTrusteeWithSidW(PTRUSTEE_W,PSID);
DWORD WINAPI FreeInheritedFromArray(PINHERITED_FROMW,USHORT,PFN_OBJECT_MGR_FUNCTS);
DWORD WINAPI GetAuditedPermissionsFromAclA(PACL,PTRUSTEE_A,PACCESS_MASK,PACCESS_MASK);
DWORD WINAPI GetAuditedPermissionsFromAclW(PACL,PTRUSTEE_W,PACCESS_MASK,PACCESS_MASK);
DWORD WINAPI GetEffectiveRightsFromAclA(PACL,PTRUSTEE_A,PACCESS_MASK);
@ -77,6 +78,7 @@ MULTIPLE_TRUSTEE_OPERATION WINAPI GetMultipleTrusteeOperationW(PTRUSTEE_W);
#define GetAuditedPermissionsFromAcl GetAuditedPermissionsFromAclW
#define GetEffectiveRightsFromAcl GetEffectiveRightsFromAclW
#define GetExplicitEntriesFromAcl GetExplicitEntriesFromAclW
#define GetInheritanceSource GetInheritanceSourceW
#define GetNamedSecurityInfo GetNamedSecurityInfoW
#define GetTrusteeForm GetTrusteeFormW
#define GetTrusteeName GetTrusteeNameW
@ -98,6 +100,7 @@ MULTIPLE_TRUSTEE_OPERATION WINAPI GetMultipleTrusteeOperationW(PTRUSTEE_W);
#define GetAuditedPermissionsFromAcl GetAuditedPermissionsFromAclA
#define GetEffectiveRightsFromAcl GetEffectiveRightsFromAclA
#define GetExplicitEntriesFromAcl GetExplicitEntriesFromAclA
#define GetInheritanceSource GetInheritanceSourceA
#define GetNamedSecurityInfo GetNamedSecurityInfoA
#define GetTrusteeForm GetTrusteeFormA
#define GetTrusteeName GetTrusteeNameA

View file

@ -18,6 +18,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define _WIN32_WINNT 0x0501
#include <stdio.h>
#include "wine/test.h"