本文整理汇总了C++中RemoveEntryList函数的典型用法代码示例。如果您正苦于以下问题:C++ RemoveEntryList函数的具体用法?C++ RemoveEntryList怎么用?C++ RemoveEntryList使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RemoveEntryList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConDrvGetConsoleInput
NTSTATUS NTAPI
ConDrvGetConsoleInput(IN PCONSOLE Console,
IN PCONSOLE_INPUT_BUFFER InputBuffer,
IN BOOLEAN KeepEvents,
IN BOOLEAN WaitForMoreEvents,
OUT PINPUT_RECORD InputRecord,
IN ULONG NumEventsToRead,
OUT PULONG NumEventsRead OPTIONAL)
{
PLIST_ENTRY CurrentInput;
ConsoleInput* Input;
ULONG i = 0;
if (Console == NULL || InputBuffer == NULL /* || InputRecord == NULL */)
return STATUS_INVALID_PARAMETER;
/* Validity checks */
ASSERT(Console == InputBuffer->Header.Console);
ASSERT((InputRecord != NULL) || (InputRecord == NULL && NumEventsToRead == 0));
if (NumEventsRead) *NumEventsRead = 0;
if (IsListEmpty(&InputBuffer->InputEvents))
{
/*
* No input is available. Wait for more input if requested,
* otherwise, we don't wait, so we return success.
*/
return (WaitForMoreEvents ? STATUS_PENDING : STATUS_SUCCESS);
}
/* Only get input if there is any */
CurrentInput = InputBuffer->InputEvents.Flink;
i = 0;
while ((CurrentInput != &InputBuffer->InputEvents) && (i < NumEventsToRead))
{
Input = CONTAINING_RECORD(CurrentInput, ConsoleInput, ListEntry);
*InputRecord = Input->InputEvent;
++InputRecord;
++i;
CurrentInput = CurrentInput->Flink;
/* Remove the events from the queue if needed */
if (!KeepEvents)
{
RemoveEntryList(&Input->ListEntry);
ConsoleFreeHeap(Input);
}
}
if (NumEventsRead) *NumEventsRead = i;
if (IsListEmpty(&InputBuffer->InputEvents))
{
ResetEvent(InputBuffer->ActiveEvent);
}
// FIXME: If we add back UNICODE support, it's here that we need to do the translation.
/* We read all the inputs available, we return success */
return STATUS_SUCCESS;
}
示例2: OrderedList
//.........这里部分代码省略.........
(HighlightOptionIndex == (TopOptionIndex + MenuLinesInView - 1))) {
//
// Highlight reaches the bottom of the popup window, scroll one menu item.
//
TopOptionIndex++;
ShowUpArrow = TRUE;
}
if ((TopOptionIndex + MenuLinesInView) == PopUpMenuLines) {
ShowDownArrow = FALSE;
}
if (HighlightOptionIndex < (PopUpMenuLines - 1)) {
HighlightOptionIndex++;
}
}
break;
case SCAN_ESC:
gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
//
// Restore link list order for orderedlist
//
if (OrderedList) {
HiiValue.Type = ValueType;
HiiValue.Value.u64 = 0;
for (Index = 0; Index < OrderList->MaxContainers; Index++) {
HiiValue.Value.u64 = GetArrayData (ValueArray, ValueType, Index);
if (HiiValue.Value.u64 == 0) {
break;
}
OneOfOption = ValueToOption (Question, &HiiValue);
if (OneOfOption == NULL) {
return EFI_NOT_FOUND;
}
RemoveEntryList (&OneOfOption->Link);
InsertTailList (&Question->OptionListHead, &OneOfOption->Link);
}
}
return EFI_DEVICE_ERROR;
default:
break;
}
break;
case CHAR_CARRIAGE_RETURN:
//
// return the current selection
//
if (OrderedList) {
ReturnValue = AllocateZeroPool (Question->CurrentValue.BufferLen);
ASSERT (ReturnValue != NULL);
Index = 0;
Link = GetFirstNode (&Question->OptionListHead);
while (!IsNull (&Question->OptionListHead, Link)) {
OneOfOption = DISPLAY_QUESTION_OPTION_FROM_LINK (Link);
Link = GetNextNode (&Question->OptionListHead, Link);
SetArrayData (ReturnValue, ValueType, Index, OneOfOption->OptionOpCode->Value.u64);
Index++;
if (Index > OrderList->MaxContainers) {
break;
}
}
if (CompareMem (ReturnValue, ValueArray, Question->CurrentValue.BufferLen) == 0) {
FreePool (ReturnValue);
return EFI_DEVICE_ERROR;
} else {
gUserInput->InputValue.Buffer = ReturnValue;
gUserInput->InputValue.BufferLen = Question->CurrentValue.BufferLen;
Status = EFI_SUCCESS;
}
} else {
ASSERT (CurrentOption != NULL);
gUserInput->InputValue.Type = CurrentOption->OptionOpCode->Type;
if (IsValuesEqual (&Question->CurrentValue.Value, &CurrentOption->OptionOpCode->Value, gUserInput->InputValue.Type)) {
return EFI_DEVICE_ERROR;
} else {
SetValuesByType (&gUserInput->InputValue.Value, &CurrentOption->OptionOpCode->Value, gUserInput->InputValue.Type);
Status = EFI_SUCCESS;
}
}
gST->ConOut->SetAttribute (gST->ConOut, SavedAttribute);
return EFI_SUCCESS;
default:
break;
}
} while (TRUE);
}
示例3: MiAllocatePoolPages
//.........这里部分代码省略.........
//
// Now loop through all the free page entries in this given list
//
NextEntry = NextHead->Flink;
while (NextEntry != NextHead)
{
/* Is freed non paged pool enabled */
if (MmProtectFreedNonPagedPool)
{
/* We need to be able to touch this page, unprotect it */
MiUnProtectFreeNonPagedPool(NextEntry, 0);
}
//
// Grab the entry and see if it can handle our allocation
//
FreeEntry = CONTAINING_RECORD(NextEntry, MMFREE_POOL_ENTRY, List);
ASSERT(FreeEntry->Signature == MM_FREE_POOL_SIGNATURE);
if (FreeEntry->Size >= SizeInPages)
{
//
// It does, so consume the pages from here
//
FreeEntry->Size -= SizeInPages;
//
// The allocation will begin in this free page area
//
BaseVa = (PVOID)((ULONG_PTR)FreeEntry +
(FreeEntry->Size << PAGE_SHIFT));
/* Remove the item from the list, depending if pool is protected */
MmProtectFreedNonPagedPool ?
MiProtectedPoolRemoveEntryList(&FreeEntry->List) :
RemoveEntryList(&FreeEntry->List);
//
// However, check if its' still got space left
//
if (FreeEntry->Size != 0)
{
/* Check which list to insert this entry into */
i = FreeEntry->Size - 1;
if (i >= MI_MAX_FREE_PAGE_LISTS) i = MI_MAX_FREE_PAGE_LISTS - 1;
/* Insert the entry into the free list head, check for prot. pool */
MmProtectFreedNonPagedPool ?
MiProtectedPoolInsertList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List, TRUE) :
InsertTailList(&MmNonPagedPoolFreeListHead[i], &FreeEntry->List);
/* Is freed non paged pool protected? */
if (MmProtectFreedNonPagedPool)
{
/* Protect the freed pool! */
MiProtectFreeNonPagedPool(FreeEntry, FreeEntry->Size);
}
}
//
// Grab the PTE for this allocation
//
PointerPte = MiAddressToPte(BaseVa);
ASSERT(PointerPte->u.Hard.Valid == 1);
//
// Grab the PFN NextEntry and index
示例4: FxFileObjectClassNormalize
//
// Destroy (dereference) the WDFFILEOBJECT related to the
// WDM PFILE_OBJECT according to its FileObjectClass.
//
VOID
FxFileObject::_DestroyFileObject(
__in FxDevice* pDevice,
__in WDF_FILEOBJECT_CLASS FileObjectClass,
__in_opt MdFileObject pWdmFileObject
)
{
FxFileObject* pfo = NULL;
PFX_DRIVER_GLOBALS FxDriverGlobals = pDevice->GetDriverGlobals();
WDF_FILEOBJECT_CLASS normalizedFileClass;
//
// Close does require a WDM file obj based on the normalized file obj
// class value.
//
normalizedFileClass = FxFileObjectClassNormalize(FileObjectClass);
if( normalizedFileClass == WdfFileObjectNotRequired ) {
return;
}
//
// Driver has specified file object support, and we
// allocated one at Create, so they must pass one
// to close, otherwise it's an error and we will leak
// the file object.
//
MxFileObject wdmFileObject(pWdmFileObject);
if( pWdmFileObject == NULL &&
normalizedFileClass != WdfFileObjectWdfCannotUseFsContexts) {
//
// It's likely that IRP_MJ_CREATE had NULL for the Wdm FileObject as well.
//
// If a driver passes != NULL for Wdm FileObject to create, and NULL to
// this routine, a WDF FxFileObject object leak will occur, which will
// be reported at driver unload.
//
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_VERBOSE, TRACINGIO,
"PFILE_OBJECT in close IRP is NULL, *Possible Leak of FxFileObject*\n");
FxVerifierDbgBreakPoint(pDevice->GetDriverGlobals());
return;
}
else if( normalizedFileClass == WdfFileObjectWdfCanUseFsContext ) {
pfo = (FxFileObject*)wdmFileObject.GetFsContext();
wdmFileObject.SetFsContext(NULL);
}
else if( normalizedFileClass == WdfFileObjectWdfCanUseFsContext2 ) {
pfo = (FxFileObject*)wdmFileObject.GetFsContext2();
wdmFileObject.SetFsContext2(NULL);
}
else {
NTSTATUS status;
//
// We must find the associated FxFileObject from the list
// on the device
//
status = FxFileObject::_GetFileObjectFromWdm(
pDevice,
WdfFileObjectWdfCannotUseFsContexts,
pWdmFileObject,
&pfo
);
//
// We should find it, unless a different one was passed to IRP_MJ_CLOSE
// than to IRP_MJ_CREATE, which is an error.
//
if (NT_SUCCESS(status) == FALSE || pfo == NULL) {
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
"Could not find WDFFILEOBJECT for PFILE_OBJECT 0x%p",
pWdmFileObject);
DoTraceLevelMessage(FxDriverGlobals, TRACE_LEVEL_ERROR, TRACINGDEVICE,
"Did a different PFILE_OBJECT get passed to "
"IRP_MJ_CLOSE than did to IRP_MJ_CREATE?");
FxVerifierDbgBreakPoint(pDevice->GetDriverGlobals());
}
}
if( pfo != NULL ) {
KIRQL irql;
//
// Remove it from the list of FxFileObjects on the FxDevice
//
pDevice->Lock(&irql);
RemoveEntryList(&pfo->m_Link);
pDevice->Unlock(irql);
// Delete the file object
pfo->DeleteObject();
}
//.........这里部分代码省略.........
示例5: TdiHandleSerializedRequest
//.........这里部分代码省略.........
);
// Figure out the type of request we have here.
switch (RequestType) {
case TDI_REGISTER_BIND_NOTIFY:
case TDI_REGISTER_ADDRESS_NOTIFY:
// This is a client register bind or address handler request.
// Insert this one into the registered client list.
NotifyElement = (PTDI_NOTIFY_COMMON)RequestInfo;
InsertTailList(
ClientList,
&NotifyElement->Linkage,
);
// Call TdiNotifyNewClient to notify this new client of all
// all existing providers.
TdiNotifyNewClient(
ProviderList,
RequestInfo
);
break;
case TDI_DEREGISTER_BIND_NOTIFY:
case TDI_DEREGISTER_ADDRESS_NOTIFY:
// This is a client deregister request. Pull him from the
// client list, free it, and we're done.
NotifyElement = (PTDI_NOTIFY_COMMON)RequestInfo;
RemoveEntryList(&NotifyElement->Linkage);
ExFreePool(NotifyElement);
break;
case TDI_REGISTER_DEVICE:
case TDI_REGISTER_ADDRESS:
// A provider is registering a device or address. Add him to
// the appropriate provider list, and then notify all
// existing clients of the new device.
ProviderElement = (PTDI_PROVIDER_RESOURCE)RequestInfo;
InsertTailList(
ProviderList,
&ProviderElement->Common.Linkage
);
// Call TdiNotifyClientList to do the hard work.
TdiNotifyClientList(
ClientList,
RequestInfo,
TRUE
);
break;
case TDI_DEREGISTER_DEVICE:
case TDI_DEREGISTER_ADDRESS:
// A provider device or address is deregistering. Pull the
示例6: Mtftp4RemoveBlockNum
/**
Remove the block number from the block range list.
@param Head The block range list to remove from
@param Num The block number to remove
@param Completed Whether Num is the last block number
@param TotalBlock The continuous block number in all
@retval EFI_NOT_FOUND The block number isn't in the block range list
@retval EFI_SUCCESS The block number has been removed from the list
@retval EFI_OUT_OF_RESOURCES Failed to allocate resource
**/
EFI_STATUS
Mtftp4RemoveBlockNum (
IN LIST_ENTRY *Head,
IN UINT16 Num,
IN BOOLEAN Completed,
OUT UINT64 *TotalBlock
)
{
MTFTP4_BLOCK_RANGE *Range;
MTFTP4_BLOCK_RANGE *NewRange;
LIST_ENTRY *Entry;
NET_LIST_FOR_EACH (Entry, Head) {
//
// Each block represents a hole [Start, End] in the file,
// skip to the first range with End >= Num
//
Range = NET_LIST_USER_STRUCT (Entry, MTFTP4_BLOCK_RANGE, Link);
if (Range->End < Num) {
continue;
}
//
// There are three different cases for Start
// 1. (Start > Num) && (End >= Num):
// because all the holes before this one has the condition of
// End < Num, so this block number has been removed.
//
// 2. (Start == Num) && (End >= Num):
// Need to increase the Start by one, and if End == Num, this
// hole has been removed completely, remove it.
//
// 3. (Start < Num) && (End >= Num):
// if End == Num, only need to decrease the End by one because
// we have (Start < Num) && (Num == End), so (Start <= End - 1).
// if (End > Num), the hold is splited into two holes, with
// [Start, Num - 1] and [Num + 1, End].
//
if (Range->Start > Num) {
return EFI_NOT_FOUND;
} else if (Range->Start == Num) {
Range->Start++;
//
// Note that: RFC 1350 does not mention block counter roll-over,
// but several TFTP hosts implement the roll-over be able to accept
// transfers of unlimited size. There is no consensus, however, whether
// the counter should wrap around to zero or to one. Many implementations
// wrap to zero, because this is the simplest to implement. Here we choose
// this solution.
//
*TotalBlock = Num;
if (Range->Round > 0) {
*TotalBlock += Range->Bound + MultU64x32 ((UINTN) (Range->Round -1), (UINT32) (Range->Bound + 1)) + 1;
}
if (Range->Start > Range->Bound) {
Range->Start = 0;
Range->Round ++;
}
if ((Range->Start > Range->End) || Completed) {
RemoveEntryList (&Range->Link);
FreePool (Range);
}
return EFI_SUCCESS;
} else {
if (Range->End == Num) {
Range->End--;
} else {
NewRange = Mtftp4AllocateRange ((UINT16) (Num + 1), (UINT16) Range->End);
if (NewRange == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Range->End = Num - 1;
NetListInsertAfter (&Range->Link, &NewRange->Link);
}
return EFI_SUCCESS;
//.........这里部分代码省略.........
示例7: MsCleanupCcb
NTSTATUS
MsCleanupCcb (
IN PMSFS_DEVICE_OBJECT MsfsDeviceObject,
IN PIRP Irp,
IN PCCB Ccb
)
/*++
Routine Description:
The routine cleans up a CCB.
Arguments:
MsfsDeviceObject - A pointer the the mailslot file system device object.
Irp - Supplies the IRP associated with the cleanup.
Ccb - Supplies the CCB for the mailslot to clean up.
Return Value:
NTSTATUS - An appropriate completion status
--*/
{
NTSTATUS status;
PFCB fcb;
PAGED_CODE();
DebugTrace(+1, Dbg, "MsCleanupCcb...\n", 0);
//
// Get a pointer to the FCB.
//
fcb = Ccb->Fcb;
//
// Acquire exclusive access to the FCB
//
MsAcquireExclusiveFcb( fcb );
status = STATUS_SUCCESS;
try {
//
// Ensure that this CCB still belongs to an active open mailslot.
//
MsVerifyCcb( Ccb );
//
// Set the CCB to closing and remove this CCB from the active list.
//
Ccb->Header.NodeState = NodeStateClosing;
RemoveEntryList( &Ccb->CcbLinks );
//
// Cleanup the share access.
//
IoRemoveShareAccess( Ccb->FileObject, &fcb->ShareAccess );
} finally {
MsReleaseFcb( fcb );
DebugTrace(-1, Dbg, "MsCloseFcb -> %08lx\n", status);
}
//
// And return to our caller
//
return status;
}
示例8: BlLoadDeviceDriver
//.........这里部分代码省略.........
DeviceId - Supplies the file id of the device on which the specified
device driver is loaded from.
LoadDevice - Supplies a pointer to a zero terminated load device
string.
DirectoryPath - Supplies a pointer to a zero terminated directory
path string.
DriverName - Supplies a pointer to a zero terminated device driver
name string.
DriverFlags - Supplies the driver flags that are to be set in the
generated data table entry.
DriverDataTableEntry - Receives a pointer to the data table entry
created for the newly-loaded driver.
Return Value:
ESUCCESS is returned if the specified driver is successfully loaded
or it is already loaded. Otherwise, and unsuccessful status is
returned.
--*/
{
CHAR DllName[256];
CHAR FullName[256];
PVOID Base;
ARC_STATUS Status;
//
// Generate the DLL name for the device driver.
//
strcpy(&DllName[0], DriverName);
//
// If the specified device driver is not already loaded, then load it.
//
if (BlCheckForLoadedDll(&DllName[0], DriverDataTableEntry) == FALSE) {
//
// Generate the full path name of device driver.
//
strcpy(&FullName[0], &DirectoryPath[0]);
strcat(&FullName[0], DriverName);
BlOutputLoadMessage(LoadDevice, &FullName[0]);
Status = BlLoadImage(DeviceId,
LoaderBootDriver,
&FullName[0],
TARGET_IMAGE,
&Base);
if (Status != ESUCCESS) {
return Status;
}
//
// Generate a data table entry for the driver, then clear the entry
// processed flag. The I/O initialization code calls each DLL in the
// loaded module list that does not have its entry processed flag set.
//
Status = BlAllocateDataTableEntry(&DllName[0],
DriverName,
Base,
DriverDataTableEntry);
if (Status != ESUCCESS) {
return Status;
}
(*DriverDataTableEntry)->Flags |= DriverFlags;
//
// Scan the import table and load all the referenced DLLs.
//
Status = BlScanImportDescriptorTable(DeviceId,
LoadDevice,
&DirectoryPath[0],
*DriverDataTableEntry);
if (Status != ESUCCESS) {
//
// Remove the driver from the load order list.
//
RemoveEntryList(&(*DriverDataTableEntry)->InLoadOrderLinks);
return Status;
}
}
return ESUCCESS;
}
示例9: WsTcUpdateProtocolList
VOID
WSAAPI
WsTcUpdateProtocolList(IN PTCATALOG Catalog,
IN PLIST_ENTRY List)
{
LIST_ENTRY TempList;
PTCATALOG_ENTRY CatalogEntry, OldCatalogEntry;
PLIST_ENTRY Entry;
/* First move from our list to the old one */
InsertHeadList(&Catalog->ProtocolList, &TempList);
RemoveEntryList(&Catalog->ProtocolList);
InitializeListHead(&Catalog->ProtocolList);
/* Loop every item on the list */
while (!IsListEmpty(List))
{
/* Get the catalog entry */
Entry = RemoveHeadList(List);
CatalogEntry = CONTAINING_RECORD(Entry, TCATALOG_ENTRY, CatalogLink);
/* Check if this item is already on our list */
Entry = TempList.Flink;
while (Entry != &TempList)
{
/* Get the catalog entry */
OldCatalogEntry = CONTAINING_RECORD(Entry, TCATALOG_ENTRY, CatalogLink);
Entry = Entry->Flink;
/* Check if they match */
if (CatalogEntry->ProtocolInfo.dwCatalogEntryId ==
OldCatalogEntry->ProtocolInfo.dwCatalogEntryId)
{
/* We have a match, use the old item instead */
WsTcEntryDereference(CatalogEntry);
CatalogEntry = OldCatalogEntry;
RemoveEntryList(&CatalogEntry->CatalogLink);
/* Decrease the number of protocols we have */
Catalog->ItemCount--;
break;
}
}
/* Add this item */
InsertTailList(&Catalog->ProtocolList, &CatalogEntry->CatalogLink);
Catalog->ItemCount++;
}
/* If there's anything left on the temporary list */
while (!IsListEmpty(&TempList))
{
/* Get the entry */
Entry = RemoveHeadList(&TempList);
CatalogEntry = CONTAINING_RECORD(Entry, TCATALOG_ENTRY, CatalogLink);
/* Remove it */
Catalog->ItemCount--;
WsTcEntryDereference(CatalogEntry);
}
}
示例10: Stop
//.........这里部分代码省略.........
BlockIo = NULL;
BlockIo2 = NULL;
Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiBlockIoProtocolGuid,
(VOID **) &BlockIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
Status = gBS->OpenProtocol (
ChildHandleBuffer[Index],
&gEfiBlockIo2ProtocolGuid,
(VOID **) &BlockIo2,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
AllChildrenStopped = FALSE;
continue;
}
}
if (BlockIo != NULL) {
Device = SD_DEVICE_DATA_FROM_BLKIO (BlockIo);
} else {
ASSERT (BlockIo2 != NULL);
Device = SD_DEVICE_DATA_FROM_BLKIO2 (BlockIo2);
}
//
// Free all on-going async tasks.
//
OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
for (Link = GetFirstNode (&Device->Queue);
!IsNull (&Device->Queue, Link);
Link = NextLink) {
NextLink = GetNextNode (&Device->Queue, Link);
RemoveEntryList (Link);
Request = SD_REQUEST_FROM_LINK (Link);
gBS->CloseEvent (Request->Event);
Request->Token->TransactionStatus = EFI_ABORTED;
if (Request->IsEnd) {
gBS->SignalEvent (Request->Token->Event);
}
FreePool (Request);
}
gBS->RestoreTPL (OldTpl);
//
// Close the child handle
//
Status = gBS->CloseProtocol (
Controller,
&gEfiSdMmcPassThruProtocolGuid,
This->DriverBindingHandle,
ChildHandleBuffer[Index]
);
Status = gBS->UninstallMultipleProtocolInterfaces (
ChildHandleBuffer[Index],
&gEfiDevicePathProtocolGuid,
Device->DevicePath,
&gEfiBlockIoProtocolGuid,
&Device->BlockIo,
&gEfiBlockIo2ProtocolGuid,
&Device->BlockIo2,
&gEfiEraseBlockProtocolGuid,
&Device->EraseBlock,
NULL
);
if (EFI_ERROR (Status)) {
AllChildrenStopped = FALSE;
gBS->OpenProtocol (
Controller,
&gEfiSdMmcPassThruProtocolGuid,
(VOID **)&PassThru,
This->DriverBindingHandle,
ChildHandleBuffer[Index],
EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
);
} else {
FreePool (Device->DevicePath);
FreeUnicodeStringTable (Device->ControllerNameTable);
FreePool (Device);
}
}
if (!AllChildrenStopped) {
return EFI_DEVICE_ERROR;
}
return EFI_SUCCESS;
}
示例11: ExTimerRundown
VOID
NTAPI
ExTimerRundown(VOID)
{
PETHREAD Thread = PsGetCurrentThread();
KIRQL OldIrql;
PLIST_ENTRY CurrentEntry;
PETIMER Timer;
ULONG DerefsToDo;
/* Lock the Thread's Active Timer List and loop it */
KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql);
CurrentEntry = Thread->ActiveTimerListHead.Flink;
while (CurrentEntry != &Thread->ActiveTimerListHead)
{
/* Get the timer */
Timer = CONTAINING_RECORD(CurrentEntry, ETIMER, ActiveTimerListEntry);
/* Reference it */
ObReferenceObject(Timer);
DerefsToDo = 1;
/* Unlock the list */
KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql);
/* Lock the Timer */
KeAcquireSpinLock(&Timer->Lock, &OldIrql);
/* Lock the list again */
KeAcquireSpinLockAtDpcLevel(&Thread->ActiveTimerListLock);
/* Make sure that the timer is valid */
if ((Timer->ApcAssociated) && (&Thread->Tcb == Timer->TimerApc.Thread))
{
/* Remove it from the list */
RemoveEntryList(&Timer->ActiveTimerListEntry);
Timer->ApcAssociated = FALSE;
/* Cancel the timer and remove its DPC and APC */
KeCancelTimer(&Timer->KeTimer);
KeRemoveQueueDpc(&Timer->TimerDpc);
if (KeRemoveQueueApc(&Timer->TimerApc)) DerefsToDo++;
/* Add another dereference to do */
DerefsToDo++;
}
/* Unlock the list */
KeReleaseSpinLockFromDpcLevel(&Thread->ActiveTimerListLock);
/* Unlock the Timer */
KeReleaseSpinLock(&Timer->Lock, OldIrql);
/* Dereference it */
ObDereferenceObjectEx(Timer, DerefsToDo);
/* Loop again */
KeAcquireSpinLock(&Thread->ActiveTimerListLock, &OldIrql);
CurrentEntry = Thread->ActiveTimerListHead.Flink;
}
/* Release lock and return */
KeReleaseSpinLock(&Thread->ActiveTimerListLock, OldIrql);
}
示例12: SmpDeleteSession
VOID
SmpDeleteSession(
IN ULONG SessionId,
IN BOOLEAN SendSessionComplete,
IN NTSTATUS SessionStatus
)
/*++
Routine Description:
This function locates and deletes a session id. If the
SendSessionComplete flag is true, then it also sends a session
complete message to the creator subsystem.
Arguments:
SessionId - Supplies the session id to delete.
SendSessionComplete - Specifies whether a session complete message
is to be sent to the creator subsystem (if one exists).
SessionStatus - Supplies the session completion status
Return Value:
--*/
{
PSMPSESSION Session;
PSMPKNOWNSUBSYS CreatorSubsystem;
RtlEnterCriticalSection(&SmpSessionListLock);
Session = SmpSessionIdToSession(SessionId);
if ( Session ) {
RemoveEntryList(&Session->SortedSessionIdListLinks);
RtlLeaveCriticalSection(&SmpSessionListLock);
CreatorSubsystem = Session->CreatorSubsystem;
RtlFreeHeap(SmpHeap,0,Session);
//
// If there is a creator subsystem, and if
// told to send a session complete message, then do it.
//
if ( CreatorSubsystem && SendSessionComplete ) {
//
// Foreign Session Complete
//
}
} else {
RtlLeaveCriticalSection(&SmpSessionListLock);
}
return;
//
// Make the compiler happy
//
SessionStatus;
}
示例13: ProcessAsyncTaskList
/**
Call back function when the timer event is signaled.
@param[in] Event The Event this notify function registered to.
@param[in] Context Pointer to the context data registered to the
Event.
**/
VOID
EFIAPI
ProcessAsyncTaskList (
IN EFI_EVENT Event,
IN VOID* Context
)
{
NVME_CONTROLLER_PRIVATE_DATA *Private;
EFI_PCI_IO_PROTOCOL *PciIo;
NVME_CQ *Cq;
UINT16 QueueId;
UINT32 Data;
LIST_ENTRY *Link;
LIST_ENTRY *NextLink;
NVME_PASS_THRU_ASYNC_REQ *AsyncRequest;
NVME_BLKIO2_SUBTASK *Subtask;
NVME_BLKIO2_REQUEST *BlkIo2Request;
EFI_BLOCK_IO2_TOKEN *Token;
BOOLEAN HasNewItem;
EFI_STATUS Status;
Private = (NVME_CONTROLLER_PRIVATE_DATA*)Context;
QueueId = 2;
Cq = Private->CqBuffer[QueueId] + Private->CqHdbl[QueueId].Cqh;
HasNewItem = FALSE;
PciIo = Private->PciIo;
//
// Submit asynchronous subtasks to the NVMe Submission Queue
//
for (Link = GetFirstNode (&Private->UnsubmittedSubtasks);
!IsNull (&Private->UnsubmittedSubtasks, Link);
Link = NextLink) {
NextLink = GetNextNode (&Private->UnsubmittedSubtasks, Link);
Subtask = NVME_BLKIO2_SUBTASK_FROM_LINK (Link);
BlkIo2Request = Subtask->BlockIo2Request;
Token = BlkIo2Request->Token;
RemoveEntryList (Link);
BlkIo2Request->UnsubmittedSubtaskNum--;
//
// If any previous subtask fails, do not process subsequent ones.
//
if (Token->TransactionStatus != EFI_SUCCESS) {
if (IsListEmpty (&BlkIo2Request->SubtasksQueue) &&
BlkIo2Request->LastSubtaskSubmitted &&
(BlkIo2Request->UnsubmittedSubtaskNum == 0)) {
//
// Remove the BlockIo2 request from the device asynchronous queue.
//
RemoveEntryList (&BlkIo2Request->Link);
FreePool (BlkIo2Request);
gBS->SignalEvent (Token->Event);
}
FreePool (Subtask->CommandPacket->NvmeCmd);
FreePool (Subtask->CommandPacket->NvmeCompletion);
FreePool (Subtask->CommandPacket);
FreePool (Subtask);
continue;
}
Status = Private->Passthru.PassThru (
&Private->Passthru,
Subtask->NamespaceId,
Subtask->CommandPacket,
Subtask->Event
);
if (Status == EFI_NOT_READY) {
InsertHeadList (&Private->UnsubmittedSubtasks, Link);
BlkIo2Request->UnsubmittedSubtaskNum++;
break;
} else if (EFI_ERROR (Status)) {
Token->TransactionStatus = EFI_DEVICE_ERROR;
if (IsListEmpty (&BlkIo2Request->SubtasksQueue) &&
Subtask->IsLast) {
//
// Remove the BlockIo2 request from the device asynchronous queue.
//
RemoveEntryList (&BlkIo2Request->Link);
FreePool (BlkIo2Request);
gBS->SignalEvent (Token->Event);
}
FreePool (Subtask->CommandPacket->NvmeCmd);
FreePool (Subtask->CommandPacket->NvmeCompletion);
FreePool (Subtask->CommandPacket);
FreePool (Subtask);
} else {
InsertTailList (&BlkIo2Request->SubtasksQueue, Link);
//.........这里部分代码省略.........
示例14: DbgpLocateStateChangeApp
PDBGP_APP_THREAD
DbgpLocateStateChangeApp(
IN PDBGP_USER_INTERFACE UserInterface,
OUT PDBG_STATE PreviousState
)
/*++
Routine Description:
This routine scans the specified user interface's application list
looking for an application whose state has changed. If an
application whose State is not DbgIdle or DbgReplyPending is found,
its address is returned.
Arguments:
UserInterface - Supplies the address of UserInterface whose
application list is to be scanned.
PreviousState - Supplies the address of a variable that returns
the previous debug state of an application thread reporting
a state change.
Return Value:
NULL - No application thread reporting a state change could be located.
NON-NULL - Returns the address of the application thread reporting a state
change.
--*/
{
PLIST_ENTRY HeadProcess, NextProcess;
PLIST_ENTRY HeadThread, NextThread;
PDBGP_APP_THREAD AppThread;
PDBGP_APP_PROCESS AppProcess;
RtlEnterCriticalSection(&UserInterface->UserInterfaceLock);
HeadProcess = &UserInterface->AppProcessListHead;
NextProcess = HeadProcess->Flink;
while ( NextProcess != HeadProcess ) {
//
// For each process managed by the user interface,
// scan its thread list
//
AppProcess = CONTAINING_RECORD(NextProcess,DBGP_APP_PROCESS,AppLinks);
HeadThread = &AppProcess->AppThreadListHead;
NextThread = HeadThread->Flink;
while ( NextThread != HeadThread ) {
AppThread = CONTAINING_RECORD(NextThread,DBGP_APP_THREAD,AppLinks);
if ( DBGP_REPORTING_STATE_CHANGE(AppThread) ) {
*PreviousState = AppThread->CurrentState;
AppThread->ContinueState = AppThread->CurrentState;
AppThread->CurrentState = DbgReplyPending;
//
// Reshuffle so that this thread is placed
// at front of list for process, and so that
// process is placed at front of list for
// user interface
//
RemoveEntryList(&AppThread->AppLinks);
InsertHeadList(
&AppProcess->AppThreadListHead,
&AppThread->AppLinks
);
RemoveEntryList(&AppProcess->AppLinks);
InsertHeadList(
&UserInterface->AppProcessListHead,
&AppProcess->AppLinks
);
RtlLeaveCriticalSection(&UserInterface->UserInterfaceLock);
//DbgpDumpAppThread(AppThread);
return AppThread;
}
NextThread = NextThread->Flink;
}
NextProcess = NextProcess->Flink;
}
RtlLeaveCriticalSection(&UserInterface->UserInterfaceLock);
return NULL;
}
示例15: CoreUpdateProfileFree
//.........这里部分代码省略.........
switch (Action) {
case MemoryProfileActionFreePages:
AllocInfoData = GetMemoryProfileAllocInfoFromAddress (DriverInfoData, MemoryProfileActionAllocatePages, Size, Buffer);
break;
case MemoryProfileActionFreePool:
AllocInfoData = GetMemoryProfileAllocInfoFromAddress (DriverInfoData, MemoryProfileActionAllocatePool, 0, Buffer);
break;
default:
ASSERT (FALSE);
AllocInfoData = NULL;
break;
}
if (AllocInfoData == NULL) {
//
// Legal case, because driver A might free memory allocated by driver B, by some protocol.
//
DriverInfoList = ContextData->DriverInfoList;
for (DriverLink = DriverInfoList->ForwardLink;
DriverLink != DriverInfoList;
DriverLink = DriverLink->ForwardLink) {
ThisDriverInfoData = CR (
DriverLink,
MEMORY_PROFILE_DRIVER_INFO_DATA,
Link,
MEMORY_PROFILE_DRIVER_INFO_SIGNATURE
);
switch (Action) {
case MemoryProfileActionFreePages:
AllocInfoData = GetMemoryProfileAllocInfoFromAddress (ThisDriverInfoData, MemoryProfileActionAllocatePages, Size, Buffer);
break;
case MemoryProfileActionFreePool:
AllocInfoData = GetMemoryProfileAllocInfoFromAddress (ThisDriverInfoData, MemoryProfileActionAllocatePool, 0, Buffer);
break;
default:
ASSERT (FALSE);
AllocInfoData = NULL;
break;
}
if (AllocInfoData != NULL) {
DriverInfoData = ThisDriverInfoData;
break;
}
}
if (AllocInfoData == NULL) {
//
// No matched allocate operation is found for this free operation.
// It is because the specified memory type allocate operation has been
// filtered by CoreNeedRecordProfile(), but free operations have no
// memory type information, they can not be filtered by CoreNeedRecordProfile().
// Then, they will be filtered here.
//
return FALSE;
}
}
Context = &ContextData->Context;
DriverInfo = &DriverInfoData->DriverInfo;
AllocInfo = &AllocInfoData->AllocInfo;
ProfileMemoryIndex = GetProfileMemoryIndex (AllocInfo->MemoryType);
Context->CurrentTotalUsage -= AllocInfo->Size;
Context->CurrentTotalUsageByType[ProfileMemoryIndex] -= AllocInfo->Size;
DriverInfo->CurrentUsage -= AllocInfo->Size;
DriverInfo->CurrentUsageByType[ProfileMemoryIndex] -= AllocInfo->Size;
DriverInfo->AllocRecordCount --;
RemoveEntryList (&AllocInfoData->Link);
if (Action == MemoryProfileActionFreePages) {
if (AllocInfo->Buffer != (PHYSICAL_ADDRESS) (UINTN) Buffer) {
CoreUpdateProfileAllocate (
AllocInfo->CallerAddress,
MemoryProfileActionAllocatePages,
AllocInfo->MemoryType,
(UINTN) ((PHYSICAL_ADDRESS) (UINTN) Buffer - AllocInfo->Buffer),
(VOID *) (UINTN) AllocInfo->Buffer
);
}
if (AllocInfo->Buffer + AllocInfo->Size != ((PHYSICAL_ADDRESS) (UINTN) Buffer + Size)) {
CoreUpdateProfileAllocate (
AllocInfo->CallerAddress,
MemoryProfileActionAllocatePages,
AllocInfo->MemoryType,
(UINTN) ((AllocInfo->Buffer + AllocInfo->Size) - ((PHYSICAL_ADDRESS) (UINTN) Buffer + Size)),
(VOID *) ((UINTN) Buffer + Size)
);
}
}
//
// Use CoreInternalFreePool() that will not update profile for this FreePool action.
//
CoreInternalFreePool (AllocInfoData);
return TRUE;
}