summaryrefslogtreecommitdiff
path: root/sal/osl/w32/process.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sal/osl/w32/process.cxx')
-rw-r--r--sal/osl/w32/process.cxx128
1 files changed, 0 insertions, 128 deletions
diff --git a/sal/osl/w32/process.cxx b/sal/osl/w32/process.cxx
index 087ee2e20c01..23001f9cd4c6 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -506,132 +506,4 @@ oslProcessError SAL_CALL osl_setProcessLocale( rtl_Locale * pLocale )
return osl_Process_E_None;
}
-/************************************************
- * Portal send/receive interface implementation
- ************************************************/
-
-static sal_Bool ReadPipe(oslPipe hPipe,
- void* pBuffer,
- sal_Int32 BytesToRead,
- sal_Int32* nBytes)
-{
- *nBytes = osl_receivePipe(hPipe, pBuffer, BytesToRead);
- OSL_TRACE("tried to receive %d, received %d.\n",
- BytesToRead, *nBytes);
- return (sal_Bool)((*nBytes >= 0) && (osl_getLastPipeError(hPipe) == osl_Pipe_E_None));
-}
-
-static sal_Bool WritePipe(oslPipe hPipe,
- void* pBuffer,
- sal_Int32 BytesToSend,
- sal_Int32* nBytes)
-{
- *nBytes = osl_sendPipe(hPipe, pBuffer, BytesToSend);
- OSL_TRACE("tried to send %d, sent %d\n",
- BytesToSend, *nBytes);
- return (sal_Bool)((*nBytes == BytesToSend) && (osl_getLastPipeError(hPipe) == osl_Pipe_E_None));
-}
-
-sal_Bool SAL_CALL osl_sendResourcePipe(oslPipe hPipe, oslSocket pSocket)
-{
- sal_Bool bRet = sal_False;
- sal_Int32 bytes = 0;
-
- /* duplicate handle on this other side ->
- receive remote process
- duplicate handle and send it */
- DWORD remoteProcessID = 0;
- HANDLE fd = (HANDLE)pSocket->m_Socket;
- oslDescriptorType code = osl_Process_TypeSocket;
-
- OSL_TRACE("osl_sendResourcePipe: enter...");
-
- if (ReadPipe(hPipe, &remoteProcessID, sizeof(remoteProcessID), &bytes))
- {
- HANDLE hRemoteProc = OpenProcess(PROCESS_DUP_HANDLE,
- FALSE,
- remoteProcessID);
-
- if (hRemoteProc != (HANDLE)NULL)
- {
- HANDLE newFd;
-
- if (DuplicateHandle(GetCurrentProcess(),
- fd,
- hRemoteProc,
- &newFd,
- 0, FALSE, DUPLICATE_SAME_ACCESS))
- {
- if (
- WritePipe(hPipe, &code, sizeof(code), &bytes) &&
- WritePipe(hPipe, &newFd, sizeof(fd), &bytes)
- )
- bRet = sal_True;
- }
-
- CloseHandle(hRemoteProc);
- }
- }
-
- if (bRet)
- {
- sal_Int32 commitCode;
- OSL_TRACE("osl_sendResourcePipe: handle sent successfully, verify...");
-
- if (
- !ReadPipe(hPipe, &commitCode, sizeof(commitCode), &bytes) ||
- (commitCode <= 0)
- )
- bRet = sal_False;
- }
-
- OSL_TRACE("osl_sendResourcePipe: exit... %d", bRet);
- return(bRet);
-}
-
-oslSocket SAL_CALL osl_receiveResourcePipe(oslPipe hPipe)
-{
- sal_Bool bRet = sal_False;
- sal_Int32 bytes = 0;
- sal_Int32 commitCode;
- oslSocket pSocket = NULL;
-
- /* duplicate handle on the other side ->
- send my process id receive duplicated handle */
- HANDLE fd = INVALID_HANDLE_VALUE;
- DWORD myProcessID = GetCurrentProcessId();
- oslDescriptorType code = osl_Process_TypeNone;
-
- OSL_TRACE("osl_receiveResourcePipe: enter...");
-
- if (
- WritePipe(hPipe, &myProcessID, sizeof(myProcessID), &bytes) &&
- ReadPipe(hPipe, &code, sizeof(code), &bytes) &&
- ReadPipe(hPipe, &fd, sizeof(fd), &bytes)
- )
- {
- if (code == osl_Process_TypeSocket)
- {
- pSocket = __osl_createSocketImpl((SOCKET)fd);
- bRet = sal_True;
- }
- else
- {
- OSL_TRACE("osl_receiveResourcePipe: UNKNOWN");
- bRet = sal_False;
- }
- }
-
- if (bRet)
- commitCode = 1;
- else
- commitCode = 0;
-
- WritePipe(hPipe, &commitCode, sizeof(commitCode), &bytes);
-
- OSL_TRACE("osl_receiveResourcePipe: exit... %d, %p", bRet, pSocket);
-
- return pSocket;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */