* fhandler_registry.cc (RegOpenUserClassesRoot): Only define when

building against w32api headers.
	(RegOpenCurrentUser): Ditto.
	* fhandler_tty.cc (GetNamedPipeClientProcessId): Ditto.
	* ntdll.h (enum _PROCESSINFOCLASS): Add ProcessImageFileName.
	(RtlInitAnsiString): Declare.
	(RtlUnicodeStringToAnsiSize): Declare.
	* sched.cc (GetForegroundWindow): Ditto.
	* sec_helper.cc (SECURITY_NT_NON_UNIQUE): Define as
	SECURITY_NT_NON_UNIQUE_RID when building against w32api headers.
	(cygsid::get_sid): Use SECURITY_NT_NON_UNIQUE rather than
	SECURITY_NT_NON_UNIQUE_RID.
	(__sec_user): Use PISECURITY_DESCRIPTOR rather than PSECURITY_DESCRIPTOR
	to allow valid pointer arithmetic.
	(_recycler_sd): Ditto.
	(_everyone_sd): Ditto.
This commit is contained in:
Corinna Vinschen
2012-07-06 13:49:53 +00:00
parent 261c701bf3
commit 6f94526c1c
6 changed files with 48 additions and 5 deletions

View File

@@ -25,6 +25,10 @@ details. */
#include "pwdgrp.h"
#include "ntdll.h"
#ifndef __MINGW64_VERSION_MAJOR
#define SECURITY_NT_NON_UNIQUE SECURITY_NT_NON_UNIQUE_RID
#endif
/* General purpose security attribute objects for global use. */
SECURITY_ATTRIBUTES NO_COPY sec_none;
SECURITY_ATTRIBUTES NO_COPY sec_none_nih;
@@ -175,7 +179,7 @@ cygsid::get_sid (DWORD s, DWORD cnt, DWORD *r, bool well_known)
well_known_sid = well_known;
else
well_known_sid = (s != SECURITY_NT_AUTH
|| r[0] != SECURITY_NT_NON_UNIQUE_RID);
|| r[0] != SECURITY_NT_NON_UNIQUE);
return psid;
}
@@ -374,7 +378,11 @@ static const struct {
{ SE_CREATE_GLOBAL_NAME, false },
{ SE_TRUSTED_CREDMAN_ACCESS_NAME, false },
{ SE_RELABEL_NAME, true },
#ifndef __MINGW64_VERSION_MAJOR
{ SE_INCREASE_WORKING_SET_NAME, false },
#else
{ SE_INC_WORKING_SET_NAME, false },
#endif
{ SE_TIME_ZONE_NAME, true },
{ SE_CREATE_SYMBOLIC_LINK_NAME, true }
};
@@ -555,7 +563,7 @@ PSECURITY_ATTRIBUTES __stdcall
__sec_user (PVOID sa_buf, PSID sid1, PSID sid2, DWORD access2, BOOL inherit)
{
PSECURITY_ATTRIBUTES psa = (PSECURITY_ATTRIBUTES) sa_buf;
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR)
PISECURITY_DESCRIPTOR psd = (PISECURITY_DESCRIPTOR)
((char *) sa_buf + sizeof (*psa));
PACL acl = (PACL) ((char *) sa_buf + sizeof (*psa) + sizeof (*psd));
NTSTATUS status;
@@ -586,7 +594,7 @@ PSECURITY_DESCRIPTOR
_recycler_sd (void *buf, bool users, bool dir)
{
NTSTATUS status;
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) buf;
PISECURITY_DESCRIPTOR psd = (PISECURITY_DESCRIPTOR) buf;
if (!psd)
return NULL;
@@ -644,7 +652,7 @@ PSECURITY_DESCRIPTOR
_everyone_sd (void *buf, ACCESS_MASK access)
{
NTSTATUS status;
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) buf;
PISECURITY_DESCRIPTOR psd = (PISECURITY_DESCRIPTOR) buf;
if (psd)
{