Exemplo n.º 1
0
void CEsperEngine::MsgEsperRead (const SArchonMessage &Msg)

//	MsgEsperRead
//
//	Requests a read on the given connection. If we fail, we return an error
//	to the caller.

	{
	CDatum dConnection = Msg.dPayload.GetElement(0);

	CString sError;
	if (!m_Connections.BeginRead(Msg, dConnection, &sError))
		{
		SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, strPattern(ERR_READ_FAILED, sError), Msg);
		if (m_bLogTrace)
			LogTrace(strPattern("[%x] Read failed: %s", CEsperInterface::ConnectionToFriendlyID(dConnection), sError));

		return;
		}

#ifdef DEBUG_SOCKET_OPS
	if (m_bLogTrace)
		LogTrace(strPattern("[%x] Read", CEsperInterface::ConnectionToFriendlyID(dConnection)));
#endif

	//	We reply when the async operation completes (or we get an error).
	}
Exemplo n.º 2
0
bool TCPServer::Listen(int port)
{
    LogTrace(LOG_NETWORKING, "Listening for incoming connections {port: %d}", port);

    struct sockaddr_in bind_address;
    uv_ip4_addr("0.0.0.0", port, &bind_address);

    int result = uv_tcp_init(uv_default_loop(), &_listener);
    if (result)
    {
        LogError(LOG_NETWORKING, "Listening for incoming connections - failure, reason: %s", uv_err_name(result));
        return false;
    }

    result = uv_tcp_bind(&_listener, (const struct sockaddr *) &bind_address, 0);
    if (result)
    {
        LogError(LOG_NETWORKING, "Listening for incoming connections - failure, reason: %s", uv_err_name(result));
        return false;
    }

    result = uv_listen((uv_stream_t *) &_listener, SOMAXCONN, IncomingConnection);
    if (result)
    {
        LogError(LOG_NETWORKING, "Listening for incoming connections - failure, reason: %s", uv_err_name(result));
        return false;
    }

    LogTrace(LOG_NETWORKING, "Listening for incoming connections - success", port);
    return true;
}
Exemplo n.º 3
0
void CEsperEngine::MsgEsperWrite (const SArchonMessage &Msg)

//	MsgEsperWrite
//
//	Requests a write on the given connection.

	{
	CDatum dConnection = Msg.dPayload.GetElement(0);
	const CString &sData = Msg.dPayload.GetElement(1);

	CString sError;
	if (!m_Connections.BeginWrite(Msg, dConnection, sData, &sError))
		{
		SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, strPattern(ERR_WRITE_FAILED, sError), Msg);
		if (m_bLogTrace)
			LogTrace(strPattern("[%x] Write failed (%d bytes): %s", CEsperInterface::ConnectionToFriendlyID(dConnection), sData.GetLength(), sError));

		return;
		}

#ifdef DEBUG_SOCKET_OPS
	if (m_bLogTrace)
		LogTrace(strPattern("[%x] Write %d bytes", CEsperInterface::ConnectionToFriendlyID(dConnection), sData.GetLength()));
#endif

	//	We reply when the async operation completes (or we get an error).
	}
Exemplo n.º 4
0
void ExecutorDummy::printSyncs()
{
    typedef pair<string, uint64_t> Record;
    struct comp
    {
        bool operator()(Record const &a, Record const &b) const
        {
            return a.second > b.second;
        }
    };

    vector<Record> sorted;
    sorted.reserve(syncs_.size());
    for (auto &r : syncs_)
    {
        string str = methods_->getMethod(r.first).second;
        sorted.emplace_back(str, r.second);
    }

    std::sort(sorted.begin(), sorted.end(), comp());

    size_t num = std::min<size_t>(10, sorted.size());
    LogTrace("sync stats: " << numFrames_ << " frames");
    for (size_t i = 0; i < num; ++i)
        LogTrace(sorted[i].first << ": " << sorted[i].second);

    syncs_.clear();
    numFrames_ = 0;
}
Exemplo n.º 5
0
static FORCEINLINE NTSTATUS
__UpdateBackendPath(
    IN  PXENVBD_FRONTEND        Frontend
    )
{
    NTSTATUS    Status;
    PCHAR       Path;

    if (Frontend->BackendPath) {
        LogTrace("<< %s\n", Frontend->BackendPath);
        AustereFree(Frontend->BackendPath);
        Frontend->BackendPath = NULL;
    }

    Status = StoreRead(NULL, Frontend->FrontendPath, 
                        "backend-id", &Path);
    if (NT_SUCCESS(Status)) {
        Frontend->BackendId = (USHORT)strtoul(Path, NULL, 10);
        AustereFree(Path);
    } else {
        Frontend->BackendId = 0;
    }

    Status = StoreRead(NULL, Frontend->FrontendPath, 
                    "backend", &Path);
    if (NT_SUCCESS(Status)) {
        LogTrace(">> %s\n", Path);
        Frontend->BackendPath = Path;
    }
    
    return Status;
}
Exemplo n.º 6
0
/// Helper function to unhook the CreateFactory2 interface
/// \param hDXGI Input DXGI module
void UnhookCreateDXGIFactory2Function(HMODULE hDXGI)
{
    LogTrace(traceENTER, "");

    // don't detach twice
    if (Real_CreateDXGIFactory2 == NULL)
    {
        Log(logERROR, "Attempting to call UnhookCreateDXGIFactory2() twice\n");
        LogTrace(traceEXIT, "");
        return;
    }

    if (hDXGI != NULL)
    {
        LONG error;
        AMDT::BeginHook();

        LogTrace(traceEXIT, "UnhookCreateDXGIFactory2");

        UNHOOK(Real_CreateDXGIFactory2, Mine_CreateDXGIFactory2);

        if (AMDT::EndHook() != NO_ERROR)
        {
            Log(logERROR, "UnhookCreateDXGIFactory2 Failed\n");
        }
    }

    Real_CreateDXGIFactory2 = NULL;

    LogTrace(traceEXIT, "");

    return;
}
Exemplo n.º 7
0
void SysConsoleServiceImp::updateLocalGid(std::string& _return, const int32_t localGid, const int32_t groupId, const int64_t timestamp, const std::string& oldIp, const std::string& newIp)
{
	LogTrace(Info, "localGid = %d, groupId = %d, oldipStr = %s, newIP = %s", localGid, groupId, oldIp.c_str(), newIp.c_str());
	if(!(localGid>=2048 && localGid<=4097))
	{
		_return = "invalid localGid";
		return;
	}

	IMetaDao *metaDao_mp = sysc->mDao;
	Meta m;

	m.serverId= localGid;
	m.timestamp = sysc->nv->getVersion();
	m.name = LOCALGIDMETANAME;
	m.groupId = groupId;
	m.type = METASERVER_TYPE;
	m.data = newIp;
	m.isDel = 0;
	if(metaDao_mp->updateLocalGid(m,oldIp,timestamp) == -1)
	{
		LogTrace(Error,"config localGid error, err= %d", myerrno);
		char buf[100];
		sprintf(buf, "setMeta db error:%d", myerrno);
		_return = buf;
	}else{
		_return = "config ok";
	}	
}
Exemplo n.º 8
0
JobStatus FullSnapJob::onSyncLsn(bool bto, int res)
{
	if(bto || res != 0){
		return onFailure(bto, res);
	}else{
		std::vector<Lsn> tmpLsns;
		for(std::vector<DLog>::const_iterator it = logs.begin(); it != logs.end(); ++it){
			Lsn tmp; 
			tmp.node = it->node;
			tmp.lsn = it->lsn;
			tmpLsns.push_back(tmp);
			LogTrace(Info, "node = %d, lsn = %lld",tmp.node, tmp.lsn);
		}
		logs.clear();
		cli->lastLsn.swap(tmpLsns);  // update session sync's lastlsns

		if(cli->lastLsn.empty())
		{
			LogTrace(Error,"last lsn is empty");
			complete = true;
			cli->snapGameover = true;
			return JOBSTOP;			
		}

		lsnVecIndex = 0;
		lastLsnId = 0;
		
		step = SyncDLog_C;
		ASYNC_CALL(SnapService, getDLogs, &FullSnapJob::onSyncLog, logs, sessionId,cli->lastLsn[lsnVecIndex].node,lastLsnId,1000);

		return SYSDEFAULT;
	}
}
Exemplo n.º 9
0
JobStatus FullSnapJob::onSyncData(bool bto, int res)
{
	if(bto || res != 0){
		return onFailure(bto,res);
	}else{
		for(std::vector<Meta>::const_iterator it = infos.begin(); it != infos.end(); ++it){
			const Meta& m = *it;
			if((m.serverId&0xFFF) == cli->nv->getUniqNodeId())
			{
				if(((m.serverId>>16) != 0))
				{
					LogTrace(Error, "NodeId conflict, please have a check,m.serverId = %lld,mynodeId = %d",m.serverId, cli->nv->getUniqNodeId());
					complete = true;
					cli->snapGameover = true;
					return JOBSTOP;
				}
				else
				{
					LogTrace(Warn, "meta about my service, serverId = %lld,  name = %s, groupId = %d", m.serverId, m.name.c_str(), m.groupId);
				}
			}
			
			log(Debug, "set metaId:%lld ts:%lld", m.serverId, m.timestamp);
			int ret = cli->mDao->set(m, false);
			if(ret < 0 ){
				LogTrace(Error, "meta set error, errno = %d", myerrno);
				if(myerrno == ETIMESTAMPLT)
				{
					LogTrace(Error, "this is empty node, meta should not be timeout");
					complete = true;
					cli->snapGameover = true;
					return JOBSTOP;					
				}
				
				ASYNC_CALL(System, sleep, &FullSnapJob::onWakeup, 1000 * 10);
				return SYSDEFAULT;
			}
			if(m.isDel == 0)
			{
				syncUndelMetaCount++;
			}
			else
			{
				syncDelMetaCount++;
			}
				
			lastServerId = it->serverId;
		}
		size_t sz = infos.size();
		LogTrace(Info, "sync meta data, size = %d,lastServerId = %lld ", infos.size(), lastServerId);
		infos.clear();
		if(sz < 1000){
			step = SyncLastLsn_C;
			ASYNC_CALL(SnapService, getLsns, &FullSnapJob::onSyncLsn, logs, sessionId);
		}else{
			ASYNC_CALL(SnapService, getMetas, &FullSnapJob::onSyncData, infos, sessionId, lastServerId, 1000);

		}
		return SYSDEFAULT;
	}
Exemplo n.º 10
0
///	終了処理
/// 全てのメモリ開放
void Graphics::term(void)
{
	LogTrace("start\n");
	mGeom.term();
	mWnd.term();
	LogTrace("end \n");
}
Exemplo n.º 11
0
DWORD WINAPI   CardDeleteContext
               (
                  __inout PCARD_DATA  pCardData
               )
{
   DWORD             dwReturn    = 0;

   LogTrace(LOGTYPE_INFO, WHERE, "Enter API...");

   /********************/
   /* Check Parameters */
   /********************/
   if ( pCardData == NULL )
   {
      LogTrace(LOGTYPE_ERROR, WHERE, "Invalid parameter [pCardData]");
      CLEANUP(SCARD_E_INVALID_PARAMETER);
   }

   LogTrace(LOGTYPE_INFO, WHERE, "Context:[0x%08X]", pCardData->hSCardCtx);
   if (pCardData->pvVendorSpecific != NULL)
   {
	   pCardData->pfnCspFree(pCardData->pvVendorSpecific);
	   pCardData->pvVendorSpecific = NULL;
   }
	
cleanup:

   LogTrace(LOGTYPE_INFO, WHERE, "Exit API...");

   return (dwReturn);
}
Exemplo n.º 12
0
int32 Stealth_CheckSuccess(AActor* oStealther, AActor* oPerceiver)
{
	//TODO implement Stealth_CheckSuccess fully
	LogTrace(LOG_CHANNEL_COMBAT_ABILITY, "Perception check for " + GetTag(oPerceiver) + " detecting " + GetTag(oStealther));

	int32 bCombatState = GetCombatState(oStealther);
	int32 nStealthRank = Stealth_GetStealthRank(oStealther);
	int32 nPerceptionRank = Stealth_GetPerceptionRank(oPerceiver);

	if ((bCombatState == FALSE_) || (nStealthRank >= nPerceptionRank))
	{
		return TRUE_;
	}
	else
	{
#ifdef DEBUG
		LogTrace(LOG_CHANNEL_COMBAT_ABILITY, "DETECTED by " + GetTag(oPerceiver));
#endif

		// display stealth detected UI message
		UI_DisplayMessage(oStealther, 3511);
		UI_DisplayMessage(oPerceiver, 3513);

		return FALSE_;
	}
}
Exemplo n.º 13
0
VOID
FrontendDestroy(
    IN  PXENVBD_FRONTEND        Frontend
    )
{
    const ULONG TargetId = Frontend->TargetId;

    LogTrace("Target[%d] @ (%d) =====>\n", TargetId, KeGetCurrentIrql());

    ASSERT3U(Frontend->RingGrantRef, ==, 0);
    ASSERT3P(Frontend->EvtchnPort, ==, 0);

    // free memory
    if (Frontend->FrontendPath) {
        AustereFree(Frontend->FrontendPath);
        Frontend->FrontendPath = NULL;
    }
    if (Frontend->TargetPath) {
        AustereFree(Frontend->TargetPath);
        Frontend->TargetPath = NULL;
    }
    if (Frontend->BackendPath) {
        AustereFree(Frontend->BackendPath);
        Frontend->BackendPath = NULL;
    }

    LogTrace("Target[%d] @ (%d) <=====\n", TargetId, KeGetCurrentIrql());
}
Exemplo n.º 14
0
/// Helper function to hook the CreateFactory2 interface
/// \param hDXGI Input DXGI module
void HookCreateDXGIFactory2Function(HMODULE hDXGI)
{
    LogTrace(traceENTER, "");

    // don't attach twice
    if (Real_CreateDXGIFactory2 != NULL)
    {
        LogTrace(traceEXIT, "already hooked");
        return;
    }

    Real_CreateDXGIFactory2 = (CreateDXGIFactory2_type)GetProcAddress(hDXGI, "CreateDXGIFactory2");

    if (Real_CreateDXGIFactory2 != NULL)
    {
        LONG error;
        AMDT::BeginHook();
        HOOK(Real_CreateDXGIFactory2, Mine_CreateDXGIFactory2);

        if (AMDT::EndHook() != NO_ERROR)
        {
            Log(logERROR, "HookCreateDXGIFactory2 Failed\n");
        }
    }
    else
    {
        Log(logERROR, "HookCreateDXGIFactory2 Failed: Cannot find the CreateDXGIFactory2 in the current DXGI module. This is not a real error if you are using Windows7.\n");
    }

    LogTrace(traceEXIT, "");

    return;
}
Exemplo n.º 15
0
/// Mine entry point for intercepted function
/// \param lpLibFileName Library file name
/// \param hFile File handle
/// \param dwFlags load flags
/// \return Loaded module.
static HMODULE WINAPI Mine_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
    RefTracker rf(&s_dwInsideLoadLibrary);

    if (s_dwInsideLoadLibrary == 1)
    {
        LogTrace(traceENTER, "lpLibFilename = %S, hFile = %p, dwFlags = %d", lpLibFileName, hFile, dwFlags);
    }

    HMODULE res = Real_LoadLibraryExW(lpLibFileName, hFile, dwFlags);
    DWORD realError = GetLastError();

    if (my_lstrcmpW(lpLibFileName, L"comctl32.dll") != 0)
    {
        // This function uses MessageBox - which will load comctl32.dll if necessary
        // To avoid recursion problems, only call it when a different DLL is being loaded.
        CheckForDebuggerAttach();
    }

    if (s_dwInsideLoadLibrary == 1)
    {
        CheckWrappers();
        LogTrace(traceEXIT, "returned 0x%p", res);
    }

    SetLastError(realError);
    return res;
}
Exemplo n.º 16
0
/// Hook the load library functions
void HookLoadLibrary()
{
    LogTrace(traceENTER, "");

    AMDT::BeginHook();

    LONG error = AMDT::HookAPICall(&(PVOID&)Real_LoadLibraryA, Mine_LoadLibraryA);
    PsAssert(error == NO_ERROR);

    error = AMDT::HookAPICall(&(PVOID&)Real_LoadLibraryExA, Mine_LoadLibraryExA);
    PsAssert(error == NO_ERROR);

    error = AMDT::HookAPICall(&(PVOID&)Real_LoadLibraryW, Mine_LoadLibraryW);
    PsAssert(error == NO_ERROR);

    error = AMDT::HookAPICall(&(PVOID&)Real_LoadLibraryExW, Mine_LoadLibraryExW);
    PsAssert(error == NO_ERROR);

    error = AMDT::HookAPICall(&(PVOID&)Real_FreeLibrary, Mine_FreeLibrary);
    PsAssert(error == NO_ERROR);

    if (AMDT::EndHook() != NO_ERROR)
    {
        Log(logERROR, "HookLoadLibrary() failed\n");
    }

    // Load the "dxgi.dll" at the beginning as we missed the dxgi loading sometimes.
    // TODO: Fix this: This function is called from DllMain(), and according to the
    // Microsoft documentation, LoadLibrary() should not be called from DllMain()
    LoadLibraryA("dxgi.dll");

    LogTrace(traceEXIT, "");
    return;
}
Exemplo n.º 17
0
NTSTATUS
DllInitialize(
    IN  PUNICODE_STRING RegistryPath
    )
{
    PWSTR       Name;
    NTSTATUS    Status;
    LogTrace("===>\n");

    Name = wcsrchr(RegistryPath->Buffer, L'\\');
    if (Name) {
        Name++;
        if (__StrStarts(Name, L"dump_")) {
            __OperatingMode = DUMP_MODE;
        } else if (__StrStarts(Name, L"hiber_")) {
            __OperatingMode = HIBER_MODE;
        } else {
            __OperatingMode = NORMAL_MODE;
        }
    }

    Status = STATUS_SUCCESS;
    LogTrace("<=== (%08x)\n", Status);
    return Status;
}
Exemplo n.º 18
0
	bool FrameImpl::LoadFromBfd(void* address)
	{
		TraceFunc();
		LogTraceLn();
		bool ret = false;
		m_address = address;
#if defined(__GNUC__) && defined(DEBUG)
		const char* file = nullptr;
		const char* func = nullptr;
		bfd_fill(file, func, m_line, m_image.c_str(), m_address);
		LogTrace(L"file: '%S'\n", file);
		LogTrace(L"func: '%S'\n", func);
		LogTrace(L"line: %Id\n", m_line);
		LogTrace(L"offs: %Id\n", m_offset);

		if (file)
			m_file = sstr::cp2w(filename_only(file), CP_OEMCP);
		if (func) {
			char buf[MAX_PATH];
			size_t size = sizeof(buf);
			int st = 0;
			abi::__cxa_demangle(func, buf, &size, &st);
			m_function = sstr::cp2w(st ? func : buf, CP_OEMCP);
		}
		ret = file || func;
#endif
		TraceFunc();
		return ret;
	}
Exemplo n.º 19
0
JobStatus FullSnapJob::onMessage(const Message &msg)
{
	LogTrace(Debug,"Metahod Entry, msgId = %d", msg.msgId);
	JobStatus ret = JOBSTOP;
	switch(msg.msgId)
	{
		case DNS:
			//impxxx set client conn factory
			LogTrace(Notice, "dsn result, %d", msg.shortArg );
			if(msg.longArg != 0)
			{
				std::vector<std::string>* ipv = (std::vector<std::string>*)msg.longArg;
				cli->ipListFromDns.swap(*ipv);
				delete ipv;
				ret = doReconnect();
			}
			else
			{
				LogTrace(Error, "Dns failure, get no host");
			}
			break;
		default:
			{
				LogTrace(Error, "invalid msgId = %d", msg.msgId);
			}
	}
	
	return ret;
}
Exemplo n.º 20
0
	sync::WaitResult_t Pool::wait_all(int64_t timeout) const
	{
		LogTrace("timeout: %Id", timeout);
		sync::WaitResult_t ret = (sync::WaitResult_t)::WaitForMultipleObjectsEx(m_handles.size(), &m_handles[0], TRUE, timeout, TRUE);
		LogErrorIf(ret == sync::WaitResult_t::FAILED, "-> %s", totext::api_error().c_str());
		LogTrace("ret: '%s'", totext::c_str(ret));
		return ret;
	}
Exemplo n.º 21
0
void 
angel_SelectNextTask(void)
{
    angel_TaskQueueItem *tqi;

    /* Find the task with the highest priority which is not blocked */
    for (tqi = angel_TaskQueueHead; tqi != NULL; tqi = tqi->next)
    {
        /* Ignore this task if it is the application or an Appl Callback
         * and the Application is blocked
         */
        if (angel_ApplicationBlocked &&
            (tqi->pri == TP_Application || tqi->pri == TP_ApplCallBack))
        {
            LogTrace2("SNT-SKIP-t%d-p%d ", tqi->index, tqi->pri);
            continue;
        }

        /* Otherwise this is the highest priority task so execute it ! */

#ifdef DEBUG_TASKS
        LogInfo(LOG_SERLOCK, ("SelectNewTask: Selecting pc %x - t%d - p%d - n%d ",
                              tqi->rb.r[15], tqi->index, tqi->pri, tqi->new_task));
#endif
        
        angel_LastExecutedTaskPriority = tqi->pri;
        angel_FreeToPool(tqi->index);

#if 0
        if (tqi->pri == TP_Application)
        {
            int i;

            LogWarning(LOG_SERLOCK, ( "Application starting:\n"));
            for (i = 0; i < 16; i++)
            {
                LogWarning(LOG_SERLOCK, ( "%8X ", tqi->rb.r[i]));
            }
            LogWarning(LOG_SERLOCK, ( "CPSR=%8X\n", tqi->rb.cpsr));
        }
#endif

        /* if it's not an interrupted thread, we need to set its environment */
        if (tqi->new_task)
            angel_SetUpTaskEnvironment(&(tqi->rb), angel_LastExecutedTaskPriority);
        else
            LogTrace("\n");

        angel_StartTask(&(tqi->rb));  /* doesn't return! */
    }

    if (tqi == NULL)
    {
        LogTrace("SNT-IDLE ");
        angel_LastExecutedTaskPriority = TP_IdleLoop;
        angel_IdleLoop();
    }
}
Exemplo n.º 22
0
//修改上下文菜单
HRESULT CCCopyPathEx::QueryContextMenu (HMENU hmenu,
										UINT uMenuIndex,
										UINT uidFirstCmd,
										UINT uidLastCmd,
										UINT uFlags)
{   
	try
	{
		UINT idCmd = uidFirstCmd;
		LogTrace("菜单值:%d", hmenu);        
		// Add the new item
		::InsertMenu(hmenu, uMenuIndex, MF_STRING | MF_BYPOSITION, idCmd++, 
			(1 == m_cFiles ? _T("Copy &Path2") : _T("Copy All &Path2") ) );
		LogTrace("菜单值:%d", hmenu);

		HMENU	hmenu1 =::CreatePopupMenu();
		UINT idCmd1 = 0;
		::InsertMenu(hmenu1, uMenuIndex, MF_STRING , idCmd1++, "test1"); 
		::InsertMenu(hmenu1, uMenuIndex, MF_STRING , idCmd1++, "test2"); 
		::AppendMenu(hmenu, MF_POPUP, (UINT_PTR)hmenu1, "test");



		// Very carefully, add the bitmap.  This bitmap is XORed by the shell, so it won't
		// look very pretty, but it's better than nothing.  The next step is apparently to
		// create an ownerdraw menu and handle painting the icon with IContextMenu3::HandleMenuMsg2
		// so the icons will look pretty like the 'Send To' icons.
		//const HINSTANCE hinst = _AtlBaseModule.GetResourceInstance();



		//if ( hinst )
		//{

		//	// Add the bitmap for the unchecked state, since that's what it is by default.
		//	m_hbmpUnchecked = ::LoadBitmap( hinst, MAKEINTRESOURCE(IDB_COPY_PATH) );
		//	if ( m_hbmpUnchecked ) 
		//	{
		//		::SetMenuItemBitmaps( hmenu, uMenuIndex, MF_BYPOSITION, m_hbmpUnchecked, NULL ); 
		//	}
		//}
		return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, idCmd - uidFirstCmd);

	} catch ( ... ) 
	{
		return E_FAIL;
	}
	//// 如果标志包含 CMF_DEFAULTONLY 我们不作任何事情. 
	//if ( uFlags & CMF_DEFAULTONLY ) 
	//{ 
	//	return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 0 ); 
	//} 

	//InsertMenu ( hmenu, uMenuIndex, MF_BYPOSITION, uidFirstCmd, _T("SimpleShlExt Test Item") ); 
	//return MAKE_HRESULT ( SEVERITY_SUCCESS, FACILITY_NULL, 1 );
}
//-----------------------------------------------------------
// Stops capturing D3DPerf markers
//-----------------------------------------------------------
LONG CAPTURE_D3DPerfMarkers_Unhook()
{
    LogTrace(traceENTER, "");

    ScopeLock t(&s_mtx);

    if (dwAttached <= 0)
    {
        Log(logERROR, "Trying to Detach ID3D10Device twice!\n");
        return -1;
    }

    s_pCaptureLayer = NULL;

    LONG error;
    AMDT::BeginHook();

    if (Real_D3DPERF_BeginEvent != NULL)
    {
        error = AMDT::UnhookAPICall(&(PVOID&)Real_D3DPERF_BeginEvent, Mine_D3DPERF_BeginEvent);
        PsAssert(error == NO_ERROR);
    }

    if (Real_D3DPERF_EndEvent != NULL)
    {
        error = AMDT::UnhookAPICall(&(PVOID&)Real_D3DPERF_EndEvent, Mine_D3DPERF_EndEvent);
        PsAssert(error == NO_ERROR);
    }

    if (Real_D3DPERF_SetMarker != NULL)
    {
        error = AMDT::UnhookAPICall(&(PVOID&)Real_D3DPERF_SetMarker, Mine_D3DPERF_SetMarker);
        PsAssert(error == NO_ERROR);
    }

    if (Real_D3DPERF_SetRegion != NULL)
    {
        error = AMDT::UnhookAPICall(&(PVOID&)Real_D3DPERF_SetRegion, Mine_D3DPERF_SetRegion);
        PsAssert(error == NO_ERROR);
    }

    error = AMDT::EndHook();

    if (error != NO_ERROR)
    {
        Log(logERROR, "failed\n");
    }
    else
    {
        dwAttached--;
    }

    LogTrace(traceEXIT, "");

    return error;
}
Exemplo n.º 24
0
	ssize_t ArchiveTest::execute()
	{
		LogTrace();
		ExtractCallback * callback(new ExtractCallback(m_archive));
		LogTrace();
		Com::Object<IArchiveExtractCallback> extractCallback(callback);
		LogTrace();
		m_archive->Extract(nullptr, (UInt32)-1, true, extractCallback);
		LogTrace();
		return static_cast<ssize_t>(callback->failed_files.size());
	}
Exemplo n.º 25
0
XEN_API NTSTATUS
XencrshEntryPoint(
    IN  PDRIVER_OBJECT  _DriverObject
    )
{
    NTSTATUS                Status;
    HW_INITIALIZATION_DATA  InitData;

    LogTrace("===> (Irql=%d)\n", KeGetCurrentIrql());
    LogVerbose("%s (%s)\n",
         MAJOR_VERSION_STR "." MINOR_VERSION_STR "." MICRO_VERSION_STR "." BUILD_NUMBER_STR,
         DAY_STR "/" MONTH_STR "/" YEAR_STR);

    LogVerbose("Loading PV Disk in %s mode\n", __OperatingModeName()); 
    if (DriverGetOperatingMode() == DUMP_MODE) {
        WRITE_PORT_ULONG(CRASH_PORT, 'PLEH');
    } 

    AustereInitialize();
    BufferInitialize();

    RtlZeroMemory(&InitData, sizeof(InitData));

    InitData.HwInitializationDataSize   =   sizeof(InitData);
    InitData.AdapterInterfaceType       =   Internal;
    InitData.HwInitialize               =   HwInitialize;
    InitData.HwStartIo                  =   HwStartIo;
    InitData.HwInterrupt                =   HwInterrupt;
#pragma warning(suppress : 4152)
    InitData.HwFindAdapter              =   HwFindAdapter;
    InitData.HwResetBus                 =   HwResetBus;
    InitData.HwDmaStarted               =   NULL;
    InitData.HwAdapterState             =   NULL;
    InitData.DeviceExtensionSize        =   FdoSizeofXenvbdFdo();
    InitData.SpecificLuExtensionSize    =   0;
    InitData.SrbExtensionSize           =   sizeof(XENVBD_SRBEXT);
    InitData.NumberOfAccessRanges       =   2;
    InitData.MapBuffers                 =   STOR_MAP_NON_READ_WRITE_BUFFERS;
    InitData.NeedPhysicalAddresses      =   TRUE;
    InitData.TaggedQueuing              =   TRUE;
    InitData.AutoRequestSense           =   TRUE;
    InitData.MultipleRequestPerLu       =   TRUE;
    InitData.HwAdapterControl           =   HwAdapterControl;
    InitData.HwBuildIo                  =   HwBuildIo;

#pragma prefast(suppress: 6387, "Crash Driver has no registry path")
    Status = StorPortInitialize(_DriverObject, NULL, &InitData, NULL);

    LogVerbose("(%08x)\n", Status);

    LogTrace("<=== (%08x) (Irql=%d)\n", Status, KeGetCurrentIrql());
    return Status;
}
Exemplo n.º 26
0
DECLSPEC_NOINLINE VOID
PdoD3ToD0(
    IN  PXENVBD_PDO             Pdo
    )
{
    LogTrace("Target[%d] =====> (Irql=%d)\n", Pdo->Frontend.TargetId, KeGetCurrentIrql());

    // connect to backend
    FrontendSetState(&Pdo->Frontend, XENVBD_ENABLED);

    LogTrace("Target[%d] <===== (Irql=%d)\n", Pdo->Frontend.TargetId, KeGetCurrentIrql());
}
Exemplo n.º 27
0
DECLSPEC_NOINLINE VOID
PdoD0ToD3(
    IN  PXENVBD_PDO             Pdo
    )
{
    LogTrace("Target[%d] =====> (Irql=%d)\n", Pdo->Frontend.TargetId, KeGetCurrentIrql());

    // disconnect from backend
    FrontendSetState(&Pdo->Frontend, XENVBD_CLOSED);

    // target suspended
    LogTrace("Target[%d] <===== (Irql=%d)\n", Pdo->Frontend.TargetId, KeGetCurrentIrql());
}
Exemplo n.º 28
0
///	初期化
void Graphics::init(void)
{
	LogTrace("\n");
	mGeom.init();
	mWnd.init();
	m_disp_status_enable=true;
	m_disp_performance_enable=true;
	m_draw_facet_normal_enable=false;
	m_disp_bounding_box_enable=false;
	m_menu_entries=0;
	LogTrace("\n");
	return;
}
Exemplo n.º 29
0
JobStatus  FullSnapJob::doReconnect()
{
	LogTrace(Info,"Method Entry");
	failCount = 0;
	syncLogCount = 0;
	syncUndelMetaCount = 0;
	syncDelMetaCount = 0;
	
	cli->lastLsn.clear();
	
	int port = 0;
	curIp.clear();
	if(cli->cfg->isLocalDaemon())
	{
		if(ipIndex < cli->ipListFromDns.size())
		{
			curIp = cli->ipListFromDns[ipIndex];
			port = cli->cfg->cSnapPort;
		}
	}
	else  // daemon
	{
		if(ipIndex < cli->ipListFromXml.size()){  // after DNS,select a new ip;
			curIp = cli->ipListFromXml[ipIndex].ip;
			port = cli->ipListFromXml[ipIndex].port;
			targetNode = cli->ipListFromXml[ipIndex].gid;
		}
	}

	ipIndex++;
	if(curIp.empty())
	{
		LogTrace(Error,"failure from all daemons, please have a check");
		cli->snapGameover = true;
		return JOBSTOP;
	}

	LogTrace(Info,"curIP = %s, isLocalDaemon = %d", curIp.c_str(), cli->cfg->isLocalDaemon());
	IAsyncCenter *center = cli->center;

	TRowTransportFactory *to = new TRowTransportFactory();
	to->init(center->getClientConnFactory(), ctxMgr->getHandler(), curIp, port);
	to->setMainThreadQueue(center->getMainQueue());
	tf.reset(to);

	SETTRANSPORT(SnapService, tf);
	step = SyncNotStart_C;
	ASYNC_CALL(SnapService, snapStart, &FullSnapJob::onStarted, sessionId, cli->nv->getGid(), targetNode);

	return SYSDEFAULT;
}
Exemplo n.º 30
0
JobStatus FullSnapJob::onSyncLog(bool bto, int res)
{
	if(bto || res != 0){
		return onFailure(bto,res);
	}else{
		size_t sz = logs.size();
		bool applyErr = false;
		size_t i = 0;
		for(; i < sz; ++i){
			const DLog& dlog = logs[i];
			int ret = cli->mDao->apply(dlog,false);
			if(ret<0)
			{
				LogTrace(Error, "sync log apply error, errno = %d", myerrno);
				applyErr = true;
				break;
			}
			lastLsnId = dlog.lsn;
		}
		syncLogCount += i; // count the stored DLog;
		LogTrace(Info, "sync log, sz = %d, total = %d", sz, syncLogCount);
		logs.clear();

		if(applyErr)
		{
			ASYNC_CALL(System, sleep, &FullSnapJob::onWakeup, 1000 * 10);
			return SYSDEFAULT;			
		}

		if(sz < 1000)
		{
			lsnVecIndex++;
			lastLsnId = 0;
			if(lsnVecIndex < cli->lastLsn.size()) // sync Dlog of next nodeid
			{
				ASYNC_CALL(SnapService, getDLogs, &FullSnapJob::onSyncLog, logs, sessionId,cli->lastLsn[lsnVecIndex].node,lastLsnId,1000);
			}
			else // sync finished, stop
			{
				ASYNC_CALL(SnapService, snapStop, &FullSnapJob::onStop, stop, sessionId);
				return SYSDEFAULT;
			}
		}
		else
		{
			ASYNC_CALL(SnapService, getDLogs, &FullSnapJob::onSyncLog, logs, sessionId,cli->lastLsn[lsnVecIndex].node,lastLsnId,1000);
		}

		return SYSDEFAULT;
	}
}