ConsoleVRDPServer.cpp revision aee940d6de6a7c6fcedb76271ace8de84849ed32
/* $Id$ */
/** @file
* VBox Console VRDP Helper class
*/
/*
* 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 "ConsoleVRDPServer.h"
#include "ConsoleImpl.h"
#include "DisplayImpl.h"
#include "KeyboardImpl.h"
#include "MouseImpl.h"
#include "AutoCaller.h"
#include "Logging.h"
#ifdef VBOX_WITH_VRDP
#include <VBox/VRDPOrders.h>
#endif /* VBOX_WITH_VRDP */
class VRDPConsoleCallback :
{
public:
{
#ifndef VBOX_WITH_XPCOM
refcnt = 0;
#endif /* !VBOX_WITH_XPCOM */
}
virtual ~VRDPConsoleCallback() {}
#ifndef VBOX_WITH_XPCOM
return ::InterlockedIncrement(&refcnt);
}
{
if (cnt == 0)
delete this;
return cnt;
}
{
if (riid == IID_IUnknown) {
*ppObj = this;
AddRef();
return S_OK;
}
if (riid == IID_IConsoleCallback) {
*ppObj = this;
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
#endif /* !VBOX_WITH_XPCOM */
STDMETHOD(OnMouseCapabilityChange)(BOOL supportsAbsolute, BOOL supportsRelative, BOOL needsHostCursor)
{
if (m_server)
{
}
return S_OK;
}
{
if (m_server)
{
}
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
return S_OK;
}
{
if (!canShow)
return E_POINTER;
/* we don't manage window activation here: always agree */
return S_OK;
}
{
if (!winId)
return E_POINTER;
/* we don't manage window activation here */
*winId = 0;
return S_OK;
}
private:
#ifndef VBOX_WITH_XPCOM
long refcnt;
#endif /* !VBOX_WITH_XPCOM */
};
#ifdef VBOX_WITH_XPCOM
#include <nsMemory.h>
#endif /* VBOX_WITH_XPCOM */
#ifdef DEBUG_sunlover
#define LOGDUMPPTR Log
{
unsigned i;
for (i = 0; i < height; i++)
{
unsigned j;
{
unsigned k;
for (k = 0; k < 8; k++)
{
}
pu8And++;
}
LOGDUMPPTR(("\n"));
}
if (fXorMaskRGB32)
{
for (i = 0; i < height; i++)
{
unsigned j;
for (j = 0; j < width; j++)
{
}
LOGDUMPPTR(("\n"));
}
}
else
{
/* RDP 24 bit RGB mask. */
for (i = 0; i < height; i++)
{
unsigned j;
for (j = 0; j < width; j++)
{
pu8Xor += 3;
}
LOGDUMPPTR(("\n"));
}
}
}
#else
#define dumpPointer(a, b, c, d) do {} while (0)
#endif /* DEBUG_sunlover */
static void findTopLeftBorder(const uint8_t *pu8AndMask, const uint8_t *pu8XorMask, uint32_t width, uint32_t height, uint32_t *pxSkip, uint32_t *pySkip)
{
/*
* Find the top border of the AND mask. First assign to special value.
*/
unsigned y;
unsigned x;
{
/* For each complete byte in the row. */
for (x = 0; x < cbAndRow - 1; x++)
{
if (pu8And[x] != 0xFF)
{
ySkipAnd = y;
break;
}
}
{
/* Last byte. */
{
ySkipAnd = y;
}
}
}
{
ySkipAnd = 0;
}
/*
* Find the left border of the AND mask.
*/
/* For all bit columns. */
{
{
{
xSkipAnd = x;
break;
}
}
}
{
xSkipAnd = 0;
}
/*
* Find the XOR mask top border.
*/
{
for (x = 0; x < width; x++)
{
if (pu32Xor[x] != 0)
{
ySkipXor = y;
break;
}
}
}
{
ySkipXor = 0;
}
/*
* Find the left border of the XOR mask.
*/
/* For all columns. */
{
{
if (*pu32Xor != 0)
{
xSkipXor = x;
break;
}
}
}
{
xSkipXor = 0;
}
}
/* Generate an AND mask for alpha pointers here, because
* guest driver does not do that correctly for Vista pointers.
* Similar fix, changing the alpha threshold, could be applied
* for the guest driver, but then additions reinstall would be
* necessary, which we try to avoid.
*/
static void mousePointerGenerateANDMask(uint8_t *pu8DstAndMask, int cbDstAndMask, const uint8_t *pu8SrcAlpha, int w, int h)
{
int y;
for (y = 0; y < h; y++)
{
int x;
for (x = 0; x < w; x++, bitmask >>= 1)
{
if (bitmask == 0)
{
bitmask = 0x80;
}
/* Whether alpha channel value is not transparent enough for the pixel to be seen. */
{
}
}
/* Point to next source and dest scans. */
pu8SrcAlpha += w * 4;
}
}
{
LogSunlover(("VRDPConsoleCallback::OnMousePointerShapeChange: %d, %d, %lux%lu, @%lu,%lu\n", visible, alpha, width, height, xHot, yHot));
if (m_server)
{
{
if (!visible)
{
}
}
{
/* Pointer consists of 1 bpp AND and 24 BPP XOR masks.
* 'shape' AND mask followed by XOR mask.
* XOR mask contains 32 bit (lsb)BGR0(msb) values.
*
* We convert this to RDP color format which consist of
* one bpp AND mask and 24 BPP (BGR) color XOR image.
*
* RDP clients expect 8 aligned width and height of
* pointer (preferably 32x32).
*
* They even contain bugs which do not appear for
* 32x32 pointers but would appear for a 41x32 one.
*
* So set pointer size to 32x32. This can be done safely
* because most pointers are 32x32.
*/
if (alpha)
{
}
/* Windows guest alpha pointers are wider than 32 pixels.
* Try to find out the top-left border of the pointer and
* then copy only meaningful bits. All complete top rows
* and all complete left columns where (AND == 1 && XOR == 0)
* are skipped. Hot spot is adjusted.
*/
/* Must not skip the hot spot. */
/*
* Compute size and allocate memory for the pointer.
*/
if (pointer)
{
/* Copy AND mask. */
unsigned x, y;
for (y = 0; y < minheight; y++)
{
for (x = 0; x < minwidth; x++)
{
if (!bit)
{
byteIndex = x / 8;
bitIndex = x % 8;
}
}
src += srcmaskwidth;
dst -= rdpmaskwidth;
}
/* Point src to XOR mask */
for (y = 0; y < minheight ; y++)
{
for (x = 0; x < minwidth; x++)
{
}
src += srcdatawidth;
dst -= rdpdatawidth;
}
}
}
}
return S_OK;
}
// ConsoleVRDPServer
////////////////////////////////////////////////////////////////////////////////
#ifdef VBOX_WITH_VRDP
{
{ VRDP_INTERFACE_VERSION_1, sizeof(VRDPCALLBACKS_1) },
};
DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackQueryProperty(void *pvCallback, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut)
{
int rc = VERR_NOT_SUPPORTED;
switch (index)
{
case VRDP_QP_NETWORK_PORT:
{
/* This is obsolete, the VRDP server uses VRDP_QP_NETWORK_PORT_RANGE instead. */
{
rc = VINF_SUCCESS;
}
else
{
}
} break;
case VRDP_QP_NETWORK_ADDRESS:
{
/* The server expects UTF8. */
if (cbAddress >= 0x10000)
{
/* More than 64K seems to be an invalid address. */
break;
}
{
if (cbAddress > 0)
{
{
}
else
{
/* The value is an empty string. */
}
}
rc = VINF_SUCCESS;
}
else
{
}
} break;
case VRDP_QP_NUMBER_MONITORS:
{
{
rc = VINF_SUCCESS;
}
else
{
}
} break;
{
{
bstr = "";
}
if (bstr == "0")
{
bstr = "3389";
}
/* The server expects UTF8. */
if (cbPortRange >= 0x10000)
{
/* More than 64K seems to be an invalid port range string. */
break;
}
{
if (cbPortRange > 0)
{
{
}
else
{
/* The value is an empty string. */
}
}
rc = VINF_SUCCESS;
}
else
{
}
} break;
#ifdef VBOX_WITH_VRDP_VIDEO_CHANNEL
case VRDP_QP_VIDEO_CHANNEL:
{
{
rc = VINF_SUCCESS;
}
else
{
}
} break;
{
{
rc = VINF_SUCCESS;
}
else
{
}
} break;
#endif /* VBOX_WITH_VRDP_VIDEO_CHANNEL */
{
{
break;
}
rc = VINF_SUCCESS;
if (pcbOut)
{
}
} break;
default:
break;
}
return rc;
}
DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClientLogon(void *pvCallback, uint32_t u32ClientId, const char *pszUser, const char *pszPassword, const char *pszDomain)
{
}
DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientConnect (void *pvCallback, uint32_t u32ClientId)
{
}
DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackClientDisconnect (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercepted)
{
}
DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackIntercept (void *pvCallback, uint32_t u32ClientId, uint32_t fu32Intercept, void **ppvIntercept)
{
int rc = VERR_NOT_SUPPORTED;
switch (fu32Intercept)
{
{
if (ppvIntercept)
{
*ppvIntercept = server;
}
rc = VINF_SUCCESS;
} break;
{
rc = VINF_SUCCESS;
} break;
{
if (ppvIntercept)
{
*ppvIntercept = server;
}
rc = VINF_SUCCESS;
} break;
default:
break;
}
return rc;
}
DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackUSB (void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint8_t u8Code, const void *pvRet, uint32_t cbRet)
{
#ifdef VBOX_WITH_USB
#else
return VERR_NOT_SUPPORTED;
#endif
}
DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackClipboard (void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData)
{
}
DECLCALLBACK(bool) ConsoleVRDPServer::VRDPCallbackFramebufferQuery (void *pvCallback, unsigned uScreenId, VRDPFRAMEBUFFERINFO *pInfo)
{
bool fAvailable = false;
if (pfb)
{
/* Query framebuffer parameters. */
ULONG bitsPerPixel = 0;
/* Now fill the information as requested by the caller. */
fAvailable = true;
}
{
}
return fAvailable;
}
DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferLock (void *pvCallback, unsigned uScreenId)
{
{
}
}
DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackFramebufferUnlock (void *pvCallback, unsigned uScreenId)
{
{
}
}
{
{
}
{
}
}
DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackInput (void *pvCallback, int type, const void *pvInput, unsigned cbInput)
{
switch (type)
{
case VRDP_INPUT_SCANCODE:
{
if (cbInput == sizeof (VRDPINPUTSCANCODE))
{
/* Track lock keys. */
{
}
{
}
{
}
{
/* Key pressed. */
}
}
} break;
case VRDP_INPUT_POINT:
{
if (cbInput == sizeof (VRDPINPUTPOINT))
{
int mouseButtons = 0;
int iWheel = 0;
{
}
{
}
{
}
{
iWheel = -1;
}
{
iWheel = 1;
}
if (server->m_fGuestWantsAbsolute)
{
pConsole->getMouse()->PutMouseEventAbsolute (pInputPoint->x + 1, pInputPoint->y + 1, iWheel, 0 /* Horizontal wheel */, mouseButtons);
} else
{
}
}
} break;
case VRDP_INPUT_CAD:
{
} break;
case VRDP_INPUT_RESET:
{
} break;
case VRDP_INPUT_SYNCH:
{
if (cbInput == sizeof (VRDPINPUTSYNCH))
{
/* The client initiated synchronization. Always make the guest to reflect the client state.
* Than means, when the guest changes the state itself, it is forced to return to the client
* state.
*/
{
}
{
}
}
} break;
default:
break;
}
}
DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint (void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId)
{
}
#endif /* VBOX_WITH_VRDP */
{
mcClipboardRefs = 0;
#ifdef VBOX_WITH_USB
mUSBBackends.fThreadRunning = false;
mUSBBackends.event = 0;
#endif
#ifdef VBOX_WITH_VRDP
mhServer = 0;
m_fGuestWantsAbsolute = false;
m_mousex = 0;
m_mousey = 0;
m_InputSynch.fGuestNumLock = false;
m_InputSynch.fGuestCapsLock = false;
m_InputSynch.fGuestScrollLock = false;
m_InputSynch.fClientNumLock = false;
m_InputSynch.fClientCapsLock = false;
m_InputSynch.fClientScrollLock = false;
mConsoleCallback = new VRDPConsoleCallback(this);
mVRDPBindPort = -1;
#endif /* VBOX_WITH_VRDP */
mAuthLibrary = 0;
}
{
Stop ();
#ifdef VBOX_WITH_VRDP
if (mConsoleCallback)
{
}
unsigned i;
for (i = 0; i < RT_ELEMENTS(maFramebuffers); i++)
{
if (maFramebuffers[i])
{
maFramebuffers[i]->Release ();
maFramebuffers[i] = NULL;
}
}
#endif /* VBOX_WITH_VRDP */
if (RTCritSectIsInitialized (&mCritSect))
{
}
}
int ConsoleVRDPServer::Launch (void)
{
LogFlowThisFunc(("\n"));
#ifdef VBOX_WITH_VRDP
int rc = VINF_SUCCESS;
{
if (loadVRDPLibrary ())
{
rc = mpfnVRDPCreateServer (&mCallbacks.header, this, (VRDPINTERFACEHDR **)&mpEntryPoints, &mhServer);
if (RT_SUCCESS(rc))
{
#ifdef VBOX_WITH_USB
#endif /* VBOX_WITH_USB */
}
else if (rc != VERR_NET_ADDRESS_IN_USE)
}
else
{
AssertMsgFailed(("Could not load the VRDP library\n"));
}
}
#else
int rc = VERR_NOT_SUPPORTED;
LogRel(("VRDP: this version does not include the VRDP server.\n"));
#endif /* VBOX_WITH_VRDP */
return rc;
}
void ConsoleVRDPServer::EnableConnections (void)
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif /* VBOX_WITH_VRDP */
}
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif /* VBOX_WITH_VRDP */
}
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif /* VBOX_WITH_VRDP */
}
void ConsoleVRDPServer::MousePointerHide (void)
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif /* VBOX_WITH_VRDP */
}
void ConsoleVRDPServer::Stop (void)
{
Assert(VALID_PTR(this)); /** @todo r=bird: there are(/was) some odd cases where this buster was invalid on
* linux. Just remove this when it's 100% sure that problem has been fixed. */
#ifdef VBOX_WITH_VRDP
if (mhServer)
{
/* Reset the handle to avoid further calls to the server. */
mhServer = 0;
if (mpEntryPoints && hServer)
{
}
}
#endif /* VBOX_WITH_VRDP */
#ifdef VBOX_WITH_USB
#endif /* VBOX_WITH_USB */
if (mAuthLibrary)
{
mAuthLibrary = 0;
}
}
/* Worker thread for Remote USB. The thread polls the clients for
* the list of attached USB devices.
*
*
* The thread is always running when the VRDP server is active.
*
* The thread scans backends and requests the device list every 2 seconds.
*
* When device list is available, the thread calls the Console to process it.
*
*/
#define VRDP_DEVICE_LIST_PERIOD_MS (2000)
#ifdef VBOX_WITH_USB
{
while (pOwner->isRemoteUSBThreadRunning ())
{
{
}
}
return VINF_SUCCESS;
}
{
mUSBBackends.fThreadRunning = true;
}
bool ConsoleVRDPServer::isRemoteUSBThreadRunning (void)
{
return mUSBBackends.fThreadRunning;
}
{
}
void ConsoleVRDPServer::remoteUSBThreadStart (void)
{
if (RT_FAILURE(rc))
{
AssertFailed ();
mUSBBackends.event = 0;
}
if (RT_SUCCESS(rc))
{
}
if (RT_FAILURE(rc))
{
}
else
{
/* Wait until the thread is ready. */
}
}
void ConsoleVRDPServer::remoteUSBThreadStop (void)
{
mUSBBackends.fThreadRunning = false;
{
}
if (mUSBBackends.event)
{
mUSBBackends.event = 0;
}
}
#endif /* VBOX_WITH_USB */
VRDPAuthResult ConsoleVRDPServer::Authenticate (const Guid &uuid, VRDPAuthGuestJudgement guestJudgement,
{
LogFlow(("ConsoleVRDPServer::Authenticate: uuid = %RTuuid, guestJudgement = %d, pszUser = %s, pszPassword = %s, pszDomain = %s, u32ClientId = %d\n",
/*
* Called only from VRDP input thread. So thread safety is not required.
*/
if (!mAuthLibrary)
{
/* Load the external authentication library. */
LogRel(("VRDPAUTH: ConsoleVRDPServer::Authenticate: loading external authentication library '%ls'\n", authLibrary.raw()));
int rc;
else
if (RT_FAILURE(rc))
if (RT_SUCCESS(rc))
{
/* Get the entry point. */
if (RT_FAILURE(rc2))
{
if (rc2 != VERR_SYMBOL_NOT_FOUND)
{
}
}
/* Get the entry point. */
if (RT_FAILURE(rc2))
{
if (rc2 != VERR_SYMBOL_NOT_FOUND)
{
}
}
if (mpfnAuthEntry2 || mpfnAuthEntry)
{
rc = VINF_SUCCESS;
}
}
if (RT_FAILURE(rc))
{
if (mAuthLibrary)
{
mAuthLibrary = 0;
}
return VRDPAuthAccessDenied;
}
}
switch (result)
{
case VRDPAuthAccessDenied:
LogRel(("VRDPAUTH: external authentication module returned 'access denied'\n"));
break;
case VRDPAuthAccessGranted:
LogRel(("VRDPAUTH: external authentication module returned 'access granted'\n"));
break;
case VRDPAuthDelegateToGuest:
LogRel(("VRDPAUTH: external authentication module returned 'delegate request to guest'\n"));
break;
default:
}
return result;
}
{
LogFlow(("ConsoleVRDPServer::AuthDisconnect: uuid = %RTuuid, u32ClientId = %d\n",
rawuuid, u32ClientId));
if (mpfnAuthEntry2)
}
int ConsoleVRDPServer::lockConsoleVRDPServer (void)
{
return rc;
}
void ConsoleVRDPServer::unlockConsoleVRDPServer (void)
{
}
const void *pvData,
{
LogFlowFunc(("pvCallback = %p, u32ClientId = %d, u32Function = %d, u32Format = 0x%08X, pvData = %p, cbData = %d\n",
int rc = VINF_SUCCESS;
switch (u32Function)
{
{
if (pServer->mpfnClipboardCallback)
{
(void *)pvData,
cbData);
}
} break;
{
if (pServer->mpfnClipboardCallback)
{
(void *)pvData,
cbData);
}
} break;
default:
}
return rc;
}
void *pvParms,
{
LogFlowFunc(("pvExtension = %p, u32Function = %d, pvParms = %p, cbParms = %d\n",
int rc = VINF_SUCCESS;
#ifdef VBOX_WITH_VRDP
switch (u32Function)
{
{
} break;
{
/* The guest announces clipboard formats. This must be delivered to all clients. */
{
NULL,
0,
NULL);
}
} break;
{
/* The clipboard service expects that the pvData buffer will be filled
* with clipboard data. The server returns the data from the client that
* announced the requested format most recently.
*/
{
}
} break;
{
{
NULL);
}
} break;
default:
}
#endif /* VBOX_WITH_VRDP */
return rc;
}
{
int rc = lockConsoleVRDPServer ();
if (RT_SUCCESS(rc))
{
if (mcClipboardRefs == 0)
{
rc = HGCMHostRegisterServiceExtension (&mhClipboard, "VBoxSharedClipboard", ClipboardServiceExtension, this);
if (RT_SUCCESS(rc))
{
}
}
}
}
{
int rc = lockConsoleVRDPServer ();
if (RT_SUCCESS(rc))
{
if (mcClipboardRefs == 0)
{
}
}
}
/* That is called on INPUT thread of the VRDP server.
* The ConsoleVRDPServer keeps a list of created backend instances.
*/
{
#ifdef VBOX_WITH_USB
/* Create a new instance of the USB backend for the new client. */
if (pRemoteUSBBackend)
{
/* Append the new instance in the list. */
int rc = lockConsoleVRDPServer ();
if (RT_SUCCESS(rc))
{
if (mUSBBackends.pHead)
{
}
else
{
}
if (ppvIntercept)
{
}
}
if (RT_FAILURE(rc))
{
pRemoteUSBBackend->Release ();
}
}
#endif /* VBOX_WITH_USB */
}
{
#ifdef VBOX_WITH_USB
/* Find the instance. */
int rc = lockConsoleVRDPServer ();
if (RT_SUCCESS(rc))
{
if (pRemoteUSBBackend)
{
/* Notify that it will be deleted. */
}
}
if (pRemoteUSBBackend)
{
/* Here the instance has been excluded from the list and can be dereferenced. */
pRemoteUSBBackend->Release ();
}
#endif
}
{
#ifdef VBOX_WITH_USB
/* Find the instance. */
int rc = lockConsoleVRDPServer ();
if (RT_SUCCESS(rc))
{
if (pRemoteUSBBackend)
{
/* Inform the backend instance that it is referenced by the Guid. */
if (fAdded)
{
/* Reference the instance because its pointer is being taken. */
}
else
{
}
}
}
if (pRemoteUSBBackend)
{
return pRemoteUSBBackend->GetBackendCallbackPointer ();
}
#endif
return NULL;
}
{
#ifdef VBOX_WITH_USB
/* Find the instance. */
int rc = lockConsoleVRDPServer ();
if (RT_SUCCESS(rc))
{
if (pRemoteUSBBackend)
{
}
if (pRemoteUSBBackend)
{
pRemoteUSBBackend->Release ();
}
}
#endif
}
{
#ifdef VBOX_WITH_USB
int rc = lockConsoleVRDPServer ();
if (RT_SUCCESS(rc))
{
if (pRemoteUSBBackend == NULL)
{
/* The first backend in the list is requested. */
}
else
{
/* Get pointer to the next backend. */
}
{
}
if (pRemoteUSBBackend)
{
pRemoteUSBBackend->Release ();
}
}
#endif
return pNextRemoteUSBBackend;
}
#ifdef VBOX_WITH_USB
/* Internal method. Called under the ConsoleVRDPServerLock. */
{
while (pRemoteUSBBackend)
{
{
break;
}
}
return pRemoteUSBBackend;
}
/* Internal method. Called under the ConsoleVRDPServerLock. */
{
while (pRemoteUSBBackend)
{
{
break;
}
}
return pRemoteUSBBackend;
}
#endif
/* Internal method. Called by the backend destructor. */
{
#ifdef VBOX_WITH_USB
int rc = lockConsoleVRDPServer ();
/* Exclude the found instance from the list. */
if (pRemoteUSBBackend->pNext)
{
}
else
{
}
if (pRemoteUSBBackend->pPrev)
{
}
else
{
}
#endif
}
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif
}
void ConsoleVRDPServer::SendResize (void) const
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif
}
void ConsoleVRDPServer::SendUpdateBitmap (unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h) const
{
#ifdef VBOX_WITH_VRDP
update.x = x;
update.y = y;
update.w = w;
update.h = h;
if (mpEntryPoints && mhServer)
{
}
#endif
}
void ConsoleVRDPServer::SendAudioSamples (void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format) const
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif
}
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif
}
void ConsoleVRDPServer::SendUSBRequest (uint32_t u32ClientId, void *pvParms, uint32_t cbParms) const
{
#ifdef VBOX_WITH_VRDP
if (mpEntryPoints && mhServer)
{
}
#endif
}
void ConsoleVRDPServer::QueryInfo (uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) const
{
#ifdef VBOX_WITH_VRDP
if (index == VRDP_QI_PORT)
{
{
}
}
else if (mpEntryPoints && mhServer)
{
}
#endif
}
#ifdef VBOX_WITH_VRDP
/* note: static function now! */
bool ConsoleVRDPServer::loadVRDPLibrary (void)
{
int rc = VINF_SUCCESS;
if (!mVRDPLibrary)
{
if (RT_SUCCESS(rc))
{
LogFlow(("VRDPServer::loadLibrary(): successfully loaded VRDP library.\n"));
struct SymbolEntry
{
const char *name;
void **ppfn;
};
#define DEFSYMENTRY(a) { #a, (void**)&mpfn##a }
static const struct SymbolEntry symbols[] =
{
};
for (unsigned i = 0; i < RT_ELEMENTS(symbols); i++)
{
if (RT_FAILURE(rc))
{
break;
}
}
}
else
{
LogRel(("VRDPServer::loadLibrary(): failed to load VRDP library! VRDP not available: rc = %Rrc\n", rc));
mVRDPLibrary = NULL;
}
}
// just to be safe
if (RT_FAILURE(rc))
{
if (mVRDPLibrary)
{
mVRDPLibrary = NULL;
}
}
return (mVRDPLibrary != NULL);
}
#endif /* VBOX_WITH_VRDP */
/*
* IRemoteDisplayInfo implementation.
*/
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
}
{
}
{
return S_OK;
}
void RemoteDisplayInfo::FinalRelease()
{
uninit ();
}
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the guest object.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan(this);
/* Confirm a successful initialization */
return S_OK;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void RemoteDisplayInfo::uninit()
{
LogFlowThisFunc(("\n"));
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
}
// IRemoteDisplayInfo properties
/////////////////////////////////////////////////////////////////////////////
{ \
if (!a##_aName) \
return E_POINTER; \
\
AutoCaller autoCaller(this); \
\
/* todo: Not sure if a AutoReadLock would be sufficient. */ \
\
\
\
\
return S_OK; \
} \
extern void IMPL_GETTER_BOOL_DUMMY(void)
{ \
if (!a##_aName) \
return E_POINTER; \
\
AutoCaller autoCaller(this); \
\
/* todo: Not sure if a AutoReadLock would be sufficient. */ \
\
\
\
\
return S_OK; \
} \
extern void IMPL_GETTER_SCALAR_DUMMY(void)
{ \
if (!a##_aName) \
return E_POINTER; \
\
AutoCaller autoCaller(this); \
\
/* todo: Not sure if a AutoReadLock would be sufficient. */ \
\
\
\
if (cbOut == 0) \
{ \
return S_OK; \
} \
\
\
if (!pchBuffer) \
{ \
Log(("RemoteDisplayInfo::" \
#_aName \
": Failed to allocate memory %d bytes\n", cbOut)); \
return E_OUTOFMEMORY; \
} \
\
\
\
\
RTMemTmpFree (pchBuffer); \
\
return S_OK; \
} \
extern void IMPL_GETTER_BSTR_DUMMY(void)
/* vi: set tabstop=4 shiftwidth=4 expandtab: */