當前位置: 首頁>>代碼示例>>C++>>正文


C++ ExInitializeResourceLite函數代碼示例

本文整理匯總了C++中ExInitializeResourceLite函數的典型用法代碼示例。如果您正苦於以下問題:C++ ExInitializeResourceLite函數的具體用法?C++ ExInitializeResourceLite怎麽用?C++ ExInitializeResourceLite使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ExInitializeResourceLite函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的ExInitializeResourceLite函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。