svchlp.cpp revision e45ccb294fc1f6b4078d058eaff86100361a7358
/** @file
*
* Definition of SVC Helper Process control routines.
*/
/*
* Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "svchlp.h"
//#include "HostImpl.h"
#include "Logging.h"
using namespace com;
enum { PipeBufSize = 1024 };
////////////////////////////////////////////////////////////////////////////////
/**
* GetLastError() is known to return NO_ERROR even after the Win32 API
* function (i.e. Write() to a non-connected server end of a pipe) returns
* FALSE... This method ensures that at least VERR_GENERAL_FAILURE is returned
* in cases like that. Intended to be called immediately after a failed API
* call.
*/
static inline int rtErrConvertFromWin32OnFailure()
{
: RTErrConvertFromWin32 (err);
}
////////////////////////////////////////////////////////////////////////////////
{
}
{
close();
}
{
if (mIsOpen)
return VERR_WRONG_ORDER;
1, // PIPE_UNLIMITED_INSTANCES,
NULL);
if (pipe == INVALID_HANDLE_VALUE)
mIsOpen = true;
mIsServer = true;
return VINF_SUCCESS;
}
{
if (mIsOpen)
return VERR_WRONG_ORDER;
0,
NULL,
0,
NULL);
if (pipe == INVALID_HANDLE_VALUE)
mIsOpen = true;
mIsServer = false;
return VINF_SUCCESS;
}
int SVCHlpClient::connect()
{
return VERR_WRONG_ORDER;
return VINF_SUCCESS;
}
int SVCHlpClient::close()
{
if (!mIsOpen)
return VERR_WRONG_ORDER;
{
if (!CloseHandle (mWriteEnd))
}
{
if (!CloseHandle (mReadEnd))
}
mIsOpen = false;
mIsServer = false;
return VINF_SUCCESS;
}
{
if (!mIsOpen)
return VERR_WRONG_ORDER;
}
{
if (!mIsOpen)
return VERR_WRONG_ORDER;
/* write -1 for NULL strings */
/* write string length */
if (RT_SUCCESS(vrc))
{
/* write string data */
}
return vrc;
}
{
}
{
if (!mIsOpen)
return VERR_WRONG_ORDER;
}
{
if (!mIsOpen)
return VERR_WRONG_ORDER;
/* read string length */
if (RT_FAILURE(vrc))
return vrc;
/* length -1 means a NULL string */
{
return VINF_SUCCESS;
}
/* read string data */
return vrc;
}
{
if (RT_SUCCESS(vrc))
return vrc;
}
////////////////////////////////////////////////////////////////////////////////
{
}
int SVCHlpServer::run()
{
int vrc = VINF_SUCCESS;
do
{
if (RT_FAILURE(vrc))
return vrc;
/* terminate request received */
return VINF_SUCCESS;
switch (msgCode)
{
case SVCHlpMsg::EnableDynamicIpConfig:
case SVCHlpMsg::EnableStaticIpConfig:
case SVCHlpMsg::EnableStaticIpConfigV6:
case SVCHlpMsg::DhcpRediscover:
{
#ifdef VBOX_WITH_NETFLT
#endif
break;
}
default:
}
if (RT_FAILURE(vrc))
return vrc;
}
while (1);
/* we never get here */
AssertFailed();
return VERR_GENERAL_FAILURE;
}