• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ KeCancelTimer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中KeCancelTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ KeCancelTimer函数的具体用法?C++ KeCancelTimer怎么用?C++ KeCancelTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了KeCancelTimer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: RunTestSuite

NTSTATUS RunTestSuite()
{
	HOOK_TRACE_INFO			hHook = { NULL };
    NTSTATUS                NtStatus;
    ULONG                   ACLEntries[1] = {0};
	UNICODE_STRING			SymbolName;
	KTIMER					Timer;
	BOOLEAN					HasInterface = FALSE;
	PFILE_OBJECT			hEasyHookDrv;

	FORCE(EasyHookQueryInterface(EASYHOOK_INTERFACE_v_1, &Interface, &hEasyHookDrv));

	HasInterface = TRUE;

	RtlInitUnicodeString(&SymbolName, L"KeCancelTimer");

    /*
        The following shows how to install and remove local hooks...
    */
    FORCE(Interface.LhInstallHook(
            MmGetSystemRoutineAddress(&SymbolName),
            KeCancelTimer_Hook,
            (PVOID)0x12345678,
            &hHook));

    // won't invoke the hook handle because hooks are inactive after installation
	KeInitializeTimer(&Timer);

    KeCancelTimer(&Timer);

    // activate the hook for the current thread
    FORCE(Interface.LhSetInclusiveACL(ACLEntries, 1, &hHook));

    // will be redirected into the handler...
    KeCancelTimer(&Timer);

    // this will NOT unhook the entry point. But the associated handler is never called again...
    Interface.LhUninstallHook(&hHook);

    // this will restore ALL entry points of currently rending removals issued by LhUninstallHook()
    Interface.LhWaitForPendingRemovals();

	ObDereferenceObject(hEasyHookDrv);

	return STATUS_SUCCESS;

ERROR_ABORT:

	if(HasInterface)
	{
		ObDereferenceObject(hEasyHookDrv);

		KdPrint(("\n[Error]: \"%S\" (code: %d)\n", Interface.RtlGetLastErrorString(), Interface.RtlGetLastError()));
	}
	else
		KdPrint(("\n[Error]: \"Unable to obtain EasyHook interface.\" (code: %d)\n", NtStatus));

    return NtStatus;
}
开发者ID:Garfield-Chen,项目名称:hf-2011,代码行数:59,代码来源:testsuite.c


示例2: FreeTimeouts

VOID FreeTimeouts(PC0C_IO_PORT pIoPort)
{
    KeCancelTimer(&pIoPort->timerReadTotal);
    KeCancelTimer(&pIoPort->timerReadInterval);
    KeCancelTimer(&pIoPort->timerWriteTotal);
    KeCancelTimer(&pIoPort->timerClose);

    KeRemoveQueueDpc(&pIoPort->timerReadTotalDpc);
    KeRemoveQueueDpc(&pIoPort->timerReadIntervalDpc);
    KeRemoveQueueDpc(&pIoPort->timerWriteTotalDpc);
    KeRemoveQueueDpc(&pIoPort->timerCloseDpc);
}
开发者ID:Bobfrat,项目名称:coi-services,代码行数:12,代码来源:timeout.c


示例3: FilterUnload

NTSTATUS FilterUnload ( IN FLT_FILTER_UNLOAD_FLAGS Flags )
{
	PLIST_ENTRY pListHead;
	PFILE_EVENT_PACKET pFileEventPacket;
	FltCloseCommunicationPort( fileManager.pServerPort );

	if(fileManager.bReady == TRUE)
	{
		FltUnregisterFilter( fileManager.pFilter );	
		KeCancelTimer(&fileManager.connectionCheckerTimer);
	}

	// Free the log directory
	if(fileManager.logDirectory.Buffer != NULL)
	{
		ExFreePoolWithTag(fileManager.logDirectory.Buffer, FILE_POOL_TAG);
		fileManager.logDirectory.Buffer = NULL;
	}
	fileManager.bCollectDeletedFiles = FALSE;

	// Free the linked list containing all the left over file events
	FreeQueuedEvents();

	return STATUS_SUCCESS;
}
开发者ID:340211173,项目名称:capture-hpc,代码行数:25,代码来源:CaptureFileMonitor.c


示例4: ExpDeleteTimer

VOID
NTAPI
ExpDeleteTimer(IN PVOID ObjectBody)
{
    KIRQL OldIrql;
    PETIMER Timer = ObjectBody;

    /* Check if it has a Wait List */
    if (Timer->WakeTimerListEntry.Flink)
    {
        /* Lock the Wake List */
        KeAcquireSpinLock(&ExpWakeListLock, &OldIrql);

        /* Check again, since it might've changed before we locked */
        if (Timer->WakeTimerListEntry.Flink)
        {
            /* Remove it from the Wait List */
            RemoveEntryList(&Timer->WakeTimerListEntry);
            Timer->WakeTimerListEntry.Flink = NULL;
        }

        /* Release the Wake List */
        KeReleaseSpinLock(&ExpWakeListLock, OldIrql);
    }

    /* Tell the Kernel to cancel the Timer and flush all queued DPCs */
    KeCancelTimer(&Timer->KeTimer);
    KeFlushQueuedDpcs();
}
开发者ID:GYGit,项目名称:reactos,代码行数:29,代码来源:timer.c


示例5: flush_thread

void STDCALL flush_thread(void* context) {
    DEVICE_OBJECT* devobj = context;
    device_extension* Vcb = devobj->DeviceExtension;
    LARGE_INTEGER due_time;
    
    ObReferenceObject(devobj);
    
    KeInitializeTimer(&Vcb->flush_thread_timer);
    
    due_time.QuadPart = -INTERVAL * 10000;
    
    KeSetTimer(&Vcb->flush_thread_timer, due_time, NULL);
    
    while (TRUE) {
        KeWaitForSingleObject(&Vcb->flush_thread_timer, Executive, KernelMode, FALSE, NULL);

        if (!(devobj->Vpb->Flags & VPB_MOUNTED) || Vcb->removing)
            break;
            
        do_flush(Vcb);
        
        KeSetTimer(&Vcb->flush_thread_timer, due_time, NULL);
    }
    
    ObDereferenceObject(devobj);
    KeCancelTimer(&Vcb->flush_thread_timer);
    
    KeSetEvent(&Vcb->flush_thread_finished, 0, FALSE);
    
    PsTerminateSystemThread(STATUS_SUCCESS);
}
开发者ID:mvardan,项目名称:reactos,代码行数:31,代码来源:flushthread.c


示例6: StatUnload

VOID
StatUnload (
    IN PDRIVER_OBJECT DriverObject
    )

{
    PDEVICE_OBJECT deviceObject;

    PAGED_CODE();

    RemoveAllHookedThunks ();
    KeCancelTimer (&LazyFreeTimer);
    LazyFreePool (NULL);

    //
    // Restore hooked addresses
    //
    *((PULONG) HalThunkForKeUpdateSystemTime) = KeUpdateSystemTimeThunk;
    if (HalThunkForKeUpdateRunTime) {
        *((PULONG) HalThunkForKeUpdateRunTime)    = KeUpdateRunTimeThunk;
    }


    //
    // Delete the device object.
    //
    IoDeleteDevice(DriverObject->DeviceObject);
    return;
}
开发者ID:mingpen,项目名称:OpenNT,代码行数:29,代码来源:pstat.c


示例7: BeepClose

NTSTATUS
NTAPI
BeepClose(IN PDEVICE_OBJECT DeviceObject,
          IN PIRP Irp)
{
    PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;

    /* Acquire the mutex and decrease reference count */
    ExAcquireFastMutex(&DeviceExtension->Mutex);
    if (!(--DeviceExtension->ReferenceCount))
    {
        /* Check for active timer */
        if (DeviceExtension->TimerActive)
        {
            /* Cancel it */
            if (KeCancelTimer(&DeviceExtension->Timer))
            {
                /* Mark it as cancelled */
                InterlockedDecrement(&DeviceExtension->TimerActive);
            }
        }

        /* Page the driver */
        MmUnlockPagableImageSection(DeviceExtension->SectionHandle);
    }

    /* Release the lock */
    ExReleaseFastMutex(&DeviceExtension->Mutex);

    /* Complete the request */
    Irp->IoStatus.Status = STATUS_SUCCESS;
    Irp->IoStatus.Information = 0;
    IoCompleteRequest(Irp, IO_NO_INCREMENT);
    return STATUS_SUCCESS;
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:35,代码来源:beep.c


示例8: BeepUnload

VOID
NTAPI
BeepUnload(IN PDRIVER_OBJECT DriverObject)
{
    PDEVICE_EXTENSION DeviceExtension;
    PDEVICE_OBJECT DeviceObject;

    /* Get DO and DE */
    DeviceObject = DriverObject->DeviceObject;
    DeviceExtension = DeviceObject->DeviceExtension;

    /* Check if the timer is active */
    if (DeviceExtension->TimerActive)
    {
        /* Cancel it */
        if (KeCancelTimer(&DeviceExtension->Timer))
        {
            /* All done */
            InterlockedDecrement(&DeviceExtension->TimerActive);
        }
    }

    /* Delete the object */
    IoDeleteDevice(DeviceObject);
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:25,代码来源:beep.c


示例9: FlTimerThreadStop

/*! .

	\param [in]
	\param [out]
	\param [in,out]

	\pre
	\post
	\return

*/
NTSTATUS
FlTimerThreadStop()
{
    LARGE_INTEGER tend_timeout;


    DBGPRINT("[flmonflt] Stopping timer thread.\n");

    tend_timeout.QuadPart = RELATIVE(SECONDS(8));
    TimerThreadStopExec = TRUE;


    KeCancelTimer(DriverInfoData->Timer);
    KeSetEvent(DriverInfoData->TimerThreadSleepWakeup, 0, FALSE);

    DBGPRINT("[flmonflt] Waiting for thread to exit.\n");
    KeWaitForSingleObject(DriverInfoData->TimerThread, Executive, KernelMode, TRUE, &tend_timeout);

    DBGPRINT("[flmonflt] Thread exited, dereferencing object.\n");
    ObDereferenceObject(DriverInfoData->TimerThread);

    DBGPRINT("[flmonflt] Thread dereferenced.\n");

    return STATUS_SUCCESS;
}
开发者ID:novoid,项目名称:tstest,代码行数:36,代码来源:FlTimerThread.c


示例10: DriverUnload

VOID DriverUnload (PDRIVER_OBJECT pDriverObject) 
{
	
	PDEVICE_OBJECT pNextObj;
	DbgPrint("MWDM_DRIVER: DriverUnload | Started\n");
	// Loop through each device controlled by Driver
	KeCancelTimer (&timer);
	pNextObj = pDriverObject->DeviceObject;

	while (pNextObj != NULL) 
	{
		PDEVICE_EXTENSION pDevExt = (PDEVICE_EXTENSION) pNextObj->DeviceExtension;

		//...
		// UNDO whatever is done in Driver Entry
		//
		// ... delete symbolic link name
		//IoDeleteSymbolicLink(&pDevExt->symLinkName);

		pNextObj = pNextObj->NextDevice;

		// then delete the device using the Extension
		IoDeleteDevice( pDevExt->DeviceObject);
	}
	DbgPrint("MWDM_DRIVER: DriverUnload | Done\n");
	return;
}
开发者ID:souri,项目名称:MWDMDriver,代码行数:27,代码来源:mwdm.C


示例11: PAGED_CODE

//=============================================================================
CMiniportWaveCyclicStream::~CMiniportWaveCyclicStream(void)
/*++
Routine Description:
  Destructor for wavecyclicstream 

Arguments:

Return Value:
  NT status code.
--*/
{
    PAGED_CODE();

    DPF_ENTER(("[CMiniportWaveCyclicStream::~CMiniportWaveCyclicStream]"));

    if (m_pTimer) {
        KeCancelTimer(m_pTimer);
        ExFreePoolWithTag(m_pTimer, MSVAD_POOLTAG);
    }

    if (m_pDpc) {
        ExFreePoolWithTag( m_pDpc, MSVAD_POOLTAG );
    }

    // Free the DMA buffer
    FreeBuffer();

    if (NULL != m_pMiniport) {
        if (m_fCapture) {
            m_pMiniport->m_fCaptureAllocated = FALSE;
        } else {
            m_pMiniport->m_fRenderAllocated = FALSE;
        }
    }
} // ~CMiniportWaveCyclicStream
开发者ID:duncanthrax,项目名称:scream,代码行数:36,代码来源:minstream.cpp


示例12: PM_unregisterHeartBeatCallback

/****************************************************************************
REMARKS:
Function to unregister a driver heart beat callback with the PM library.
****************************************************************************/
void PMAPI PM_unregisterHeartBeatCallback(
    PM_heartBeat_cb cb)
{
    int i;

    // Remove heart beat callback from list
    for (i = 0; i < _PM_hb->numHeartBeatCallbacks; i++) {
        if (_PM_hb->heartBeat[i] == cb) {
            PM_lockSNAPAccess(-1,true);
            if (i < _PM_hb->numHeartBeatCallbacks-1) {
                RtlMoveMemory(&_PM_hb->heartBeat[i],&_PM_hb->heartBeat[i+1], sizeof(_PM_hb->heartBeat[i]) * (_PM_hb->numHeartBeatCallbacks-1 - i));
                RtlMoveMemory(&_PM_hb->heartBeatData[i],&_PM_hb->heartBeatData[i+1],sizeof(_PM_hb->heartBeatData[i]) * (_PM_hb->numHeartBeatCallbacks-1 - i));
                }
            _PM_hb->numHeartBeatCallbacks--;
            PM_unlockSNAPAccess(-1);
            break;
            }
        }

    // If last time called, kill periodic timer and driver thread
    if (_PM_hb->numHeartBeatCallbacks == 0) {
        PM_lockSNAPAccess(-1,true);
        KeCancelTimer(&_PM_hb->kTimer);
        // PsTerminateSystemThread can only be called within driver thread context
        _PM_hb->bThreadRunning = false;
        PM_unlockSNAPAccess(-1);
        }
}
开发者ID:kendallb,项目名称:scitech-mgl,代码行数:32,代码来源:pm.c


示例13: EventLogStart

NTSTATUS
	EventLogStart(PEVENT_LOG EventLog)
{
	LARGE_INTEGER TimerDueTime;
	NTSTATUS Status;

	RtlZeroMemory(EventLog, sizeof(EVENT_LOG));
	InitializeListHead(&EventLog->EventListHead);
	KeInitializeSpinLock(&EventLog->EventListLock);
	KeInitializeTimer(&EventLog->Timer);
	KeInitializeDpc(&EventLog->TimerDpc, EventLogTimerDpcRoutine, EventLog);
	SysWorkerInit(&EventLog->Worker);

	Status = SysWorkerStart(&EventLog->Worker);
	if (!NT_SUCCESS(Status)) {
		goto start_failed;
	}

	TimerDueTime.QuadPart = 0;
	KeSetTimerEx(&EventLog->Timer, TimerDueTime, 500, &EventLog->TimerDpc);
	return STATUS_SUCCESS;

start_failed:
	EventLog->Stopping = 1;
	KeCancelTimer(&EventLog->Timer);
	KeFlushQueuedDpcs();
	SysWorkerStop(&EventLog->Worker);
	EventLogFlush(EventLog);

	return Status;
}
开发者ID:JayceM6,项目名称:pcmonitor,代码行数:31,代码来源:eventlog.c


示例14: CmpShutdownWorkers

VOID
NTAPI
CmpShutdownWorkers(VOID)
{
    /* Stop lazy flushing */
    PAGED_CODE();
    KeCancelTimer(&CmpLazyFlushTimer);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:8,代码来源:cmlazy.c


示例15: SrvCancelTimer

VOID
SrvCancelTimer (
    PSRV_TIMER Timer
    )

/*++

Routine Description:

    This routine cancels a timer.

Arguments:

    Timer -- pointer to the timer

Return Value:

    None.

--*/

{
    PAGED_CODE( );

    //
    // Cancel the timer.
    //

    if ( !KeCancelTimer( &Timer->Timer ) ) {

        //
        // We were unable to cancel the timer.  This means that the
        // timer routine has either already run or is scheduled to run.
        // We need to wait for the timer routine to complete before we
        // continue.
        //
        // We expect that if we couldn't cancel the timer (which
        // shouldn't happen often), then the timer routine has probably
        // already completed, so we call KeReadStateEvent first to avoid
        // the overhead of KeWaitForSingleObject.
        //

        if ( !KeReadStateEvent( &Timer->Event ) ) {
            KeWaitForSingleObject(
                &Timer->Event,
                UserRequest,
                KernelMode,     // don't let kernel stack be paged
                FALSE,          // not alertable
                NULL            // no timeout
                );
        }

    }

    return;

} // SrvCancelTimer
开发者ID:Gaikokujin,项目名称:WinNT4,代码行数:57,代码来源:blktimer.c


示例16: BackupRegistersDeInit

void BackupRegistersDeInit(HANDLE_DEV dev)
{
    WriteBackupRegistersToRegistry(dev);
#ifdef ENABLE_TIMER_DPC
    KeCancelTimer(timer);
    KeFlushQueuedDpcs(); //wait for dpc complete
    SAFE_FREE_POOL(dpc, IVH_BACKUP_POOL_TAG);
    SAFE_FREE_POOL(timer, IVH_BACKUP_POOL_TAG);
#endif
}
开发者ID:sky8336,项目名称:mn201307,代码行数:10,代码来源:BackupRegisters.c


示例17: EventLogStop

VOID
	EventLogStop(PEVENT_LOG EventLog)
{
	PSYS_WRK_ITEM WrkItem = NULL;

	EventLog->Stopping = 1;
	KeCancelTimer(&EventLog->Timer);
	KeFlushQueuedDpcs();
	SysWorkerStop(&EventLog->Worker);
	EventLogFlush(EventLog);
}
开发者ID:JayceM6,项目名称:pcmonitor,代码行数:11,代码来源:eventlog.c


示例18: rtTimerNtStopWorker

/**
 * Worker function that stops an active timer.
 *
 * Shared by RTTimerStop and RTTimerDestroy.
 *
 * @param   pTimer      The active timer.
 */
static void rtTimerNtStopWorker(PRTTIMER pTimer)
{
    /*
     * Just cancel the timer, dequeue the DPCs and flush them (if this is supported).
     */
    ASMAtomicWriteBool(&pTimer->fSuspended, true);

    KeCancelTimer(&pTimer->NtTimer);

    for (RTCPUID iCpu = 0; iCpu < pTimer->cSubTimers; iCpu++)
        KeRemoveQueueDpc(&pTimer->aSubTimers[iCpu].NtDpc);
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:19,代码来源:timer-r0drv-nt.cpp


示例19: LMDestroy

NTSTATUS
LMDestroy(
	IN PBUFFLOCK_CONTROL BuffLockCtl
){
	BOOLEAN	cancelledInSystemTimerQueue;

	cancelledInSystemTimerQueue = KeCancelTimer(&BuffLockCtl->IoIdleTimer);
	if(cancelledInSystemTimerQueue == FALSE) {
		KDPrintM(DBG_OTHER_ERROR, ("Buffer lock IO idle timer is not cancelled in the system timer queue.\n"));
	}
	return STATUS_SUCCESS;
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:12,代码来源:lockmgmt.c


示例20: RemoveDPCTimer

NTSTATUS RemoveDPCTimer(PVOID InBuffer)
{
	PREMOVE_DPCTIMER Temp = (PREMOVE_DPCTIMER)InBuffer;
	ULONG_PTR TimerObject = Temp->TimerObject;
	if (TimerObject&&MmIsAddressValid((PVOID)TimerObject))
	{

		if (KeCancelTimer((PKTIMER)TimerObject))
		{
			return STATUS_SUCCESS;
		}
	}
	return STATUS_UNSUCCESSFUL;
}
开发者ID:ChengChengCC,项目名称:Ark-tools,代码行数:14,代码来源:DpcTimerDrv.c



注:本文中的KeCancelTimer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ KeDelayExecutionThread函数代码示例发布时间:2022-05-30
下一篇:
C++ KeBugCheckEx函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap