MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / CanSetWindowsHook

Method CanSetWindowsHook

cpp/iedriver/HookProcessor.cpp:117–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117bool HookProcessor::CanSetWindowsHook(HWND window_handle) {
118 int driver_bitness = 32;
119 HANDLE driver_process_handle = ::GetCurrentProcess();
120 if (Is64BitProcess(driver_process_handle)) {
121 driver_bitness = 64;
122 }
123 ::CloseHandle(driver_process_handle);
124
125 DWORD process_id;
126 DWORD thread_id = ::GetWindowThreadProcessId(window_handle, &process_id);
127 HANDLE browser_process_handle = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, process_id);
128 int browser_bitness = 32;
129 if (Is64BitProcess(browser_process_handle)) {
130 browser_bitness = 64;
131 }
132
133 if (driver_bitness != browser_bitness) {
134 LOG(WARN) << "Unable to set Windows hook procedure. Driver is a "
135 << driver_bitness << "-bit process, but browser is a "
136 << browser_bitness << "-bit process.";
137 }
138 return driver_bitness == browser_bitness;
139}
140
141bool HookProcessor::Is64BitProcess(HANDLE process_handle) {
142 if (!RegistryUtilities::Is64BitWindows()) {

Callers 6

IsProtectedModeMethod · 0.80
SetFocusToBrowserMethod · 0.80
SetCookieMethod · 0.80
GetCookiesMethod · 0.80
SimulateActionsMethod · 0.80

Calls 1

LOGClass · 0.50

Tested by

no test coverage detected