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

Method CreateReturnPipe

cpp/iedriver/HookProcessor.cpp:201–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199}
200
201void HookProcessor::CreateReturnPipe() {
202 LOG(TRACE) << "Entering HookProcessor::CreateReturnPipe";
203 std::wstring pipe_name = StringUtilities::Format(PIPE_NAME_TEMPLATE,
204 ::GetCurrentProcessId());
205 PSECURITY_ATTRIBUTES security_attributes_pointer = NULL;
206
207 // Set security descriptor so low-integrity processes can write to it.
208 PSECURITY_DESCRIPTOR pointer_to_descriptor;
209 BOOL descriptor_created = ::ConvertStringSecurityDescriptorToSecurityDescriptor(
210 LOW_INTEGRITY_SDDL_SACL,
211 SDDL_REVISION_1,
212 &pointer_to_descriptor,
213 NULL);
214
215 if (!descriptor_created) {
216 LOGERR(DEBUG) << "Could not create security descriptor. "
217 << "Assuming OS does not support low-integrity processes.";
218 } else {
219 SECURITY_ATTRIBUTES security_attributes;
220 security_attributes.lpSecurityDescriptor = pointer_to_descriptor;
221 security_attributes.nLength = sizeof(security_attributes);
222 security_attributes_pointer = &security_attributes;
223 }
224 this->pipe_handle_ = ::CreateNamedPipe(pipe_name.c_str(),
225 PIPE_ACCESS_DUPLEX,
226 PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
227 PIPE_UNLIMITED_INSTANCES,
228 0,
229 NAMED_PIPE_BUFFER_SIZE,
230 PIPE_CONNECTION_TIMEOUT_IN_MILLISECONDS,
231 security_attributes_pointer);
232
233 // failed to create pipe?
234 if (this->pipe_handle_ == INVALID_HANDLE_VALUE) {
235 LOG(WARN) << "Failed to create named pipe. Communication back from browser will not work.";
236 } else {
237 LOG(DEBUG) << "Created named pipe " << LOGWSTRING(pipe_name);
238 }
239}
240
241void HookProcessor::Dispose() {
242 LOG(TRACE) << "Entering HookProcessor::Dispose";

Callers 1

InitializeMethod · 0.95

Calls 1

LOGClass · 0.50

Tested by

no test coverage detected