本文整理汇总了C++中ExInterlockedInsertTailList函数的典型用法代码示例。如果您正苦于以下问题:C++ ExInterlockedInsertTailList函数的具体用法?C++ ExInterlockedInsertTailList怎么用?C++ ExInterlockedInsertTailList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ExInterlockedInsertTailList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ChewCreate
BOOLEAN ChewCreate(VOID (*Worker)(PVOID), PVOID WorkerContext)
{
PWORK_ITEM Item;
Item = ExAllocatePoolWithTag(NonPagedPool,
sizeof(WORK_ITEM),
CHEW_TAG);
if (Item)
{
Item->WorkItem = IoAllocateWorkItem(WorkQueueDevice);
if (!Item->WorkItem)
{
ExFreePool(Item);
return FALSE;
}
Item->Worker = Worker;
Item->WorkerContext = WorkerContext;
ExInterlockedInsertTailList(&WorkQueue, &Item->Entry, &WorkQueueLock);
KeResetEvent(&WorkQueueClear);
IoQueueWorkItem(Item->WorkItem, ChewWorkItem, DelayedWorkQueue, Item);
return TRUE;
}
else
{
return FALSE;
}
}
示例2: PushEvent
VOID PushEvent(IN PEVENTDATA pEvtData)
/*++
Routine Description:
“违规事件”压栈
Arguments:
pEvtData - 指定“违规事件”
Return Value:
None.
Author:
Fypher
--*/
{
PAGED_CODE();
ExInterlockedInsertTailList(&g_EventDataLinkListHead, &pEvtData->ListEntry, &g_EventDataLock);
InterlockedIncrement(&g_ulEventDataCount);
KeReleaseSemaphore(&g_EventDataSemaphore, 0, 1, FALSE);
}
示例3: NdisCompleteBindAdapter
/*
* @implemented
*/
VOID
EXPORT
NdisCompleteBindAdapter(
IN NDIS_HANDLE BindAdapterContext,
IN NDIS_STATUS Status,
IN NDIS_STATUS OpenStatus)
/*
* FUNCTION: Indicates a packet to bound protocols
* ARGUMENTS:
* Adapter = Pointer to logical adapter
* Packet = Pointer to packet to indicate
* RETURNS:
* Status of operation
* NOTES:
* - FIXME: partially-implemented
*/
{
PROTOCOL_BINDING *Protocol = (PROTOCOL_BINDING *)BindAdapterContext;
if (!NT_SUCCESS(Status)) {
NDIS_DbgPrint(MIN_TRACE, ("Binding failed (%x)\n", Status));
return;
}
/* Put protocol binding struct on global list */
ExInterlockedInsertTailList(&ProtocolListHead, &Protocol->ListEntry, &ProtocolListLock);
}
示例4: TestList
void TestList()
{
LIST_ENTRY tHead;
InitializeListHead(&tHead);
MyListNode* pData;
ULONG i=0;
KSPIN_LOCK tLock;
KeInitializeSpinLock(&tLock);
KdPrint(("begin insert data to list \n"));
for(i=0; i<10; i++)
{
KdPrint(("insert one %d\n",i));
pData = (MyListNode*)ExAllocatePool(PagedPool,sizeof(MyListNode));
pData->data = i;
ExInterlockedInsertTailList(&tHead,&pData->ListEntry,&tLock);
}
KdPrint(("begin remove from link and print"));
while(!IsListEmpty(&tHead))
{
MyListNode* pCurNode = (MyListNode*)ExInterlockedRemoveHeadList(&tHead,&tLock);
KdPrint(("%d ",pCurNode->data));
ExFreePool(pCurNode);
}
}
示例5: DraidCreateListenContext
PDRAID_LISTEN_CONTEXT
DraidCreateListenContext(
PDRAID_GLOBALS DraidGlobals,
PLPX_ADDRESS Addr
) {
KIRQL oldIrql;
BOOLEAN AlreadyExist;
PLIST_ENTRY listEntry;
PDRAID_LISTEN_CONTEXT ListenContext;
//
// Check address is already in the listen context list
//
ACQUIRE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, &oldIrql);
AlreadyExist = FALSE;
for (listEntry = DraidGlobals->ListenContextList.Flink;
listEntry != &DraidGlobals->ListenContextList;
listEntry = listEntry->Flink)
{
ListenContext = CONTAINING_RECORD (listEntry, DRAID_LISTEN_CONTEXT, Link);
if (!ListenContext->Destroy && RtlCompareMemory(ListenContext->Addr.Node,
Addr->Node, 6) == 6) {
KDPrintM(DBG_LURN_INFO, ("New LPX address already exist.Ignoring.\n"));
AlreadyExist = TRUE;
break;
}
}
RELEASE_SPIN_LOCK(&DraidGlobals->ListenContextSpinlock, oldIrql);
if (AlreadyExist) {
return NULL;
}
//
// Alloc listen context
//
ListenContext = ExAllocatePoolWithTag(NonPagedPool, sizeof(DRAID_LISTEN_CONTEXT),
DRAID_LISTEN_CONTEXT_POOL_TAG);
if (!ListenContext) {
KDPrintM(DBG_LURN_INFO, ("Failed to alloc listen context\n"));
return NULL;
}
RtlZeroMemory(ListenContext, sizeof(DRAID_LISTEN_CONTEXT));
KeInitializeEvent(
&ListenContext->TdiListenContext.CompletionEvent,
NotificationEvent,
FALSE
);
InitializeListHead(&ListenContext->Link);
RtlCopyMemory(ListenContext->Addr.Node, Addr->Node, 6);
ListenContext->Addr.Port = HTONS(DRIX_ARBITER_PORT_NUM_BASE);
ExInterlockedInsertTailList(&DraidGlobals->ListenContextList,
&ListenContext->Link,
&DraidGlobals->ListenContextSpinlock
);
return ListenContext;
}
示例6: Filter
VOID __stdcall Filter(ULONG ServiceId, ULONG TableBase, ULONG Argc, ULONG StackAddr) {
ULONG pid = (ULONG)PsGetCurrentProcessId();
if (pid == g_nPid) {
ULONG i;
PXBoxData pData=(PXBoxData)ExAllocateFromNPagedLookasideList(&g_nPageList);
if(!pData)
return;
if (StackAddr < MmUserProbeAddress)
pData->bFromUser = 1;
else
pData->bFromUser = 0;
if (TableBase == (ULONG)KeServiceDescriptorTable.ServiceTableBase)
pData->bFromSSDT = 1;
else
pData->bFromSSDT = 0;
if (Argc > 16)
Argc = 16;
pData->argc = (UCHAR)Argc;
for (i = 0; i < Argc; ++i)
pData->args[i] = ((PULONG)StackAddr)[i];
pData->pid = (ULONG)pid;
pData->tid = (ULONG)PsGetCurrentThreadId();
pData->sid = ServiceId;
KeQuerySystemTime(&pData->time);
ExInterlockedInsertTailList(&g_linkListHead, &pData->ListEntry, &g_lock);
KeReleaseSemaphore( &g_keySemaphore, 0, 1, FALSE );
}
}
示例7: EncryptedIoQueueAddIrp
NTSTATUS EncryptedIoQueueAddIrp (EncryptedIoQueue *queue, PIRP irp)
{
NTSTATUS status;
InterlockedIncrement (&queue->OutstandingIoCount);
if (queue->StopPending)
{
Dump ("STATUS_DEVICE_NOT_READY out=%d\n", queue->OutstandingIoCount);
status = STATUS_DEVICE_NOT_READY;
goto err;
}
status = IoAcquireRemoveLock (&queue->RemoveLock, irp);
if (!NT_SUCCESS (status))
goto err;
#ifdef TC_TRACE_IO_QUEUE
{
PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation (irp);
Dump ("* %I64d [%I64d] %c len=%d out=%d\n", irpSp->MajorFunction == IRP_MJ_WRITE ? irpSp->Parameters.Write.ByteOffset : irpSp->Parameters.Read.ByteOffset, GetElapsedTime (&queue->LastPerformanceCounter), irpSp->MajorFunction == IRP_MJ_WRITE ? 'W' : 'R', irpSp->MajorFunction == IRP_MJ_WRITE ? irpSp->Parameters.Write.Length : irpSp->Parameters.Read.Length, queue->OutstandingIoCount);
}
#endif
IoMarkIrpPending (irp);
ExInterlockedInsertTailList (&queue->MainThreadQueue, &irp->Tail.Overlay.ListEntry, &queue->MainThreadQueueLock);
KeSetEvent (&queue->MainThreadQueueNotEmptyEvent, IO_DISK_INCREMENT, FALSE);
return STATUS_PENDING;
err:
DecrementOutstandingIoCount (queue);
return status;
}
示例8: DraidRegisterClient
NTSTATUS
DraidRegisterClient(
PDRAID_CLIENT_INFO Client
) {
ASSERT(g_DraidGlobals);
ExInterlockedInsertTailList(&g_DraidGlobals->ClientList, &Client->AllClientList, &g_DraidGlobals->ClientListSpinlock);
return STATUS_SUCCESS;
}
示例9: DraidRegisterArbiter
NTSTATUS
DraidRegisterArbiter(
PDRAID_ARBITER_INFO Arbiter
) {
ASSERT(g_DraidGlobals);
ExInterlockedInsertTailList(&g_DraidGlobals->ArbiterList, &Arbiter->AllArbiterList, &g_DraidGlobals->ArbiterListSpinlock);
return STATUS_SUCCESS;
}
示例10: while
void RosKmAdapter::DoWork(void)
{
bool done = false;
while (!done)
{
NTSTATUS status = KeWaitForSingleObject(
&m_workerThreadEvent,
Executive,
KernelMode,
FALSE,
NULL);
status;
NT_ASSERT(status == STATUS_SUCCESS);
if (m_workerExit)
{
done = true;
continue;
}
for (;;)
{
ROSDMABUFSUBMISSION * pDmaBufSubmission = DequeueDmaBuffer(&m_dmaBufQueueLock);
if (pDmaBufSubmission == NULL)
{
break;
}
ROSDMABUFINFO * pDmaBufInfo = pDmaBufSubmission->m_pDmaBufInfo;
if (pDmaBufInfo->m_DmaBufState.m_bPaging)
{
//
// Run paging buffer in software
//
ProcessPagingBuffer(pDmaBufSubmission);
NotifyDmaBufCompletion(pDmaBufSubmission);
}
else
{
//
// Process render DMA buffer
//
ProcessRenderBuffer(pDmaBufSubmission);
NotifyDmaBufCompletion(pDmaBufSubmission);
}
ExInterlockedInsertTailList(&m_dmaBufSubmissionFree, &pDmaBufSubmission->m_QueueEntry, &m_dmaBufQueueLock);
}
}
}
示例11: LibTCPEnqueuePacket
void LibTCPEnqueuePacket(PCONNECTION_ENDPOINT Connection, struct pbuf *p)
{
PQUEUE_ENTRY qp;
qp = (PQUEUE_ENTRY)ExAllocateFromNPagedLookasideList(&QueueEntryLookasideList);
qp->p = p;
qp->Offset = 0;
ExInterlockedInsertTailList(&Connection->PacketQueue, &qp->ListEntry, &Connection->Lock);
}
示例12: FileWrite
NTSTATUS FileWrite(__in BASE_FILE * File, __in PIRP Irp,
__in PIO_STACK_LOCATION IrpStack)
{
BASE_DEVICE *Device = BaseFileGetDevice(File);
DEVICE_DATA *DeviceData = (DEVICE_DATA *) BaseDeviceGetPrivate(Device);
ULONG Length = IrpStack->Parameters.Write.Length;
PVOID Buffer;
BUFFER_DATA *BufferData;
size_t Size;
NTSTATUS Status = STATUS_SUCCESS;
PAGED_CODE();
__try {
ASSERT(Irp->MdlAddress);
if (Irp->MdlAddress == NULL) {
TRACE_MSG(TRACE_LEVEL_ERROR, TRACE_FLAG_DEFAULT,
"Null MDL pointer\n");
Status = STATUS_INVALID_PARAMETER;
__leave;
}
Buffer = MmGetSystemAddressForMdlSafe(Irp->MdlAddress,
NormalPagePriority);
if (Buffer == NULL) {
Status = STATUS_INSUFFICIENT_RESOURCES;
TRACE_ERR("MmGetSystemAddressForMdlSafe", Status);
__leave;
}
Size = FIELD_OFFSET(BUFFER_DATA, Data) + Length;
BufferData =
(BUFFER_DATA *) ExAllocatePoolWithTag(NonPagedPool, Size,
SAMPLE_POOL_TAG);
if (BufferData == NULL) {
Status = STATUS_INSUFFICIENT_RESOURCES;
TRACE_ERR("ExAllocatePoolWithTag", Status);
__leave;
}
TRACE_MSG(TRACE_LEVEL_INFO, TRACE_FLAG_DEFAULT,
"Write %u bytes\n",
IrpStack->Parameters.Write.Length);
RtlCopyMemory(BufferData->Data, Buffer, Length);
BufferData->Length = Length;
ExInterlockedInsertTailList(&DeviceData->BufferList,
&BufferData->ListEntry,
&DeviceData->BufferListLock);
Irp->IoStatus.Information = Length;
}
__finally {
BaseFileCompleteRequest(File, Irp, Status);
}
return Status;
}
示例13: PacketRead
NTSTATUS PacketRead( IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp )
{
POPEN_INSTANCE open;
PNDIS_PACKET pPacket;
NDIS_STATUS status;
NTSTATUS ntStatus;
PIO_STACK_LOCATION irpSp;
// DebugPrint(("Read\n"));
open = DeviceObject->DeviceExtension;
IoIncrement(open);
if(!open->Bound) {
ntStatus = STATUS_DEVICE_NOT_READY;
goto ERROR;
}
irpSp = IoGetCurrentIrpStackLocation(Irp);
if (irpSp->Parameters.Read.Length < ETHERNET_HEADER_LENGTH) {
ntStatus = STATUS_BUFFER_TOO_SMALL;
goto ERROR;
}
NdisAllocatePacket( &status, &pPacket, open->PacketPool );
if (status != NDIS_STATUS_SUCCESS) {
// DebugPrint(("Packet: Read- No free packets\n"));
ntStatus = STATUS_INSUFFICIENT_RESOURCES;
goto ERROR;
}
RESERVED(pPacket)->Irp=Irp;
RESERVED(pPacket)->pMdl=NULL;
IoMarkIrpPending(Irp);
IoSetCancelRoutine(Irp, PacketCancelRoutine);
ExInterlockedInsertTailList(
&open->RcvList,
&RESERVED(pPacket)->ListElement,
&open->RcvQSpinLock);
return STATUS_PENDING;
ERROR:
Irp->IoStatus.Status = ntStatus;
IoCompleteRequest (Irp, IO_NO_INCREMENT);
IoDecrement(open);
return ntStatus;
}
示例14: CompletionIrpCompletionRoutine
NTSTATUS
CompletionIrpCompletionRoutine(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
IN PCOMPLETION_DATA Context
)
{
PMINIPORT_DEVICE_EXTENSION HwDeviceExtension = Context->HwDeviceExtension;
PSCSI_REQUEST_BLOCK completionSrb = Context->CompletionSrb;
PCCB shippedCcb = Context->ShippedCcb;
KDPrint(4, ("Entered\n"));
UNREFERENCED_PARAMETER(DeviceObject);
if(completionSrb->DataBuffer)
{
KDPrint(2, ("Unexpected IRP completion!!! "
"Maybe completion SRB did not reach NDASSCSI's StartIo routine.\n"));
ASSERT(completionSrb->DataBuffer);
InterlockedDecrement(&HwDeviceExtension->RequestExecuting);
LsuDecrementTdiClientInProgress();
InitializeListHead(&shippedCcb->ListEntry);
LsCcbSetStatusFlag(shippedCcb, CCBSTATUS_FLAG_TIMER_COMPLETE);
ExInterlockedInsertTailList(
&HwDeviceExtension->CcbTimerCompletionList,
&shippedCcb->ListEntry,
&HwDeviceExtension->CcbTimerCompletionListSpinLock
);
completionSrb->DataBuffer = NULL;
} else {
//
// Free the CCB if it is not going to the timer completion routine
// and allocated from the system pool by NDASSCSI.
//
if(Context->ShippedCcbAllocatedFromPool)
LsCcbPostCompleteCcb(shippedCcb);
}
// Free resources
ExFreePoolWithTag(completionSrb, NDSC_PTAG_SRB);
ExFreePoolWithTag(Context, NDSC_PTAG_CMPDATA);
IoFreeIrp(Irp);
return STATUS_MORE_PROCESSING_REQUIRED;
}
示例15: FileDiskReadWrite
NTSTATUS
FileDiskReadWrite (
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
)
{
PDEVICE_EXTENSION device_extension;
PIO_STACK_LOCATION io_stack;
//得到扩展设备
device_extension = (PDEVICE_EXTENSION) DeviceObject->DeviceExtension;
//判断是否有物理设备。没有打开文件,就返回失败
if (!device_extension->media_in_device)
{
Irp->IoStatus.Status = STATUS_NO_MEDIA_IN_DEVICE;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_NO_MEDIA_IN_DEVICE;
}
io_stack = IoGetCurrentIrpStackLocation(Irp);
// 读0长的时候立刻成功
if (io_stack->Parameters.Read.Length == 0)
{
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
//放入队列里面去
IoMarkIrpPending(Irp);
// 把请求写入链表
ExInterlockedInsertTailList(
&device_extension->list_head,
&Irp->Tail.Overlay.ListEntry,
&device_extension->list_lock
);
// 设置事件。让线程循环运行。
KeSetEvent(
&device_extension->request_event,
(KPRIORITY) 0,
FALSE
);
return STATUS_PENDING;
}