* UPDATE HISTORY:
* 07/26/2005 Created
*/
+
#include "ntmarta.h"
#define NDEBUG
HINSTANCE hDllInstance;
+/* FIXME: Vista+ API */
+VOID
+WINAPI
+SetSecurityAccessMask(IN SECURITY_INFORMATION SecurityInformation,
+ OUT LPDWORD DesiredAccess)
+{
+ *DesiredAccess = 0;
+
+ if (SecurityInformation & (OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION))
+ *DesiredAccess |= WRITE_OWNER;
+
+ if (SecurityInformation & DACL_SECURITY_INFORMATION)
+ *DesiredAccess |= WRITE_DAC;
+
+ if (SecurityInformation & SACL_SECURITY_INFORMATION)
+ *DesiredAccess |= ACCESS_SYSTEM_SECURITY;
+}
+
+/* FIXME: Vista+ API */
+VOID
+WINAPI
+QuerySecurityAccessMask(IN SECURITY_INFORMATION SecurityInformation,
+ OUT LPDWORD DesiredAccess)
+{
+ *DesiredAccess = 0;
+
+ if (SecurityInformation & (OWNER_SECURITY_INFORMATION |
+ GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION))
+ {
+ *DesiredAccess |= READ_CONTROL;
+ }
+
+ if (SecurityInformation & SACL_SECURITY_INFORMATION)
+ *DesiredAccess |= ACCESS_SYSTEM_SECURITY;
+}
+
static ACCESS_MODE
AccpGetAceAccessMode(IN PACE_HEADER AceHeader)
{
*pObjectTypeGuid = pOas->ObjectTypeGuid;
if (pInheritedObjectTypeGuid != NULL && pOas->ObjectsPresent & ACE_INHERITED_OBJECT_TYPE_PRESENT)
- *pObjectTypeGuid = pOas->InheritedObjectTypeGuid;
+ *pInheritedObjectTypeGuid = pOas->InheritedObjectTypeGuid;
Ret = pOas->ObjectsPresent;
break;
*ppSid = NULL;
*Allocated = FALSE;
+ /* Windows ignores this */
+#if 0
if (Trustee->pMultipleTrustee || Trustee->MultipleTrusteeOperation != NO_MULTIPLE_TRUSTEE)
{
/* This is currently not supported */
return ERROR_INVALID_PARAMETER;
}
+#endif
switch (Trustee->TrusteeForm)
{
if (SecurityInfo & GROUP_SECURITY_INFORMATION && ppsidGroup != NULL)
{
- *ppsidOwner = NULL;
+ *ppsidGroup = NULL;
if (!GetSecurityDescriptorGroup(pSD,
ppsidGroup,
&Defaulted))
NULL);
Status = NtOpenFile(Handle,
- DesiredAccess,
+ DesiredAccess | SYNCHRONIZE,
&ObjectAttributes,
&IoStatusBlock,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
(DWORD)DesiredAccess);
if (*Handle2 == NULL)
{
- goto FailOpenService;
+ Ret = GetLastError();
+ ASSERT(Ret != ERROR_SUCCESS);
+ goto Cleanup;
}
DesiredAccess &= ~SC_MANAGER_CONNECT;
(DWORD)DesiredAccess);
if (*Handle == NULL)
{
- if (*Handle2 != NULL)
- {
- CloseServiceHandle((SC_HANDLE)(*Handle2));
- }
-
-FailOpenService:
Ret = GetLastError();
+ ASSERT(Ret != ERROR_SUCCESS);
+ ASSERT(*Handle2 != NULL);
+ CloseServiceHandle((SC_HANDLE)(*Handle2));
+
goto Cleanup;
}
break;
LocalFree((HLOCAL)pSid1);
}
+ /* Succeed, if no ACL needs to be allocated */
+ if (SizeInformation.AclBytesInUse == 0)
+ goto Cleanup;
+
/* OK, now create the new ACL */
DPRINT("Allocating %u bytes for the new ACL\n", SizeInformation.AclBytesInUse);
pNew = (PACL)LocalAlloc(LMEM_FIXED, SizeInformation.AclBytesInUse);