当前位置: 首页>>代码示例>>C++>>正文


C++ KeSetEvent函数代码示例

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


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

示例1: cp_parallelized_crypt

void cp_parallelized_crypt(
	   int   is_encrypt, xts_key *key, fc_callback on_complete, 
	   void *param, const unsigned char *in, unsigned char *out, u32 len, u64 offset)
{
	req_item *item;
	req_part *part;
	u32       part_sz;
	u32       part_of;

	if ( (len < F_OP_THRESOLD) ||
		 ((item = ExAllocateFromNPagedLookasideList(&pool_req_mem)) == NULL) )
	{
		if (is_encrypt != 0) {
			xts_encrypt(in, out, len, offset, key);
		} else {
			xts_decrypt(in, out, len, offset, key);
		}
		on_complete(param); return;
	}
	item->is_encrypt = is_encrypt;
	item->length = len;
	item->in  = in;
	item->out = out;
	item->offset      = offset;
	item->on_complete = on_complete;
	item->param = param;
	item->key   = key;

	part_sz = _align(len / dc_cpu_count, F_MIN_REQ);
	part_of = 0; part = &item->parts[0];
	do
	{
		part_sz      = min(part_sz, len);
		part->item   = item;
		part->offset = part_of;
		part->length = part_sz;

		InterlockedPushEntrySList(&pool_head, &part->entry);

		part_of += part_sz; len -= part_sz; part++;
	} while (len != 0);

	KeSetEvent(&pool_signal_event, IO_NO_INCREMENT, FALSE);
}
开发者ID:capturePointer,项目名称:diskcryptor,代码行数:44,代码来源:fast_crypt.c

示例2: ExQueueWorkItem

/*++
 * @name ExQueueWorkItem
 * @implemented NT4
 *
 *     The ExQueueWorkItem routine acquires rundown protection for
 *     the specified descriptor.
 *
 * @param WorkItem
 *        Pointer to an initialized Work Queue Item structure. This structure
 *        must be located in nonpaged pool memory.
 *
 * @param QueueType
 *        Type of the queue to use for this item. Can be one of the following:
 *          - DelayedWorkQueue
 *          - CriticalWorkQueue
 *          - HyperCriticalWorkQueue
 *
 * @return None.
 *
 * @remarks This routine is obsolete. Use IoQueueWorkItem instead.
 *
 *          Callers of this routine must be running at IRQL <= DISPATCH_LEVEL.
 *
 *--*/
VOID
NTAPI
ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem,
                IN WORK_QUEUE_TYPE QueueType)
{
    PEX_WORK_QUEUE WorkQueue = &ExWorkerQueue[QueueType];
    ASSERT(QueueType < MaximumWorkQueue);
    ASSERT(WorkItem->List.Flink == NULL);

    /* Don't try to trick us */
    if ((ULONG_PTR)WorkItem->WorkerRoutine < MmUserProbeAddress)
    {
        /* Bugcheck the system */
        KeBugCheckEx(WORKER_INVALID,
                     1,
                     (ULONG_PTR)WorkItem,
                     (ULONG_PTR)WorkItem->WorkerRoutine,
                     0);
    }

    /* Insert the Queue */
    KeInsertQueue(&WorkQueue->WorkerQueue, &WorkItem->List);
    ASSERT(!WorkQueue->Info.QueueDisabled);

    /*
     * Check if we need a new thread. Our decision is as follows:
     *  - This queue type must support Dynamic Threads (duh!)
     *  - It actually has to have unprocessed items
     *  - We have CPUs which could be handling another thread
     *  - We haven't abused our usage of dynamic threads.
     */
    if ((WorkQueue->Info.MakeThreadsAsNecessary) &&
        (!IsListEmpty(&WorkQueue->WorkerQueue.EntryListHead)) &&
        (WorkQueue->WorkerQueue.CurrentCount <
         WorkQueue->WorkerQueue.MaximumCount) &&
        (WorkQueue->DynamicThreadCount < 16))
    {
        /* Let the balance manager know about it */
        DPRINT1("Requesting a new thread. CurrentCount: %lu. MaxCount: %lu\n",
                WorkQueue->WorkerQueue.CurrentCount,
                WorkQueue->WorkerQueue.MaximumCount);
        KeSetEvent(&ExpThreadSetManagerEvent, 0, FALSE);
    }
}
开发者ID:GYGit,项目名称:reactos,代码行数:68,代码来源:work.c

示例3: FileDiskDeleteDevice

//保证每一次操作完成。
PDEVICE_OBJECT
FileDiskDeleteDevice (
    IN PDEVICE_OBJECT DeviceObject
    )
{
    PDEVICE_EXTENSION   device_extension;
    PDEVICE_OBJECT      next_device_object;

    PAGED_CODE();

    ASSERT(DeviceObject != NULL);

    device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;

    device_extension->terminate_thread = TRUE;

    KeSetEvent(
        &device_extension->request_event,
        (KPRIORITY) 0,
        FALSE
        );

    KeWaitForSingleObject(
        device_extension->thread_pointer,
        Executive,
        KernelMode,
        FALSE,
        NULL
        );

    ObDereferenceObject(device_extension->thread_pointer);

    if (device_extension->security_client_context != NULL)
    {
        SeDeleteClientSecurity(device_extension->security_client_context);
        ExFreePool(device_extension->security_client_context);
    }

    next_device_object = DeviceObject->NextDevice;

    IoDeleteDevice(DeviceObject);

    return next_device_object;
}
开发者ID:ren22342411,项目名称:seewhatIwrite,代码行数:45,代码来源:filedisk.c

示例4: FileDiskCleanupLogicalUnit

VOID
FileDiskCleanupLogicalUnit(
    __in PNDAS_LOGICALUNIT_EXTENSION LogicalUnitExtension)
{
    PFILEDISK_EXTENSION fileDiskExtension;

    PAGED_CODE();

    fileDiskExtension = FileDiskGetExtension(LogicalUnitExtension);

    ASSERT(NULL != fileDiskExtension);

    ASSERT(NULL == fileDiskExtension->CurrentSrb);

    fileDiskExtension->ThreadShouldStop = TRUE;

    KeSetEvent(
        &fileDiskExtension->ThreadNotificationEvent,
        IO_NO_INCREMENT,
        FALSE);

    KeWaitForSingleObject(
        &fileDiskExtension->ThreadCompleteEvent,
        Executive,
        KernelMode,
        FALSE,
        NULL);

    ObDereferenceObject(fileDiskExtension->ThreadObject);
    ZwClose(fileDiskExtension->ThreadHandle);

    fileDiskExtension->ThreadObject = NULL;
    fileDiskExtension->ThreadHandle = NULL;

    FileDiskCloseDataFile(fileDiskExtension);

    ExFreePoolWithTag(
        fileDiskExtension->FilePath.Buffer,
        FILEDISK_EXT_TAG);

    fileDiskExtension->FilePath.Buffer = NULL;
    fileDiskExtension->FilePath.Length = 0;
    fileDiskExtension->FilePath.MaximumLength = 0;
}
开发者ID:yzx65,项目名称:ndas4windows,代码行数:44,代码来源:filedisk.c

示例5: V2vkListenerProcessInternalSyncTx

static NTSTATUS
V2vkListenerProcessInternalSyncTx(V2VK_LISTENER_CONTEXT *vlc)
{
    NTSTATUS status;
    unsigned available;
    volatile UCHAR *msg;
    V2V_LISTENER_RESP_ITEM *vlri;

    DbgPrint("%s listener(%p) sending internal response #%d\n", V2VDRV_LOGTAG, vlc, vlc->txCounter + 1);
    available = v2v_nc2_producer_bytes_available(vlc->channel);
    DbgPrint("%s listener(%p) channel indicates minimum bytes available: 0x%x\n", V2VDRV_LOGTAG, vlc, available);
    ASSERT(vlc->u.xferInternal.respList);

    /* No resizing fixed responses for fastrx */

    status = v2v_nc2_prep_message(vlc->channel, sizeof(V2V_RESP_INTERNAL), V2V_MESSAGE_TYPE_INTERNAL, 0, &msg);
    if (!NT_SUCCESS(status)) {
        if (status == STATUS_RETRY) {
            /* No room right now, return and try again later */
            DbgPrint("%s listener(%p) not enough buffer space to send response #%d; retry\n",
                     V2VDRV_LOGTAG, vlc, vlc->txCounter + 1);
            return STATUS_RETRY;
        }
        DbgPrint("%s listener(%p) transmit internal response failure; abort processing - error: 0x%x\n",
                 V2VDRV_LOGTAG, vlc, status);
        return status; /* failure */
    }
    vlc->txCounter++; /* next message */
    vlri = vlc->u.xferInternal.respList;
    vlc->u.xferInternal.respList = vlri->next;
    if (!vlc->u.xferInternal.respList)
        vlc->u.xferInternal.respTail = NULL;
    /* Response already formed, just copy it in */
    RtlCopyMemory((void*)msg, vlri, sizeof(V2V_RESP_INTERNAL));
    ExFreePoolWithTag(vlri, V2VDRV_TAG);

    v2v_nc2_send_messages(vlc->channel);

    /* Keep the send loop going by setting the event. If there is no more room, the prep message call
       will return ERROR_RETRY and just land us back in the wait. */
    KeSetEvent(v2v_get_send_event(vlc->channel), IO_NO_INCREMENT, FALSE);

    return STATUS_SUCCESS;
}
开发者ID:barryrandall,项目名称:xc-windows,代码行数:44,代码来源:v2vsync.c

示例6: ChewWorkItem

VOID NTAPI ChewWorkItem(PDEVICE_OBJECT DeviceObject, PVOID ChewItem)
{
    PWORK_ITEM WorkItem = ChewItem;
    KIRQL OldIrql;

    WorkItem->Worker(WorkItem->WorkerContext);

    IoFreeWorkItem(WorkItem->WorkItem);

    KeAcquireSpinLock(&WorkQueueLock, &OldIrql);
    RemoveEntryList(&WorkItem->Entry);

    if (IsListEmpty(&WorkQueue))
        KeSetEvent(&WorkQueueClear, 0, FALSE);

    KeReleaseSpinLock(&WorkQueueLock, OldIrql);

    ExFreePoolWithTag(WorkItem, CHEW_TAG);
}
开发者ID:hoangduit,项目名称:reactos,代码行数:19,代码来源:workqueue.c

示例7: NeoSet

// Set the event
void NeoSet(NEO_EVENT *event)
{
	// Validate arguments
	if (event == NULL)
	{
		return;
	}

#ifndef	WIN9X
	KeSetEvent(event->event, 0, FALSE);
#else	// WIN9X
	if (event->win32_event != 0)
	{
		DWORD h = event->win32_event;
		_asm mov eax, h;
		VxDCall(_VWIN32_SetWin32Event);
	}
#endif	// WIN9X
}
开发者ID:RexSi,项目名称:SoftEtherVPN,代码行数:20,代码来源:NDIS5.c

示例8: DF_DispatchReadWrite

NTSTATUS
DF_DispatchReadWrite(PDEVICE_OBJECT DeviceObject, PIRP Irp)
{
	PDF_DEVICE_EXTENSION DevExt;

	DevExt = (PDF_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
	if (DevExt->bIsProtected == TRUE)
	{
		IoMarkIrpPending(Irp);
		// Queue this IRP
		ExInterlockedInsertTailList(&DevExt->RwList,
			&Irp->Tail.Overlay.ListEntry, &DevExt->RwListSpinLock);
		// Set Event
		KeSetEvent(&DevExt->RwThreadStartEvent, IO_NO_INCREMENT, FALSE);
		return STATUS_PENDING;
	}
	IoSkipCurrentIrpStackLocation(Irp);
	return IoCallDriver(DevExt->LowerDeviceObject, Irp);
}
开发者ID:maodapeng,项目名称:WDUtils,代码行数:19,代码来源:Dispatch.c

示例9: RTDECL

RTDECL(int)  RTSemEventDestroy(RTSEMEVENT hEventSem)
{
    /*
     * Validate input.
     */
    PRTSEMEVENTINTERNAL pThis = hEventSem;
    if (pThis == NIL_RTSEMEVENT)
        return VINF_SUCCESS;
    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    AssertMsgReturn(pThis->u32Magic == RTSEMEVENT_MAGIC, ("pThis->u32Magic=%RX32 pThis=%p\n", pThis->u32Magic, pThis), VERR_INVALID_HANDLE);

    /*
     * Invalidate it and signal the object just in case.
     */
    ASMAtomicIncU32(&pThis->u32Magic);
    KeSetEvent(&pThis->Event, 0xfff, FALSE);
    rtR0SemEventNtRelease(pThis);
    return VINF_SUCCESS;
}
开发者ID:leopucci,项目名称:VirtualMonitor,代码行数:19,代码来源:semevent-r0drv-nt.cpp

示例10: DokanStopEventNotificationThreadInternal

VOID DokanStopEventNotificationThreadInternal(__in PDEVICE_OBJECT DeviceObject,
                                              __in PVOID Context) {
  PDokanDCB Dcb;

  UNREFERENCED_PARAMETER(Context);

  DDbgPrint("==> DokanStopEventNotificationThreadInternal\n");

  Dcb = DeviceObject->DeviceExtension;
  if (KeSetEvent(&Dcb->ReleaseEvent, 0, FALSE) > 0 &&
      Dcb->EventNotificationThread) {
    KeWaitForSingleObject(Dcb->EventNotificationThread, Executive, KernelMode,
                          FALSE, NULL);
    ObDereferenceObject(Dcb->EventNotificationThread);
    Dcb->EventNotificationThread = NULL;
  }

  DDbgPrint("<== DokanStopEventNotificationThreadInternal\n");
}
开发者ID:shinyhaskett,项目名称:dokany,代码行数:19,代码来源:notification.c

示例11: NPF_UnbindAdapter

VOID
NPF_UnbindAdapter(
    OUT PNDIS_STATUS        Status,
    IN  NDIS_HANDLE         ProtocolBindingContext,
    IN  NDIS_HANDLE         UnbindContext
    )
{
    POPEN_INSTANCE   Open =(POPEN_INSTANCE)ProtocolBindingContext;

	TRACE_ENTER();

	ASSERT(Open != NULL);

	//
	// The following code has been disabled bcause the kernel dump feature has been disabled.
	//
	////
	//// Awake a possible pending read on this instance
	//// TODO should be ok.
	////
 //	if(Open->mode & MODE_DUMP)
 //		NdisSetEvent(&Open->DumpEvent);
 //	else
	if (Open->ReadEvent != NULL)
		KeSetEvent(Open->ReadEvent,0,FALSE);

	//
	// The following code has been disabled bcause the kernel dump feature has been disabled.
	//
	////
	//// If this instance is in dump mode, complete the dump and close the file
	//// TODO needs to be checked again.
	////
 //	if((Open->mode & MODE_DUMP) && Open->DumpFileHandle != NULL)
 //		NPF_CloseDumpFile(Open);

	*Status = NDIS_STATUS_SUCCESS;

	NPF_CloseBinding(Open);

	TRACE_EXIT();
	return;
}
开发者ID:52M,项目名称:npcap,代码行数:43,代码来源:Openclos.c

示例12: IopRemovePlugPlayEvent

/*
 * Remove the current PnP event from the tail of the event queue
 * and signal IopPnpNotifyEvent if there is yet another event in the queue.
 */
static NTSTATUS
IopRemovePlugPlayEvent(VOID)
{
    /* Remove a pnp event entry from the tail of the queue */
    if (!IsListEmpty(&IopPnpEventQueueHead))
    {
        ExFreePool(CONTAINING_RECORD(RemoveTailList(&IopPnpEventQueueHead), PNP_EVENT_ENTRY, ListEntry));
    }

    /* Signal the next pnp event in the queue */
    if (!IsListEmpty(&IopPnpEventQueueHead))
    {
        KeSetEvent(&IopPnpNotifyEvent,
                   0,
                   FALSE);
    }

    return STATUS_SUCCESS;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:23,代码来源:plugplay.c

示例13: ReadonlyDismountVolumeThreadProc

VOID
ReadonlyDismountVolumeThreadProc (
	IN	PREADONLY	Readonly
	)
{
	SPY_LOG_PRINT( LFS_DEBUG_READONLY_TRACE, ("ReadonlyDismountVolumeThreadProc: Start Readonly = %p\n", Readonly) );
				
	Readonly_Reference( Readonly );

	KeSetEvent( &Readonly->DiskmountReadyEvent, IO_DISK_INCREMENT, FALSE );

	ReadonlyDismountVolume( Readonly->LfsDeviceExt );

	Readonly->DismountThreadHandle = NULL;

	Readonly_Dereference( Readonly );

	PsTerminateSystemThread( STATUS_SUCCESS );
}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:19,代码来源:readonly.c

示例14: FilterStartCompletionRoutine

NTSTATUS
FilterStartCompletionRoutine(
    PDEVICE_OBJECT   DeviceObject,
    PIRP             Irp,
    PVOID            Context
    )
/*++
Routine Description:
    A completion routine for use when calling the lower device objects to
    which our filter deviceobject is attached.

Arguments:

    DeviceObject - Pointer to deviceobject
    Irp          - Pointer to a PnP Irp.
    Context      - NULL
Return Value:

    NT Status is returned.

--*/

{
    PKEVENT             event = (PKEVENT)Context;

    UNREFERENCED_PARAMETER (DeviceObject);

    //
    // If the lower driver didn't return STATUS_PENDING, we don't need to 
    // set the event because we won't be waiting on it. 
    // This optimization avoids grabbing the dispatcher lock, and improves perf.
    //
    if (Irp->PendingReturned == TRUE) {
        KeSetEvent (event, IO_NO_INCREMENT, FALSE);
    }

    //
    // The dispatch routine will have to call IoCompleteRequest
    //

    return STATUS_MORE_PROCESSING_REQUIRED;

}
开发者ID:kcrazy,项目名称:winekit,代码行数:43,代码来源:filter.c

示例15: ReleasePoolBuffer

static void ReleasePoolBuffer (EncryptedIoQueue *queue, void *address)
{
	EncryptedIoQueueBuffer *buffer;
	AcquireBufferPoolMutex (queue);
	
	for (buffer = queue->FirstPoolBuffer; buffer != NULL; buffer = buffer->NextBuffer)
	{
		if (buffer->Address == address)
		{
			ASSERT (buffer->InUse);

			buffer->InUse = FALSE;
			break;
		}
	}

	ReleaseBufferPoolMutex (queue);
	KeSetEvent (&queue->PoolBufferFreeEvent, IO_DISK_INCREMENT, FALSE);
}
开发者ID:BitMerc,项目名称:veracrypt,代码行数:19,代码来源:EncryptedIoQueue.c


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