/** * when an error occurs, report the error, and close the session. * * @function onError * * @date 2015-02-09 * * @revision none * * @designer Eric Tsang * * @programmer Eric Tsang * * @note none * * @signature static void onError(Session* session, int errCode, int * winErrCode) * * @param session session structure pointer * @param errCode error return code indicating the nature of the error. * @param winErrCode the windows error return code, indicating the nature * of the error. */ static void onError(Session* session, int errCode, int winErrCode) { char output[MAX_STRING_LEN]; // buffer for output // parse user parameters TestClntSession* testClntSession = (TestClntSession*) session->usrPtr; // print error message... sprintf_s(output, "ERROR: %s\r\n", rctoa(errCode)); appendWindowText(testClntSession->ctrlClnt->clientWnds->hOutput, output); // abort sessionClose(session); }
/** * Client exits normally. */ IOReturn org_virtualbox_SupDrvClient::clientClose(void) { LogFlow(("org_virtualbox_SupDrvClient::clientClose([%p]) (cur pid=%d proc=%p)\n", this, RTProcSelf(), RTR0ProcHandleSelf())); AssertMsg((RTR0PROCESS)m_Task == RTR0ProcHandleSelf(), ("%p %p\n", m_Task, RTR0ProcHandleSelf())); /* * Clean up the session if it's still around. * * We cannot rely 100% on close, and in the case of a dead client * we'll end up hanging inside vm_map_remove() if we postpone it. */ if (m_pSession) { sessionClose(RTProcSelf()); Assert(!m_pSession); } m_pProvider = NULL; terminate(); return kIOReturnSuccess; }