Bug 1511438 Part 1: Replace ProcessTypeRequiresWinEventHook with XRE_Win32kCallsAllowed. r=froydnj

ProcessTypeRequiresWinEventHook was added when attempting to turn on win32k
lockdown for GMP processes. Having a less specific, but globally accessible,
function will make it more useful while applying win32k lockdown to other
process types.
This commit is contained in:
Bob Owen 2019-01-29 08:49:13 +00:00
Родитель d2f299b489
Коммит 2f9e2d054c
3 изменённых файлов: 21 добавлений и 10 удалений

Просмотреть файл

@ -634,15 +634,6 @@ namespace mozilla {
namespace ipc {
namespace windows {
static bool ProcessTypeRequiresWinEventHook() {
switch (XRE_GetProcessType()) {
case GeckoProcessType_GMPlugin:
return false;
default:
return true;
}
}
void InitUIThread() {
// If we aren't setup before a call to NotifyWorkerThread, we'll hang
// on startup.
@ -654,7 +645,7 @@ void InitUIThread() {
MOZ_ASSERT(gUIThreadId == GetCurrentThreadId(),
"Called InitUIThread multiple times on different threads!");
if (!gWinEventHook && ProcessTypeRequiresWinEventHook()) {
if (!gWinEventHook && XRE_Win32kCallsAllowed()) {
gWinEventHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_DESTROY,
NULL, &WinEventHook, GetCurrentProcessId(),
gUIThreadId, WINEVENT_OUTOFCONTEXT);

Просмотреть файл

@ -4734,6 +4734,18 @@ bool XRE_UseNativeEventProcessing() {
return true;
}
#if defined(XP_WIN)
bool XRE_Win32kCallsAllowed() {
switch (XRE_GetProcessType()) {
case GeckoProcessType_GMPlugin:
case GeckoProcessType_RDD:
return false;
default:
return true;
}
}
#endif
// If you add anything to this enum, please update about:support to reflect it
enum {
kE10sEnabledByUser = 0,

Просмотреть файл

@ -451,6 +451,14 @@ XRE_API(bool, XRE_IsSocketProcess, ())
*/
XRE_API(bool, XRE_UseNativeEventProcessing, ())
#if defined(XP_WIN)
/**
* @returns true if win32k calls are allowed in this process type, false if
* win32k is (or should be) disabled.
*/
XRE_API(bool, XRE_Win32kCallsAllowed, ())
#endif
typedef void (*MainFunction)(void* aData);
XRE_API(nsresult, XRE_InitParentProcess,