static VOID VMCAShutdownRPCServer( VOID ) { DWORD dwError = 0; // stop rpc listening dwError = VMCAStopRpcServer(); BAIL_ON_VMCA_ERROR(dwError); if (gVMCAServerGlobals.pRPCServerThread) { dwError = dcethread_interrupt(gVMCAServerGlobals.pRPCServerThread); dwError = VMCAMapDCEErrorCode(dwError); BAIL_ON_VMCA_ERROR(dwError); #if defined(_WIN32) // BUGBUG BUGBUG PR http://bugzilla.eng.vmware.com/show_bug.cgi?id=1219191 // This is most likely a pthread issue due to signal lost. // We should update pthread to see if we can resolve this. // http://bugzilla.eng.vmware.com/show_bug.cgi?id=1224401 tracks this effort. VMCASleep(1); // sleep 1s #else dwError = dcethread_join(gVMCAServerGlobals.pRPCServerThread, NULL); dwError = VMCAMapDCEErrorCode(dwError); BAIL_ON_VMCA_ERROR(dwError); #endif gVMCAServerGlobals.pRPCServerThread = NULL; } error: return; }
static VOID EventLogShutdownRPCServer( VOID ) { DWORD dwError = 0; dwError = EventLogStopRpcServer(); BAIL_ON_VMEVENT_ERROR(dwError); if (gEventLogServerGlobals.pRPCServerThread) { dwError = LwMapErrnoToLwError( dcethread_interrupt( gEventLogServerGlobals.pRPCServerThread)); BAIL_ON_VMEVENT_ERROR(dwError); dwError = LwMapErrnoToLwError( dcethread_join( gEventLogServerGlobals.pRPCServerThread, NULL)); BAIL_ON_VMEVENT_ERROR(dwError); gEventLogServerGlobals.pRPCServerThread = NULL; } error: return; }
NTSTATUS EVTSvcmStop( PLW_SVCM_INSTANCE pInstance ) { DWORD dwError = 0; EVT_LOG_INFO("Eventlog Service exiting..."); gbExitNow = TRUE; if (gbRegisteredTcpIp) { dwError = EVTUnregisterAllEndpoints(); BAIL_ON_EVT_ERROR(dwError); dwError = EVTStopListen(); BAIL_ON_EVT_ERROR(dwError); } dwError = LwmEvtSrvStopListenThread(); BAIL_ON_EVT_ERROR(dwError); if (gbRegisteredTcpIp) { dwError = LwMapErrnoToLwError(dcethread_interrupt(gNetworkThread)); BAIL_ON_EVT_ERROR(dwError); dwError = LwMapErrnoToLwError(dcethread_join(gNetworkThread, NULL)); BAIL_ON_EVT_ERROR(dwError); } cleanup: LwEvtDbShutdownEventDatabase(); EVTSetConfigDefaults(); EVTFreeSecurityDescriptor(gServerInfo.pAccess); gServerInfo.pAccess = NULL; return LwWin32ErrorToNtStatus(dwError); error: EVT_LOG_ERROR("Eventlog exiting due to error [code:%d]", dwError); goto cleanup; }
VOID SrvSvcRpcShutdown( VOID ) { DWORD dwError = ERROR_SUCCESS; BOOLEAN bInLock = FALSE; SRVSVC_LOCK_MUTEX(bInLock, &gSrvsServerInfo.mutex); if (gSrvsServerInfo.pServerBinding) { dwError = SrvSvcUnregisterForRPC(gSrvsServerInfo.pServerBinding); BAIL_ON_SRVSVC_ERROR(dwError); gSrvsServerInfo.pServerBinding = NULL; } if (gSrvsServerInfo.pRegistryBinding) { dwError = WinRegUnregisterForRPC(gSrvsServerInfo.pRegistryBinding); BAIL_ON_SRVSVC_ERROR(dwError); gSrvsServerInfo.pRegistryBinding = NULL; } if (gSrvsServerInfo.pRpcListenerThread) { dwError = LwMapErrnoToLwError(dcethread_interrupt(gSrvsServerInfo.pRpcListenerThread)); BAIL_ON_SRVSVC_ERROR(dwError); dwError = LwMapErrnoToLwError(dcethread_join(gSrvsServerInfo.pRpcListenerThread, NULL)); BAIL_ON_SRVSVC_ERROR(dwError); } if (gSrvsServerInfo.pSessionSecDesc) { SrvSvcSrvDestroyServerSecurityDescriptor(gSrvsServerInfo.pSessionSecDesc); gSrvsServerInfo.pSessionSecDesc = NULL; } error: SRVSVC_UNLOCK_MUTEX(bInLock, &gSrvsServerInfo.mutex); return; }