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


C++ ExAcquireResourceSharedLite函数代码示例

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


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

示例1: pnp_cancel_remove_device

static NTSTATUS pnp_cancel_remove_device(PDEVICE_OBJECT DeviceObject) {
    device_extension* Vcb = DeviceObject->DeviceExtension;
    NTSTATUS Status;

    ExAcquireResourceSharedLite(&Vcb->tree_lock, TRUE);

    ExAcquireResourceSharedLite(&Vcb->fileref_lock, TRUE);

    if (Vcb->root_fileref && Vcb->root_fileref->fcb && (Vcb->root_fileref->open_count > 0 || has_open_children(Vcb->root_fileref))) {
        Status = STATUS_ACCESS_DENIED;
        goto end;
    }

    Status = send_disks_pnp_message(Vcb, IRP_MN_CANCEL_REMOVE_DEVICE);
    if (!NT_SUCCESS(Status)) {
        WARN("send_disks_pnp_message returned %08x\n", Status);
        goto end;
    }

end:
    ExReleaseResourceLite(&Vcb->fileref_lock);
    ExReleaseResourceLite(&Vcb->tree_lock);

    return STATUS_SUCCESS;
}
开发者ID:maharmstone,项目名称:btrfs,代码行数:25,代码来源:pnp.c

示例2: FspFileNodeTryAcquireSharedF

BOOLEAN FspFileNodeTryAcquireSharedF(FSP_FILE_NODE *FileNode, ULONG Flags, BOOLEAN Wait)
{
    PAGED_CODE();

    FSP_FILE_NODE_GET_FLAGS();
    FSP_FILE_NODE_ASSERT_FLAGS_CLR();

    BOOLEAN Result = TRUE;

    if (Flags & FspFileNodeAcquireMain)
    {
        Result = ExAcquireResourceSharedLite(FileNode->Header.Resource, Wait);
        if (!Result)
            return FALSE;
    }

    if (Flags & FspFileNodeAcquirePgio)
    {
        Result = ExAcquireResourceSharedLite(FileNode->Header.PagingIoResource, Wait);
        if (!Result)
        {
            if (Flags & FspFileNodeAcquireMain)
                ExReleaseResourceLite(FileNode->Header.Resource);
            return FALSE;
        }
    }

    if (Result)
        FSP_FILE_NODE_SET_FLAGS();

    return Result;
}
开发者ID:LucaBongiorni,项目名称:winfsp,代码行数:32,代码来源:file.c

示例3: TestResourceExclusiveAccess

static
VOID
TestResourceExclusiveAccess(
    IN PERESOURCE Res)
{
    LONG Count = 0;

    KeEnterCriticalRegion();
    ok_bool_true(ExAcquireResourceExclusiveLite(Res, FALSE), "ExAcquireResourceExclusiveLite returned"); ++Count;

    CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);

    ok_bool_true(ExAcquireResourceExclusiveLite(Res, TRUE), "ExAcquireResourceExclusiveLite returned"); ++Count;
    CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);

    ok_bool_true(ExAcquireResourceSharedLite(Res, FALSE), "ExAcquireResourceSharedLite returned"); ++Count;
    ok_bool_true(ExAcquireResourceSharedLite(Res, TRUE), "ExAcquireResourceSharedLite returned"); ++Count;
    ok_bool_true(ExAcquireSharedStarveExclusive(Res, FALSE), "ExAcquireSharedStarveExclusive returned"); ++Count;
    ok_bool_true(ExAcquireSharedStarveExclusive(Res, TRUE), "ExAcquireSharedStarveExclusive returned"); ++Count;
    ok_bool_true(ExAcquireSharedWaitForExclusive(Res, FALSE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
    ok_bool_true(ExAcquireSharedWaitForExclusive(Res, TRUE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
    CheckResourceStatus(Res, TRUE, Count, 0LU, 0LU);

    ExConvertExclusiveToSharedLite(Res);
    CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);

    while (Count--)
        ExReleaseResourceLite(Res);
    KeLeaveCriticalRegion();
}
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:30,代码来源:ExResource.c

示例4: TestResourceSharedAccess

static
VOID
TestResourceSharedAccess(
    IN PERESOURCE Res)
{
    LONG Count = 0;

    KeEnterCriticalRegion();
    ok_bool_true(ExAcquireResourceSharedLite(Res, FALSE), "ExAcquireResourceSharedLite returned"); ++Count;
    CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);

    ok_bool_true(ExAcquireResourceSharedLite(Res, FALSE), "ExAcquireResourceSharedLite returned"); ++Count;
    ok_bool_true(ExAcquireResourceSharedLite(Res, TRUE), "ExAcquireResourceSharedLite returned"); ++Count;
    ok_bool_true(ExAcquireSharedStarveExclusive(Res, FALSE), "ExAcquireSharedStarveExclusive returned"); ++Count;
    ok_bool_true(ExAcquireSharedStarveExclusive(Res, TRUE), "ExAcquireSharedStarveExclusive returned"); ++Count;
    ok_bool_true(ExAcquireSharedWaitForExclusive(Res, FALSE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
    ok_bool_true(ExAcquireSharedWaitForExclusive(Res, TRUE), "ExAcquireSharedWaitForExclusive returned"); ++Count;
    CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);

    /* this one fails, TRUE would deadlock */
    ok_bool_false(ExAcquireResourceExclusiveLite(Res, FALSE), "ExAcquireResourceExclusiveLite returned");
    CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);

    /* this asserts */
    if (!KmtIsCheckedBuild)
        ExConvertExclusiveToSharedLite(Res);
    CheckResourceStatus(Res, FALSE, Count, 0LU, 0LU);

    while (Count--)
        ExReleaseResourceLite(Res);
    KeLeaveCriticalRegion();
}
开发者ID:mutoso-mirrors,项目名称:reactos,代码行数:32,代码来源:ExResource.c

示例5: FspFileNodeAcquireSharedF

VOID FspFileNodeAcquireSharedF(FSP_FILE_NODE *FileNode, ULONG Flags)
{
    PAGED_CODE();

    FSP_FILE_NODE_GET_FLAGS();
    FSP_FILE_NODE_ASSERT_FLAGS_CLR();

    if (Flags & FspFileNodeAcquireMain)
        ExAcquireResourceSharedLite(FileNode->Header.Resource, TRUE);

    if (Flags & FspFileNodeAcquirePgio)
        ExAcquireResourceSharedLite(FileNode->Header.PagingIoResource, TRUE);

    FSP_FILE_NODE_SET_FLAGS();
}
开发者ID:LucaBongiorni,项目名称:winfsp,代码行数:15,代码来源:file.c

示例6: DokanCheckKeepAlive

VOID DokanCheckKeepAlive(__in PDokanDCB Dcb) {
  LARGE_INTEGER tickCount;
  ULONG mounted;

  // DDbgPrint("==> DokanCheckKeepAlive\n");

  KeEnterCriticalRegion();
  KeQueryTickCount(&tickCount);
  ExAcquireResourceSharedLite(&Dcb->Resource, TRUE);

  if (Dcb->TickCount.QuadPart < tickCount.QuadPart) {

    mounted = Dcb->Mounted;

    ExReleaseResourceLite(&Dcb->Resource);

    DDbgPrint("  Timeout, umount\n");

    if (!mounted) {
      // not mounted
      KeLeaveCriticalRegion();
      return;
    }
    DokanUnmount(Dcb);

  } else {
    ExReleaseResourceLite(&Dcb->Resource);
  }

  KeLeaveCriticalRegion();
  // DDbgPrint("<== DokanCheckKeepAlive\n");
}
开发者ID:Driim,项目名称:dokany,代码行数:32,代码来源:timeout.c

示例7: vol_get_length

static NTSTATUS vol_get_length(volume_device_extension* vde, PIRP Irp) {
    PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp);
    pdo_device_extension* pdode = vde->pdode;
    GET_LENGTH_INFORMATION* gli;
    LIST_ENTRY* le;

    if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(GET_LENGTH_INFORMATION))
        return STATUS_BUFFER_TOO_SMALL;

    gli = (GET_LENGTH_INFORMATION*)Irp->AssociatedIrp.SystemBuffer;

    gli->Length.QuadPart = 0;

    ExAcquireResourceSharedLite(&pdode->child_lock, TRUE);

    le = pdode->children.Flink;
    while (le != &pdode->children) {
        volume_child* vc = CONTAINING_RECORD(le, volume_child, list_entry);

        gli->Length.QuadPart += vc->size;

        le = le->Flink;
    }

    ExReleaseResourceLite(&pdode->child_lock);

    Irp->IoStatus.Information = sizeof(GET_LENGTH_INFORMATION);

    return STATUS_SUCCESS;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:30,代码来源:volume.c

示例8: vol_is_writable

static NTSTATUS vol_is_writable(volume_device_extension* vde) {
    pdo_device_extension* pdode = vde->pdode;
    NTSTATUS Status;
    LIST_ENTRY* le;
    BOOL writable = FALSE;

    ExAcquireResourceSharedLite(&pdode->child_lock, TRUE);

    le = pdode->children.Flink;
    while (le != &pdode->children) {
        volume_child* vc = CONTAINING_RECORD(le, volume_child, list_entry);

        Status = dev_ioctl(vc->devobj, IOCTL_DISK_IS_WRITABLE, NULL, 0, NULL, 0, TRUE, NULL);

        if (NT_SUCCESS(Status)) {
            writable = TRUE;
            break;
        } else if (Status != STATUS_MEDIA_WRITE_PROTECTED)
            goto end;

        le = le->Flink;
    }

    Status = writable ? STATUS_SUCCESS : STATUS_MEDIA_WRITE_PROTECTED;

end:
ExReleaseResourceLite(&pdode->child_lock);

    return STATUS_SUCCESS;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:30,代码来源:volume.c

示例9: CdAcquireForCache

BOOLEAN
CdAcquireForCache (
    _Inout_ PFCB Fcb,
    _In_ BOOLEAN Wait
    )

/*++

Routine Description:

    The address of this routine is specified when creating a CacheMap for
    a file.  It is subsequently called by the Lazy Writer for synchronization.

Arguments:

    Fcb -  The pointer supplied as context to the cache initialization
           routine.

    Wait - TRUE if the caller is willing to block.

Return Value:

    None

--*/

{
    PAGED_CODE();

    NT_ASSERT(IoGetTopLevelIrp() == NULL);
    IoSetTopLevelIrp((PIRP)FSRTL_CACHE_TOP_LEVEL_IRP);

    return ExAcquireResourceSharedLite( Fcb->Resource, Wait );
}
开发者ID:Realhram,项目名称:wdk81,代码行数:34,代码来源:resrcsup.c

示例10: pnp_remove_device

static NTSTATUS pnp_remove_device(PDEVICE_OBJECT DeviceObject) {
    device_extension* Vcb = DeviceObject->DeviceExtension;
    NTSTATUS Status;

    ExAcquireResourceSharedLite(&Vcb->tree_lock, TRUE);

    Status = send_disks_pnp_message(Vcb, IRP_MN_REMOVE_DEVICE);

    if (!NT_SUCCESS(Status))
        WARN("send_disks_pnp_message returned %08x\n", Status);

    ExReleaseResourceLite(&Vcb->tree_lock);

    if (DeviceObject->Vpb->Flags & VPB_MOUNTED) {
        Status = FsRtlNotifyVolumeEvent(Vcb->root_file, FSRTL_VOLUME_DISMOUNT);
        if (!NT_SUCCESS(Status)) {
            WARN("FsRtlNotifyVolumeEvent returned %08x\n", Status);
        }

        if (Vcb->vde)
            Vcb->vde->mounted_device = NULL;

        ExAcquireResourceExclusiveLite(&Vcb->tree_lock, TRUE);
        Vcb->removing = TRUE;
        ExReleaseResourceLite(&Vcb->tree_lock);

        if (Vcb->open_files == 0)
            uninit(Vcb);
    }

    return STATUS_SUCCESS;
}
开发者ID:maharmstone,项目名称:btrfs,代码行数:32,代码来源:pnp.c

示例11: KeEnterCriticalRegion

dev_hook *dc_find_hook(wchar_t *dev_name)
{
	PLIST_ENTRY entry;
	dev_hook   *hook;
	dev_hook   *found = NULL;

	KeEnterCriticalRegion();
	ExAcquireResourceSharedLite(&hooks_sync_resource, TRUE);

	entry = hooks_list_head.Flink;

	while (entry != &hooks_list_head)
	{
		hook  = CONTAINING_RECORD(entry, dev_hook, hooks_list);
		entry = entry->Flink;

		if (_wcsicmp(hook->dev_name, dev_name) == 0) {
			dc_reference_hook(hook);
			found = hook; break;
		}
	}
	
	ExReleaseResourceLite(&hooks_sync_resource);
	KeLeaveCriticalRegion();

	return found;
}
开发者ID:smartinm,项目名称:diskcryptor,代码行数:27,代码来源:devhook.c

示例12: vol_check_verify

static NTSTATUS vol_check_verify(volume_device_extension* vde) {
    pdo_device_extension* pdode = vde->pdode;
    NTSTATUS Status;
    LIST_ENTRY* le;

    ExAcquireResourceSharedLite(&pdode->child_lock, TRUE);

    le = pdode->children.Flink;
    while (le != &pdode->children) {
        volume_child* vc = CONTAINING_RECORD(le, volume_child, list_entry);

        Status = dev_ioctl(vc->devobj, IOCTL_STORAGE_CHECK_VERIFY, NULL, 0, NULL, 0, FALSE, NULL);
        if (!NT_SUCCESS(Status))
            goto end;

        le = le->Flink;
    }

    Status = STATUS_SUCCESS;

end:
    ExReleaseResourceLite(&pdode->child_lock);

    return Status;
}
开发者ID:Moteesh,项目名称:reactos,代码行数:25,代码来源:volume.c

示例13: dc_probe_decrypt

static 
int dc_probe_decrypt(dev_hook *hook, dc_header **header, xts_key **res_key, dc_pass *password)
{
	xts_key  *hdr_key;
	dsk_pass *d_pass;	
	int       resl, succs;

	hdr_key = NULL; succs = 0; *header = NULL;
	do
	{
		/* read raw volume header */
		if ( (resl = io_read_header(hook, header, NULL, NULL)) != ST_OK ) {
			break;
		}
		if ( (hdr_key = mm_secure_alloc(sizeof(xts_key))) == NULL ) {
			resl = ST_NOMEM; break;
		}

		/* derive header key and decrypt header */
		do
		{
			if (password != NULL)
			{
				/* probe mount with entered password */
				if (succs = cp_decrypt_header(hdr_key, *header, password)) {
					break;
				}
			}

			KeEnterCriticalRegion();
			ExAcquireResourceSharedLite(&p_resource, TRUE);

			/* probe mount with cached passwords */
			for (d_pass = f_pass; d_pass; d_pass = d_pass->next)
			{
				if (succs = cp_decrypt_header(hdr_key, *header, &d_pass->pass)) {
					break;
				}
			}

			ExReleaseResourceLite(&p_resource);
			KeLeaveCriticalRegion();
		} while (0);

		if (succs != 0) {
			*res_key = hdr_key; hdr_key = NULL; resl = ST_OK; 
		} else {
			resl = ST_PASS_ERR;
		}
	} while (0);

	if (resl != ST_OK && *header != NULL) {
		mm_secure_free(*header); *header = NULL;
	}
	if (hdr_key != NULL) {
		mm_secure_free(hdr_key);
	}
	return resl;
}
开发者ID:the-alien,项目名称:diskcryptor,代码行数:59,代码来源:mount.c

示例14: VfsAcqReadAhead

//
//	acquire for read ahead
//
BOOLEAN DDKAPI VfsAcqReadAhead(PVOID context, BOOLEAN wait)
{
	PLKLFCB fcb = (PLKLFCB) context;

	ASSERT(fcb);
	ASSERT((fcb->id.type == FCB) && (fcb->id.size == sizeof(PLKLFCB)));
	
	return ExAcquireResourceSharedLite(&(fcb->fcb_resource), wait);
}
开发者ID:luciang,项目名称:lklvfs,代码行数:12,代码来源:cmcallbacks.c

示例15: MrLockGlobal

BOOLEAN MrLockGlobal(BOOLEAN ex)
{
    KeEnterCriticalRegion();

    if (!ex)
        return ExAcquireResourceSharedLite(&g_core.mc_lock, TRUE);

    return ExAcquireResourceExclusiveLite(&g_core.mc_lock, TRUE);
}
开发者ID:matt-wu,项目名称:Moure,代码行数:9,代码来源:moure.c


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