diff --git a/ipc/glue/ProtocolUtils.cpp b/ipc/glue/ProtocolUtils.cpp index 68a33e9bedf7..d11f13461d46 100644 --- a/ipc/glue/ProtocolUtils.cpp +++ b/ipc/glue/ProtocolUtils.cpp @@ -65,42 +65,6 @@ IPCResult IPCResult::Fail(NotNull actor, const char* where, return IPCResult(false); } -#if defined(XP_WIN) -bool DuplicateHandle(HANDLE aSourceHandle, DWORD aTargetProcessId, - HANDLE* aTargetHandle, DWORD aDesiredAccess, - DWORD aOptions) { - // If our process is the target just duplicate the handle. - if (aTargetProcessId == base::GetCurrentProcId()) { - return !!::DuplicateHandle(::GetCurrentProcess(), aSourceHandle, - ::GetCurrentProcess(), aTargetHandle, - aDesiredAccess, false, aOptions); - } - -# if defined(MOZ_SANDBOX) - // Try the broker next (will fail if not sandboxed). - if (SandboxTarget::Instance()->BrokerDuplicateHandle( - aSourceHandle, aTargetProcessId, aTargetHandle, aDesiredAccess, - aOptions)) { - return true; - } -# endif - - // Finally, see if we already have access to the process. - ScopedProcessHandle targetProcess( - OpenProcess(PROCESS_DUP_HANDLE, FALSE, aTargetProcessId)); - if (!targetProcess) { - CrashReporter::AnnotateCrashReport( - CrashReporter::Annotation::IPCTransportFailureReason, - "Failed to open target process."_ns); - return false; - } - - return !!::DuplicateHandle(::GetCurrentProcess(), aSourceHandle, - targetProcess, aTargetHandle, aDesiredAccess, - FALSE, aOptions); -} -#endif - void AnnotateSystemError() { int64_t error = 0; #if defined(XP_WIN) diff --git a/ipc/glue/ProtocolUtils.h b/ipc/glue/ProtocolUtils.h index ae562f26a092..24ea2c233d8b 100644 --- a/ipc/glue/ProtocolUtils.h +++ b/ipc/glue/ProtocolUtils.h @@ -639,16 +639,6 @@ MOZ_NEVER_INLINE void ArrayLengthReadError(const char* aElementName); MOZ_NEVER_INLINE void SentinelReadError(const char* aElementName); -#if defined(XP_WIN) -// This is a restricted version of Windows' DuplicateHandle() function -// that works inside the sandbox and can send handles but not retrieve -// them. Unlike DuplicateHandle(), it takes a process ID rather than -// a process handle. It returns true on success, false otherwise. -bool DuplicateHandle(HANDLE aSourceHandle, DWORD aTargetProcessId, - HANDLE* aTargetHandle, DWORD aDesiredAccess, - DWORD aOptions); -#endif - /** * Annotate the crash reporter with the error code from the most recent system * call. Returns the system error.