mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
6d32b64ab0
The window message we previously hooked no longer gets sent and the associated shared memory no longer seems to be created either. Also, we don't seem to be notified about the load of UIAutomationCore.dll until after it has already instantiated a11y, which is obviously too late for us to hook anything. Instead, we block UIA instantiation via LazyInstantiator, just as we do for MSAA/IA2: 1. Refactor CompatibilityUIA so that rather than being called by a hook, it simply allows the caller to query the process ids of any UIA clients. 2. CompatibilityUIA now searches handles in our process for named pipes created by UIA for communication with the remote process and then uses GetNamedPipeServerProcessId to get the process id on the other end of each pipe. 3. Refactor LazyInstantiator so that it first tries to get the MSAA/IA2 client process id, then calls CompatibilityUIA to get any UIA client process ids. 4. LazyInstantiator now handles setting the instantiator and blocking of clients for UIA as well as MSAA/IA2 using the same code. 5. Because UIA client detection can be expensive if clients repeatedly query us, cache the result. Reset that cache only when one of our windows comes to the foreground. Differential Revision: https://phabricator.services.mozilla.com/D181958
86 lines
2.4 KiB
C
86 lines
2.4 KiB
C
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_NtUndoc_h
|
|
#define mozilla_NtUndoc_h
|
|
|
|
#include <winternl.h>
|
|
|
|
#if defined(__cplusplus)
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifndef STATUS_INFO_LENGTH_MISMATCH
|
|
# define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS)0xC0000004L)
|
|
#endif
|
|
|
|
#ifndef STATUS_BUFFER_TOO_SMALL
|
|
# define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023L)
|
|
#endif
|
|
|
|
#ifndef STATUS_MORE_ENTRIES
|
|
# define STATUS_MORE_ENTRIES ((NTSTATUS)0x00000105L)
|
|
#endif
|
|
|
|
enum UndocSystemInformationClass { SystemExtendedHandleInformation = 64 };
|
|
|
|
struct SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX {
|
|
PVOID mObject;
|
|
ULONG_PTR mPid;
|
|
ULONG_PTR mHandle;
|
|
ACCESS_MASK mGrantedAccess;
|
|
USHORT mCreatorBackTraceIndex;
|
|
USHORT mObjectTypeIndex;
|
|
ULONG mAttributes;
|
|
ULONG mReserved;
|
|
};
|
|
|
|
struct SYSTEM_HANDLE_INFORMATION_EX {
|
|
ULONG_PTR mHandleCount;
|
|
ULONG_PTR mReserved;
|
|
SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX mHandles[1];
|
|
};
|
|
|
|
#ifndef __MINGW32__
|
|
enum UndocObjectInformationClass { ObjectNameInformation = 1 };
|
|
|
|
struct OBJECT_NAME_INFORMATION {
|
|
UNICODE_STRING Name;
|
|
};
|
|
#endif
|
|
|
|
// The following declarations are documented on MSDN but are not included in
|
|
// public user-mode headers.
|
|
|
|
enum DirectoryObjectAccessFlags {
|
|
DIRECTORY_QUERY = 0x0001,
|
|
DIRECTORY_TRAVERSE = 0x0002,
|
|
DIRECTORY_CREATE_OBJECT = 0x0004,
|
|
DIRECTORY_CREATE_SUBDIRECTORY = 0x0008,
|
|
DIRECTORY_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | 0x000F
|
|
};
|
|
|
|
NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE aDirectoryHandle,
|
|
ACCESS_MASK aDesiredAccess,
|
|
POBJECT_ATTRIBUTES aObjectAttributes);
|
|
|
|
struct OBJECT_DIRECTORY_INFORMATION {
|
|
UNICODE_STRING mName;
|
|
UNICODE_STRING mTypeName;
|
|
};
|
|
|
|
NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE aDirectoryHandle,
|
|
PVOID aOutBuffer, ULONG aBufferLength,
|
|
BOOLEAN aReturnSingleEntry,
|
|
BOOLEAN aRestartScan, PULONG aContext,
|
|
PULONG aOutReturnLength);
|
|
|
|
#if defined(__cplusplus)
|
|
} // extern "C"
|
|
#endif
|
|
|
|
#endif // mozilla_NtUndoc_h
|