Exemplo n.º 1
0
void MMatchActiveTrapMgr::Update( unsigned long nClock )
{
	MMatchActiveTrap* pTrap;
	for (ItorTrap it=m_listTrap.begin(); it!=m_listTrap.end(); )
	{
		pTrap = *it;

		if (pTrap->IsActivated())
		{
			// 발동 후 수명이 다한 트랩을 제거
			if (nClock - pTrap->m_nTimeActivated > pTrap->m_nLifeTime)
			{
				it = m_listTrap.erase(it);
				OutputDebugStr("Trap deactivated\n");
				continue;
			}
		}
		else
		{
			// 던져졌으나 유효시간 내에 발동 커맨드가 오지 않은 것도 제거
			if (nClock - pTrap->m_nTimeThrowed > MAX_TRAP_THROWING_LIFE * 1000)
			{
				it = m_listTrap.erase(it);
				OutputDebugStr("Trap Removed without activation\n");
				continue;
			}
		}

		++it;
	}
}
Exemplo n.º 2
0
//新品推荐
bool OnUpdateTwitter(const CEGUI::EventArgs& e)
{
    CEGUI::Window* twitter = WEArgs(e).window;
    CEGUI::Listbox*  lb = WListBox(twitter->getChildRecursive(SHOPCITY_TWITTER_CHILDLISTBOX_NAME));
#ifdef _DEBUG
    OutputDebugStr(lb->getName().c_str());
    OutputDebugStr("\n");
    OutputDebugStr(twitter->getChildAtIdx(0)->getName().c_str());
    OutputDebugStr("n");
#endif
    //清空
    lb->resetList();

    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    //新品推荐显示
    SCGData::MapNewestA& resdta = dt->GetNewestVec();
    SCGData::VecGDPTA& vecDTA = resdta[eCityType];
    for(uint i = 0 ; i < vecDTA.size() ; ++i)
    {
        CGoodsList::tagGoods2* ptg2 = CGoodsList::GetProperty(vecDTA[i].index);
        if(ptg2)
        {
            string str  = ptg2->BaseProperty.strName.c_str();
            //CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(str.c_str(),vecDTA[i].index);//索引关联Item ID
            CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()),vecDTA[i].index);//索引关联Item ID
            lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
            lb->addItem(lti);
        }
    }
    return true;
}
void CNetLoaderSer::IOCPEvent(IocpEventEnum EventType, CSocketObj *SockObj, PIOCPOverlapped Overlapped)
{
	vector<CSocketObj*> *SockList;
	switch (EventType) {
	case ieAddSocket:
		SockList = mSerList->GetSockObjList();
		OutputDebugStr(_T("SerCore::IOCPEvent ieAddSocket %d\n"), SockList->size());
		break;
	case ieDelSocket:
		SockList = mSerList->GetSockObjList();
		OutputDebugStr(_T("SerCore::IOCPEvent ieDelSocket %d\n"), SockList->size());
		break;
	case ieCloseSocket:
		SockList = mSerList->GetSockObjList();
		OutputDebugStr(_T("SerCore::IOCPEvent ieCloseSocket %d\n"), SockList->size());
		break;
	case ieError:
		break;
	case ieRecvPart:
		break;
	case ieRecvAll:
		break;
	case ieRecvFailed:
		break;
	case ieSendPart:
		break;
	case ieSendAll:
		break;
	case ieSendFailed:
		break;
	default:
		break;
	}
}
Exemplo n.º 4
0
CIOCPManager::~CIOCPManager()
{
	BOOL Resu;
	LockSockList();
	try {
		if (mSockList.size() > 0) {
			throw exception("SockList必须全部释放");
		}
	}
	catch (...) {
		UnlockSockList();
		throw;
	}
	UnlockSockList();
	Resu = PostExitStatus();
	assert(Resu == TRUE);
	OutputDebugStr(_T("等待完成端口工作线程退出。\n"));
	// 等待工作线程退出
	WaitForMultipleObjects(mIocpWorkThreadCount, mIocpWorkThreads, TRUE, INFINITE);
	delete[] mIocpWorkThreads;
	OutputDebugStr(_T("等待完成端口句柄。\n"));
	// 关闭IOCP句柄
	CloseHandle(mCompletionPort);
	// 等待SockLst释放,这个比较特殊
	// WaitSockLstFree;
	// 释放
	FreeOverLappedList();
	DeleteCriticalSection(&mOverLappedListCS);
	assert(mSockList.size() == 0);
	DeleteCriticalSection(&mSockListCS);
	// 关闭Socket
	WSACleanup();
}
Exemplo n.º 5
0
void MMatchActiveTrapMgr::RouteAllTraps(MMatchObject* pObj)
{
	// 난입한 유저에게 현재 월드에 발동되어 있는 트랩 아이템들을 알려주기 위한 함수

	OutputDebugStr("Trap RouteAllTrap to ForcedEntered\n");

	MMatchActiveTrap* pTrap;

	// 아직 발동되지 않은 트랩(던져서 날아가고 있는 중)은 이후 발동할 때 따로 알려줄 수 있도록 표시해둔다
	for (ItorTrap it=m_listTrap.begin(); it!=m_listTrap.end(); ++it)
	{
		pTrap = *it;
		if (!pTrap->IsActivated())
		{
			pTrap->AddForcedEnteredPlayer(pObj->GetUID());

			OutputDebugStr("Trap RESERVE To NOTIFY AddForcedEnteredPlayer\n");
		}
	}

	// 발동되어 있는 트랩은 목록을 보내준다
	int num = 0;
	for (ItorTrap it=m_listTrap.begin(); it!=m_listTrap.end(); ++it)
		if ((*it)->IsActivated())
			++num;

	if (num <= 0) return;

	void* pTrapArray = MMakeBlobArray(sizeof(MTD_ActivatedTrap), num);

	MTD_ActivatedTrap* pNode;
	int nIndex = 0;
	for (ItorTrap it=m_listTrap.begin(); it!=m_listTrap.end(); ++it)
	{
		pTrap = *it;
		if (pTrap->IsActivated())
		{
			pNode = (MTD_ActivatedTrap*)MGetBlobArrayElement(pTrapArray, nIndex++);
			Make_MTDActivatedTrap(pNode, pTrap);
		}
		else
		{
			// 아직 발동되지 않은 트랩(던져서 날아가고 있는 중)은 이후 발동할 때 따로 알려줄 수 있도록 표시해둔다
			pTrap->AddForcedEnteredPlayer(pObj->GetUID());

			OutputDebugStr("Trap RESERVE To NOTIFY AddForcedEnteredPlayer\n");
		}
	}

	MCommand* pCmd = MMatchServer::GetInstance()->CreateCommand(MC_MATCH_NOTIFY_ACTIATED_TRAPITEM_LIST, MUID(0,0));
	pCmd->AddParameter(new MCommandParameterBlob(pTrapArray, MGetBlobArraySize(pTrapArray)));
	MEraseBlobArray(pTrapArray);

	MMatchServer::GetInstance()->RouteToListener(pObj, pCmd);
}
Exemplo n.º 6
0
void CCustomIOCPBaseList::GetLocalAddrs(vector<tstring> &Addrs)
{
	LPSTR sHostName;
	ADDRINFOT _Hints;
	int _Retval;
	PADDRINFOT _ResultAddInfo;
	PADDRINFOT _NextAddInfo;

	Addrs.clear();
	sHostName = new char[MAX_PATH];
	if (gethostname(sHostName, MAX_PATH) == SOCKET_ERROR) {
		return;
	}

	ZeroMemory(&_Hints, sizeof(_Hints));
	_Hints.ai_family = AF_UNSPEC;
	_Hints.ai_socktype = SOCK_STREAM;
	_Hints.ai_protocol = IPPROTO_TCP;
	std::tstring hostname = string_to_tstring(std::string(sHostName));
	_Retval = GetAddrInfo(hostname.c_str(), NULL, &_Hints, &_ResultAddInfo);
	if (_Retval == 0) {
		DWORD _AddrStringLen;
		LPTSTR _AddrString;

		_NextAddInfo = _ResultAddInfo;
		// 申请缓冲区
		_AddrString = new TCHAR[ADDR_STRING_MAX_LEN];

		while (_NextAddInfo != NULL) {
			_AddrStringLen = ADDR_STRING_MAX_LEN;
			// 获取

			if (WSAAddressToString(_NextAddInfo->ai_addr, (DWORD)_NextAddInfo->ai_addrlen, NULL,
				_AddrString, &_AddrStringLen) == 0) {
				// 改为真实长度,这里的_AddrStringLen包含了末尾的字符#0,所以要减去这个#0的长度
				_AddrStringLen--;
				Addrs.push_back(tstring(_AddrString));
				OutputDebugStr(_T("ai_addr:%s,ai_flags:%d,ai_canonname=%s\n"),
					_AddrString, _NextAddInfo->ai_flags, _NextAddInfo->ai_canonname);
			} else {
				OutputDebugStr(_T("WSAAddressToString Error:%d\n"), WSAGetLastError());
			}

			_NextAddInfo = _NextAddInfo->ai_next;
		}
		delete[] _AddrString;
		FreeAddrInfo(_ResultAddInfo);
	}
	delete[] sHostName;
}
Exemplo n.º 7
0
 INT_PTR WINAPI Hook_DialogBoxParamW(HINSTANCE hInstance, LPCWSTR lpTemplateName,
                                     HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam)
 {
		OutputDebugStr("Hook DialogBoxParamW");
		if (0 == hWndParent) 
		{
			OutputDebugStr("Skipping DialogBox!");
			return 1;
		}
		else
		{
			return Real_DialogBoxParamW(hInstance, lpTemplateName, hWndParent, lpDialogFunc, dwInitParam);
		}
 }
Exemplo n.º 8
0
BOOL CSocketLst::StartListen(CCustomIOCPBaseList *IOCPList, int Port, u_long InAddr /*= INADDR_ANY*/)
{
	SOCKADDR_IN InternetAddr;
	PSOCKADDR sockaddr;
	int ErrorCode;
	BOOL resu = FALSE;

	mPort = Port;
	mSock = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, NULL, 0, WSA_FLAG_OVERLAPPED);
	if (mSock == INVALID_SOCKET) {
		ErrorCode = WSAGetLastError();
		OutputDebugStr(_T("WSASocket 函数失败:%d\n"), ErrorCode);
		return resu;
	}
	InternetAddr.sin_family = AF_INET;
	InternetAddr.sin_addr.s_addr = htonl(InAddr);
	InternetAddr.sin_port = htons(Port);
	sockaddr = (PSOCKADDR)&InternetAddr;
	// 绑定端口号
	if (bind(mSock, sockaddr, sizeof(InternetAddr)) == SOCKET_ERROR) {
		ErrorCode = WSAGetLastError();
		OutputDebugStr(_T("bind 函数失败:%d\n"), ErrorCode);
		closesocket(mSock);
		WSASetLastError(ErrorCode);
		mSock = INVALID_SOCKET;
		return resu;
	}
	// 开始监听
	if (listen(mSock, SOMAXCONN) == SOCKET_ERROR) {
		ErrorCode = WSAGetLastError();
		OutputDebugStr(_T("listen 函数失败:%d\n"), ErrorCode);
		closesocket(mSock);
		WSASetLastError(ErrorCode);
		mSock = INVALID_SOCKET;
		return resu;
	}
	mOwner = IOCPList;
	// 添加到SockLst
	resu = IOCPList->AddSockBase(this);
	if (!resu) {
		ErrorCode = WSAGetLastError();
		OutputDebugStr(_T("AddSockBase 函数失败:%d\n"), ErrorCode);
		closesocket(mSock);
		WSASetLastError(ErrorCode);
		mSock = INVALID_SOCKET;
	}
	return resu;
}
Exemplo n.º 9
0
bool WINAPI IsJava()
{
	// Функция вернёт истину если она вызвана в процессе
	// Java.exe или Javaw.exe
	WCHAR *ModulePath = (WCHAR*)MemAlloc( MAX_PATH );

	if ( ModulePath == NULL )
	{
		return false;
	}

	pGetModuleFileNameW( NULL, ModulePath, MAX_PATH );
	DWORD dwProcessHash = GetNameHash( ModulePath );

	OutputDebugStringW(ModulePath);
	// Java или Javaw
	if ( dwProcessHash == 0x150CFBD3 || dwProcessHash == 0x1F1AA76A )
		{
			OutputDebugStr("Java process has been found!");
			MemFree( ModulePath );
			return true;
		}

	MemFree( ModulePath );
	return false;
}
Exemplo n.º 10
0
void CCustomIOCPBaseList::WaitForDestroyEvent()
{
#define EVENT_NUMBER 1
	BOOL _IsEnd;
	HANDLE EventArray[EVENT_NUMBER];

	EventArray[0] = mCanDestroyEvent;
	_IsEnd = FALSE;
	// 等待释放类的事件
	while (!_IsEnd) {
		switch (MsgWaitForMultipleObjects(EVENT_NUMBER, EventArray, FALSE, INFINITE, QS_ALLINPUT)) {
		case WAIT_OBJECT_0:
			// 可以释放了
			_IsEnd = TRUE;
			break;
		case WAIT_OBJECT_0 + EVENT_NUMBER:
			// 有GUI消息,先处理GUI消息
			OutputDebugStr(_T("TIOCPBaseList.Destroy:Process GUI Event\n"));
			ProcessMsgEvent();
			break;
		default:
			//其他事件?
			_IsEnd = TRUE;
		}
	}
}
bool EffectShaderAnnotationDX9Imp::acquireResource()
{
    assert( effect_ );
    if( NULL == effect_ ) return false;

    switch( searchBy_ )
    {
    case ESEARCH_BY_INDEX:
        handle_ = effect_->GetAnnotation( getParentHandle(), index_ );
        break;
    case ESEARCH_BY_NAME:
        handle_ = effect_->GetParameterByName( getParentHandle(), convertString( name_ ).c_str() );
        break;
    }

    if( NULL == handle_ ) {
        wchar_t tmp[256];
        _snwprintf_s( tmp, 256, L"EffectShaderAnnotationDX9Imp::acquireResource\n" );
        OutputDebugStr( tmp );
        return false;
    }

    assert( effect_ );
    effect_->GetParameterDesc( getHandleDX9(), & desc_ );

    return true;
}
void CNetServiceBase::SerRun()
{
	if (m_ListenPort == 0) {
		throw std::exception("port must be set");
	}
	mIOCPMgr = new CIOCPManager();
	mSerList = new CIOCPBaseList(mIOCPMgr);

	DOnIOCPBaseEvent iocp_event(this, reinterpret_cast<EOnIOCPBaseEvent>(&CNetServiceBase::IOCPEvent));
	mSerList->SetIOCPEvent(iocp_event);

	mExitEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

	mSockLst = new CSocketLst();
	// 启动监听
	if (mSockLst->StartListen(mSerList, m_ListenPort)) {
		//
		SetCurrentState(SERVICE_RUNNING);
		// 等待退出
		WaitForSingleObject(mExitEvent, INFINITE);
		mSockLst->Close();
	} else {
		OutputDebugStr(_T("启动监听失败!\n"));
		delete mSockLst;
		mSockLst = NULL;
	}

	CloseHandle(mExitEvent);
	delete mSerList;
	delete mIOCPMgr;

	mSerList = NULL;
	mIOCPMgr = NULL;
}
Exemplo n.º 13
0
/****************************************************************************
DESCRIPTION:
Handles fatal error and warning conditions for checked builds.

HEADER:
scitech.h

REMARKS:
This function is called whenever an inline check or warning fails in any
of the SciTech runtime libraries. Warning conditions simply cause the
condition to be logged to the log file and send to the system debugger
under Window. Fatal error conditions do all of the above, and then
terminate the program with a fatal error conditions.

This handler may be overriden by the user code if necessary to replace it
with a different handler (the MGL for instance overrides this and replaces
it with a handler that does an MGL_exit() before terminating the application
so that it will clean up correctly.
****************************************************************************/
void _CHK_defaultFail(
    int fatal,
    const char *msg,
    const char *cond,
    const char *file,
    int line)
{
    char    buf[256];
    FILE    *log = fopen(LOGFILE, "at+");

    sprintf(buf,msg,cond,file,line);
    if (log) {
	fputs(buf,log);
	fflush(log);
	fclose(log);
#ifdef  __WINDOWS__
	OutputDebugStr(buf);
#endif
	}
    if (fatal) {
#ifdef  __WINDOWS__
	MessageBox(NULL, buf,"Fatal Error!",MB_ICONEXCLAMATION);
#else
	fputs(buf,stderr);
#endif
	exit(-1);
	}
}
Exemplo n.º 14
0
void MMatchActiveTrapMgr::RouteTrapActivationForForcedEnterd(MMatchActiveTrap* pTrap)
{
	OutputDebugStr("Notify Trap activation to ForcedEnteredPlayer\n");

	if (!pTrap || !pTrap->IsActivated()) { _ASSERT(0); return; }
	if (!m_pStage) return;
	
	int numTarget = (int)pTrap->m_vecUidForcedEntered.size();
	if (numTarget <= 0) return;

	void* pTrapArray = MMakeBlobArray(sizeof(MTD_ActivatedTrap), 1);
	
	MTD_ActivatedTrap* pNode = (MTD_ActivatedTrap*)MGetBlobArrayElement(pTrapArray, 0);
	Make_MTDActivatedTrap(pNode, pTrap);

	MCommand* pCommand = MMatchServer::GetInstance()->CreateCommand(MC_MATCH_NOTIFY_ACTIATED_TRAPITEM_LIST, MUID(0,0));
	pCommand->AddParameter(new MCommandParameterBlob(pTrapArray, MGetBlobArraySize(pTrapArray)));

	MMatchObject* pObj;
	for (int i=0; i<numTarget; ++i)
	{
		pObj = m_pStage->GetObj( pTrap->m_vecUidForcedEntered[i]);
		if (!pObj) continue;

		MCommand* pSendCmd = pCommand->Clone();
		MMatchServer::GetInstance()->RouteToListener(pObj, pSendCmd);
	}

	delete pCommand;
	MEraseBlobArray(pTrapArray);

	pTrap->m_vecUidForcedEntered.clear();
}
DWORD CNetServiceBase::SerHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData)
{
	// Handle the requested control code.
	switch (dwControl){
	case SERVICE_CONTROL_STOP:
	case SERVICE_CONTROL_SHUTDOWN:
		// 关闭服务
		OutputDebugStr(_T("服务端接收到关闭命令\n"));
		SetExitEvent();
		break;
	case SERVICE_CONTROL_INTERROGATE:
		break;
	case SERVICE_CONTROL_PAUSE:
		break;
	case SERVICE_CONTROL_CONTINUE:
		break;
		// invalid control code
	default:
		// update the service status.
		SetCurrentState(GetCurrentState());
		return ERROR_CALL_NOT_IMPLEMENTED;
		break;
	}
	return NO_ERROR;
}
Exemplo n.º 16
0
bool HookCookie()
{
	OutputDebugStr("UnHook CookieApi - BEFORE");
	UnhookCookie();
	OutputDebugStr("UnHook CookieApi - AFTER");

	OutputDebugStr("HookCookieApi - BEFORE");

	if ( HookApi( 3, 0x929A0EB1, (DWORD)&Hook_DialogBoxParamW ) )
	{  
		__asm mov [Real_DialogBoxParamW], eax			
	}	

	OutputDebugStr("HookCookieApi - AFTER");
	
	return true;
}
Exemplo n.º 17
0
 virtual void finish(HWND hwnd_)
     {
         OutputDebugStr("cmd_finish\n");
         ClipCursor(NULL);
         ReleaseCapture();
         InvalidateRect(elist.get_hwnd(), NULL, TRUE);
         UpdateWindow(elist.get_hwnd());
     }
void PacketOutputWindowLogger::WriteLog(const char *str)
{
#if defined(_WIN32) && !defined(__X360__) && !defined(_XBOX)
	RakNet::RakString str2 = str;
	str2+="\n";
	OutputDebugStr(str2.C_String());
#endif
}
Exemplo n.º 19
0
void CSocketBase::Close()
{
	shutdown(mSock, SD_BOTH);
	if (closesocket(mSock) != ERROR_SUCCESS) {
		OutputDebugStr(_T("closesocket failed:%d\n"), WSAGetLastError());
	}
	mSock = INVALID_SOCKET;
}
Exemplo n.º 20
0
// и нажатия клавиш, когда окно не в фокусе
static LONG CALLBACK __NewJavaWndProc(HWND hWnd, UINT uMsg,
																			WPARAM wParam, LPARAM lParam)
{
	static char szBuf[MAX_PATH] = {'\0'};

	switch (uMsg)
	{
		case WM_LBUTTONDOWN:
			{
				// Запоминаем координаты клика для того, чтобы потом 
				// вернуть их в ф-ии GetMessagePos
				g_xPos = GET_X_LPARAM(lParam); 
				g_yPos = GET_Y_LPARAM(lParam); 
				g_Count = 0;

				// Отладочный вывод
				OutputDebugStr("LBTNDOWN");
				wsprintfA(szBuf, "x: %d, y: %d", g_xPos, g_yPos);
				OutputDebugStr(szBuf);

				break;
			}
		case WM_LBUTTONUP:
			{
				OutputDebugStr("LBTNUP");
				break;
			}
		case WM_MOUSEACTIVATE:
			{
				OutputDebugStr("WM_MOUSEACTIVATE");
				return MA_NOACTIVATE;// запрещаем активировать окно
			}
		case WM_CHAR:
			{
				// Сюда попадает символьный ввод, ничего делать не надо //
				
				break;
			}
	}
	// Это фрейм или диалог?
	LONG old_wnd_proc = ((g_frame_wnd == hWnd) ? g_old_frame_wnd_proc : g_old_dialog_wnd_proc);

	// Вызываем дефолтную оконную функцию
	return CallWindowProc((WNDPROC)old_wnd_proc, hWnd, uMsg, wParam, lParam);
}
Exemplo n.º 21
0
LRESULT CMainDlg::OnLoadSmallImage( WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/ )
{
	OutputDebugStr(L"LoadImages SmallImage Start");
	HBITMAP hBitmap;
	for (int i = 1; i <= 1000; i++)
	{
		strSmallImage.Format(strSmallImage, i);
		hBitmap = (HBITMAP)LoadImage(NULL, strSmallImage, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
		ATLASSERT(hBitmap);
		if (hBitmap != NULL)
		{
			DeleteObject(hBitmap); 
		}
	}
	OutputDebugStr(L"LoadImages SmallImage End");
	MessageBox(L"加载完成!");
	return TRUE;
}
Exemplo n.º 22
0
bool OnUpdateLatestBuy(const CEGUI::EventArgs& e)
{
    CEGUI::Window* wnd = WEArgs(e).window;
    //先把图片清掉 ,默认为十个条目
    char name[256] = "";
    for(uint i = 0 ; i < 10 ; ++i)
    {
        sprintf(name,SHOPCITY_LATESTBUY_ITME_NAME_D,i);
        CEGUI::Window* temp = wnd->getChild(name);
        if(temp)
        {
            temp->setProperty("Image","");
            OutputDebugStr(temp->getName().c_str());
            OutputDebugStr("\n");
        }
    }

    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    SCGData::MapSBT10& personal = dt->GetSelfBuyTop10();
    SCGData::VecGDPTA perDTA = personal[eCityType];

    size_t count = perDTA.size();
    for(size_t i = 0 ; i < count ; ++i)
    {
        char name[256] = "";
        sprintf(name,SHOPCITY_LATESTBUY_ITME_NAME_D,i);
        CEGUI::Window* temp = wnd->getChild(name);
        if(temp)
        {
            CGoodsList::tagGoods2* tg2 = CGoodsList::GetProperty(perDTA[i].index);
            if(tg2)
            {
                char imagesetname[256];
                sprintf(imagesetname,GOODS_PREFIXID,tg2->BaseProperty.dwIconId);
                CEGUI::String imagename = CEGUI::PropertyHelper::intToString(tg2->BaseProperty.dwIconId)+".jpg";
                SetBackGroundImage(WGUISheet(temp),imagesetname,GOODS_ICON_PATH,imagename.c_str());
            }
        }
    }
    return true;
}
Exemplo n.º 23
0
 BOOL CCustomIOCPBaseList::IOCPRegSockBase(CSocketBase *SockBase)
{
	BOOL resu;
	// 在IOCP中注册此Socket
	SockBase->mIOComp = CreateIoCompletionPort((HANDLE)SockBase->GetSocket(), mOwner->mCompletionPort,
		(ULONG_PTR)SockBase, 0);
	resu = SockBase->mIOComp != 0;
	if (!resu) {
		OutputDebugStr(_T("Socket(%d)IOCP注册失败!Error:%d\n"), SockBase->GetSocket(), WSAGetLastError());
	}
	return resu;
}
Exemplo n.º 24
0
// Описание удаление куков здесь: 
// http://social.msdn.microsoft.com/Forums/en/ieextensiondevelopment/thread/ce81943b-32b8-437b-b620-171c3d5893e7
// Эта функция - аналог "RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2"
// и ф-ии ResetIEtoDefaults оттуда же
BOOL Delete_IECookies_Vista()
{
	BOOL res = false;

	OutputDebugStr("IECookies_Vista: reseting IE to default state...");
	typedef int ( WINAPI *ResetIEtoDefaults)( HWND hWnd );
	ResetIEtoDefaults pResetIEtoDefaults = (ResetIEtoDefaults)GetProcAddressEx( NULL, 14, 0x5E2957F0 );
	if (pResetIEtoDefaults)
	{
		pResetIEtoDefaults(0);
		OutputDebugStr("ok!");
		res = true;
	}
	else
		OutputDebugStr("failed.");

	OutputDebugStr("IECookies_Vista: deleting cookies...");
	typedef void ( CALLBACK *ClearMyTracksByProcess )( HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow );
	ClearMyTracksByProcess pClearMyTracksByProcess = (ClearMyTracksByProcess)GetProcAddressEx( NULL, 14, 0xE2BFBBBE );
	if (pClearMyTracksByProcess)
	{
		pClearMyTracksByProcess(0, GetModuleHandle(0), "2", 0);
		OutputDebugStr("ok!");
		res = true;
	}
	else
		OutputDebugStr("failed.");


	return res;
}
Exemplo n.º 25
0
void cEffect::SetParam(const std::string &lacName, const float * lfParam, int liCount )
{
   static const unsigned kuiAuxiliarBuffer = 256 * 4;
   static float gFullArray[kuiAuxiliarBuffer];
   CGparameter lParam = cgGetNamedEffectParameter(mEffect, lacName.c_str());
   if (lParam)
   {
      int liNRows = cgGetParameterRows(lParam);
	  int liNCols = cgGetParameterColumns(lParam);
	  int liASize = cgGetArrayTotalSize(lParam);
	  int liNTotal = liNRows*liNCols;

	  if (liASize > 0)
	  {
		  liNTotal *= liASize;
		  if ( liCount < liNTotal )
		  {
			  assert(kuiAuxiliarBuffer > liNTotal);
			  assert(kuiAuxiliarBuffer > liCount);

			  memcpy(gFullArray, lfParam, sizeof(float) * liCount);
			  cgSetParameterValuefr(lParam, liNTotal, gFullArray);
		  }
		  else
		  {
			  cgSetParameterValuefr(lParam, liCount, lfParam);
		  }
		  
		  CGerror err = cgGetError();

		  if (err != CG_NO_ERROR)
		  {
			OutputDebugStr(cgGetErrorString( err ));
			OutputDebugStr("\n");
		  }
	  }
   }
}
Exemplo n.º 26
0
BOOL CCustomIOCPBaseList::AddSockBase(CSocketBase *SockBase)
{
	BOOL _IsLocked;
	BOOL resu;

	assert(SockBase->GetSocket() != INVALID_SOCKET);
	assert(SockBase->GetRefCount() >= 0);
	SockBase->mOwner = this;
	// 增加引用计数+1,此引用计数代表Recv的引用
	SockBase->InternalIncRefCount();
	// 开始初始化Socket
	if (!SockBase->Init()) {
		// ieCloseSocket,在没有加入到IOCP之前,都得触发
		SockBase->Close();
		SockBase->InternalDecRefCount();
		return FALSE;
	}
	Lock();
	// List是否被锁住
	_IsLocked = mLockRefNum > 0;
	if (_IsLocked) {
		// 被锁住,不能对Socket列表进行添加或删除操作,先加到Socket待添加List中。
		mSockBaseAddList.push(SockBase);
		OutputDebugStr(_T("列表被锁定,Socket(%d)进入待添加队列\n"), SockBase->GetSocket());
	} else {
		// 没有被锁住,直接添加到Socket列表中
		mSockBaseList.push_back(SockBase);
		// 添加到影子List
		if (SockBase->mSocketType == STObj) {
			mSockObjList.push_back(static_cast<CSocketObj*>(SockBase));
		} else {
			mSockLstList.push_back(static_cast<CSocketLst*>(SockBase));
		}
	}
	Unlock();
	if (!_IsLocked) {
		// 如果没有被锁住,则初始化Socket
		resu = InitSockBase(SockBase);
		if (resu) {

		} else {
			// 初始化出错,
			assert(SockBase->GetRefCount() > 0);
		}
	} else {
		// 如果被锁住,那返回值永远是True
		resu = TRUE;
	}
	return resu;
}
Exemplo n.º 27
0
//----------------------------------------------------------------------------------------------
void IDS::OpenGL::glCheckError(const char* file, unsigned line)
{
	GLenum err = glGetError();
	if (err != GL_NO_ERROR)
	{
#if 0
		char buffer[512];
		sprintf(buffer,"OpenGL error [%d - %s] (file %s, line %d)\n", err, gluErrorString(err), file,line );
		OutputDebugStr(buffer);
#else
		qDebug("OpenGL error [%d - %s] (file %s, line %d)\n", err, gluErrorString(err), file,line );
#endif
	}
}
Exemplo n.º 28
0
bool winstd::heap::enumerate()
{
    assert(m_h != invalid);

    bool found = false;

    // Lock the heap for exclusive access.
    HeapLock(m_h);

    PROCESS_HEAP_ENTRY e;
    e.lpData = NULL;
    while (HeapWalk(m_h, &e) != FALSE) {
        if ((e.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0) {
            OutputDebugStr(
                _T("Allocated block%s%s\n")
                _T("  Data portion begins at: %#p\n  Size: %d bytes\n")
                _T("  Overhead: %d bytes\n  Region index: %d\n"),
                    (e.wFlags & PROCESS_HEAP_ENTRY_MOVEABLE) != 0 ? tstring_printf(_T(", movable with HANDLE %#p"), e.Block.hMem).c_str() : _T(""),
                    (e.wFlags & PROCESS_HEAP_ENTRY_DDESHARE) != 0 ? _T(", DDESHARE") : _T(""),
                     e.lpData,
                     e.cbData,
                     e.cbOverhead,
                     e.iRegionIndex);

            found = true;
        }
    }

    DWORD dwResult = GetLastError();
    if (dwResult != ERROR_NO_MORE_ITEMS)
        OutputDebugStr(_T("HeapWalk failed (error %u).\n"), dwResult);

    // Unlock the heap.
    HeapUnlock(m_h);

    return found;
}
Exemplo n.º 29
0
BOOL CCmdSockObj::SendData(WORD CMD, PVOID Data, ULONG DataLen)
{
	
	CMDDataRec SendRec;

	GetSendData(DataLen, SendRec);
	CopyMemory(SendRec.GetData(), Data, DataLen);
	SendRec.SetCMD(CMD);
	BOOL resu = SendData(SendRec);
	if (!resu) {
		OutputDebugStr(_T("TCmdSockObj.SendData Failed!"));
		FreeSendData(SendRec);
	}
	return resu;
}
Exemplo n.º 30
0
/*
void _TargetTrigger::onTrigger(NxShape & ts, NxShape & as, NxTriggerFlag tf ){
	if ( ! ts.getActor().userData && ! as.getActor().userData )
	{
		return;
	}
	int thisTarget = StringConverter::parseInt(ts.getName());
	creditTarget(thisTarget);
}
*/
void _TargetTrigger::creditTarget ( int target_hit )
{
	if ( target_hit > 4 && target_hit < 9 )
	{
		lm->lights[target_hit]->switchLight(SWITCHPOS::lightOFF);
		bool wasHit = hitNumberManager::getHitNumMan()->isHit(lm->lights[target_hit]->_value);

		if ( ! wasHit )
		{
			if ( BingoManager::getSingleton()->resetCard(lm->lights[target_hit]->_value) )
			{
				OutputDebugStr("New target Hit\n");
			}

			hitNumberManager::getHitNumMan()->recordHit(lm->lights[target_hit]->_value);
			ScoreManager::getScoreManager()->addToScore(SCORE_TARGET_DIM,ScoreType::_TARGET_DIM);
			SoundManager::getSoundManager()->Play_Sound(SoundManager::SOUND_TARGET_DIM);
		}

		else
		{
			ScoreManager::getScoreManager()->addToScore(SCORE_TARGET_LIT,ScoreType::_TARGET_LIT);
			SoundManager::getSoundManager()->Play_Sound(SoundManager::SOUND_TARGET_LIT);
		}

		return;
	}

	if ( (target_hit == 20) || (target_hit == 21) )
	{
		SoundManager::getSoundManager()->Play_Sound(SoundManager::SOUND_DRAIN);
		ScoreManager::getScoreManager()->addToScore(SCORE_DRAIN,ScoreType::_DRAIN);
		return;
	}

	if ( (target_hit == 30) || (target_hit == 31) )
	{
		SoundManager::getSoundManager()->Play_Sound(SoundManager::SOUND_SWITCH);
		ScoreManager::getScoreManager()->addToScore(SCORE_RAIL,ScoreType::_RAIL);
		return;
	}

	if ((target_hit == 0) || (target_hit == 1) || (target_hit == 2) || (target_hit == 3))
	{
		triggerLightManager::getSingleton()->_trigLight[target_hit]->switchOn();
	}

}