本文整理汇总了C++中KeInitializeDpc函数的典型用法代码示例。如果您正苦于以下问题:C++ KeInitializeDpc函数的具体用法?C++ KeInitializeDpc怎么用?C++ KeInitializeDpc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KeInitializeDpc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XenPci_HighSync
VOID
XenPci_HighSync(PXENPCI_HIGHSYNC_FUNCTION function0, PXENPCI_HIGHSYNC_FUNCTION functionN, PVOID context)
{
ULONG ActiveProcessorCount;
ULONG i;
highsync_info_t *highsync_info;
KIRQL old_irql;
UNREFERENCED_PARAMETER(context);
FUNCTION_ENTER();
highsync_info = ExAllocatePoolWithTag(NonPagedPool, sizeof(highsync_info_t), XENPCI_POOL_TAG);
RtlZeroMemory(highsync_info, sizeof(highsync_info_t));
KeInitializeEvent(&highsync_info->highsync_complete_event, SynchronizationEvent, FALSE);
highsync_info->function0 = function0;
highsync_info->functionN = functionN;
highsync_info->context = context;
highsync_info->sync_level = HIGH_LEVEL;
#if (NTDDI_VERSION >= NTDDI_WINXP)
ActiveProcessorCount = (ULONG)KeNumberProcessors;
#else
ActiveProcessorCount = (ULONG)*KeNumberProcessors;
#endif
/* Go to HIGH_LEVEL to prevent any races with Dpc's on the current processor */
KeRaiseIrql(highsync_info->sync_level, &old_irql);
highsync_info->do_spin = TRUE;
for (i = 0; i < ActiveProcessorCount; i++)
{
if (i == 0)
KeInitializeDpc(&highsync_info->dpcs[i], XenPci_HighSyncCallFunction0, highsync_info);
else
KeInitializeDpc(&highsync_info->dpcs[i], XenPci_HighSyncCallFunctionN, highsync_info);
KeSetTargetProcessorDpc(&highsync_info->dpcs[i], (CCHAR)i);
KeSetImportanceDpc(&highsync_info->dpcs[i], HighImportance);
KdPrint((__DRIVER_NAME " queuing Dpc for CPU %d\n", i));
KeInsertQueueDpc(&highsync_info->dpcs[i], NULL, NULL);
}
KdPrint((__DRIVER_NAME " All Dpc's queued\n"));
KeMemoryBarrier();
KeLowerIrql(old_irql);
KdPrint((__DRIVER_NAME " Waiting for highsync_complete_event\n"));
KeWaitForSingleObject(&highsync_info->highsync_complete_event, Executive, KernelMode, FALSE, NULL);
#if (NTDDI_VERSION >= NTDDI_WINXP)
KeFlushQueuedDpcs();
#else
{
/* just wait 1 second until all DPC's finish - not ideal but it's only for W2K */
LARGE_INTEGER interval;
interval.QuadPart = -1 * 1000 * 1000 * 10; /* 1 second */
KeDelayExecutionThread(KernelMode, FALSE, &interval);
}
#endif
ExFreePoolWithTag(highsync_info, XENPCI_POOL_TAG);
FUNCTION_EXIT();
}
示例2: AllocTimeouts
VOID AllocTimeouts(PC0C_IO_PORT pIoPort)
{
KeInitializeTimer(&pIoPort->timerReadTotal);
KeInitializeTimer(&pIoPort->timerReadInterval);
KeInitializeTimer(&pIoPort->timerWriteTotal);
KeInitializeTimer(&pIoPort->timerClose);
KeInitializeDpc(&pIoPort->timerReadTotalDpc, TimeoutReadTotal, pIoPort);
KeInitializeDpc(&pIoPort->timerReadIntervalDpc, TimeoutReadInterval, pIoPort);
KeInitializeDpc(&pIoPort->timerWriteTotalDpc, TimeoutWriteTotal, pIoPort);
KeInitializeDpc(&pIoPort->timerCloseDpc, TimeoutClose, pIoPort);
}
示例3: LlcInitializeTimerSystem
VOID
LlcInitializeTimerSystem(
VOID
)
/*++
Routine Description:
This routine initializes the lightweight timer system for the
data link driver.
Arguments:
None.
Return Value:
None.
--*/
{
ASSUME_IRQL(PASSIVE_LEVEL);
KeInitializeDpc(&TimerSystemDpc, ScanTimersDpc, NULL);
KeInitializeTimer(&SystemTimer);
KeSetTimer(&SystemTimer, DueTime, &TimerSystemDpc);
}
示例4: NotifierInitialize
NTSTATUS
NotifierInitialize(
IN PXENVIF_FRONTEND Frontend,
OUT PXENVIF_NOTIFIER *Notifier
)
{
NTSTATUS status;
*Notifier = __NotifierAllocate(sizeof (XENVIF_NOTIFIER));
status = STATUS_NO_MEMORY;
if (*Notifier == NULL)
goto fail1;
(*Notifier)->Frontend = Frontend;
KeInitializeSpinLock(&(*Notifier)->Lock);
KeInitializeDpc(&(*Notifier)->Dpc,
NotifierDpc,
*Notifier);
return STATUS_SUCCESS;
fail1:
Error("fail1 (%08x)\n", status);
return status;
}
示例5: PM_registerHeartBeatCallback
/****************************************************************************
REMARKS:
Function to register a driver heart beat callback function. The first
function that is called sets the interval for all the callback functions
and they will be called in the order they were registered. This function
will implement this mechanism in whatever way is appropriate for the
device driver environment.
Note that currently there is no mechanism to specify the timer intervals at
run-time, so we use a pre-determined value of 32 milliseconds that will be
useful for NT display driver polling and DPVL update functions.
****************************************************************************/
void PMAPI PM_registerHeartBeatCallback(
PM_heartBeat_cb cb,
void *data)
{
// Kernel objects must always be resident in memory
if (_PM_hb == NULL) {
_PM_hb = ExAllocatePool(NonPagedPool, sizeof(_PM_heartBeat_t));
if (_PM_hb == NULL)
return;
RtlZeroMemory(_PM_hb, sizeof(_PM_heartBeat_t));
}
// If first time called, start periodic timer (pre-determined intervals)
if (_PM_hb->numHeartBeatCallbacks == 0) {
KeInitializeTimer(&_PM_hb->kTimer);
KeInitializeDpc(&_PM_hb->kTimerDpc,_PM_heartBeatTimeout,(void*)_PM_hb);
KeSetTimerEx(&_PM_hb->kTimer,RtlConvertLongToLargeInteger(-10000*HEART_BEAT_MS),
HEART_BEAT_MS,&_PM_hb->kTimerDpc);
KeInitializeEvent(&_PM_hb->kTimerEvent,NotificationEvent,FALSE);
// Callbacks will be executed within driver helper thread, not DPC
_PM_hb->bThreadRunning = true;
PsCreateSystemThread(&_PM_hb->hDriverThread,THREAD_ALL_ACCESS,NULL,
NULL,NULL,_PM_heartBeatThread,(void*)_PM_hb);
}
// Add heart beat callback to list
PM_lockSNAPAccess(-1,true);
if (_PM_hb->numHeartBeatCallbacks < MAX_HEART_BEAT_CALLBACKS) {
_PM_hb->heartBeat[_PM_hb->numHeartBeatCallbacks] = cb;
_PM_hb->heartBeatData[_PM_hb->numHeartBeatCallbacks] = data;
_PM_hb->numHeartBeatCallbacks++;
}
PM_unlockSNAPAccess(-1);
}
示例6: CmpInitializeDelayedCloseTable
VOID
CmpInitializeDelayedCloseTable()
/*++
Routine Description:
Initialize delayed close table; allocation + LRU list initialization.
Arguments:
Return Value:
NONE.
--*/
{
ExInitializeWorkItem(&CmpDelayCloseWorkItem, CmpDelayCloseWorker, NULL);
KeInitializeGuardedMutex(&CmpDelayedCloseTableLock);
InitializeListHead(&(CmpDelayedLRUListHead));
KeInitializeDpc(&CmpDelayCloseDpc,
CmpDelayCloseDpcRoutine,
NULL);
KeInitializeTimer(&CmpDelayCloseTimer);
}
示例7: 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;
}
示例8: init_redirection
void
init_redirection(struct scsifilt *sf)
{
InitializeListHead(&sf->redirect_srb_list);
InitializeListHead(&sf->redirect_complete_list);
KeInitializeDpc(&sf->redirect_srb_dpc, redirect_srb_dpc, sf);
}
示例9: InitializeEventing
NTSTATUS InitializeEventing(CEncoderDevice* pEncDevice)
{
// First, allocate buffers
NTSTATUS ntStatus = STATUS_SUCCESS;
if(!EventHandler)
{
EventHandler = (PEventHandlerData)ExAllocatePoolWithTag(NonPagedPool,
sizeof(EventHandlerData), MS_SAMPLE_ANALOG_POOL_TAG);
if (!EventHandler) {
ntStatus = STATUS_UNSUCCESSFUL;
return ntStatus;
}
pEncDevice->EventData = reinterpret_cast<PVOID>(EventHandler);
KeInitializeEvent(&(EventHandler->InitEvent),
SynchronizationEvent,
FALSE);
KeInitializeEvent(&(EventHandler->TuneEvent),
SynchronizationEvent,
FALSE);
KeInitializeEvent(&(EventHandler->ThreadEvent),
SynchronizationEvent,
FALSE);
KeInitializeSpinLock(&(EventHandler->LockAccess));
KeInitializeDpc (&(EventHandler->DPCObject), reinterpret_cast <PKDEFERRED_ROUTINE>(TimerDpcInterrupt), EventHandler);
KeInitializeTimerEx(&(EventHandler->timer), SynchronizationTimer);
}
KeClearEvent(&(EventHandler->InitEvent));
KeClearEvent(&(EventHandler->TuneEvent));
KeClearEvent(&(EventHandler->ThreadEvent));
return ntStatus;
}
示例10: dtrace_hook_int
void dtrace_hook_int(UCHAR ivec, void (*InterruptHandler)( void ), uintptr_t *paddr)
{
INT_VECTOR OrgVec;
int i;
PRKDPC Dpc;
cpunos = 0;
if (paddr != 0) {
BackupInterrupt(ivec, &OrgVec);
#ifdef _AMD64_
*(ULONG64 *)paddr = VEC_OFFSET_TO_ADDR(OrgVec);
#else
*(ULONG32 *)paddr = VEC_OFFSET_TO_ADDR(OrgVec);
#endif
}
Dpc = (PRKDPC) ExAllocatePoolWithTag(NonPagedPool, sizeof(KDPC)*KeNumberProcessors, 'Tag1');
for (i = 0; i < KeNumberProcessors; i++) {
KeInitializeDpc(&Dpc[i], hook_init, NULL);
}
KeInitializeEvent(&SyncIDT, NotificationEvent, FALSE);
for (i=0; i < KeNumberProcessors; i++) {
KeSetTargetProcessorDpc(&Dpc[i], (char) i);
KeSetImportanceDpc(&Dpc[i], HighImportance);
KeInsertQueueDpc(&Dpc[i], (PVOID) ivec, (PVOID)InterruptHandler);
}
KeWaitForSingleObject(&SyncIDT,Executive,KernelMode,0,NULL);
KeClearEvent(&SyncIDT);
ExFreePoolWithTag(Dpc, 'Tag1');
}
示例11: SendEachProcessorDpc
VOID
SendEachProcessorDpc (
PKDEFERRED_ROUTINE Routine,
PVOID Context,
PVOID SysArg1,
PVOID SysArg2
)
/*++
Routine Description
This routine sends DPC to each processor in multiprocessor system
Arguments
Routine
Deferred routine
Context, SysArg1, SysArg2
Parameters, see MSDN doc for KeInitializeDpc, KeInsertQueueDpc
Return Value
None
--*/
{
UNICODE_STRING u;
RtlInitUnicodeString (&u, L"KeFlushQueuedDpcs");
*(PVOID*)&pKeFlushQueuedDpcs = MmGetSystemRoutineAddress (&u);
for (CCHAR i=0; i<KeNumberProcessors; i++)
{
KDPC Dpc;
KdPrint(("SendEachProcessorDpc: processor [%d] in queue\n", i));
KeInitializeDpc (&Dpc, Routine, Context);
KeSetTargetProcessorDpc (&Dpc, i);
KeInsertQueueDpc (&Dpc, SysArg1, SysArg2);
KdPrint(("SendEachProcessorDpc: processor [%d] completed its DPC\n", i));
}
if (pKeFlushQueuedDpcs)
{
// Ensure that all DPCs are delivered.
pKeFlushQueuedDpcs ();
}
else
{
KdPrint(("pKeFlushQueuedDpcs = NULL!!!\n"));
}
KdPrint(("SendEachProcessorDpc: all completed\n"));
}
示例12: KiInitializeInterruptTimers
VOID
KiInitializeInterruptTimers(
VOID
)
{
LARGE_INTEGER DueTime;
//
// If not timing ISRs, nothing to do.
//
if (KiTimeLimitIsrMicroseconds == 0) {
return;
}
//
// The kernel is initialized. Use a timer to determine the amount
// the Time Stamp Counter advances by in 10 seconds, then use that
// result to set the ISR time limit.
//
if ((KeFeatureBits & KF_RDTSC) == 0) {
//
// Processor doesn't support the RDTSC instruction, don't attempt
// to time ISRs.
//
return;
}
KiIsrTimerInit = ExAllocatePoolWithTag(NonPagedPool,
sizeof(*KiIsrTimerInit),
' eK');
if (KiIsrTimerInit == NULL) {
//
// Couldn't allocate memory for timer? Skip ISR timing.
//
return;
}
KeInitializeTimerEx(&KiIsrTimerInit->SampleTimer, SynchronizationTimer);
KeInitializeDpc(&KiIsrTimerInit->Dpc, &KiInitializeInterruptTimersDpc, NULL);
//
// Relative time in 100 nanoseconds = 10 seconds.
//
DueTime.QuadPart = -(10 * 10 * 1000 * 1000);
KeSetTimerEx(&KiIsrTimerInit->SampleTimer,
DueTime, //
10000, // repeat in 10 seconds.
&KiIsrTimerInit->Dpc);
}
示例13: MPCreateThread
VOID MPCreateThread(VOID (*FunctionPointer)(IN PKDPC, IN PVOID, IN PVOID, IN PVOID))
{
/*
*
* Multi-Processor Consideration ::
*
* Each processor has it's own IDT.
*
*/
CCHAR i;
long currentProcessor =0;
PKDPC pkDpc =NULL;
KIRQL oldIrql, currentIrql;
allProcessorDone =0;
currentIrql = KeGetCurrentIrql();
if (currentIrql < DISPATCH_LEVEL)
KeRaiseIrql(DISPATCH_LEVEL, &oldIrql);
InterlockedAnd(&allProcessorDone, 0);
pkDpc = (PKDPC)ExAllocatePoolWithTag(NonPagedPool, KeNumberProcessors * sizeof(KDPC), (ULONG)' pni');
if (!pkDpc)
{
DbgPrint("Insufficient Resource error\n");
return;
}
currentProcessor = KeGetCurrentProcessorNumber();
for (i = 0; i < KeNumberProcessors; i++)
{
cpuNum[i] =i;
KeInitializeDpc(&pkDpc[i],
FunctionPointer,
&cpuNum[i]);
KeSetTargetProcessorDpc(&pkDpc[i], i);
KeInsertQueueDpc(&pkDpc[i], NULL, NULL);
}
// wait for all of the processor's hooking initialization.
while(InterlockedCompareExchange(&allProcessorDone, KeNumberProcessors - 1, KeNumberProcessors - 1) != KeNumberProcessors - 1)
{
_asm pause;
}
if (currentIrql < DISPATCH_LEVEL)
KeLowerIrql(oldIrql);
if (pkDpc)
{
ExFreePool(pkDpc);
pkDpc = NULL;
}
}
示例14: KrnlHlprDPCQueue
NTSTATUS KrnlHlprDPCQueue(_In_ KDEFERRED_ROUTINE* pDPCFn,
_In_ CLASSIFY_DATA* pClassifyData,
_In_ REDIRECT_DATA* pRedirectData,
_In_opt_ VOID* pContext) /* 0 */
{
#if DBG
DbgPrintEx(DPFLTR_IHVNETWORK_ID,
DPFLTR_INFO_LEVEL,
" ---> KrnlHlprDPCQueue()\n");
#endif /// DBG
NT_ASSERT(pDPCFn);
NT_ASSERT(pClassifyData);
NT_ASSERT(pRedirectData);
NTSTATUS status = STATUS_SUCCESS;
DPC_DATA* pDPCData = 0;
status = KrnlHlprDPCDataCreate(&pDPCData,
pClassifyData,
pRedirectData,
pContext);
HLPR_BAIL_ON_FAILURE(status);
KeInitializeDpc(&(pDPCData->kdpc),
pDPCFn,
0);
KeInsertQueueDpc(&(pDPCData->kdpc),
pDPCData,
0);
HLPR_BAIL_LABEL:
#pragma warning(push)
#pragma warning(disable: 6001) /// pDPCData initialized with call to KrnlHlprDPCDataCreate
if(status != STATUS_SUCCESS &&
pDPCData)
KrnlHlprDPCDataDestroy(&pDPCData);
#pragma warning(pop)
#if DBG
DbgPrintEx(DPFLTR_IHVNETWORK_ID,
DPFLTR_INFO_LEVEL,
" <--- KrnlHlprDPCQueue() [status: %#x]\n",
status);
#endif /// DBG
return status;
}
示例15: natInitFwSession
VOID natInitFwSession()
{
LARGE_INTEGER DueTime;
KeInitializeTimer(&g_FwSessionTimer);
KeInitializeDpc(&g_FwSessionDpc, natFwSessionTimerFunction, NULL);
InitializeListHead(&g_FwSessionList);
NdisAllocateSpinLock(&g_FwSessionLock);
DueTime.QuadPart = -1;
KeSetTimerEx(&g_FwSessionTimer, DueTime, INIT_SESSION_TIMEOUT_SEC*1000 ,&g_FwSessionDpc);
}