• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ KeAcquireSpinLock函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: HashTableLockShared

/** Locks a given table bucket for shared access.
 *
 *  @param Table Table which bucket is about to be locked.
 *  @param Index A zero-based index of the bucket to lock.
 *  @param Irql Address of variable. If the table is not a dispatch IRQL
 *  one, this parameter is ignored. Otherwise, the variable is filled with
 *  the current IRQL value just before the locking in shared mode is performed.
 *
 *  @remark
 *  If access to the table is not synchronized, the routine performs nothing.
 *
 *  The @link(HASH_TABLE_IRQL_VALIDATE) is used to check whether the caller
 *  runs at a valid IRQL.
 */
static VOID HashTableLockShared(PHASH_TABLE Table, ULONG32 Index, PKIRQL Irql)
{
   HASH_TABLE_IRQL_VALIDATE(Table);
   ASSERT(Index < Table->Size);

   switch (Table->Type) {
      case httPassiveLevel:
         KeEnterCriticalRegion();
         ExAcquireResourceSharedLite(&Table->Locks[Index], TRUE);
         break;
      case httDispatchLevel:
         KeAcquireSpinLock(&Table->DispatchLocks[Index], Irql);
         break;
      case httNoSynchronization:
         break;
      default:
         DEBUG_ERROR("Invalid hash table type: %u", Table->Type);
         break;
   }

   return;
}
开发者ID:MartinDrab,项目名称:IRPMon,代码行数:36,代码来源:hash_table.c


示例2: KeAcquireSpinLock

void
RosKmAdapter::QueueDmaBuffer(
    IN_CONST_PDXGKARG_SUBMITCOMMAND pSubmitCommand)
{
    ROSDMABUFINFO *         pDmaBufInfo = (ROSDMABUFINFO *)pSubmitCommand->pDmaBufferPrivateData;
    KIRQL                   OldIrql;
    ROSDMABUFSUBMISSION *   pDmaBufSubmission;

    KeAcquireSpinLock(&m_dmaBufQueueLock, &OldIrql);

    //
    // Combination indicating preparation error, thus the DMA buffer should be discarded
    //
    if ((pSubmitCommand->DmaBufferPhysicalAddress.QuadPart == 0) &&
            (pSubmitCommand->DmaBufferSubmissionStartOffset == 0) &&
            (pSubmitCommand->DmaBufferSubmissionEndOffset == 0))
    {
        m_ErrorHit.m_PreparationError = 1;
    }

    if (!pDmaBufInfo->m_DmaBufState.m_bSubmittedOnce)
    {
        pDmaBufInfo->m_DmaBufState.m_bSubmittedOnce = 1;
    }

    NT_ASSERT(!IsListEmpty(&m_dmaBufSubmissionFree));

    pDmaBufSubmission = CONTAINING_RECORD(RemoveHeadList(&m_dmaBufSubmissionFree), ROSDMABUFSUBMISSION, m_QueueEntry);

    pDmaBufSubmission->m_pDmaBufInfo = pDmaBufInfo;

    pDmaBufSubmission->m_StartOffset = pSubmitCommand->DmaBufferSubmissionStartOffset;
    pDmaBufSubmission->m_EndOffset = pSubmitCommand->DmaBufferSubmissionEndOffset;
    pDmaBufSubmission->m_SubmissionFenceId = pSubmitCommand->SubmissionFenceId;

    InsertTailList(&m_dmaBufQueue, &pDmaBufSubmission->m_QueueEntry);

    KeReleaseSpinLock(&m_dmaBufQueueLock, OldIrql);
}
开发者ID:eejackliu,项目名称:graphics-driver-samples,代码行数:39,代码来源:RosKmdAdapter.cpp


示例3: NtfsReleaseFCB

VOID
NtfsReleaseFCB(PNTFS_VCB Vcb,
               PNTFS_FCB Fcb)
{
    KIRQL oldIrql;

    DPRINT("releasing FCB at %p: %S, refCount:%d\n",
           Fcb,
           Fcb->PathName,
           Fcb->RefCount);

    KeAcquireSpinLock(&Vcb->FcbListLock, &oldIrql);
    Fcb->RefCount--;
    if (Fcb->RefCount <= 0 && !NtfsFCBIsDirectory(Fcb))
    {
        RemoveEntryList(&Fcb->FcbListEntry);
        CcUninitializeCacheMap(Fcb->FileObject, NULL, NULL);
        NtfsDestroyFCB(Fcb);
    }

    KeReleaseSpinLock(&Vcb->FcbListLock, oldIrql);
}
开发者ID:RareHare,项目名称:reactos,代码行数:22,代码来源:fcb.c


示例4: datapipe_get

ULONG datapipe_get(datapipe_t *dp, char *buf, ULONG size)
{
	struct datapipe_entry *de;
	ULONG result = 0;
	KIRQL irql;

	KeAcquireSpinLock(&dp->guard, &irql);
	de = dp->first;

	if (!de) goto done;
	if (de->size > size) goto done;

	dp->first = de->next;

	memcpy(buf, de->data, de->size);
	result = de->size;

	free(de);
done:
	KeReleaseSpinLock(&dp->guard, irql);
	return result;
}
开发者ID:Endt4sk,项目名称:sebek,代码行数:22,代码来源:datapipe.c


示例5: vboxNewProtDeviceAdded

static NTSTATUS vboxNewProtDeviceAdded(PVBOXMOUSE_DEVEXT pDevExt)
{
    if (!vboxNewProtIsEnabled())
    {
        WARN(("New Protocol is disabled"));
        return STATUS_UNSUCCESSFUL;
    }

    NTSTATUS Status = STATUS_SUCCESS;
    KIRQL Irql;
    KeAcquireSpinLock(&g_ctx.SyncLock, &Irql);
    InsertHeadList(&g_ctx.DevExtList, &pDevExt->ListEntry);
    if (!g_ctx.pCurrentDevExt)
    {
        ASMAtomicWritePtr(&g_ctx.pCurrentDevExt, pDevExt);
        /* ensure the object is not deleted while it is being used by a poller thread */
        ObReferenceObject(pDevExt->pdoSelf);
    }
    KeReleaseSpinLock(&g_ctx.SyncLock, Irql);

    return Status;
}
开发者ID:virendramishra,项目名称:VirtualBox4.1.18,代码行数:22,代码来源:VBoxMFInternal.cpp


示例6: NdasPortClearLpxLocalAddressList

VOID
NdasPortClearLpxLocalAddressList(
	PNDASPORT_DRIVER_EXTENSION DriverExtension)
{
	PLIST_ENTRY entry;
	KIRQL oldIrql;

	KeAcquireSpinLock(&DriverExtension->LpxLocalAddressListSpinLock, &oldIrql);
	
	entry = DriverExtension->LpxLocalAddressList.Flink;
	while (entry != &DriverExtension->LpxLocalAddressList)
	{
		PTDI_ADDRESS_LPX_LIST_ENTRY lpxAddressEntry;

		lpxAddressEntry = CONTAINING_RECORD(
			entry, 
			TDI_ADDRESS_LPX_LIST_ENTRY, 
			ListEntry);

		//
		// Forward the link first
		//
		entry = entry->Flink;
		
		//
		// And remove the actual entry
		//
		RemoveEntryList(&lpxAddressEntry->ListEntry);
		
		//
		// Now we can free the allocated list
		//
		ExFreePoolWithTag(
			lpxAddressEntry,
			NDASPORT_TAG_TDI);
	}

	KeReleaseSpinLock(&DriverExtension->LpxLocalAddressListSpinLock, oldIrql);
}
开发者ID:JanD1943,项目名称:ndas4windows,代码行数:39,代码来源:network.c


示例7: CancelRoutine

VOID CancelRoutine(IN PDEVICE_OBJECT pDevObj, IN PIRP pIrp)
{
  LIST_ENTRY queueToComplete;
  PC0C_IO_PORT pIoPort;
  PC0C_IRP_STATE pState;
  KIRQL oldIrql;
  PC0C_IRP_QUEUE pQueue;

  IoReleaseCancelSpinLock(pIrp->CancelIrql);

  pIoPort = FDO_PORT_TO_IO_PORT(pDevObj);
  pState = GetIrpState(pIrp);
  HALT_UNLESS(pState);

  pQueue = &pIoPort->irpQueues[pState->iQueue];

  InitializeListHead(&queueToComplete);

  KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql);

  if (pState->flags & C0C_IRP_FLAG_IN_QUEUE) {
    RemoveEntryList(&pIrp->Tail.Overlay.ListEntry);
    pState->flags &= ~C0C_IRP_FLAG_IN_QUEUE;
  }

  pIrp->IoStatus.Status = STATUS_CANCELLED;
  InsertTailList(&queueToComplete, &pIrp->Tail.Overlay.ListEntry);

  if (pState->flags & C0C_IRP_FLAG_IS_CURRENT) {
    ShiftQueue(pQueue);

    if (pState->iQueue == C0C_QUEUE_WRITE)
      ReadWrite(pIoPort->pIoPortRemote, FALSE, pIoPort, FALSE, &queueToComplete);
  }

  KeReleaseSpinLock(pIoPort->pIoLock, oldIrql);

  FdoPortCompleteQueue(&queueToComplete);
}
开发者ID:210230,项目名称:com0com,代码行数:39,代码来源:startirp.c


示例8: Notification_Send

void Notification_Send(NOTIFICATION_QUEUE *queue, const PGNOTIFICATION *notification) {
	KIRQL irq;

	KeAcquireSpinLock(&queue->lock, &irq);

	if(IsListEmpty(&queue->irp_list)) {
		if(queue->queued < 64) {
			PGNOTIFYNODE *notifynode;

			notifynode = ExAllocateFromNPagedLookasideList(&queue->lookaside);
			
			InitializeListHead(&notifynode->entry);
			RtlCopyMemory(&notifynode->notification, notification, sizeof(PGNOTIFICATION));

			InsertTailList(&queue->notification_list, &notifynode->entry);
			++queue->queued;
		}
		
		KeReleaseSpinLock(&queue->lock, irq);
	}
	else {
		PGIRPNODE *irpnode = (PGIRPNODE*)RemoveHeadList(&queue->irp_list);
		PGNOTIFICATION *irpnotification = irpnode->irp->AssociatedIrp.SystemBuffer;
		PIRP irp;

		RtlCopyMemory(irpnotification, notification, sizeof(PGNOTIFICATION));

		irp = irpnode->irp;
		ExFreeToNPagedLookasideList(&queue->lookaside, irpnode);

		KeReleaseSpinLock(&queue->lock, irq);

		irp->IoStatus.Status = STATUS_SUCCESS;
		irp->IoStatus.Information = sizeof(PGNOTIFICATION);

		IoCompleteRequest(irp, IO_NO_INCREMENT);
	}
}
开发者ID:Tudi,项目名称:PG2-firewall,代码行数:38,代码来源:notifyqueue.c


示例9: XenM2BPdoUnlink

VOID
XenM2BPdoUnlink(PXENM2B_PDO_EXTENSION pPdoExt,
                BOOLEAN Locked)
{
    PXENM2B_FDO_EXTENSION pFdoExt;
    PXENM2B_HID_CONTEXT   pHidCtx = pPdoExt->pHidCtx;
    PLIST_ENTRY           pEntry = &pPdoExt->ListEntry;
    KIRQL                 Irql;

    ASSERT(pPdoExt->pFdo != NULL);
    pFdoExt = (PXENM2B_FDO_EXTENSION)pPdoExt->pFdo->DeviceExtension;
    ASSERT(pFdoExt != NULL);

    if (!Locked)
        KeAcquireSpinLock(&pFdoExt->PdoListLock, &Irql);

    // If we are unlinking the active Pdo due to a device removal we need to reset the active hid context.
    //
    if (pFdoExt->pActiveHidCtx == pHidCtx) {
        pFdoExt->pActiveHidCtx = NULL;
        XenM2BReleaseHidContext(pHidCtx);
    }

    RemoveEntryList(pEntry);
    pPdoExt->pFdo = NULL;
    ASSERT(pFdoExt->References != 0);
    pFdoExt->References--;

    if (!Locked)
        KeReleaseSpinLock(&pFdoExt->PdoListLock, Irql);

    // If the removed Pdo had the final reference to the Fdo, delete the Fdo now.
    //
    if (pFdoExt->References == 0) {
        ASSERT(!Locked);
        XenM2BDeleteDevice(pFdoExt);
    }
}
开发者ID:OpenXT,项目名称:xc-windows,代码行数:38,代码来源:pdo.c


示例10: RemoveFromListIfAvailable

BOOL
STREAMAPI
RemoveFromListIfAvailable (
    IN OUT PHW_STREAM_REQUEST_BLOCK *pSrb,
    IN KSPIN_LOCK                   *SpinLock,
    IN OUT BOOL                     *BusyFlag,
    IN LIST_ENTRY                   *ListHead
    )
{
    KIRQL                       Irql;

    KeAcquireSpinLock (SpinLock, &Irql);

    //
    // If the queue is now empty, clear the busy flag, and return
    //
    if (IsListEmpty(ListHead)) {
        *BusyFlag = FALSE;
        KeReleaseSpinLock(SpinLock, Irql);
        return FALSE;
    }
    //
    // otherwise extract the SRB
    //
    else {
        PUCHAR          ptr;
        PSRB_EXTENSION  pSrbExt;

        ptr = (PUCHAR)RemoveHeadList(ListHead);
        *BusyFlag = TRUE;
        KeReleaseSpinLock(SpinLock, Irql);
        // Get the SRB out of the SRB extension and return it
        pSrbExt = (PSRB_EXTENSION) (((PUCHAR) ptr) -
                     FIELDOFFSET(SRB_EXTENSION, ListEntry));
        *pSrb = pSrbExt->pSrb;
    }
    return TRUE;
}
开发者ID:cutepig123,项目名称:GeneralUtility,代码行数:38,代码来源:capvideo.c


示例11: AnlgTunerScanRemoveEvent

VOID 
AnlgTunerScanRemoveEvent(
                        PFILE_OBJECT  FileObject,
                        struct _KSEVENT_ENTRY*  EventEntry
	)
{
    KIRQL OldIrql;
    CEncoderDevice* pEncDevice = NULL;

    DbgPrint("AnlgTunerScanRemoveEvent enter!\n");
    PKSFILTER Filter = KsGetFilterFromFileObject(FileObject);
    ASSERT(Filter);
    if (!Filter) return;
    ASSERT(EventEntry);

    PKSDEVICE pDevice = KsFilterGetDevice(Filter);
    pEncDevice = reinterpret_cast<CEncoderDevice *>(pDevice->Context);

    KeAcquireSpinLock(&pEncDevice->EventHandlerSpinLock, &OldIrql);

    if(pEncDevice->ScanInitialization)
		RemoveEntryList(&EventEntry->ListEntry);
    if (pEncDevice->pScanEvent) 
    {

        pEncDevice->pScanEvent = NULL;
        pEncDevice->EventData = NULL;
        pEncDevice->ScanInitialization = FALSE;
        if (EventHandler)//if not already stopped due to the end of the range stop it
        {
            EventHandler->bStopScan = TRUE;
            KeSetEvent(&(EventHandler->TuneEvent), 0,FALSE);
        }
    }
    KeReleaseSpinLock(&pEncDevice->EventHandlerSpinLock, OldIrql);
	return;

}
开发者ID:kcrazy,项目名称:winekit,代码行数:38,代码来源:anlgevent.cpp


示例12: ClasspDequeueIdleRequest

/*++

ClasspDequeueIdleRequest

Routine Description:

    This function will remove the next idle request from the list.
    If there are no requests in the queue, then it will return NULL.

Arguments:

    FdoExtension         - Pointer to the functional device extension

Return Value:

    Pointer to removed IRP

--*/
PIRP
ClasspDequeueIdleRequest(
    PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
    )
{
    PCLASS_PRIVATE_FDO_DATA fdoData = FdoExtension->PrivateFdoData;
    PLIST_ENTRY listEntry = NULL;
    PIRP irp = NULL;
    KIRQL oldIrql;

    KeAcquireSpinLock(&fdoData->IdleListLock, &oldIrql);

    if (fdoData->IdleIoCount > 0) {
        listEntry = RemoveHeadList(&fdoData->IdleIrpList);
        //
        // Make sure we actaully removed a request from the list
        //
        NT_ASSERT(listEntry != &fdoData->IdleIrpList);
        //
        // Decrement the idle I/O count.
        //
        fdoData->IdleIoCount--;
        //
        // Stop the timer on last request
        //
        if (fdoData->IdleIoCount == 0) {
            ClasspStopIdleTimer(fdoData);
        }
        irp = CONTAINING_RECORD(listEntry, IRP, Tail.Overlay.ListEntry);
        NT_ASSERT(irp->Type == IO_TYPE_IRP);


        InitializeListHead(&irp->Tail.Overlay.ListEntry);
    }

    KeReleaseSpinLock(&fdoData->IdleListLock, oldIrql);
    return irp;
}
开发者ID:340211173,项目名称:Windows-driver-samples,代码行数:56,代码来源:clntirp.c


示例13: FdoPortClose

NTSTATUS FdoPortClose(IN PC0C_FDOPORT_EXTENSION pDevExt, IN PIRP pIrp)
{
  NTSTATUS status;
  LIST_ENTRY queueToComplete;
  KIRQL oldIrql;
  PC0C_IO_PORT pIoPort;

  pIoPort = pDevExt->pIoPortLocal;

  pIoPort->isOpen = FALSE;

  if (pIoPort->pIoPortRemote->plugInMode)
    IoInvalidateDeviceRelations(pIoPort->pIoPortRemote->pPhDevObj, BusRelations);

  InitializeListHead(&queueToComplete);

  KeAcquireSpinLock(pIoPort->pIoLock, &oldIrql);

  pIoPort->escapeChar = 0;
  pIoPort->writeHoldingRemote = 0;
  pIoPort->sendXonXoff = 0;
  SetModemControl(pIoPort, C0C_MCR_OUT2, C0C_MCR_MASK | C0C_MCR_OPEN, &queueToComplete);
  FreeBuffer(&pIoPort->readBuf);
  SetBreakHolding(pIoPort, FALSE, &queueToComplete);

  KeReleaseSpinLock(pIoPort->pIoLock, oldIrql);

  FdoPortCompleteQueue(&queueToComplete);

  status = FdoPortStartIrp(pIoPort, pIrp, C0C_QUEUE_CLOSE, StartIrpClose);

  if (status != STATUS_PENDING) {
    pIrp->IoStatus.Status = status;
    IoCompleteRequest(pIrp, IO_NO_INCREMENT);
  }

  return status;
}
开发者ID:Bobfrat,项目名称:coi-services,代码行数:38,代码来源:openclos.c


示例14: vboxVhwaHlpOverlayDstRectUnion

void vboxVhwaHlpOverlayDstRectUnion(PVBOXMP_DEVEXT pDevExt, D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId, RECT *pRect)
{
    if (vboxVhwaHlpOverlayListIsEmpty(pDevExt, VidPnSourceId))
    {
        memset(pRect, 0, sizeof (*pRect));
        return;
    }

    PVBOXWDDM_SOURCE pSource = &pDevExt->aSources[VidPnSourceId];
    KIRQL OldIrql;
    KeAcquireSpinLock(&pSource->OverlayListLock, &OldIrql);
    if (pSource->cOverlays)
    {
        PVBOXWDDM_OVERLAY pOverlay = VBOXWDDM_OVERLAY_FROM_ENTRY(pSource->OverlayList.Flink);
        *pRect = pOverlay->DstRect;
        while (pOverlay->ListEntry.Flink != &pSource->OverlayList)
        {
            pOverlay = VBOXWDDM_OVERLAY_FROM_ENTRY(pOverlay->ListEntry.Flink);
            vboxWddmRectUnite(pRect, &pOverlay->DstRect);
        }
    }
    KeReleaseSpinLock(&pSource->OverlayListLock, OldIrql);
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:23,代码来源:VBoxMPVhwa.cpp


示例15: FspFileNodeSetDirInfo

VOID FspFileNodeSetDirInfo(FSP_FILE_NODE *FileNode, PCVOID Buffer, ULONG Size)
{
    // !PAGED_CODE();

    FSP_FSVOL_DEVICE_EXTENSION *FsvolDeviceExtension =
        FspFsvolDeviceExtension(FileNode->FsvolDeviceObject);
    FSP_FILE_NODE_NONPAGED *NonPaged = FileNode->NonPaged;
    KIRQL Irql;
    UINT64 DirInfo;

    /* no need to acquire the DirInfoSpinLock as the FileNode is acquired */
    DirInfo = NonPaged->DirInfo;

    FspMetaCacheInvalidateItem(FsvolDeviceExtension->DirInfoCache, DirInfo);
    DirInfo = 0 != Buffer ?
        FspMetaCacheAddItem(FsvolDeviceExtension->DirInfoCache, Buffer, Size) : 0;
    FileNode->DirInfoChangeNumber++;

    /* acquire the DirInfoSpinLock to protect against concurrent FspFileNodeInvalidateDirInfo */
    KeAcquireSpinLock(&NonPaged->DirInfoSpinLock, &Irql);
    NonPaged->DirInfo = DirInfo;
    KeReleaseSpinLock(&NonPaged->DirInfoSpinLock, Irql);
}
开发者ID:LucaBongiorni,项目名称:winfsp,代码行数:23,代码来源:file.c


示例16: USBPcapBufferInitializeBuffer

/*
 * If there is buffer allocated for given control device, writes global
 * PCAP header to the buffer, otherwise does nothing.
 */
VOID USBPcapBufferInitializeBuffer(PDEVICE_EXTENSION pDevExt)
{
    PDEVICE_EXTENSION      pRootExt;
    PUSBPCAP_ROOTHUB_DATA  pData;
    KIRQL                  irql;

    ASSERT(pDevExt->deviceMagic == USBPCAP_MAGIC_CONTROL);

    pRootExt = (PDEVICE_EXTENSION)pDevExt->context.control.pRootHubObject->DeviceExtension;
    pData = pRootExt->context.usb.pDeviceData->pRootData;

    if (pData->buffer == NULL)
    {
        return;
    }

    /* Buffer found - reset all data and write global PCAP header */
    KeAcquireSpinLock(&pData->bufferLock, &irql);
    pData->readOffset = 0;
    pData->writeOffset = 0;
    USBPcapWriteGlobalHeader(pData);
    KeReleaseSpinLock(&pData->bufferLock, irql);
}
开发者ID:jue-jiang,项目名称:usbpcap,代码行数:27,代码来源:USBPcapBuffer.c


示例17: free_adapter_list

void
free_adapter_list(void)
{
	KIRQL irql;
	struct adapter_entry *adapter;

	KeAcquireSpinLock(&g_list_guard, &irql);

	__try {

		for (adapter = g_first; adapter != NULL;) {
			struct adapter_entry *adapter2 = adapter->next;
			free(adapter);
			adapter = adapter2;
		}

		g_first = g_last = NULL;
		g_count = 0;

	} __finally {
		KeReleaseSpinLock(&g_list_guard, irql);
	}
}
开发者ID:340211173,项目名称:hf-2011,代码行数:23,代码来源:adapters.c


示例18: usbd_xfer_complete

static void
usbd_xfer_complete(struct ndis_softc *sc, struct ndisusb_ep *ne,
    struct ndisusb_xfer *nx, usb_error_t status)
{
	struct ndisusb_xferdone *nd;
	uint8_t irql;

	nd = malloc(sizeof(struct ndisusb_xferdone), M_USBDEV,
	    M_NOWAIT | M_ZERO);
	if (nd == NULL) {
		device_printf(sc->ndis_dev, "out of memory");
		return;
	}
	nd->nd_xfer = nx;
	nd->nd_status = status;

	KeAcquireSpinLock(&sc->ndisusb_xferdonelock, &irql);
	InsertTailList((&sc->ndisusb_xferdonelist), (&nd->nd_donelist));
	KeReleaseSpinLock(&sc->ndisusb_xferdonelock, irql);

	IoQueueWorkItem(sc->ndisusb_xferdoneitem,
	    (io_workitem_func)usbd_xfertask_wrap, WORKQUEUE_CRITICAL, sc);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:23,代码来源:subr_usbd.c


示例19: SerialSendByte

VOID NTAPI
SerialSendByte(
	IN PKDPC Dpc,
	IN PVOID pDeviceExtension, // real type PSERIAL_DEVICE_EXTENSION
	IN PVOID Unused1,
	IN PVOID Unused2)
{
	PSERIAL_DEVICE_EXTENSION DeviceExtension;
	PUCHAR ComPortBase;
	UCHAR Byte;
	KIRQL Irql;
	UCHAR IER;
	NTSTATUS Status;

	DeviceExtension = (PSERIAL_DEVICE_EXTENSION)pDeviceExtension;
	ComPortBase = ULongToPtr(DeviceExtension->BaseAddress);

	KeAcquireSpinLock(&DeviceExtension->OutputBufferLock, &Irql);
	while (!IsCircularBufferEmpty(&DeviceExtension->OutputBuffer)
		&& READ_PORT_UCHAR(SER_LSR(ComPortBase)) & SR_LSR_THR_EMPTY)
	{
		Status = PopCircularBufferEntry(&DeviceExtension->OutputBuffer, &Byte);
		if (!NT_SUCCESS(Status))
			break;
		WRITE_PORT_UCHAR(SER_THR(ComPortBase), Byte);
		INFO_(SERIAL, "Byte sent to COM%lu: 0x%02x\n",
			DeviceExtension->ComPort, Byte);
		DeviceExtension->SerialPerfStats.TransmittedCount++;
	}
	if (!IsCircularBufferEmpty(&DeviceExtension->OutputBuffer))
	{
		/* allow new interrupts */
		IER = READ_PORT_UCHAR(SER_IER(ComPortBase));
		WRITE_PORT_UCHAR(SER_IER(ComPortBase), IER | SR_IER_THR_EMPTY);
	}
	KeReleaseSpinLock(&DeviceExtension->OutputBufferLock, Irql);
}
开发者ID:GYGit,项目名称:reactos,代码行数:37,代码来源:misc.c


示例20: CheckProtectProcess

NTSTATUS CheckProtectProcess(__in HANDLE ProcessId)
{
	// 这里要先判断链表是否为空
	if (IsListEmpty(&ProtectProcessList.HeadList))
		return STATUS_NOT_FOUND;

	KIRQL irql;
	KeAcquireSpinLock(&ProtectProcessList.Lock, &irql);

	// 链表头
	PLIST_ENTRY pList = ProtectProcessList.HeadList.Flink;

	BOOLEAN isFind = FALSE;
	while (pList != &ProtectProcessList.HeadList)
	{
		PPROTECT_PROCESS element = CONTAINING_RECORD(pList, PROTECT_PROCESS, ListEntry);

		if (element->ProcessId == ProcessId)
		{
			KdPrint(("[ISISandBox] CheckProtectProcess Find ProcessId : %u.\n", element->ProcessId));
			isFind = TRUE;
			break;
		}

		pList = pList->Flink;
	}

	KeReleaseSpinLock(&ProtectProcessList.Lock, irql);

	if (isFind)
		return STATUS_SUCCESS;
	else
	{
		KdPrint(("[ISISandBox] CheckProtectProcess Cannot find ProcessId : %u.\n", ProcessId));
		return STATUS_NOT_FOUND;
	}
}
开发者ID:killbug2004,项目名称:wy-windows-driver,代码行数:37,代码来源:DataStruct.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ KeBugCheck函数代码示例发布时间:2022-05-30
下一篇:
C++ KdScreenPriv函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap