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

C++ ExInitializeResourceLite函数代码示例

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

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



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

示例1: CdfsCreateFCB

PFCB
CdfsCreateFCB(PCWSTR FileName)
{
    PFCB Fcb;

    Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(FCB), TAG_FCB);
    if(!Fcb) return NULL;

    RtlZeroMemory(Fcb, sizeof(FCB));

    if (FileName)
    {
        wcscpy(Fcb->PathName, FileName);
        if (wcsrchr(Fcb->PathName, '\\') != 0)
        {
            Fcb->ObjectName = wcsrchr(Fcb->PathName, '\\');
        }
        else
        {
            Fcb->ObjectName = Fcb->PathName;
        }
    }

    ExInitializeResourceLite(&Fcb->PagingIoResource);
    ExInitializeResourceLite(&Fcb->MainResource);
    ExInitializeResourceLite(&Fcb->NameListResource);
    Fcb->RFCB.PagingIoResource = &Fcb->PagingIoResource;
    Fcb->RFCB.Resource = &Fcb->MainResource;
    Fcb->RFCB.IsFastIoPossible = FastIoIsNotPossible;
    InitializeListHead(&Fcb->ShortNameList);

    return(Fcb);
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:33,代码来源:fcb.c


示例2: DokanAllocateFCB

// We must NOT call without VCB lcok
PDokanFCB
DokanAllocateFCB(
	__in PDokanVCB Vcb
	)
{
	PDokanFCB fcb = ExAllocatePool(sizeof(DokanFCB));

	if (fcb == NULL) {
		return NULL;
	}

	ASSERT(fcb != NULL);
	ASSERT(Vcb != NULL);

	RtlZeroMemory(fcb, sizeof(DokanFCB));

	fcb->Identifier.Type = FCB;
	fcb->Identifier.Size = sizeof(DokanFCB);

	fcb->Vcb = Vcb;

	ExInitializeResourceLite(&fcb->MainResource);
	ExInitializeResourceLite(&fcb->PagingIoResource);

	ExInitializeFastMutex(&fcb->AdvancedFCBHeaderMutex);

#if _WIN32_WINNT >= 0x0501
	FsRtlSetupAdvancedHeader(&fcb->AdvancedFCBHeader, &fcb->AdvancedFCBHeaderMutex);
#else
	if (DokanFsRtlTeardownPerStreamContexts) {
		FsRtlSetupAdvancedHeader(&fcb->AdvancedFCBHeader, &fcb->AdvancedFCBHeaderMutex);
	}
#endif


	fcb->AdvancedFCBHeader.ValidDataLength.LowPart = 0xffffffff;
	fcb->AdvancedFCBHeader.ValidDataLength.HighPart = 0x7fffffff;

	fcb->AdvancedFCBHeader.Resource = &fcb->MainResource;
	fcb->AdvancedFCBHeader.PagingIoResource = &fcb->PagingIoResource;

	fcb->AdvancedFCBHeader.AllocationSize.QuadPart = 4096;
	fcb->AdvancedFCBHeader.FileSize.QuadPart = 4096;

	fcb->AdvancedFCBHeader.IsFastIoPossible = FastIoIsNotPossible;

	ExInitializeResourceLite(&fcb->Resource);

	InitializeListHead(&fcb->NextCCB);
	InsertTailList(&Vcb->NextFCB, &fcb->NextFCB);

	InterlockedIncrement(&Vcb->FcbAllocated);

	return fcb;
}
开发者ID:nmlgc,项目名称:dokany,代码行数:56,代码来源:create.c


示例3: FatCreateDcb

PFCB
NTAPI
FatCreateDcb(IN PFAT_IRP_CONTEXT IrpContext,
             IN PVCB Vcb,
             IN PFCB ParentDcb,
             IN FF_FILE *FileHandle)
{
    PFCB Fcb;

    /* Allocate it and zero it */
    Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(FCB), TAG_FCB);
    RtlZeroMemory(Fcb, sizeof(FCB));

    /* Set node types */
    Fcb->Header.NodeTypeCode = FAT_NTC_DCB;
    Fcb->Header.NodeByteSize = sizeof(FCB);
    Fcb->Condition = FcbGood;

    /* Initialize resources */
    Fcb->Header.Resource = &Fcb->Resource;
    ExInitializeResourceLite(Fcb->Header.Resource);

    Fcb->Header.PagingIoResource = &Fcb->PagingIoResource;
    ExInitializeResourceLite(Fcb->Header.PagingIoResource);

    /* Initialize mutexes */
    Fcb->Header.FastMutex = &Fcb->HeaderMutex;
    ExInitializeFastMutex(&Fcb->HeaderMutex);
    FsRtlSetupAdvancedHeader(&Fcb->Header, &Fcb->HeaderMutex);

    /* Insert into parent's DCB list */
    InsertHeadList(&ParentDcb->Dcb.ParentDcbList, &Fcb->ParentDcbLinks);

    /* Set backlinks */
    Fcb->ParentFcb = ParentDcb;
    Fcb->Vcb = Vcb;

    /* Initialize parent dcb list */
    InitializeListHead(&Fcb->Dcb.ParentDcbList);

    /* Set FullFAT handle */
    Fcb->FatHandle = FileHandle;

    /* Set names */
    if (FileHandle)
    {
        FatSetFcbNames(IrpContext, Fcb);

        /* Ensure the full name is set */
        FatSetFullFileNameInFcb(IrpContext, Fcb);
    }

    return Fcb;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:54,代码来源:dir.c


示例4: FatCreateFcb

PFCB
NTAPI
FatCreateFcb(IN PFAT_IRP_CONTEXT IrpContext,
             IN PVCB Vcb,
             IN PFCB ParentDcb,
             IN FF_FILE *FileHandle)
{
    PFCB Fcb;

    /* Allocate it and zero it */
    Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(FCB), TAG_FCB);
    RtlZeroMemory(Fcb, sizeof(FCB));

    /* Set node types */
    Fcb->Header.NodeTypeCode = FAT_NTC_FCB;
    Fcb->Header.NodeByteSize = sizeof(FCB);
    Fcb->Condition = FcbGood;

    /* Initialize resources */
    Fcb->Header.Resource = &Fcb->Resource;
    ExInitializeResourceLite(Fcb->Header.Resource);

    Fcb->Header.PagingIoResource = &Fcb->PagingIoResource;
    ExInitializeResourceLite(Fcb->Header.PagingIoResource);

    /* Initialize mutexes */
    Fcb->Header.FastMutex = &Fcb->HeaderMutex;
    ExInitializeFastMutex(&Fcb->HeaderMutex);
    FsRtlSetupAdvancedHeader(&Fcb->Header, &Fcb->HeaderMutex);

    /* Insert into parent's DCB list */
    InsertTailList(&ParentDcb->Dcb.ParentDcbList, &Fcb->ParentDcbLinks);

    /* Set backlinks */
    Fcb->ParentFcb = ParentDcb;
    Fcb->Vcb = Vcb;

    /* Set file handle and sizes */
    Fcb->Header.FileSize.LowPart = FileHandle->Filesize;
    Fcb->Header.ValidDataLength.LowPart = FileHandle->Filesize;
    Fcb->FatHandle = FileHandle;

    /* Initialize locks */
    FsRtlInitializeFileLock(&Fcb->Fcb.Lock, NULL, NULL);
    FsRtlInitializeOplock(&Fcb->Fcb.Oplock);

    /* Set names */
    FatSetFcbNames(IrpContext, Fcb);

    return Fcb;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:51,代码来源:fcb.c


示例5: InitTimerImpl

INIT_FUNCTION
NTSTATUS
NTAPI
InitTimerImpl(VOID)
{
   ULONG BitmapBytes;

   ExInitializeFastMutex(&Mutex);

   BitmapBytes = ROUND_UP(NUM_WINDOW_LESS_TIMERS, sizeof(ULONG) * 8) / 8;
   WindowLessTimersBitMapBuffer = ExAllocatePoolWithTag(NonPagedPool, BitmapBytes, TAG_TIMERBMP);
   if (WindowLessTimersBitMapBuffer == NULL)
   {
      return STATUS_UNSUCCESSFUL;
   }

   RtlInitializeBitMap(&WindowLessTimersBitMap,
                       WindowLessTimersBitMapBuffer,
                       BitmapBytes * 8);

   /* yes we need this, since ExAllocatePoolWithTag isn't supposed to zero out allocated memory */
   RtlClearAllBits(&WindowLessTimersBitMap);

   ExInitializeResourceLite(&TimerLock);
   InitializeListHead(&TimersListHead);

   return STATUS_SUCCESS;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:28,代码来源:timer.c


示例6: InitUserImpl

INIT_FUNCTION
NTSTATUS
NTAPI
InitUserImpl(VOID)
{
    NTSTATUS Status;

    ExInitializeResourceLite(&UserLock);

    if (!UserCreateHandleTable())
    {
        ERR("Failed creating handle table\n");
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    Status = InitSessionImpl();
    if (!NT_SUCCESS(Status))
    {
        ERR("Error init session impl.\n");
        return Status;
    }

    InitUserAtoms();

    InitSysParams();

    return STATUS_SUCCESS;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:28,代码来源:ntuser.c


示例7: SepInitializeWorkList

BOOLEAN
SepInitializeWorkList(
    VOID
    )

/*++

Routine Description:

    Initializes the mutex and list head used to queue work from the
    Executive to LSA.  This mechanism operates on top of the normal ExWorkerThread
    mechanism by capturing the first thread to perform LSA work and keeping it
    until all the current work is done.

    The reduces the number of worker threads that are blocked on I/O to LSA.

Arguments:

    None.


Return Value:

    TRUE if successful, FALSE otherwise.

--*/

{
    PAGED_CODE();

    ExInitializeResourceLite(&SepLsaQueueLock);
    InitializeListHead(&SepLsaQueue);
    return( TRUE );
}
开发者ID:AlexiaChen,项目名称:wrk_study,代码行数:34,代码来源:seglobal.c


示例8: DriverEntry

NTSTATUS 
DriverEntry(
    PDRIVER_OBJECT DriverObject,
    PUNICODE_STRING RegistryPath )
{
    NTSTATUS            Status;

    UNREFERENCED_PARAMETER(RegistryPath);

    DriverObject->DriverUnload  = DriverUnload;

    DbgPrint ( "%s DriverObject=%p\n", __FUNCTION__, DriverObject );

    // Step #1 : Initialize the lock that protects the g_Tidxxx globals (ExInitializeResourceLite())
    ExInitializeResourceLite(&g_TidLock);

    Status = PsSetCreateThreadNotifyRoutine( ThreadNotifyCallback ); 
    if ( ! NT_SUCCESS ( Status ) ) {
        DbgPrint ( "%s PsSetCreateThreadNotifyRoutine() FAIL=%08x\n", __FUNCTION__, Status );
        goto Exit;
    }

    Status = STATUS_SUCCESS;

Exit :
    return Status;
}
开发者ID:EternalKeel,项目名称:CodeMachineCourse,代码行数:27,代码来源:locking.c


示例9: _DymArraySynchronizationAlloc

static NTSTATUS _DymArraySynchronizationAlloc(PUTILS_DYM_ARRAY Array)
{
	NTSTATUS status = STATUS_UNSUCCESSFUL;
	DEBUG_ENTER_FUNCTION("Array=0x%p", Array);

	switch (Array->PoolType) {
		case PagedPool:
			Array->LockPaged = (PERESOURCE)HeapMemoryAllocNonPaged(sizeof(ERESOURCE));
			if (Array->LockPaged != NULL) {
				status = ExInitializeResourceLite(Array->LockPaged);
				if (!NT_SUCCESS(status))
					HeapMemoryFree(Array->LockPaged);
			} else status = STATUS_INSUFFICIENT_RESOURCES;
			break;
		case NonPagedPool:
			Array->LockNonPaged = (PKSPIN_LOCK)HeapMemoryAllocNonPaged(sizeof(KSPIN_LOCK));
			if (Array->LockNonPaged != NULL) {
				KeInitializeSpinLock(Array->LockNonPaged);
				status = STATUS_SUCCESS;
			} else status = STATUS_INSUFFICIENT_RESOURCES;
			break;
		default:
			DEBUG_ERROR("Invalid pool type supplied (%u)", Array->PoolType);
			status = STATUS_NOT_SUPPORTED;
			break;
	}

	DEBUG_EXIT_FUNCTION("0x%x", status);
	return status;
}
开发者ID:MartinDrab,项目名称:Hackerfest2015,代码行数:30,代码来源:utils-dym-array.c


示例10: DokanAllocateCCB

PDokanCCB
DokanAllocateCCB(
	__in PDokanDCB	Dcb,
	__in PDokanFCB	Fcb
	)
{
	PDokanCCB ccb = ExAllocatePool(sizeof(DokanCCB));

	if (ccb == NULL)
		return NULL;

	ASSERT(ccb != NULL);
	ASSERT(Fcb != NULL);

	RtlZeroMemory(ccb, sizeof(DokanCCB));

	ccb->Identifier.Type = CCB;
	ccb->Identifier.Size = sizeof(DokanCCB);

	ccb->Fcb = Fcb;

	ExInitializeResourceLite(&ccb->Resource);

	InitializeListHead(&ccb->NextCCB);

	ExAcquireResourceExclusiveLite(&Fcb->Resource, TRUE);
	InsertTailList(&Fcb->NextCCB, &ccb->NextCCB);
	ExReleaseResourceLite(&Fcb->Resource);

	ccb->MountId = Dcb->MountId;

	return ccb;
}
开发者ID:DieBagger,项目名称:MediaPortal-2,代码行数:33,代码来源:create.c


示例11: IopInitBootLog

VOID
INIT_FUNCTION
IopInitBootLog(BOOLEAN StartBootLog)
{
    ExInitializeResourceLite(&IopBootLogResource);
    if (StartBootLog) IopStartBootLog();
}
开发者ID:hoangduit,项目名称:reactos,代码行数:7,代码来源:bootlog.c


示例12: SortedListCreate

NTSTATUS SortedListCreate(	OUT PSORTED_LIST pSortedList,IN ULONG uSizeOfEntry, IN POOL_TYPE poolType,
                            IN ULONG uPoolTag, IN BOOLEAN bMultiThread, IN SORTEDLISTENTRYCLEANUP pfnCleanupFunc
                         )
{
    ASSERTMSG("Pointer to sorted list must not be NULL", pSortedList != NULL);
    ASSERTMSG("Cleanup function must not be NULL", pfnCleanupFunc != NULL);

    NTSTATUS status = STATUS_SUCCESS;
    // initialize all variables of the sorted list
    RtlZeroMemory(pSortedList, sizeof(SORTED_LIST));
    pSortedList->poolType = poolType;
    pSortedList->uPoolTag = uPoolTag;
    pSortedList->uSizeOfEntry = uSizeOfEntry;
    pSortedList->uElementCount = 0;
    pSortedList->head = pSortedList->tail = NULL;
    pSortedList->bIsMultiThread = bMultiThread;
    pSortedList->bIsWriteLocked = FALSE;
    pSortedList->lReaderCount = 0;
    pSortedList->pLock = NULL;

    // if multithreaded list
    if(bMultiThread)
    {
        pSortedList->pLock = (PERESOURCE) ExAllocatePoolWithTag(NonPagedPool, sizeof(ERESOURCE), uPoolTag);
        status = ExInitializeResourceLite(pSortedList->pLock);
    }

    pSortedList->pfnEntryCleanup = pfnCleanupFunc;

    return status;
}
开发者ID:vmurafa,项目名称:dementia-forensics,代码行数:31,代码来源:SortedList.cpp


示例13: HandleTableCreate

NTSTATUS HandleTableCreate(EHashTableType HandleTableType, CHANDLE_TABLE_HANDLE_CREATED *HandleCreateProcedure, CHANDLE_TABLE_HANDLE_DELETED *HandleDeleteProcedure, CHANDLE_TABLE_HANDLE_TRANSLATED *HandleTranslateProcedure, PCHANDLE_TABLE *HandleTable)
{
	POOL_TYPE poolType = (HandleTableType == httPassiveLevel) ? PagedPool : NonPagedPool;
	PCHANDLE_TABLE tmpHandleTable = NULL;
	NTSTATUS status = STATUS_UNSUCCESSFUL;
	DEBUG_ENTER_FUNCTION("HandleTableType=%u; HandleCreateProcedure=0x%p; HandleDeleteProcedure=0x%p; HandleTranslateProcedure=0x%p; HandleTable=0x%p", HandleTableType, HandleCreateProcedure, HandleDeleteProcedure, HandleTranslateProcedure, HandleTable);

	tmpHandleTable = (PCHANDLE_TABLE)HeapMemoryAllocNonPaged(sizeof(CHANDLE_TABLE));
	if (tmpHandleTable != NULL) {
		tmpHandleTable->NextFreeHandle = 1;
		tmpHandleTable->HandleTableType = HandleTableType;
		tmpHandleTable->PoolType = poolType;
		tmpHandleTable->HandleCreateProcedure = HandleCreateProcedure;
		tmpHandleTable->HandleDeleteProcedure = HandleDeleteProcedure;
		tmpHandleTable->HandleTranslateProcedure = HandleTranslateProcedure;
		switch (tmpHandleTable->HandleTableType) {
			case httPassiveLevel:
				status = ExInitializeResourceLite(&tmpHandleTable->LockP);
				break;
			case httDispatchLevel:
				KeInitializeSpinLock(&tmpHandleTable->LockD);
				tmpHandleTable->ExclusiveLocker = NULL;
				status = STATUS_SUCCESS;
				break;
			case httNoSynchronization:
				status = STATUS_SUCCESS;
				break;
			default:
				status = STATUS_NOT_SUPPORTED;
				break;
		}

		if (NT_SUCCESS(status)) {
			status = HashTableCreate(httNoSynchronization, 37, _HashFunction, _CompareFunction, _FreeFunction, &tmpHandleTable->HashTable);
			if (NT_SUCCESS(status))
				*HandleTable = tmpHandleTable;

			if (!NT_SUCCESS(status)) {
				switch (tmpHandleTable->HandleTableType) {
					case httPassiveLevel:
						ExDeleteResourceLite(&tmpHandleTable->LockP);
						break;
					case httDispatchLevel:
						break;
					case httNoSynchronization:
						break;
					default:
						break;
				}
			}
		}

		if (!NT_SUCCESS(status))
			HeapMemoryFree(tmpHandleTable);
	} else status = STATUS_INSUFFICIENT_RESOURCES;

	DEBUG_EXIT_FUNCTION("0x%x, *HandleTable=0x%p", status, *HandleTable);
	return status;
}
开发者ID:MartinDrab,项目名称:IRPMon,代码行数:59,代码来源:handle-table.c


示例14: CtxCreateStreamHandleContext

NTSTATUS
CtxCreateStreamHandleContext (
    __deref_out PSTREAMHANDLE_CONTEXT *StreamHandleContext
    )
/*++

Routine Description:

    This routine creates a new stream context

Arguments:

    StreamContext         - Returns the stream context

Return Value:

    Status

--*/
{
    NTSTATUS status;
    PSTREAMHANDLE_CONTEXT streamHandleContext;

    PAGED_CODE();

    //
    //  Allocate a stream context
    //

    status = FltAllocateContext( g_FileFltContext.FileFltHandle,
                                 FLT_STREAMHANDLE_CONTEXT,
                                 STREAMHANDLE_CONTEXT_SIZE,
                                 NonPagedPool,
                                 &streamHandleContext );

    if (!NT_SUCCESS( status )) {


        return status;
    }

    //
    //  Initialize the newly created context
    //

    RtlZeroMemory( streamHandleContext, STREAMHANDLE_CONTEXT_SIZE );

    streamHandleContext->Resource = FsAllocateResource();
    if(streamHandleContext->Resource == NULL) {

        FltReleaseContext( streamHandleContext );
        return STATUS_INSUFFICIENT_RESOURCES;
    }
    ExInitializeResourceLite( streamHandleContext->Resource );

    *StreamHandleContext = streamHandleContext;

    return STATUS_SUCCESS;
}
开发者ID:340211173,项目名称:hf-2011,代码行数:59,代码来源:context.c


示例15: LogpInitializeBufferInfo

// Initialize a log file related code such as a flushing thread.
_Use_decl_annotations_ static NTSTATUS LogpInitializeBufferInfo(
    const wchar_t *log_file_path, LogBufferInfo *info) {
  PAGED_CODE();
  NT_ASSERT(log_file_path);
  NT_ASSERT(info);

  KeInitializeSpinLock(&info->spin_lock);

  auto status = RtlStringCchCopyW(
      info->log_file_path, RTL_NUMBER_OF_FIELD(LogBufferInfo, log_file_path),
      log_file_path);
  if (!NT_SUCCESS(status)) {
    return status;
  }

  status = ExInitializeResourceLite(&info->resource);
  if (!NT_SUCCESS(status)) {
    return status;
  }
  info->resource_initialized = true;

  // Allocate two log buffers on NonPagedPool.
  info->log_buffer1 = reinterpret_cast<char *>(
      ExAllocatePoolWithTag(NonPagedPoolNx, kLogpBufferSize, kLogpPoolTag));
  if (!info->log_buffer1) {
    LogpFinalizeBufferInfo(info);
    return STATUS_INSUFFICIENT_RESOURCES;
  }

  info->log_buffer2 = reinterpret_cast<char *>(
      ExAllocatePoolWithTag(NonPagedPoolNx, kLogpBufferSize, kLogpPoolTag));
  if (!info->log_buffer2) {
    LogpFinalizeBufferInfo(info);
    return STATUS_INSUFFICIENT_RESOURCES;
  }

  // Initialize these buffers
  RtlFillMemory(info->log_buffer1, kLogpBufferSize, 0xff);  // for diagnostic
  info->log_buffer1[0] = '\0';
  info->log_buffer1[kLogpBufferSize - 1] = '\0';  // at the end

  RtlFillMemory(info->log_buffer2, kLogpBufferSize, 0xff);  // for diagnostic
  info->log_buffer2[0] = '\0';
  info->log_buffer2[kLogpBufferSize - 1] = '\0';  // at the end

  // Buffer should be used is log_buffer1, and location should be written logs
  // is the head of the buffer.
  info->log_buffer_head = info->log_buffer1;
  info->log_buffer_tail = info->log_buffer1;

  status = LogpInitializeLogFile(info);
  if (status == STATUS_OBJECT_PATH_NOT_FOUND) {
    HYPERPLATFORM_LOG_INFO("The log file needs to be activated later.");
    status = STATUS_REINITIALIZATION_NEEDED;
  } else if (!NT_SUCCESS(status)) {
    LogpFinalizeBufferInfo(info);
  }
  return status;
}
开发者ID:JulianVolodia,项目名称:HyperPlatform,代码行数:60,代码来源:log.cpp


示例16: FspFileNodeCreate

NTSTATUS FspFileNodeCreate(PDEVICE_OBJECT DeviceObject,
    ULONG ExtraSize, FSP_FILE_NODE **PFileNode)
{
    PAGED_CODE();

    *PFileNode = 0;

    FSP_FILE_NODE_NONPAGED *NonPaged = FspAllocNonPaged(sizeof *NonPaged);
    if (0 == NonPaged)
        return STATUS_INSUFFICIENT_RESOURCES;

    FSP_FILE_NODE *FileNode = FspAlloc(sizeof *FileNode + ExtraSize);
    if (0 == FileNode)
    {
        FspFree(NonPaged);
        return STATUS_INSUFFICIENT_RESOURCES;
    }

    RtlZeroMemory(NonPaged, sizeof *NonPaged);
    ExInitializeResourceLite(&NonPaged->Resource);
    ExInitializeResourceLite(&NonPaged->PagingIoResource);
    ExInitializeFastMutex(&NonPaged->HeaderFastMutex);
    KeInitializeSpinLock(&NonPaged->DirInfoSpinLock);

    RtlZeroMemory(FileNode, sizeof *FileNode + ExtraSize);
    FileNode->Header.NodeTypeCode = FspFileNodeFileKind;
    FileNode->Header.NodeByteSize = sizeof *FileNode;
    FileNode->Header.IsFastIoPossible = FastIoIsNotPossible;
    FileNode->Header.Resource = &NonPaged->Resource;
    FileNode->Header.PagingIoResource = &NonPaged->PagingIoResource;
    FileNode->Header.ValidDataLength.QuadPart = MAXLONGLONG;
        /* disable ValidDataLength functionality */
    FsRtlSetupAdvancedHeader(&FileNode->Header, &NonPaged->HeaderFastMutex);
    FileNode->NonPaged = NonPaged;
    FileNode->RefCount = 1;
    FileNode->FsvolDeviceObject = DeviceObject;
    FspDeviceReference(FileNode->FsvolDeviceObject);
    RtlInitEmptyUnicodeString(&FileNode->FileName, FileNode->FileNameBuf, (USHORT)ExtraSize);

    FsRtlInitializeFileLock(&FileNode->FileLock, FspFileNodeCompleteLockIrp, 0);

    *PFileNode = FileNode;

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


示例17: MESSAGETABLE_Create

PAGEABLE
NTSTATUS
MESSAGETABLE_Create(
	_Out_	PHMESSAGETABLE	phMessageTable
)
{
	NTSTATUS		eStatus			= STATUS_UNSUCCESSFUL;
	PMESSAGE_TABLE	ptMessageTable	= NULL;

	ASSERT(PASSIVE_LEVEL == KeGetCurrentIrql());

	if (NULL == phMessageTable)
	{
		eStatus = STATUS_INVALID_PARAMETER;
		goto lblCleanup;
	}

	ptMessageTable = ExAllocatePoolWithTag(NonPagedPool,
										   sizeof(*ptMessageTable),
										   MESSAGE_TABLE_POOL_TAG);
	if (NULL == ptMessageTable)
	{
		eStatus = STATUS_INSUFFICIENT_RESOURCES;
		goto lblCleanup;
	}
	RtlSecureZeroMemory(ptMessageTable, sizeof(*ptMessageTable));

	RtlInitializeGenericTableAvl(&(ptMessageTable->tTable),
								 &messagetable_CompareRoutine,
								 &messagetable_AllocateRoutine,
								 &messagetable_FreeRoutine,
								 NULL);
	ptMessageTable->bTableInitialized = TRUE;

	eStatus = ExInitializeResourceLite(&(ptMessageTable->tLock));
	if (!NT_SUCCESS(eStatus))
	{
		goto lblCleanup;
	}
	ptMessageTable->bLockInitialized = TRUE;

	// Transfer ownership:
	*phMessageTable = (HMESSAGETABLE)ptMessageTable;
	ptMessageTable = NULL;

	eStatus = STATUS_SUCCESS;

lblCleanup:
#pragma warning(suppress: 4133)	// warning C4133: 'function': incompatible types - from 'PMESSAGE_TABLE' to 'HMESSAGETABLE'
	CLOSE(ptMessageTable, MESSAGETABLE_Destroy);

	return eStatus;
}
开发者ID:mbikovitsky,项目名称:drunken-ironman,代码行数:53,代码来源:MessageTable.c


示例18: iCtx_CreateStreamContext

NTSTATUS
iCtx_CreateStreamContext (
    __in PFLT_RELATED_OBJECTS FltObjects,
    __deref_out PSTREAM_CONTEXT *StreamContext
    )
/*++

Routine Description:

    This routine creates a new stream context

Arguments:

    StreamContext         - Returns the stream context

Return Value:

    Status

--*/
{
    NTSTATUS status;
    PSTREAM_CONTEXT streamContext;

    PAGED_CODE();

    status = FltAllocateContext( FltObjects->Filter,
                                 FLT_STREAM_CONTEXT,
                                 STREAM_CONTEXT_SIZE,
                                 NonPagedPool,
                                 &streamContext );
    if (!NT_SUCCESS( status )) 
	{
        return status;
    }

    //  Initialize the newly created context
    RtlZeroMemory( streamContext, STREAM_CONTEXT_SIZE );

    streamContext->Resource = ExAllocatePoolWithTag( NonPagedPool, sizeof( ERESOURCE ),RESOURCE_TAG );
    if(streamContext->Resource == NULL)
	{
        FltReleaseContext( streamContext );
        return STATUS_INSUFFICIENT_RESOURCES;
    }
    ExInitializeResourceLite( streamContext->Resource );

    KeInitializeSpinLock(&streamContext->Resource1) ; 

    *StreamContext = streamContext;

    return STATUS_SUCCESS;
}
开发者ID:yedushusheng,项目名称:FileEncryption,代码行数:53,代码来源:ctx.c


示例19: LfsAllocateResource

INLINE
PERESOURCE
LfsAllocateResource (
    )
{
    PERESOURCE Resource;

    Resource = (PERESOURCE) ExAllocateFromNPagedLookasideList( &GlobalLfs.EResourceLookasideList );

    ExInitializeResourceLite( Resource );

    return Resource;
}
开发者ID:Nevermore2015,项目名称:ndas4windows,代码行数:13,代码来源:lfsstruct.c


示例20: KdPrintKrnl

VOID
	CDirControlList::Init()
{
	KdPrintKrnl(LOG_PRINTF_LEVEL_INFO, LOG_RECORED_LEVEL_NEED, L"begin");

	InitializeListHead(&ms_ListHead);
	KeInitializeSpinLock(&ms_SpLock);	
	ExInitializeResourceLite(&ms_Lock);

	KdPrintKrnl(LOG_PRINTF_LEVEL_INFO, LOG_RECORED_LEVEL_NEED, L"end");

	return;
}
开发者ID:fengkuangfj,项目名称:SecretDisk2,代码行数:13,代码来源:DirControlList.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ExInterlockedInsertTailList函数代码示例发布时间:2022-05-30
下一篇:
C++ ExInitializeFastMutex函数代码示例发布时间: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