--- trunk/reactos/subsys/system/regedit/security.c 2005-09-23 15:31:04 UTC (rev 18013)
+++ trunk/reactos/subsys/system/regedit/security.c 2005-09-23 15:31:42 UTC (rev 18014)
@@ -86,7 +86,7 @@
};
-LPREGKEYSECURITY CRegKeySecurity_fnConstructor(HANDLE Handle, SE_OBJECT_TYPE ObjectType, SI_OBJECT_INFO *ObjectInfo, BOOL *Btn)
+static LPREGKEYSECURITY CRegKeySecurity_fnConstructor(HANDLE Handle, SI_OBJECT_INFO *ObjectInfo, BOOL *Btn)
{
LPREGKEYSECURITY obj;
@@ -96,7 +96,6 @@
obj->ref = 1;
obj->lpVtbl = &efvt;
obj->Handle = Handle;
- obj->ObjectType = ObjectType;
obj->ObjectInfo = *ObjectInfo;
obj->Btn = Btn;
}
@@ -153,11 +152,32 @@
PSECURITY_DESCRIPTOR* ppSecurityDescriptor,
BOOL fDefault)
{
- /* FIXME */
- if(GetSecurityInfo(this->Handle, this->ObjectType, RequestedInformation, 0, 0,
- 0, 0, ppSecurityDescriptor) == ERROR_SUCCESS)
+ DWORD DescriptorSize = 0;
+ PSECURITY_DESCRIPTOR SecurityDescriptor;
+ LONG ErrorCode;
+
+ /* find out how much memory we need to allocate */
+ ErrorCode = RegGetKeySecurity(this->Handle, RequestedInformation, NULL, &DescriptorSize);
+ if(ErrorCode == ERROR_INSUFFICIENT_BUFFER)
{
- return S_OK;
+ SecurityDescriptor = (PSECURITY_DESCRIPTOR)LocalAlloc(LMEM_FIXED, DescriptorSize);
+ if (SecurityDescriptor != NULL)
+ {
+ if (RegGetKeySecurity(this->Handle, RequestedInformation, SecurityDescriptor, &DescriptorSize) == ERROR_SUCCESS)
+ {
+ *ppSecurityDescriptor = SecurityDescriptor;
+ return S_OK;
+ }
+ else
+ {
+ LocalFree((HLOCAL)SecurityDescriptor);
+ return E_ACCESSDENIED;
+ }
+ }
+ else
+ {
+ return E_OUTOFMEMORY;
+ }
}
else
{
@@ -345,7 +365,7 @@
ObjectInfo.pszObjectName = KeyName;
ObjectInfo.pszPageTitle = KeyName;
- if(!(RegKeySecurity = CRegKeySecurity_fnConstructor(hInfoKey, SE_REGISTRY_KEY, &ObjectInfo, &Result)))
+ if(!(RegKeySecurity = CRegKeySecurity_fnConstructor(hInfoKey, &ObjectInfo, &Result)))
{
/* FIXME - print error with FormatMessage */
return FALSE;
--- trunk/reactos/subsys/system/regedit/security.h 2005-09-23 15:31:04 UTC (rev 18013)
+++ trunk/reactos/subsys/system/regedit/security.h 2005-09-23 15:31:42 UTC (rev 18014)
@@ -7,17 +7,6 @@
VOID
UnloadAclUiDll(VOID);
-/* FIXME - remove the definition */
-DWORD STDCALL
-GetSecurityInfo(HANDLE handle,
- SE_OBJECT_TYPE ObjectType,
- SECURITY_INFORMATION SecurityInfo,
- PSID* ppsidOwner,
- PSID* ppsidGroup,
- PACL* ppDacl,
- PACL* ppSacl,
- PSECURITY_DESCRIPTOR* ppSecurityDescriptor);
-
DEFINE_GUID(IID_CRegKeySecurity, 0x965fc360, 0x16ff, 0x11d0, 0x0091, 0xcb,0x00,0xaa,0x00,0xbb,0xb7,0x23);
/******************************************************************************
@@ -72,7 +61,6 @@
DWORD ref;
/* CRegKeySecurity fields */
HANDLE Handle;
- SE_OBJECT_TYPE ObjectType;
SI_OBJECT_INFO ObjectInfo;
BOOL *Btn;
} REGKEYSECURITY;