本文整理汇总了C++中TraceError函数的典型用法代码示例。如果您正苦于以下问题:C++ TraceError函数的具体用法?C++ TraceError怎么用?C++ TraceError使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TraceError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SENSOR_FunctionEnter
// This callback is called when interval wait time has expired and driver is ready
// to collect new sample. The callback reads current value, compare value to threshold,
// pushes it up to CLX framework, and schedule next wake up time.
VOID ActivityDevice::OnTimerExpire(_In_ WDFTIMER timer)
{
NTSTATUS status = STATUS_SUCCESS;
SENSOR_FunctionEnter();
PActivityDevice pDevice = GetActivityContextFromSensorInstance(WdfTimerGetParentObject(timer));
if (nullptr == pDevice)
{
status = STATUS_INSUFFICIENT_RESOURCES;
TraceError("ACT %!FUNC! GetActivityContextFromSensorInstance failed %!STATUS!", status);
}
else
{
// Get data and push to clx
WdfWaitLockAcquire(pDevice->m_Lock, NULL);
status = pDevice->GetData();
if (!NT_SUCCESS(status) && STATUS_DATA_NOT_ACCEPTED != status)
{
TraceError("ACT %!FUNC! GetAccData Failed %!STATUS!", status);
}
WdfWaitLockRelease(pDevice->m_Lock);
// Schedule next wake up time
if (Act_Default_MinDataInterval_Ms <= pDevice->m_Interval &&
FALSE != pDevice->m_PoweredOn &&
FALSE != pDevice->m_Started)
{
WdfTimerStart(pDevice->m_Timer, WDF_REL_TIMEOUT_IN_MS(pDevice->m_Interval));
}
}
SENSOR_FunctionExit(status);
}
示例2: GetCustomSensorContextFromSensorInstance
// Called by Sensor CLX to get sampling rate of the sensor.
NTSTATUS
CustomSensorDevice::OnGetDataInterval(
_In_ SENSOROBJECT SensorInstance, // sensor device object
_Out_ PULONG DataRateMs // sampling rate in milliseconds
)
{
PCustomSensorDevice pDevice = GetCustomSensorContextFromSensorInstance(SensorInstance);
NTSTATUS Status = STATUS_SUCCESS;
SENSOR_FunctionEnter();
if (nullptr == pDevice)
{
Status = STATUS_INVALID_PARAMETER;
TraceError("CSTM %!FUNC! Sensor(%08X) parameter is invalid. Failed %!STATUS!", (INT) SensorInstance, Status);
goto Exit;
}
if (nullptr == DataRateMs)
{
Status = STATUS_INVALID_PARAMETER;
TraceError("CSTM %!FUNC! DataRateMs(%08X) parameter is invalid. Failed %!STATUS!", (INT)DataRateMs, Status);
goto Exit;
}
*DataRateMs = pDevice->m_Interval;
Exit:
SENSOR_FunctionExit(Status);
return Status;
}
示例3: XenLowerBackendInit
BOOLEAN
XenLowerBackendInit(
PXEN_LOWER XenLower)
{
PCHAR path;
NTSTATUS status;
// Note this is split from the XenLowerInit so it can be called on the resume
// path in case backend values change.
XXX_TODO("--XT-- All the backend path handling assumes dom0 is the backend, this will change for device domains")
// XXX TODO all the backend path handling assumes dom0 is the backend. This will
// not necessarily be true with device domains. The changes to support this go
// beyond this module though.
path = XenLowerReadXenstoreValue(XenLower->FrontendPath, "backend");
if (path == NULL)
{
TraceError((__FUNCTION__
": XenLowerReadXenstoreValue() failed to return the back end path, fatal.\n"));
return FALSE;
}
status = RtlStringCchCopyA(XenLower->BackendPath,
sizeof(XenLower->BackendPath),
path);
XmFreeMemory(path);
if (status != STATUS_SUCCESS)
{
XenLower->BackendPath[0] = 0;
TraceError((__FUNCTION__
": Failed to copy back end path - status: 0x%x\n", status));
return FALSE;
}
status = xenbus_read_domain_id(XBT_NIL, XenLower->FrontendPath,
"backend-id", &XenLower->BackendDomid);
if (!NT_SUCCESS(status))
{
TraceWarning((__FUNCTION__
": Failed to read backend id from %s (%x), setting to dom0\n",
XenLower->FrontendPath, status));
XenLower->BackendDomid = DOMAIN_ID_0();
}
// XXX TODO for now we only support a dom0 backend so check that here. Later
// when we support a device domain for vusb, other domids will be fine.
XXX_TODO("--XT-- For now we only support a dom0 backend so check that here");
if (unwrap_DOMAIN_ID(XenLower->BackendDomid) != unwrap_DOMAIN_ID(DOMAIN_ID_0()))
{
TraceError((XENTARGET
": cannot connect to backend Domid: %d, only dom0 supported currently\n",
XenLower->BackendDomid));
return FALSE;
}
TraceInfo((__FUNCTION__
": XenLower initialized - FrontendPath: %s BackendPath: %s BackendDomid: %d\n",
XenLower->FrontendPath, XenLower->BackendPath, unwrap_DOMAIN_ID(XenLower->BackendDomid)));
return TRUE;
}
示例4: XenLowerInterfaceVersion
ULONG
XenLowerInterfaceVersion(
PXEN_LOWER XenLower)
{
NTSTATUS status;
PCHAR vstr;
int version;
vstr = XenLowerReadXenstoreValue(XenLower->BackendPath, "version");
if (vstr == NULL)
{
TraceError((__FUNCTION__\
": XenLowerReadXenstoreValue() failed to return the vusb version.\n"));
return 0;
}
sscanf_s(vstr, "%d", &version);
XmFreeMemory(vstr);
// Need to now write the version we support to the frontend
status = xenbus_printf(XBT_NIL, XenLower->FrontendPath,
"version", "%d", XEN_LOWER_INTERFACE_VERSION);
if (!NT_SUCCESS(status))
{
TraceError((__FUNCTION__\
": xenbus_printf(frontend/version) failed.\n"));
return 0;
}
TraceInfo((__FUNCTION__
": Read backend version: %d - Wrote frontend version: %d\n",
version, XEN_LOWER_INTERFACE_VERSION));
return (ULONG)version;
}
示例5: XenLowerGntTblEndAccess
BOOLEAN
XenLowerGntTblEndAccess(
grant_ref_t Ref)
{
NTSTATUS status;
GRANT_REF gref = wrap_GRANT_REF(Ref, 0);
// Note that the only call this callback passes FALSE for keepref
// which is good since this grant impl. does not support that currently.
if (Ref == INVALID_GRANT_REF)
{
TraceError((__FUNCTION__ ": invalid grant ref specified, cannot continue.\n"));
return FALSE;
}
XenLowerTraceGref(Ref, gref);
status = GnttabEndForeignAccess(gref);
if (!NT_SUCCESS(status))
{
TraceError((__FUNCTION__ ": failed to end grant access and return grant ref.\n"));
return FALSE;
}
return TRUE;
}
示例6: timeGetTime
void CPythonPlayerEventHandler::OnHit(UINT uSkill, CActorInstance& rkActorVictim, BOOL isSendPacket)
{
DWORD dwVIDVictim=rkActorVictim.GetVirtualID();
// Update Target
CPythonPlayer::Instance().SetTarget(dwVIDVictim, FALSE);
// Update Target
if (isSendPacket)
{
//#define ATTACK_TIME_LOG
#ifdef ATTACK_TIME_LOG
static std::map<DWORD, float> s_prevTimed;
float curTime = timeGetTime() / 1000.0f;
bool isFirst = false;
if (s_prevTimed.end() == s_prevTimed.find(dwVIDVictim))
{
s_prevTimed[dwVIDVictim] = curTime;
isFirst = true;
}
float diffTime = curTime-s_prevTimed[dwVIDVictim];
if (diffTime < 0.1f && !isFirst)
{
TraceError("ATTACK(SPEED_HACK): %.4f(%.4f) %d", curTime, diffTime, dwVIDVictim);
}
else
{
TraceError("ATTACK: %.4f(%.4f) %d", curTime, diffTime, dwVIDVictim);
}
s_prevTimed[dwVIDVictim] = curTime;
#endif
CPythonNetworkStream& rkStream=CPythonNetworkStream::Instance();
rkStream.SendAttackPacket(uSkill, dwVIDVictim);
}
if (!rkActorVictim.IsPushing())
return;
// 거대 몬스터 밀림 제외
extern bool IS_HUGE_RACE(unsigned int vnum);
if (IS_HUGE_RACE(rkActorVictim.GetRace()))
return;
CPythonCharacterManager::Instance().AdjustCollisionWithOtherObjects(&rkActorVictim);
const TPixelPosition& kPPosLast=rkActorVictim.NEW_GetLastPixelPositionRef();
SVictim kVictim;
kVictim.m_dwVID=dwVIDVictim;
kVictim.m_lPixelX=long(kPPosLast.x);
kVictim.m_lPixelY=long(kPPosLast.y);
rkActorVictim.TEMP_Push(kVictim.m_lPixelX, kVictim.m_lPixelY);
m_kVctkVictim.push_back(kVictim);
}
示例7: SENSOR_FunctionEnter
// This routine is called by the framework when the PnP manager sends an
// IRP_MN_START_DEVICE request to the driver stack. This routine is
// responsible for performing operations that are necessary to make the
// driver's device operational (for e.g. mapping the hardware resources
// into memory).
NTSTATUS ActivityDevice::OnPrepareHardware(
_In_ WDFDEVICE device, // Supplies a handle to the framework device object
_In_ WDFCMRESLIST /*ResourcesRaw*/, // Supplies a handle to a collection of framework resource
// objects. This collection identifies the raw (bus-relative) hardware
// resources that have been assigned to the device.
_In_ WDFCMRESLIST /*ResourcesTranslated*/) // Supplies a handle to a collection of framework
// resource objects. This collection identifies the translated
// (system-physical) hardware resources that have been assigned to the
// device. The resources appear from the CPU's point of view.
{
NTSTATUS status = STATUS_SUCCESS;
SENSOR_FunctionEnter();
// Create WDFOBJECT for the sensor
WDF_OBJECT_ATTRIBUTES sensorAttributes = {};
WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&sensorAttributes, ActivityDevice);
// Register sensor instance with clx
SENSOROBJECT sensorInstance = NULL;
status = SensorsCxSensorCreate(device, &sensorAttributes, &sensorInstance);
if (!NT_SUCCESS(status))
{
TraceError("ACT %!FUNC! SensorsCxSensorCreate failed %!STATUS!", status);
}
else
{
PActivityDevice pDevice = GetActivityContextFromSensorInstance(sensorInstance);
if (nullptr == pDevice)
{
status = STATUS_INSUFFICIENT_RESOURCES;
TraceError("ACT %!FUNC! GetActivityContextFromSensorInstance failed %!STATUS!", status);
}
else
{
// Fill out properties
status = pDevice->Initialize(device, sensorInstance);
if (!NT_SUCCESS(status))
{
TraceError("ACT %!FUNC! Initialize device object failed %!STATUS!", status);
}
else
{
SENSOR_CONFIG sensorConfig = {};
SENSOR_CONFIG_INIT(&sensorConfig);
sensorConfig.pEnumerationList = pDevice->m_pEnumerationProperties;
status = SensorsCxSensorInitialize(sensorInstance, &sensorConfig);
if (!NT_SUCCESS(status))
{
TraceError("ACT %!FUNC! SensorsCxSensorInitialize failed %!STATUS!", status);
}
}
}
}
SENSOR_FunctionExit(status);
return status;
}
示例8: SENSOR_FunctionEnter
// Internal routine to perform simulator initialization
NTSTATUS
HardwareSimulator::InitializeInternal(
_In_ WDFOBJECT SimulatorInstance) // Instance of the WDF object for the simulator
{
NTSTATUS Status = STATUS_SUCCESS;
WDF_OBJECT_ATTRIBUTES TimerAttributes = {};
WDF_TIMER_CONFIG TimerConfig = {};
SENSOR_FunctionEnter();
// Only initialize the simulator if it is in the "not initialized" state
if (SimulatorState_NotInitialized == m_State)
{
// Create Lock
Status = WdfWaitLockCreate(WDF_NO_OBJECT_ATTRIBUTES, &m_Lock);
if (!NT_SUCCESS(Status))
{
m_Lock = NULL;
TraceError("CSTM %!FUNC! WdfWaitLockCreate failed %!STATUS!", Status);
goto Exit;
}
// Create a timer object for simulation updates
WDF_TIMER_CONFIG_INIT(&TimerConfig, HardwareSimulator::OnTimerExpire);
WDF_OBJECT_ATTRIBUTES_INIT(&TimerAttributes);
TimerAttributes.ParentObject = SimulatorInstance;
TimerAttributes.ExecutionLevel = WdfExecutionLevelPassive;
Status = WdfTimerCreate(&TimerConfig, &TimerAttributes, &m_Timer);
if (!NT_SUCCESS(Status))
{
m_Timer = NULL;
TraceError("CSTM %!FUNC! WdfTimerCreate failed %!STATUS!", Status);
goto Exit;
}
// Set the simulator state to "initialized"
m_State = SimulatorState_Initialized;
m_SimulatorInstance = SimulatorInstance;
}
Exit:
if (!NT_SUCCESS(Status) && NULL != m_Lock)
{
WdfObjectDelete(m_Lock);
m_Lock = NULL;
}
SENSOR_FunctionExit(Status);
return Status;
}
示例9: GetPedometerContextFromSensorInstance
// Called by Sensor CLX to begin keeping history
NTSTATUS
PedometerDevice::OnStartHistory(
_In_ SENSOROBJECT SensorInstance // Sensor device object
)
{
PPedometerDevice pDevice = GetPedometerContextFromSensorInstance(SensorInstance);
NTSTATUS Status = STATUS_SUCCESS;
PHardwareSimulator pSimulator = nullptr;
SENSOR_FunctionEnter();
if (nullptr == pDevice)
{
Status = STATUS_INVALID_PARAMETER;
TraceError("PED %!FUNC! Sensor(0x%p) parameter is invalid. Failed %!STATUS!", SensorInstance, Status);
goto Exit;
}
if (FALSE == pDevice->m_HistorySupported)
{
Status = STATUS_NOT_SUPPORTED;
TraceError("PED %!FUNC! History is not supported by the HW");
goto Exit;
}
if (FALSE == pDevice->m_PoweredOn)
{
Status = STATUS_DEVICE_NOT_READY;
TraceError("PED %!FUNC! Sensor is not powered on! %!STATUS!", Status);
goto Exit;
}
pSimulator = GetHardwareSimulatorContextFromInstance(pDevice->m_SimulatorInstance);
if (nullptr == pSimulator)
{
Status = STATUS_INSUFFICIENT_RESOURCES;
TraceError("PED %!FUNC! GetHardwareSimulatorContextFromInstance failed %!STATUS!", Status);
goto Exit;
}
// Start the pedometer history
Status = pSimulator->StartHistory();
if (!NT_SUCCESS(Status))
{
TraceError("PED %!FUNC! Start History failed %!STATUS!", Status);
}
Exit:
SENSOR_FunctionExit(Status);
return Status;
}
示例10: V4vCtrlInitializeFile
static NTSTATUS
V4vCtrlInitializeFile(XENV4V_CONTEXT *ctx, V4V_INIT_VALUES *invs, PIRP irp)
{
NTSTATUS status = STATUS_SUCCESS;
if (ctx == NULL) {
TraceError(("no file context!\n"));
return STATUS_INVALID_HANDLE;
}
if (invs->rxEvent == NULL) {
TraceError(("no event handle!\n"));
return STATUS_INVALID_HANDLE;
}
do {
// Reference the event objects
status = ObReferenceObjectByHandle(invs->rxEvent,
EVENT_MODIFY_STATE,
*ExEventObjectType,
irp->RequestorMode,
(void **)&ctx->kevReceive,
NULL);
if (!NT_SUCCESS(status)) {
TraceError(("failed to get a reference to the receive event - error: 0x%x\n", status));
break;
}
ctx->ringLength = invs->ringLength;
// Straighten out the ring
if (ctx->ringLength > PAGE_SIZE) {
ctx->ringLength = (ctx->ringLength + XENV4V_RING_MULT - 1) & ~(XENV4V_RING_MULT - 1);
}
else {
ctx->ringLength = PAGE_SIZE; // minimum to guarantee page alignment
}
InterlockedExchange(&ctx->state, XENV4V_STATE_IDLE);
} while (FALSE);
if (!NT_SUCCESS(status)) {
// If it failed, undo everything
if (ctx->kevReceive != NULL) {
ObDereferenceObject(ctx->kevReceive);
ctx->kevReceive = NULL;
}
}
return status;
}
示例11: V4vDispatchWmi
static NTSTATUS NTAPI
V4vDispatchWmi(PDEVICE_OBJECT fdo, PIRP irp)
{
NTSTATUS status;
PXENV4V_EXTENSION pde = V4vGetDeviceExtension(fdo);
TraceVerbose(("====> '%s'.\n", __FUNCTION__));
// We don't support WMI, so just pass it on down the stack
status = IoAcquireRemoveLock(&pde->removeLock, irp);
if (!NT_SUCCESS(status)) {
TraceError(("failed to acquire IO lock - error: 0x%x\n", status));
return V4vSimpleCompleteIrp(irp, status);
}
IoSkipCurrentIrpStackLocation(irp);
status = IoCallDriver(pde->ldo, irp);
IoReleaseRemoveLock(&pde->removeLock, irp);
TraceVerbose(("<==== '%s'.\n", __FUNCTION__));
return status;
}
示例12: SENSOR_PROPERTY_LIST_SIZE
// This routine initializes the supported data fields
NTSTATUS ActivityDevice::InitializeSupportedDataFields()
{
WDF_OBJECT_ATTRIBUTES memoryAttributes = {};
WDFMEMORY memoryHandle = NULL;
const ULONG size = SENSOR_PROPERTY_LIST_SIZE(ACTIVITY_DATA_COUNT);
NTSTATUS status = STATUS_SUCCESS;
SENSOR_FunctionEnter();
WDF_OBJECT_ATTRIBUTES_INIT(&memoryAttributes);
memoryAttributes.ParentObject = m_SensorInstance;
status = WdfMemoryCreate(&memoryAttributes,
PagedPool,
SENSOR_POOL_TAG_ACTIVITY,
size,
&memoryHandle,
reinterpret_cast<PVOID*>(&m_pSupportedDataFields));
if (!NT_SUCCESS(status) || nullptr == m_pSupportedDataFields)
{
TraceError("ACT %!FUNC! WdfMemoryCreate failed %!STATUS!", status);
}
else
{
SENSOR_PROPERTY_LIST_INIT(m_pSupportedDataFields, size);
m_pSupportedDataFields->Count = ACTIVITY_DATA_COUNT;
m_pSupportedDataFields->List[ACTIVITY_DATA_TIMESTAMP] = PKEY_SensorData_Timestamp;
m_pSupportedDataFields->List[ACTIVITY_DATA_CURRENT_STATE] = PKEY_SensorData_CurrentActivityState;
m_pSupportedDataFields->List[ACTIVITY_DATA_CURRENT_CONFIDENCE] = PKEY_SensorData_CurrentActivityStateConfidence_Percentage;
}
SENSOR_FunctionExit(status);
return status;
}
示例13: _XenQueueWork
NTSTATUS
_XenQueueWork(
IN const CHAR *Caller,
IN const CHAR *Name,
IN XEN_WORK_CALLBACK Work,
IN VOID *Context
)
{
XEN_WORKITEM *Item;
KIRQL Irql;
Item = XmAllocateZeroedMemory(sizeof(XEN_WORKITEM));
if (!Item) {
TraceError(("%s: %s() failed to queue %s\n", __FUNCTION__, Caller, Name));
return STATUS_NO_MEMORY;
}
TraceVerbose(("%s: %s() queueing '%s'\n", __FUNCTION__, Caller, Name));
Item->Magic = WORKITEM_MAGIC;
Item->Name = Name;
Item->Work = Work;
Item->Context = Context;
Irql = acquire_irqsafe_lock(&WorkItemDispatchLock);
InsertTailList(&PendingWorkItems, &Item->List);
release_irqsafe_lock(&WorkItemDispatchLock, Irql);
KeSetEvent(&WorkItemThread->event, IO_NO_INCREMENT, FALSE);
return STATUS_SUCCESS;
}
示例14: Direct3DCreate9Ex
/********************************************************************
DetectWDDMDriver
Set a property if the driver on the machine is a WDDM driver. One
reliable way to detect the presence of a WDDM driver is to try and
use the Direct3DCreate9Ex() function. This method attempts that
then sets the property appropriately.
********************************************************************/
static HRESULT DetectWDDMDriver()
{
HRESULT hr = S_OK;
HMODULE hModule = NULL;
// Manually load the d3d9.dll library. If the library couldn't be loaded then we obviously won't be able
// to try calling the function so just return.
hr = LoadSystemLibrary(L"d3d9.dll", &hModule);
if (E_MODNOTFOUND == hr)
{
TraceError(hr, "Unable to load DirectX APIs, skipping WDDM driver check.");
ExitFunction1(hr = S_OK);
}
ExitOnFailure(hr, "Failed to the load the existing DirectX APIs.");
// Obtain the address of the Direct3DCreate9Ex function. If this fails we know it isn't a WDDM
// driver so just exit.
const void* Direct3DCreate9ExPtr = ::GetProcAddress(hModule, "Direct3DCreate9Ex");
ExitOnNull(Direct3DCreate9ExPtr, hr, S_OK, "Unable to load Direct3DCreateEx function, so the driver is not a WDDM driver.");
// At this point we know it's a WDDM driver so set the property.
hr = WcaSetIntProperty(L"WIX_WDDM_DRIVER_PRESENT", 1);
ExitOnFailure(hr, "Failed write property");
LExit:
if (NULL != hModule)
{
FreeLibrary(hModule);
}
return hr;
}
示例15: TraceError
void CPythonPlayer::__RunCoolTime(DWORD dwSkillSlotIndex)
{
TSkillInstance & rkSkillInst = m_playerStatus.aSkill[dwSkillSlotIndex];
CPythonSkill::TSkillData * pkSkillData;
if (!CPythonSkill::Instance().GetSkillData(rkSkillInst.dwIndex, &pkSkillData))
{
TraceError("CPythonPlayer::__SendUseSkill(dwSkillSlotIndex=%d) - NOT CHECK", dwSkillSlotIndex);
return;
}
CPythonSkill::TSkillData& rkSkillData=*pkSkillData;
rkSkillInst.fCoolTime = rkSkillData.GetSkillCoolTime(rkSkillInst.fcurEfficientPercentage);
rkSkillInst.fLastUsedTime = CTimer::Instance().GetCurrentSecond();
int iSpd = 100 - GetStatus(POINT_CASTING_SPEED);
if (iSpd > 0)
iSpd = 100 + iSpd;
else if (iSpd < 0)
iSpd = 10000 / (100 - iSpd);
else
iSpd = 100;
rkSkillInst.fCoolTime = rkSkillInst.fCoolTime * iSpd / 100;
PyCallClassMemberFunc(m_ppyGameWindow, "RunUseSkillEvent", Py_BuildValue("(if)", dwSkillSlotIndex, rkSkillInst.fCoolTime));
}