本文整理汇总了C++中RemoveHeadList函数的典型用法代码示例。如果您正苦于以下问题:C++ RemoveHeadList函数的具体用法?C++ RemoveHeadList怎么用?C++ RemoveHeadList使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RemoveHeadList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteHandleTable
VOID
DeleteHandleTable(PPROVIDER_HANDLE_BLOCK HandleTable)
{
PPROVIDER_HANDLE_BLOCK Current;
PLIST_ENTRY CurrentEntry;
CloseAllHandles(HandleTable);
CurrentEntry = RemoveHeadList(&HandleTable->Entry);
while (CurrentEntry != &HandleTable->Entry)
{
Current = CONTAINING_RECORD(CurrentEntry,
PROVIDER_HANDLE_BLOCK,
Entry);
HeapFree(GlobalHeap, 0, Current);
CurrentEntry = RemoveHeadList(&HandleTable->Entry);
}
}
示例2: Pkt0FinalizeIrpQueue
static VOID
Pkt0FinalizeIrpQueue(PLIST_ENTRY IrpQueue)
{
PLIST_ENTRY entry;
PIRP irp;
while (!IsListEmpty(IrpQueue)) {
entry = RemoveHeadList(IrpQueue);
irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.ListEntry);
Pkt0CompleteIrp(irp, STATUS_PIPE_CLOSING, 0);
}
}
示例3: ssh_interceptor_iodevice_cancel_queued_read
/*
Cancel routine for queued read operations initiated by user-mode daemons.
*/
void
ssh_interceptor_iodevice_cancel_queued_read(PDEVICE_OBJECT device,
PIRP irp)
{
SshInterceptorIoDevice io_dev;
PLIST_ENTRY entry, next_entry;
LIST_ENTRY cancelled_irps;
/* Cancel processing is protected by queue-specific lock, not by the (one
and only) system-wide Cancel lock */
IoReleaseCancelSpinLock(irp->CancelIrql);
io_dev = SSH_NTDEV_TO_SSHDEV(device);
NdisInitializeListHead(&cancelled_irps);
SSH_DEBUG(SSH_D_MIDSTART,
("ssh_interceptor_iodevice_cancel_queued_read()"));
/* Find and dequeue all canceled IRPs (not just the one given as argument).
Complete the IRPs after releasing the spin lock. */
NdisAcquireSpinLock(&io_dev->read_queue_lock);
entry = io_dev->read_queue.Flink;
while (entry && (entry != &io_dev->read_queue))
{
next_entry = entry->Flink;
irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.ListEntry);
if (irp->Cancel)
{
RemoveEntryList(entry);
InsertTailList(&cancelled_irps, entry);
}
entry = next_entry;
}
NdisReleaseSpinLock(&io_dev->read_queue_lock);
while (!IsListEmpty(&cancelled_irps))
{
entry = RemoveHeadList(&cancelled_irps);
irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.ListEntry);
irp->IoStatus.Status = STATUS_CANCELLED;
irp->IoStatus.Information = 0;
IoCompleteRequest(irp, IO_NO_INCREMENT);
SSH_DEBUG(SSH_D_NICETOKNOW,
("IoCompleteRequest(irp = 0x%p, status = STATUS_CANCELLED)",
irp));
};
}
示例4: AdapterStop
void AdapterStop() {
PLIST_ENTRY ListEntry;
PDHCP_ADAPTER Adapter;
ApiLock();
while( !IsListEmpty( &AdapterList ) ) {
ListEntry = (PLIST_ENTRY)RemoveHeadList( &AdapterList );
Adapter = CONTAINING_RECORD( ListEntry, DHCP_ADAPTER, ListEntry );
free( Adapter );
}
ApiUnlock();
WSACleanup();
}
示例5: ssh_iodevice_buffer_alloc
__inline SshDeviceBuffer
ssh_iodevice_buffer_alloc(SshInterceptorIoDevice io_dev,
Boolean reliable)
{
SshDeviceBuffer buf = NULL;
PLIST_ENTRY entry;
/* 1. Try to get a SshDeviceBuffer from a free list */
entry = NdisInterlockedRemoveHeadList(&io_dev->free_list,
&io_dev->free_list_lock);
if (entry)
buf = CONTAINING_RECORD(entry, SshDeviceBufferStruct, link);
/* 2. If failed and this is a reliable message, try to replace
an existing unreliable one */
if ((buf == NULL) && (reliable))
{
NdisAcquireSpinLock(&io_dev->output_queue_lock);
if (!IsListEmpty(&io_dev->unreliable_output_queue))
{
/* We found an existing unreliable message */
entry = RemoveHeadList(&io_dev->unreliable_output_queue);
/* We must remove the entry from output_queue too */
buf = CONTAINING_RECORD(entry, SshDeviceBufferStruct,
unreliable_list_link);
SSH_ASSERT(buf != io_dev->current_read_buf);
/* This removes the entry from output_queue */
RemoveEntryList(&(buf->link));
}
NdisReleaseSpinLock(&io_dev->output_queue_lock);
/* If found, we must delete the old message */
if (buf != NULL)
ssh_free(buf->addr);
}
/* 3. If still failed, try to allocate memory for a new
SshDeviceBuffer */
if ((buf == NULL) && (reliable))
{
buf = ssh_malloc(sizeof(*buf));
if (buf)
{
/* This buffer will be deleted after use */
buf->pre_allocated = 0;
}
}
return buf;
}
示例6: PacketReceiveIndicate
NDIS_STATUS NDIS_API PacketReceiveIndicate(IN NDIS_HANDLE ProtocolBindingContext,
IN NDIS_HANDLE MacReceiveContext,
IN PVOID HeaderBuffer,
IN UINT HeaderBufferSize,
IN PVOID LookaheadBuffer,
IN UINT LookaheadBufferSize,
IN UINT PacketSize)
{
// upcall on packet arrival
POPEN_INSTANCE Open;
PLIST_ENTRY PacketListEntry;
PNDIS_PACKET pPacket;
NDIS_STATUS Status;
UINT BytesTransfered = 0;
PPACKET_RESERVED pReserved;
if (HeaderBufferSize != ETHERNET_HEADER_LENGTH)
return NDIS_STATUS_NOT_ACCEPTED;
Open = (POPEN_INSTANCE) ProtocolBindingContext;
// See if there are any pending reads that we can satisfy
NdisAcquireSpinLock(&Open->RcvQSpinLock); // fixed 5.11.97
if (IsListEmpty(&Open->RcvList)) {
NdisReleaseSpinLock(&Open->RcvQSpinLock);
return NDIS_STATUS_NOT_ACCEPTED;
}
PacketListEntry = RemoveHeadList(&Open->RcvList);
NdisReleaseSpinLock(&Open->RcvQSpinLock);
pReserved = CONTAINING_RECORD(PacketListEntry, PACKET_RESERVED, ListElement);
pPacket = CONTAINING_RECORD(pReserved, NDIS_PACKET, ProtocolReserved);
// Copy the MAC header
NdisMoveMemory(RESERVED(pPacket)->lpBuffer, HeaderBuffer, HeaderBufferSize);
// Call the Mac to transfer the data portion of the packet
NdisTransferData(&Status, Open->AdapterHandle, MacReceiveContext, 0, PacketSize, pPacket, &BytesTransfered);
if (Status == NDIS_STATUS_PENDING)
return NDIS_STATUS_PENDING;
if (Status == NDIS_STATUS_SUCCESS) {
PacketTransferDataComplete(Open, pPacket, Status, BytesTransfered);
return NDIS_STATUS_SUCCESS;
}
PacketTransferDataComplete(Open, pPacket, Status, 0);
return NDIS_STATUS_SUCCESS;
}
示例7: RemoveHeadList
//
// Dynamic heaps are conceptually the same concept as dynamic buffers, but for descriptors
// instead of buffer data.
//
HRESULT DX12Framework::AllocateVersionedDescriptorHeap(DescriptorHeap** ppHeap)
{
//
// Grab a heap from our lookaside list if possible.
//
if (!IsListEmpty(&m_DynamicDescriptorHeapListHead))
{
LIST_ENTRY* pEntry = RemoveHeadList(&m_DynamicDescriptorHeapListHead);
*ppHeap = static_cast<DescriptorHeap*>(pEntry);
return S_OK;
}
//
// No available buffers, let's try to allocate a new one.
//
HRESULT hr;
ID3D12DescriptorHeap* pD3DDescriptorHeap = nullptr;
D3D12_DESCRIPTOR_HEAP_DESC Desc = {};
Desc.NumDescriptors = DYNAMIC_HEAP_SIZE;
Desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
Desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
hr = m_pDevice->CreateDescriptorHeap(&Desc, IID_PPV_ARGS(&pD3DDescriptorHeap));
if (FAILED(hr))
{
LOG_WARNING("Failed to create D3D12 descriptor heap, hr=0x%.8x", hr);
goto cleanup;
}
DescriptorHeap* pHeap = nullptr;
try
{
pHeap = new DescriptorHeap();
}
catch (std::bad_alloc&)
{
LOG_WARNING("Failed to allocate dynamic descriptor heap");
hr = E_OUTOFMEMORY;
goto cleanup;
}
pHeap->pHeap = pD3DDescriptorHeap;
*ppHeap = pHeap;
return S_OK;
cleanup:
SafeRelease(pD3DDescriptorHeap);
return hr;
}
示例8: IopErrorLogGetEntry
PLIST_ENTRY
IopErrorLogGetEntry(
)
/*++
Routine Description:
This routine gets the next entry from the head of the error log queue
and returns it to the caller.
Arguments:
None.
Return Value:
The return value is a pointer to the packet removed, or NULL if there were
no packets on the queue.
--*/
{
KIRQL irql;
PLIST_ENTRY listEntry;
//
// Remove the next packet from the queue, if there is one.
//
ExAcquireSpinLock( &IopErrorLogLock, &irql );
if (IsListEmpty( &IopErrorLogListHead )) {
//
// Indicate no more work will be done in the context of this worker
// thread and indicate to the caller that no packets were located.
//
IopErrorLogPortPending = FALSE;
listEntry = (PLIST_ENTRY) NULL;
} else {
//
// Remove the next packet from the head of the list.
//
listEntry = RemoveHeadList( &IopErrorLogListHead );
}
ExReleaseSpinLock( &IopErrorLogLock, irql );
return listEntry;
}
示例9: LibTCPDequeuePacket
PQUEUE_ENTRY LibTCPDequeuePacket(PCONNECTION_ENDPOINT Connection)
{
PLIST_ENTRY Entry;
PQUEUE_ENTRY qp = NULL;
if (IsListEmpty(&Connection->PacketQueue)) return NULL;
Entry = RemoveHeadList(&Connection->PacketQueue);
qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry);
return qp;
}
示例10: HistoryDeleteBuffers
VOID FASTCALL
HistoryDeleteBuffers(PCONSOLE Console)
{
PLIST_ENTRY CurrentEntry;
PHISTORY_BUFFER HistoryBuffer;
while (!IsListEmpty(&Console->HistoryBuffers))
{
CurrentEntry = RemoveHeadList(&Console->HistoryBuffers);
HistoryBuffer = CONTAINING_RECORD(CurrentEntry, HISTORY_BUFFER, ListEntry);
HistoryDeleteBuffer(HistoryBuffer);
}
}
示例11: HID_Device_processQueue
static void HID_Device_processQueue(DEVICE_OBJECT *device)
{
LIST_ENTRY *entry;
IRP *irp;
BASE_DEVICE_EXTENSION *ext = device->DeviceExtension;
UINT buffer_size = RingBuffer_GetBufferSize(ext->ring_buffer);
HID_XFER_PACKET *packet;
packet = HeapAlloc(GetProcessHeap(), 0, buffer_size);
entry = RemoveHeadList(&ext->irp_queue);
while(entry != &ext->irp_queue)
{
int ptr;
irp = CONTAINING_RECORD(entry, IRP, Tail.Overlay.s.ListEntry);
ptr = PtrToUlong( irp->Tail.Overlay.OriginalFileObject->FsContext );
RingBuffer_Read(ext->ring_buffer, ptr, packet, &buffer_size);
if (buffer_size)
{
NTSTATUS rc;
ULONG out_length;
IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
packet->reportBuffer = (BYTE *)packet + sizeof(*packet);
TRACE_(hid_report)("Processing Request (%i)\n",ptr);
rc = copy_packet_into_buffer(packet, irp->AssociatedIrp.SystemBuffer, irpsp->Parameters.Read.Length, &out_length);
irp->IoStatus.u.Status = rc;
irp->IoStatus.Information = out_length;
}
else
{
irp->IoStatus.Information = 0;
irp->IoStatus.u.Status = STATUS_UNSUCCESSFUL;
}
IoCompleteRequest( irp, IO_NO_INCREMENT );
entry = RemoveHeadList(&ext->irp_queue);
}
HeapFree(GetProcessHeap(), 0, packet);
}
示例12: while
void CParaNdisRX::FreeRxDescriptorsFromList()
{
while (!IsListEmpty(&m_NetReceiveBuffers))
{
pRxNetDescriptor pBufferDescriptor = (pRxNetDescriptor)RemoveHeadList(&m_NetReceiveBuffers);
ParaNdis_FreeRxBufferDescriptor(m_Context, pBufferDescriptor);
}
for (UINT i = 0; i < ARRAYSIZE(m_ReservedRxBufferMemory); i++) {
if (m_ReservedRxBufferMemory[i].Virtual) {
ParaNdis_FreePhysicalMemory(m_Context, &m_ReservedRxBufferMemory[i]);
}
}
}
示例13: FilemonCleanGuardPath
// 清空监控目录
NTSTATUS FilemonCleanGuardPath(PIO_STACK_LOCATION pStack, PIRP pIrp)
{
KIRQL irql;
PLIST_ENTRY pList = NULL;
KeAcquireSpinLock(&FltData.spinkLock, &irql);
while(&FltData.listGuard != (pList = RemoveHeadList(&FltData.listGuard)))
{
PFILEMON_GUARD pGuardPath = NULL;
}
KeReleaseSpinLock(&FltData.spinkLock, irql);
return STATUS_SUCCESS;
}
示例14: SignalLatch
VOID SignalLatch (PCountDownLatch CountDownLatch) {
// decrementa o contador interno, desbloqueando todas as threads em espera se este chegar a zero
if (CountDownLatch->counter == 0) {
}
CountDownLatch->counter--;
if (CountDownLatch->counter == 0) {
while (!IsListEmpty(&CountDownLatch->Waiters)) {
PWAIT_BLOCK WaitBlockPtr = CONTAINING_RECORD(RemoveHeadList(&CountDownLatch->Waiters), WAIT_BLOCK, Link);
UtActivate(WaitBlockPtr->Thread);
}
}
}
示例15: CleanupReads
VOID CleanupReads( PDEVICE_EXTENSION pdx, PFILE_OBJECT pfo, NTSTATUS status )
{
PIO_STACK_LOCATION ReadStack;
PLIST_ENTRY head, next, current;
LIST_ENTRY CancelList;
PIRP ReadIrp;
KIRQL OldIrql;
// manually cancel all pending reads that match this file handle
InitializeListHead( &CancelList );
KeAcquireSpinLock (&pdx->ReadIrpLock, &OldIrql );
head = &pdx->ReadIrpList;
for( next=head->Flink; next != head; )
{
ReadIrp = CONTAINING_RECORD( next, IRP, Tail.Overlay.ListEntry );
ReadStack = IoGetCurrentIrpStackLocation( ReadIrp );
// advance next pointer now, as we want to muck with it
current = next;
next = next->Flink;
// skip IRPs that do not match
// if pfo == NULL, then don't skip anything
if(pfo && pfo != ReadStack->FileObject )
{
KdPrint((DRIVERNAME " - Skipping IRP, it belongs to a different handle\n"));
continue;
}
// add it to the cancel list
RemoveEntryList( current );
InsertTailList ( &CancelList, current );
}
KeReleaseSpinLock( &pdx->ReadIrpLock, OldIrql );
// now complete the IRPs we cancelled
while (!IsListEmpty(&CancelList))
{
next = RemoveHeadList( &CancelList );
ReadIrp = CONTAINING_RECORD(next, IRP, Tail.Overlay.ListEntry);
IoSetCancelRoutine ( ReadIrp, NULL );
IoReleaseRemoveLock( &pdx->RemoveLock, ReadIrp );
CompleteRequest ( ReadIrp, status, 0 );
}
}