ConsoleVRDPServer.cpp revision 427a7af1868411904934522dc1acebea2ed97373
/** @file
*
* VBox Console VRDP Helper class
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#include "ConsoleVRDPServer.h"
#include "ConsoleImpl.h"
#include "DisplayImpl.h"
#ifdef VRDP_NO_COM
#include "KeyboardImpl.h"
#include "MouseImpl.h"
#include <VBox/VRDPOrders.h>
#endif /* VRDP_NO_COM */
#include "Logging.h"
#ifdef VRDP_NO_COM
class VRDPConsoleCallback : public IConsoleCallback
{
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 */
{
if (m_server)
{
}
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 */
static void findTopLeftBorder (uint8_t *pu8Shape, 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;
}
}
STDMETHODIMP VRDPConsoleCallback::OnMousePointerShapeChange (BOOL visible, BOOL alpha, ULONG xHot, ULONG yHot,
{
Log(("VRDPConsoleCallback::OnMousePointerShapeChange: %d, %d, %dx%d, @%d,%d\n", visible, alpha, width, height, xHot, yHot));
if (m_server)
{
if (!shape)
{
if (!visible)
{
m_server->MousePointerHide ();
}
}
{
/* 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.
*/
/* 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;
}
#endif /* VRDP_NO_COM */
// ConsoleVRDPServer
////////////////////////////////////////////////////////////////////////////////
#ifdef VBOX_VRDP
#ifdef VRDP_NO_COM
{
{ VRDP_INTERFACE_VERSION_1, sizeof (VRDPCALLBACKS_1) },
};
#else
int (VBOXCALL *ConsoleVRDPServer::mpfnVRDPStartServer) (IConsole *pConsole, IVRDPServer *pVRDPServer, HVRDPSERVER *phServer);
int (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSetFramebuffer) (HVRDPSERVER hServer, IFramebuffer *pFramebuffer, uint32_t fFlags);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSetCallback) (HVRDPSERVER hServer, VRDPSERVERCALLBACK *pcallback, void *pvUser);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSendUpdateBitmap)(HVRDPSERVER hServer, unsigned uScreenId, unsigned x, unsigned y, unsigned w, unsigned h);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSendAudioSamples)(HVRDPSERVER hserver, void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSendAudioVolume) (HVRDPSERVER hserver, uint16_t left, uint16_t right);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSendUSBRequest) (HVRDPSERVER hserver, uint32_t u32ClientId, void *pvParms, uint32_t cbParms);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPSendUpdate) (HVRDPSERVER hServer, unsigned uScreenId, void *pvUpdate, uint32_t cbUpdate);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPQueryInfo) (HVRDPSERVER hserver, uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut);
void (VBOXCALL *ConsoleVRDPServer::mpfnVRDPClipboard) (HVRDPSERVER hserver, uint32_t u32Function, uint32_t u32Format, const void *pvData, uint32_t cbData, uint32_t *pcbActualRead);
#endif /* VRDP_NO_COM */
#endif /* VBOX_VRDP */
#ifdef VRDP_NO_COM
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:
{
if (port == 0)
{
}
{
rc = VINF_SUCCESS;
}
else
{
}
} break;
case VRDP_QP_NETWORK_ADDRESS:
{
{
{
}
rc = VINF_SUCCESS;
}
} break;
case VRDP_QP_NUMBER_MONITORS:
{
{
rc = VINF_SUCCESS;
}
else
{
}
} 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)
{
{
rc = VINF_SUCCESS;
} break;
{
rc = VINF_SUCCESS;
} break;
{
rc = VINF_SUCCESS;
} break;
default:
break;
}
if (VBOX_SUCCESS (rc))
{
if (ppvIntercept)
{
*ppvIntercept = server;
}
}
return rc;
}
DECLCALLBACK(int) ConsoleVRDPServer::VRDPCallbackUSB (void *pvCallback, void *pvIntercept, uint32_t u32ClientId, uint8_t u8Code, const void *pvRet, uint32_t cbRet)
{
}
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))
{
}
} 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, mouseButtons);
} else
{
}
}
} break;
case VRDP_INPUT_CAD:
{
} break;
case VRDP_INPUT_RESET:
{
} break;
default:
break;
}
}
DECLCALLBACK(void) ConsoleVRDPServer::VRDPCallbackVideoModeHint (void *pvCallback, unsigned cWidth, unsigned cHeight, unsigned cBitsPerPixel, unsigned uScreenId)
{
}
#endif /* VRDP_NO_COM */
{
mcClipboardRefs = 0;
#ifdef VBOX_WITH_USB
mUSBBackends.fThreadRunning = false;
mUSBBackends.event = 0;
#endif
#ifdef VBOX_VRDP
mhServer = 0;
#ifdef VRDP_NO_COM
m_fGuestWantsAbsolute = false;
m_mousex = 0;
m_mousey = 0;
mConsoleCallback = new VRDPConsoleCallback(this);
#endif /* VRDP_NO_COM */
#endif /* VBOX_VRDP */
mAuthLibrary = 0;
}
{
Stop ();
#ifdef VRDP_NO_COM
if (mConsoleCallback)
{
}
int i;
for (i = 0; i < ELEMENTS(maFramebuffers); i++)
{
if (maFramebuffers[i])
{
maFramebuffers[i]->Release ();
maFramebuffers[i] = NULL;
}
}
#endif /* VRDP_NO_COM */
if (RTCritSectIsInitialized (&mCritSect))
{
}
}
int ConsoleVRDPServer::Launch (void)
{
LogFlowMember(("ConsoleVRDPServer::Launch\n"));
#ifdef VBOX_VRDP
int rc = VINF_SUCCESS;
&& vrdpEnabled
&& loadVRDPLibrary ())
{
#ifdef VRDP_NO_COM
rc = mpfnVRDPCreateServer (&mCallbacks.header, this, (VRDPINTERFACEHDR **)&mpEntryPoints, &mhServer);
#else
#endif /* VRDP_NO_COM */
if (VBOX_SUCCESS(rc))
{
#ifdef VBOX_WITH_USB
#endif /* VBOX_WITH_USB */
}
else
}
#else
int rc = VERR_NOT_SUPPORTED;
#endif /* VBOX_VRDP */
return rc;
}
#ifdef VRDP_NO_COM
void ConsoleVRDPServer::EnableConnections (void)
{
#ifdef VBOX_VRDP
if (mpEntryPoints)
{
}
#endif /* VBOX_VRDP */
}
{
#ifdef VBOX_VRDP
if (mpEntryPoints)
{
}
#endif /* VBOX_VRDP */
}
void ConsoleVRDPServer::MousePointerHide (void)
{
#ifdef VBOX_VRDP
if (mpEntryPoints)
{
}
#endif /* VBOX_VRDP */
}
#else
void ConsoleVRDPServer::SetCallback (void)
{
#ifdef VBOX_VRDP
/* This is called after VM is created and allows the server to accept client connection. */
if (mhServer && mpfnVRDPSetCallback)
{
}
#endif /* VBOX_VRDP */
}
#endif /* VRDP_NO_COM */
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_VRDP
if (mhServer)
{
/* Reset the handle to avoid further calls to the server. */
mhServer = 0;
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
#endif /* VRDP_NO_COM */
}
#endif /* VBOX_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 (VBOX_FAILURE (rc))
{
AssertFailed ();
mUSBBackends.event = 0;
}
if (VBOX_SUCCESS (rc))
{
}
if (VBOX_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 = %Vuuid, 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()));
if (VBOX_FAILURE (rc))
if (VBOX_SUCCESS (rc))
{
/* Get the entry point. */
if (VBOX_FAILURE (rc2))
{
}
/* Get the entry point. */
if (VBOX_FAILURE (rc2))
{
}
if (mpfnAuthEntry2 || mpfnAuthEntry)
{
rc = VINF_SUCCESS;
}
}
if (VBOX_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 = %Vuuid, 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_VRDP
switch (u32Function)
{
{
} break;
{
/* The guest announces clipboard formats. This must be delivered to all clients. */
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
NULL,
0,
NULL);
}
#else
if (mpfnVRDPClipboard)
{
NULL,
0,
NULL);
}
#endif /* VRDP_NO_COM */
} 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.
*/
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
if (mpfnVRDPClipboard)
{
}
#endif /* VRDP_NO_COM */
} break;
{
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
NULL);
}
#else
if (mpfnVRDPClipboard)
{
NULL);
}
#endif /* VRDP_NO_COM */
} break;
default:
}
#endif /* VBOX_VRDP */
return rc;
}
#ifdef VRDP_NO_COM
#else
void ConsoleVRDPServer::ClipboardCreate (uint32_t u32ClientId, PFNVRDPCLIPBOARDCALLBACK *ppfn, void **ppv)
#endif /* VRDP_NO_COM */
{
int rc = lockConsoleVRDPServer ();
if (VBOX_SUCCESS (rc))
{
if (mcClipboardRefs == 0)
{
rc = HGCMHostRegisterServiceExtension (&mhClipboard, "VBoxSharedClipboard", ClipboardServiceExtension, this);
if (VBOX_SUCCESS (rc))
{
}
}
#ifdef VRDP_NO_COM
#else
if (VBOX_SUCCESS (rc))
{
*ppv = this;
}
#endif /* VRDP_NO_COM */
}
}
{
int rc = lockConsoleVRDPServer ();
if (VBOX_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 VRDP_NO_COM
#else
void ConsoleVRDPServer::USBBackendCreate (uint32_t u32ClientId, PFNVRDPUSBCALLBACK *ppfn, void **ppv)
#endif /* VRDP_NO_COM */
{
#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 (VBOX_SUCCESS (rc))
{
if (mUSBBackends.pHead)
{
}
else
{
}
#ifdef VRDP_NO_COM
#else
#endif /* VRDP_NO_COM */
}
if (VBOX_FAILURE (rc))
{
pRemoteUSBBackend->Release ();
}
}
#endif /* VBOX_WITH_USB */
}
{
#ifdef VBOX_WITH_USB
/* Find the instance. */
int rc = lockConsoleVRDPServer ();
if (VBOX_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 (VBOX_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 (VBOX_SUCCESS (rc))
{
if (pRemoteUSBBackend)
{
}
if (pRemoteUSBBackend)
{
pRemoteUSBBackend->Release ();
}
}
#endif
}
{
#ifdef VBOX_WITH_USB
int rc = lockConsoleVRDPServer ();
if (VBOX_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_VRDP
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
if (mpfnVRDPSendUpdate)
#endif /* VRDP_NO_COM */
#endif
}
void ConsoleVRDPServer::SendResize (void) const
{
#ifdef VBOX_VRDP
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
if (mpfnVRDPSendResize)
#endif /* VRDP_NO_COM */
#endif
}
void ConsoleVRDPServer::SendUpdateBitmap (unsigned uScreenId, uint32_t x, uint32_t y, uint32_t w, uint32_t h) const
{
#ifdef VBOX_VRDP
#ifdef VRDP_NO_COM
update.x = x;
update.y = y;
update.w = w;
update.h = h;
if (mpEntryPoints)
{
}
#else
#endif /* VRDP_NO_COM */
#endif
}
#ifdef VRDP_NO_COM
#else
{
#ifdef VBOX_VRDP
#endif
}
#endif /* VRDP_NO_COM */
void ConsoleVRDPServer::SendAudioSamples (void *pvSamples, uint32_t cSamples, VRDPAUDIOFORMAT format) const
{
#ifdef VBOX_VRDP
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
#endif /* VRDP_NO_COM */
#endif
}
{
#ifdef VBOX_VRDP
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
#endif /* VRDP_NO_COM */
#endif
}
void ConsoleVRDPServer::SendUSBRequest (uint32_t u32ClientId, void *pvParms, uint32_t cbParms) const
{
#ifdef VBOX_VRDP
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
#endif /* VRDP_NO_COM */
#endif
}
void ConsoleVRDPServer::QueryInfo (uint32_t index, void *pvBuffer, uint32_t cbBuffer, uint32_t *pcbOut) const
{
#ifdef VBOX_VRDP
#ifdef VRDP_NO_COM
if (mpEntryPoints)
{
}
#else
if (mpfnVRDPQueryInfo)
#endif /* VRDP_NO_COM */
#endif
}
#ifdef VBOX_VRDP
/* note: static function now! */
bool ConsoleVRDPServer::loadVRDPLibrary (void)
{
int rc = VINF_SUCCESS;
if (!mVRDPLibrary)
{
if (VBOX_SUCCESS(rc))
{
LogFlow(("VRDPServer::loadLibrary(): successfully loaded VRDP library.\n"));
struct SymbolEntry
{
const char *name;
void **ppfn;
};
#define DEFSYMENTRY(a) { #a, (void**)&mpfn##a }
#ifdef VRDP_NO_COM
static const struct SymbolEntry symbols[] =
{
};
#else
static const struct SymbolEntry symbols[] =
{
};
#endif /* VRDP_NO_COM */
{
if (VBOX_FAILURE(rc))
{
break;
}
}
}
else
{
LogFlow(("VRDPServer::loadLibrary(): failed to load VRDP library! VRDP not available.\n"));
mVRDPLibrary = NULL;
}
}
// just to be safe
if (VBOX_FAILURE(rc))
{
if (mVRDPLibrary)
{
mVRDPLibrary = NULL;
}
}
return (mVRDPLibrary != NULL);
}
#endif /* VBOX_VRDP */
/*
* IRemoteDisplayInfo implementation.
*/
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
void RemoteDisplayInfo::FinalRelease()
{
if (isReady())
uninit ();
}
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the guest object.
*/
{
setReady (true);
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()
{
LogFlowMember (("RemoteDisplayInfo::uninit()\n"));
AssertReturn (isReady(), (void) 0);
setReady (false);
}
// IRemoteDisplayInfo properties
/////////////////////////////////////////////////////////////////////////////
{ \
if (!a##_aName) \
return E_POINTER; \
\
CHECK_READY(); \
\
\
\
\
return S_OK; \
}
{ \
if (!a##_aName) \
return E_POINTER; \
\
CHECK_READY(); \
\
\
\
\
return S_OK; \
}
{ \
if (!a##_aName) \
return E_POINTER; \
\
CHECK_READY(); \
\
\
\
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; \
}