/* Called to reset adapter to a given character mode. */ static BOOLEAN VBoxDrvResetHW(PVOID HwDeviceExtension, ULONG Columns, ULONG Rows) { PVBOXMP_DEVEXT pExt = (PVBOXMP_DEVEXT) HwDeviceExtension; LOGF_ENTER(); if (pExt->iDevice==0) /* Primary device */ { VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ENABLE); VideoPortWritePortUshort((PUSHORT)VBE_DISPI_IOPORT_DATA, VBE_DISPI_DISABLED); #if 0 /* ResetHW is not the place to do such cleanup. See MSDN. */ if (pExt->u.primary.pvReqFlush != NULL) { VbglGRFree((VMMDevRequestHeader *)pExt->u.primary.pvReqFlush); pExt->u.primary.pvReqFlush = NULL; } VbglTerminate(); VBoxFreeDisplaysHGSMI(VBoxCommonFromDeviceExt(pExt)); #endif } else { LOG(("ignoring non primary device %d", pExt->iDevice)); } LOGF_LEAVE(); /* Tell the system to use VGA BIOS to set the text video mode. */ return FALSE; }
VOID VBoxDeviceRemoved(PVBOXMOUSE_DEVEXT pDevExt) { LOGF_ENTER(); /* Save the allocated request pointer and clear the devExt. */ VMMDevReqMouseStatus *pSCReq = (VMMDevReqMouseStatus *) InterlockedExchangePointer((PVOID volatile *)&pDevExt->pSCReq, NULL); if (pDevExt->bHostMouse && vboxIsHostInformed()) { // tell the VMM that from now on we can't handle absolute coordinates anymore VMMDevReqMouseStatus *req = NULL; int rc = VbglGRAlloc((VMMDevRequestHeader **)&req, sizeof(VMMDevReqMouseStatus), VMMDevReq_SetMouseStatus); if (RT_SUCCESS(rc)) { req->mouseFeatures = 0; req->pointerXPos = 0; req->pointerYPos = 0; rc = VbglGRPerform(&req->header); if (RT_FAILURE(rc)) { WARN(("VbglGRPerform failed with rc=%#x", rc)); } VbglGRFree(&req->header); } else { WARN(("VbglGRAlloc failed with rc=%#x", rc)); } InterlockedExchange(&g_ctx.fHostInformed, FALSE); } if (pSCReq) { VbglGRFree(&pSCReq->header); } LONG callCnt = InterlockedDecrement(&g_ctx.cDevicesStarted); vboxNewProtDeviceRemoved(pDevExt); if (callCnt == 0) { if (vboxIsVBGLInited()) { /* Set the flag to prevent reinitializing of the VBGL. */ InterlockedExchange(&g_ctx.fVBGLInitFailed, TRUE); VbglTerminate(); /* The VBGL is now in the not initialized state. */ InterlockedExchange(&g_ctx.fVBGLInited, FALSE); InterlockedExchange(&g_ctx.fVBGLInitFailed, FALSE); } } LOGF_LEAVE(); }