* 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:
parent
261c701bf3
commit
6f94526c1c
@ -1,3 +1,29 @@
|
|||||||
|
2012-07-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
2012-07-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* advapi32.cc (_ADVAPI32_): Drop definition.
|
||||||
|
* kernel32.cc (_KERNEL32_): Ditto.
|
||||||
|
* winlean.h: Add definitions required to use Mingw64 headers.
|
||||||
|
(FILE_SHARE_VALID_FLAGS): Drop definition.
|
||||||
|
|
||||||
2012-07-06 Corinna Vinschen <corinna@vinschen.de>
|
2012-07-06 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* winsup.h (_WIN32_WINNT): Define. Explain why.
|
* winsup.h (_WIN32_WINNT): Define. Explain why.
|
||||||
|
@ -77,10 +77,12 @@ static const HKEY registry_keys[] =
|
|||||||
|
|
||||||
static const int ROOT_KEY_COUNT = sizeof (registry_keys) / sizeof (HKEY);
|
static const int ROOT_KEY_COUNT = sizeof (registry_keys) / sizeof (HKEY);
|
||||||
|
|
||||||
|
#ifndef __MINGW64_VERSION_MAJOR
|
||||||
extern "C" {
|
extern "C" {
|
||||||
LONG WINAPI RegOpenUserClassesRoot (HANDLE, DWORD, REGSAM, PHKEY);
|
LONG WINAPI RegOpenUserClassesRoot (HANDLE, DWORD, REGSAM, PHKEY);
|
||||||
LONG WINAPI RegOpenCurrentUser (REGSAM, PHKEY);
|
LONG WINAPI RegOpenCurrentUser (REGSAM, PHKEY);
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Make sure to access the correct per-user HKCR and HKCU hives, even if
|
/* Make sure to access the correct per-user HKCR and HKCU hives, even if
|
||||||
the current user is only impersonated in another user's session. */
|
the current user is only impersonated in another user's session. */
|
||||||
|
@ -1482,7 +1482,9 @@ fhandler_pty_slave::fixup_after_exec ()
|
|||||||
fixup_after_fork (NULL);
|
fixup_after_fork (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __MINGW64_VERSION_MAJOR
|
||||||
extern "C" BOOL WINAPI GetNamedPipeClientProcessId (HANDLE, PULONG);
|
extern "C" BOOL WINAPI GetNamedPipeClientProcessId (HANDLE, PULONG);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This thread function handles the master control pipe. It waits for a
|
/* This thread function handles the master control pipe. It waits for a
|
||||||
client to connect. Then it checks if the client process has permissions
|
client to connect. Then it checks if the client process has permissions
|
||||||
|
@ -491,7 +491,8 @@ typedef enum _PROCESSINFOCLASS
|
|||||||
ProcessVmCounters = 3,
|
ProcessVmCounters = 3,
|
||||||
ProcessTimes = 4,
|
ProcessTimes = 4,
|
||||||
ProcessSessionInformation = 24,
|
ProcessSessionInformation = 24,
|
||||||
ProcessWow64Information = 26
|
ProcessWow64Information = 26,
|
||||||
|
ProcessImageFileName = 27
|
||||||
} PROCESSINFOCLASS;
|
} PROCESSINFOCLASS;
|
||||||
|
|
||||||
typedef struct _DEBUG_BUFFER
|
typedef struct _DEBUG_BUFFER
|
||||||
@ -1270,6 +1271,7 @@ extern "C"
|
|||||||
PBOOLEAN);
|
PBOOLEAN);
|
||||||
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
|
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
|
||||||
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
||||||
|
VOID NTAPI RtlInitAnsiString (PANSI_STRING, PCSTR);
|
||||||
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
|
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
|
||||||
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
|
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
|
||||||
NTSTATUS NTAPI RtlIntegerToUnicodeString (ULONG, ULONG, PUNICODE_STRING);
|
NTSTATUS NTAPI RtlIntegerToUnicodeString (ULONG, ULONG, PUNICODE_STRING);
|
||||||
@ -1301,6 +1303,7 @@ extern "C"
|
|||||||
BOOLEAN);
|
BOOLEAN);
|
||||||
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
|
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
|
||||||
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
|
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
|
||||||
|
ULONG NTAPI RtlUnicodeStringToAnsiSize (PUNICODE_STRING);
|
||||||
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
|
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
|
||||||
BOOLEAN);
|
BOOLEAN);
|
||||||
NTSTATUS NTAPI RtlUnicodeStringToOemString (PANSI_STRING, PUNICODE_STRING,
|
NTSTATUS NTAPI RtlUnicodeStringToOemString (PANSI_STRING, PUNICODE_STRING,
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "registry.h"
|
#include "registry.h"
|
||||||
|
|
||||||
|
#ifndef __MINGW64_VERSION_MAJOR
|
||||||
extern "C" HWND WINAPI GetForegroundWindow();
|
extern "C" HWND WINAPI GetForegroundWindow();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Win32 priority to UNIX priority Mapping.
|
/* Win32 priority to UNIX priority Mapping.
|
||||||
For now, I'm just following the spec: any range of priorities is ok.
|
For now, I'm just following the spec: any range of priorities is ok.
|
||||||
|
@ -25,6 +25,10 @@ details. */
|
|||||||
#include "pwdgrp.h"
|
#include "pwdgrp.h"
|
||||||
#include "ntdll.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. */
|
/* General purpose security attribute objects for global use. */
|
||||||
SECURITY_ATTRIBUTES NO_COPY sec_none;
|
SECURITY_ATTRIBUTES NO_COPY sec_none;
|
||||||
SECURITY_ATTRIBUTES NO_COPY sec_none_nih;
|
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;
|
well_known_sid = well_known;
|
||||||
else
|
else
|
||||||
well_known_sid = (s != SECURITY_NT_AUTH
|
well_known_sid = (s != SECURITY_NT_AUTH
|
||||||
|| r[0] != SECURITY_NT_NON_UNIQUE_RID);
|
|| r[0] != SECURITY_NT_NON_UNIQUE);
|
||||||
return psid;
|
return psid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,7 +378,11 @@ static const struct {
|
|||||||
{ SE_CREATE_GLOBAL_NAME, false },
|
{ SE_CREATE_GLOBAL_NAME, false },
|
||||||
{ SE_TRUSTED_CREDMAN_ACCESS_NAME, false },
|
{ SE_TRUSTED_CREDMAN_ACCESS_NAME, false },
|
||||||
{ SE_RELABEL_NAME, true },
|
{ SE_RELABEL_NAME, true },
|
||||||
|
#ifndef __MINGW64_VERSION_MAJOR
|
||||||
{ SE_INCREASE_WORKING_SET_NAME, false },
|
{ SE_INCREASE_WORKING_SET_NAME, false },
|
||||||
|
#else
|
||||||
|
{ SE_INC_WORKING_SET_NAME, false },
|
||||||
|
#endif
|
||||||
{ SE_TIME_ZONE_NAME, true },
|
{ SE_TIME_ZONE_NAME, true },
|
||||||
{ SE_CREATE_SYMBOLIC_LINK_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)
|
__sec_user (PVOID sa_buf, PSID sid1, PSID sid2, DWORD access2, BOOL inherit)
|
||||||
{
|
{
|
||||||
PSECURITY_ATTRIBUTES psa = (PSECURITY_ATTRIBUTES) sa_buf;
|
PSECURITY_ATTRIBUTES psa = (PSECURITY_ATTRIBUTES) sa_buf;
|
||||||
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR)
|
PISECURITY_DESCRIPTOR psd = (PISECURITY_DESCRIPTOR)
|
||||||
((char *) sa_buf + sizeof (*psa));
|
((char *) sa_buf + sizeof (*psa));
|
||||||
PACL acl = (PACL) ((char *) sa_buf + sizeof (*psa) + sizeof (*psd));
|
PACL acl = (PACL) ((char *) sa_buf + sizeof (*psa) + sizeof (*psd));
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
@ -586,7 +594,7 @@ PSECURITY_DESCRIPTOR
|
|||||||
_recycler_sd (void *buf, bool users, bool dir)
|
_recycler_sd (void *buf, bool users, bool dir)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) buf;
|
PISECURITY_DESCRIPTOR psd = (PISECURITY_DESCRIPTOR) buf;
|
||||||
|
|
||||||
if (!psd)
|
if (!psd)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -644,7 +652,7 @@ PSECURITY_DESCRIPTOR
|
|||||||
_everyone_sd (void *buf, ACCESS_MASK access)
|
_everyone_sd (void *buf, ACCESS_MASK access)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
PSECURITY_DESCRIPTOR psd = (PSECURITY_DESCRIPTOR) buf;
|
PISECURITY_DESCRIPTOR psd = (PISECURITY_DESCRIPTOR) buf;
|
||||||
|
|
||||||
if (psd)
|
if (psd)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user