void MainExitServer() { lprintf("ExitServer terminating server\n"); ExitAsyncConnections(); CloseAllSessions(); /* gotta do this before anything, cause it uses kod, accounts */ CloseDefaultChannels(); ResetLoadMotd(); ResetLoadBof(); ResetTable(); ResetBufferPool(); ResetSysTimer(); ResetDLlist(); ResetNameID(); ResetAccount(); ResetUser(); ResetString(); ResetRoomData(); ResetResource(); ResetTimer(); ResetList(); ResetObject(); ResetMessage(); ResetClass(); ResetConfig(); DeleteAllBlocks(); }
void InterfaceReloadSystem() { EnterServerLock(); lprintf("InterfaceReloadSystem reloading system\n"); PauseTimers(); SendBlakodBeginSystemEvent(SYSEVENT_RELOAD_SYSTEM); GarbageCollect(); SaveAll(); ResetAdminConstants(); ResetUser(); ResetString(); ResetRoomData(); ResetLoadMotd(); ResetLoadBof(); ResetDLlist(); ResetNameID(); ResetResource(); ResetTimer(); ResetList(); ResetObject(); ResetMessage(); ResetClass(); LoadMotd(); LoadBof(); LoadRsc(); LoadKodbase(); UpdateSecurityRedbook(); LoadAdminConstants(); /* can't reload accounts because sessions have pointers to accounts */ if (!LoadAllButAccount()) eprintf("InterfaceReloadSystem couldn't load game. You are dead.\n"); AllocateParseClientListNodes(); /* it needs a list to send to users */ AddBuiltInDLlist(); SendBlakodEndSystemEvent(SYSEVENT_RELOAD_SYSTEM); UnpauseTimers(); LeaveServerLock(); }
LPREGVALUE CRKey::Add( DWORD dwType, LPCTSTR pName, const void * pValue, DWORD dwValue, BOOL bFile) {_STTEX(); BOOL bNew = FALSE; LPREGVALUE prv = (LPREGVALUE)Find( pName ); // Did we find an existing object? if ( prv != NULL ) ResetObject( prv, NULL, 0, (LPVOID)pName ); else // Create new object { prv = (LPREGVALUE)New( NULL, 0, (LPVOID)pName ); if ( prv == NULL ) return NULL; } // end else // Save the type prv->type = dwType; RULIB_TRY { if ( bFile ) { CWinFile wf; if ( wf.OpenExisting( (char*)pValue ) ) { DWORD dwSize = wf.Size(); if ( dwSize < m_dwMinSize ) dwSize = m_dwMinSize; if ( dwSize ) { // Allocate memory prv->data = new BYTE[ dwSize + 1 ]; if ( prv->data == NULL ) { Delete( prv ); return FALSE; } prv->size = dwSize; // Read data from file if ( !wf.Size() || !wf.Read( prv->data, wf.Size() ) ) ZeroMemory( prv->data, prv->size ); } // end if } // end if else bFile = FALSE; } // end if // Save the data if ( !bFile && ( dwValue != 0 || m_dwMinSize != 0 ) ) { // What size should we use DWORD sz = m_dwMinSize < dwValue ? dwValue : m_dwMinSize; // Allocate memory prv->data = new BYTE[ sz + 1 ]; if ( prv->data == NULL ) { Delete( prv ); return FALSE; } prv->size = sz; // Initialize data if ( pValue != NULL && dwValue != 0 ) { memcpy( prv->data, pValue, dwValue ); ( (LPBYTE)prv->data )[ dwValue ] = 0; } // end if else ZeroMemory( prv->data, sz + 1 ); } // end if } // end try // Just forget it if error RULIB_CATCH_ALL { ASSERT( 0 ); return NULL; } return prv; }