Exemple #1
0
void ResourceBase::Unload()
{
    if (InterlockedCompareExchange(&mState, RES_UNLOADING, RES_LOADED) == RES_LOADED)
    {
        //destination status changed during task waiting
        if (mDestState == RES_LOADED)
        {
            SetState(RES_LOADED);
            return;
        }

        for (;;)
        {
            OnUnload();
            if (mDestState != RES_LOADED)
            {
                SetState(RES_UNLOADED);
                return;
            }

            //destination status changed during resource loading - load resource back
            SetState(RES_LOADING);
            bool result = OnLoad();

            if (mDestState == RES_LOADED)
            {
                SetState(result ? RES_LOADED : RES_FAILED);
                return;
            }
        }
    }
}
void Module::Unload() {
	if (!IsActive())
		return;

	// Unhook all events
	__unhook(&ModuleManager::OnDraw, BH::moduleManager, &Module::OnDraw, this);
	__unhook(&ModuleManager::OnAutomapDraw, BH::moduleManager, &Module::OnAutomapDraw, this);
	__unhook(&ModuleManager::OnOOGDraw, BH::moduleManager, &Module::OnOOGDraw, this);

	__unhook(&ModuleManager::OnGameJoin, BH::moduleManager, &Module::OnGameJoin, this);
	__unhook(&ModuleManager::OnGameExit, BH::moduleManager, &Module::OnGameExit, this);

	__unhook(&ModuleManager::OnLoop, BH::moduleManager, &Module::OnLoop, this);

	__unhook(&ModuleManager::OnLeftClick, BH::moduleManager, &Module::OnLeftClick, this);
	__unhook(&ModuleManager::OnRightClick, BH::moduleManager, &Module::OnRightClick, this);
	__unhook(&ModuleManager::OnKey, BH::moduleManager, &Module::OnKey, this);

	__unhook(&ModuleManager::OnChatPacketRecv, BH::moduleManager, &Module::OnChatPacketRecv, this);
	__unhook(&ModuleManager::OnRealmPacketRecv, BH::moduleManager, &Module::OnRealmPacketRecv, this);
	__unhook(&ModuleManager::OnGamePacketRecv, BH::moduleManager, &Module::OnGamePacketRecv, this);

	__unhook(&ModuleManager::OnChatMsg, BH::moduleManager, &Module::OnChatMsg, this);
	__unhook(&Module::UserInput, this, &Module::OnUserInput, this);

	active = false;
	OnUnload();
}
Exemple #3
0
// disconnects bot, destroys lua instances and cleans up.
void BotUnload( botState *bot ) {

    // simply for debugging
    char* name = alloca( strlen( bot->nick ) + 1);
    strcpy( name, bot->nick );

    // unload plugins.
    for( int i = 0; i < bot->pluginCount; i++ ) {
        printf( "unloading %s\n", bot->pluginNames[i] );
        OnUnload( bot, i );
        lua_close( bot->pluginStates[i] );
        free( bot->pluginNames[i] );
    }
	
	// unload bot-wide lua state
	free( bot->globalState );

    free( bot->nick );
    free( bot->altnick );
    free( bot->fullname );
    free( bot->autosendcmd );
    free( bot->rawCarry );

    if ( bot->hostname == bot->server ) {
        free( bot->server );
    } else {
        free( bot->server );
        free( bot->hostname );
    }

	// free info grabbed from 005
	if ( bot->networkName ) free( bot->networkName );
	if ( bot->chanTypes ) free( bot->chanTypes );
	if ( bot->prefix ) free( bot->prefix );
	if ( bot->statusMsg ) free( bot->statusMsg );
	if ( bot->chanModes ) free( bot->chanModes );
	if ( bot->caseMapping ) free( bot->caseMapping );

    // free memory we use for dealing with individual lines
    for( int i = 0; i < PROTOCOL_FIELDS; i++ )
        free( bot->msg[i] );

    // the array
    free( bot->msg );

    Log( bot, "finished cleaning up\n" );

	fclose( bot->log );
	bot->pluginCount--;
    
	printf( "finished cleaning up bot [%s]\n", name );
}
Exemple #4
0
//--------------------------------------------------------------------------
bool EntityS::Unload()
{
	if(m_pkCache)
	{
		if(m_kServerNode.IsAttach(m_pkCache->m_kWildEntities))
		{
			OnUnload();
			m_pkCache->m_kIndexMap.Remove(m_kIndex);
			VE_DELETE(this);
			return true;
		}
	}
	return false;
}
Exemple #5
0
	FBOXAPI void Event::OnUpdate()
	{
		if (Input::Key[KEY_SPACE])
		{
			OnUnload();
			OnLoad();
			OnStart();
		}

		if (Stage::CurrentScene != 0)
		{
			Stage::CurrentScene->update();
		}
	}
Exemple #6
0
	NullTexture::~NullTexture()
	{
		OnUnload();

		safe_delete_array(mPixelData);
	}
Exemple #7
0
/* initialization */
NTSTATUS
DriverEntry(IN PDRIVER_OBJECT theDriverObject,
            IN PUNICODE_STRING theRegistryPath)
{
    NTSTATUS status = STATUS_SUCCESS;
	int i;
	UNICODE_STRING name, linkname;

	memtrack_init();
	KeInitializeSpinLock(&g_traffic_guard);

#ifdef USE_TDI_HOOKING
	KdPrint(("[tdi_fw] WARNING! Using unstable working mode: TDI hooking!\n"));
#endif

	status = ot_init();
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: ot_init: 0x%x\n", status));
		goto done;
	}

	status = filter_init();
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: filter_init: 0x%x\n", status));
		goto done;
	}

	status = conn_state_init();
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: conn_state_init: 0x%x\n", status));
		goto done;
	}
	
	for (i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++)
		theDriverObject->MajorFunction[i] = DeviceDispatch;

#if DBG
	// register UnLoad procedure
	theDriverObject->DriverUnload = OnUnload;
#endif

	/* create control device and symbolic link */

	RtlInitUnicodeString(&name, L"\\Device\\tdifw");

	status = IoCreateDevice(theDriverObject,
							0,
							&name,
							0,
							0,
							TRUE,		// exclusive!
							&g_devcontrol);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: IoCreateDevice(control): 0x%x!\n", status));
		goto done;
	}

	RtlInitUnicodeString(&linkname, L"\\??\\tdifw");

	status = IoCreateSymbolicLink(&linkname, &name);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: IoCreateSymbolicLink: 0x%x!\n", status));
		goto done;
	}

	RtlInitUnicodeString(&name, L"\\Device\\tdifw_nfo");

	status = IoCreateDevice(theDriverObject,
							0,
							&name,
							0,
							0,
							FALSE,		// not exclusive!
							&g_devnfo);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: IoCreateDevice(nfo): 0x%x!\n", status));
		goto done;
	}

	RtlInitUnicodeString(&linkname, L"\\??\\tdifw_nfo");

	status = IoCreateSymbolicLink(&linkname, &name);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: IoCreateSymbolicLink: 0x%x!\n", status));
		goto done;
	}

#ifndef USE_TDI_HOOKING

	status = c_n_a_device(theDriverObject, &g_tcpfltobj, &g_tcpoldobj, L"\\Device\\Tcp");
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: c_n_a_device: 0x%x\n", status));
		goto done;
	}

	status = c_n_a_device(theDriverObject, &g_udpfltobj, &g_udpoldobj, L"\\Device\\Udp");
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: c_n_a_device: 0x%x\n", status));
		goto done;
	}

	status = c_n_a_device(theDriverObject, &g_ipfltobj, &g_ipoldobj, L"\\Device\\RawIp");
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: c_n_a_device: 0x%x\n", status));
		goto done;
	}

#else	/* USE_TDI_HOOKING */

	/* get device objects for tcp/udp/ip */

	status = get_device_object(L"\\Device\\Tcp", &g_tcpfltobj);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: get_device_object(tcp): 0x%x\n", status));
		goto done;
	}
	
	status = get_device_object(L"\\Device\\Udp", &g_udpfltobj);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: get_device_object(udp): 0x%x\n", status));
		goto done;
	}
	
	status = get_device_object(L"\\Device\\RawIp", &g_ipfltobj);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: get_device_object(ip): 0x%x\n", status));
		goto done;
	}

	/* hook tcpip */

	status = hook_tcpip(&g_old_DriverObject, TRUE);
	if (status != STATUS_SUCCESS) {
		KdPrint(("[tdi_fw] DriverEntry: hook_driver: 0x%x\n", status));
		goto done;
	}
	g_hooked = TRUE;

#endif	/* USE_TDI_HOOKING */

	status = STATUS_SUCCESS;

done:
	if (status != STATUS_SUCCESS) {
		// cleanup
		OnUnload(theDriverObject);
	}

    return status;
}
	void CTestPluginsLoader::Unload()
	{
		OnUnload();
	}
Exemple #9
0
	void Window::OnResourceUnload()
	{
		OnUnload();

		safe_delete(mLayout);
	}
Exemple #10
0
//============================================================
// <T>服务器卸载处理。</T>
//
// @return 处理结果
//============================================================
TResult FServer::Unload(){
   MO_INFO("Server '%s' unload.", (TCharC*)_name);
   return OnUnload();
}
Exemple #11
0
	void Resource::Unload()
	{
		if (mLoadState == LOADED ||
			mLoadState == LOADING)
			OnUnload();
	}