这篇教程C++ ExInitializeResourceLite函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ExInitializeResourceLite函数的典型用法代码示例。如果您正苦于以下问题:C++ ExInitializeResourceLite函数的具体用法?C++ ExInitializeResourceLite怎么用?C++ ExInitializeResourceLite使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ExInitializeResourceLite函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: CdfsCreateFCBPFCBCdfsCreateFCB(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,
示例2: DokanAllocateFCB// We must NOT call without VCB lcokPDokanFCBDokanAllocateFCB( __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,
示例3: FatCreateDcbPFCBNTAPIFatCreateDcb(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,
示例4: FatCreateFcbPFCBNTAPIFatCreateFcb(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,
示例5: InitTimerImplINIT_FUNCTIONNTSTATUSNTAPIInitTimerImpl(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,
示例6: InitUserImplINIT_FUNCTIONNTSTATUSNTAPIInitUserImpl(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,
示例7: SepInitializeWorkListBOOLEANSepInitializeWorkList( 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,
示例8: DriverEntryNTSTATUS 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,
示例9: _DymArraySynchronizationAllocstatic 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,
示例10: DokanAllocateCCBPDokanCCBDokanAllocateCCB( __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,
示例11: IopInitBootLogVOIDINIT_FUNCTIONIopInitBootLog(BOOLEAN StartBootLog){ ExInitializeResourceLite(&IopBootLogResource); if (StartBootLog) IopStartBootLog();}
开发者ID:hoangduit,项目名称:reactos,代码行数:7,
示例12: SortedListCreateNTSTATUS 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,
示例13: HandleTableCreateNTSTATUS 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,
示例14: CtxCreateStreamHandleContextNTSTATUSCtxCreateStreamHandleContext ( __deref_out PSTREAMHANDLE_CONTEXT *StreamHandleContext )/*++Routine Description: This routine creates a new stream contextArguments: StreamContext - Returns the stream contextReturn 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,
示例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,
示例16: FspFileNodeCreateNTSTATUS 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,
示例17: MESSAGETABLE_CreatePAGEABLENTSTATUSMESSAGETABLE_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,
示例18: iCtx_CreateStreamContextNTSTATUSiCtx_CreateStreamContext ( __in PFLT_RELATED_OBJECTS FltObjects, __deref_out PSTREAM_CONTEXT *StreamContext )/*++Routine Description: This routine creates a new stream contextArguments: StreamContext - Returns the stream contextReturn 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,
示例19: LfsAllocateResourceINLINEPERESOURCELfsAllocateResource ( ){ PERESOURCE Resource; Resource = (PERESOURCE) ExAllocateFromNPagedLookasideList( &GlobalLfs.EResourceLookasideList ); ExInitializeResourceLite( Resource ); return Resource;}
开发者ID:Nevermore2015,项目名称:ndas4windows,代码行数:13,
示例20: KdPrintKrnlVOID 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,
示例21: CtxCreateStreamHandleContext/*++Routine Description: This routine creates a new stream contextArguments: StreamContext - Returns the stream contextReturn Value: Status--*/NTSTATUSCtxCreateStreamHandleContext ( __deref_out PCTX_STREAMHANDLE_CONTEXT *StreamHandleContext ){ NTSTATUS status; PCTX_STREAMHANDLE_CONTEXT streamHandleContext; PAGED_CODE(); // // Allocate a stream context // DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS, ("[Ctx]: Allocating stream handle context /n") ); status = FltAllocateContext( Globals.Filter, FLT_STREAMHANDLE_CONTEXT, CTX_STREAMHANDLE_CONTEXT_SIZE, PagedPool, &streamHandleContext ); if (!NT_SUCCESS( status )) { DebugTrace( DEBUG_TRACE_STREAMHANDLE_CONTEXT_OPERATIONS | DEBUG_TRACE_ERROR, ("[Ctx]: Failed to allocate stream handle context with status 0x%x /n", status) ); return status; } // // Initialize the newly created context // RtlZeroMemory( streamHandleContext, CTX_STREAMHANDLE_CONTEXT_SIZE ); streamHandleContext->Resource = CtxAllocateResource(); if(streamHandleContext->Resource == NULL) { FltReleaseContext( streamHandleContext ); return STATUS_INSUFFICIENT_RESOURCES; } ExInitializeResourceLite( streamHandleContext->Resource ); *StreamHandleContext = streamHandleContext; return STATUS_SUCCESS;}
开发者ID:killbug2004,项目名称:wy-windows-driver,代码行数:66,
示例22: AFSInitializeProcessCBAFSProcessCB *AFSInitializeProcessCB( IN ULONGLONG ParentProcessId, IN ULONGLONG ProcessId){ AFSProcessCB *pProcessCB = NULL; AFSDeviceExt *pDeviceExt = (AFSDeviceExt *)AFSDeviceObject->DeviceExtension; __Enter { pProcessCB = (AFSProcessCB *)AFSExAllocatePoolWithTag( NonPagedPool, sizeof( AFSProcessCB), AFS_PROCESS_CB_TAG); if( pProcessCB == NULL) { try_return( pProcessCB); } RtlZeroMemory( pProcessCB, sizeof( AFSProcessCB)); pProcessCB->TreeEntry.HashIndex = (ULONGLONG)ProcessId; pProcessCB->ParentProcessId = (ULONGLONG)ParentProcessId; if( pDeviceExt->Specific.Control.ProcessTree.TreeHead == NULL) { pDeviceExt->Specific.Control.ProcessTree.TreeHead = (AFSBTreeEntry *)pProcessCB; } else { AFSInsertHashEntry( pDeviceExt->Specific.Control.ProcessTree.TreeHead, &pProcessCB->TreeEntry); } ExInitializeResourceLite( &pProcessCB->Lock); pProcessCB->ActiveAuthGroup = &AFSNoPAGAuthGroup;try_exit: NOTHING; } return pProcessCB;}
开发者ID:bagdxk,项目名称:openafs,代码行数:48,
示例23: NtfsCreateFCBPNTFS_FCBNtfsCreateFCB(PCWSTR FileName, PCWSTR Stream, PNTFS_VCB Vcb){ PNTFS_FCB Fcb; ASSERT(Vcb); ASSERT(Vcb->Identifier.Type == NTFS_TYPE_VCB); Fcb = ExAllocateFromNPagedLookasideList(&NtfsGlobalData->FcbLookasideList); RtlZeroMemory(Fcb, sizeof(NTFS_FCB)); Fcb->Identifier.Type = NTFS_TYPE_FCB; Fcb->Identifier.Size = sizeof(NTFS_TYPE_FCB); Fcb->Vcb = Vcb; if (FileName) { wcscpy(Fcb->PathName, FileName); if (wcsrchr(Fcb->PathName, '//') != 0) { Fcb->ObjectName = wcsrchr(Fcb->PathName, '//'); } else { Fcb->ObjectName = Fcb->PathName; } } if (Stream) { wcscpy(Fcb->Stream, Stream); } else { Fcb->Stream[0] = UNICODE_NULL; } ExInitializeResourceLite(&Fcb->MainResource); Fcb->RFCB.Resource = &(Fcb->MainResource); return Fcb;}
开发者ID:GYGit,项目名称:reactos,代码行数:46,
示例24: MrStartCoreNTSTATUS MrStartCore( IN PDRIVER_OBJECT drvobj, IN PUNICODE_STRING regpath ){ NTSTATUS status; __try { /* initialize core structure */ ExInitializeResourceLite(&g_core.mc_lock); InitializeListHead(&g_core.mc_dcb_list); /* store registry path */ g_core.mc_reg = *regpath; g_core.mc_reg.Buffer = MrAlloc(regpath->MaximumLength); if (g_core.mc_reg.Buffer) RtlCopyMemory(g_core.mc_reg.Buffer, regpath->Buffer, regpath->MaximumLength); /* query resitry */ status = MrQueryRegistry(regpath); if (!NT_SUCCESS(status)) { __leave; } /* create device object */ g_core.mc_devobj = MrCreateDevice(drvobj, MOURE_DEVICE, MOURE_SYMLNK); if (NULL == g_core.mc_devobj) { status = STATUS_INSUFFICIENT_RESOURCES; __leave; } } __finally { if (!NT_SUCCESS(status)) { /* do cleanup */ MrStopCore(); } } return status;}
开发者ID:matt-wu,项目名称:Moure,代码行数:45,
示例25: NameCacheInitBOOLEANNameCacheInit(PKLG_NAME_CACHE* ppNameCache){ PKLG_NAME_CACHE pNameCacheTmp; DWORD cou; if (ppNameCache == NULL) { DbPrint(DC_NAMEC,DL_WARNING, ("Whatta hella!? NameCacheInit: incorrect NameCache IN parameter/n")); DbgBreakPoint(); return FALSE; } if (*ppNameCache != NULL) { DbPrint(DC_NAMEC,DL_WARNING, ("NameCache - already inited!/n")); DbgBreakPoint(); return FALSE; } *ppNameCache = ExAllocatePoolWithTag(NonPagedPool, sizeof(KLG_NAME_CACHE), 'NboS'); if (*ppNameCache == NULL) { DbPrint(DC_NAMEC,DL_WARNING, ("NameCache not inited - low memory/n")); DbgBreakPoint(); return FALSE; } pNameCacheTmp = *ppNameCache; ExInitializeResourceLite(&pNameCacheTmp->m_CacheResource); for (cou = 0; cou < HASH_SIZE; cou++) { pNameCacheTmp->m_NameCache[cou] = NULL;#ifdef __DBG__ pNameCacheTmp->m_NameCacheLen[cou]=0;#endif }#ifdef __DBG__ pNameCacheTmp->m_NCLen = 0; #endif DbPrint(DC_NAMEC, DL_INFO, ("NameCacheInit complete/n")); return TRUE;}
开发者ID:hackshields,项目名称:antivirus,代码行数:44,
示例26: _AIMem_InitPAIMemObject_AIMem_Init(int BlockSize){ PAIMemObject pAIMem; pAIMem = (PAIMemObject) ExAllocatePoolWithTag(NonPagedPool, sizeof(AIMemObject), '~boS'); if (pAIMem == 0) return 0; ExInitializeResourceLite(&pAIMem->m_CacheResource);#ifdef __DBG__ pAIMem->m_dwMaxItems = 0; pAIMem->m_dwCurItems = 0;#endif pAIMem->m_Hint = 0; pAIMem->m_BlockSize = BlockSize; if (_AIMem_InitBlocks(pAIMem, BlockSize) == 0) { _AIMem_Done(pAIMem); pAIMem = 0; } return pAIMem;}
开发者ID:hackshields,项目名称:antivirus,代码行数:23,
示例27: LogpInitializeBufferInfoEXTERN_C static NTSTATUS LogpInitializeBufferInfo( _In_ const wchar_t *LogFilePath, _In_opt_ PDEVICE_OBJECT DeviceObject, _Inout_ LogBufferInfo *Info) { NT_ASSERT(LogFilePath); NT_ASSERT(Info); KeInitializeSpinLock(&Info->SpinLock); auto status = ExInitializeResourceLite(&Info->Resource); if (!NT_SUCCESS(status)) { return status; } Info->ResourceInitialized = true; if (DeviceObject) { // We can handle IRP_MJ_SHUTDOWN in order to flush buffered log entries. status = IoRegisterShutdownNotification(DeviceObject); if (!NT_SUCCESS(status)) { LogpFinalizeBufferInfo(DeviceObject, Info); return status; } } // Allocate two log buffers on NonPagedPool. Info->LogBuffer1 = reinterpret_cast<char *>(ExAllocatePoolWithTag( NonPagedPoolNx, LOGP_BUFFER_SIZE, LOGP_POOL_TAG_NAME)); if (!Info->LogBuffer1) { LogpFinalizeBufferInfo(DeviceObject, Info); return STATUS_INSUFFICIENT_RESOURCES; } Info->LogBuffer2 = reinterpret_cast<char *>(ExAllocatePoolWithTag( NonPagedPoolNx, LOGP_BUFFER_SIZE, LOGP_POOL_TAG_NAME)); if (!Info->LogBuffer2) { LogpFinalizeBufferInfo(DeviceObject, Info); return STATUS_INSUFFICIENT_RESOURCES; } // Initialize these buffers RtlFillMemory(Info->LogBuffer1, LOGP_BUFFER_SIZE, 0xff); // for debug Info->LogBuffer1[0] = '/0'; Info->LogBuffer1[LOGP_BUFFER_SIZE - 1] = '/0'; // at the end RtlFillMemory(Info->LogBuffer2, LOGP_BUFFER_SIZE, 0xff); // for debug Info->LogBuffer2[0] = '/0'; Info->LogBuffer2[LOGP_BUFFER_SIZE - 1] = '/0'; // at the end // Buffer should be used is LogBuffer1, and location should be written logs // is the head of the buffer. Info->LogBufferHead = Info->LogBuffer1; Info->LogBufferTail = Info->LogBuffer1; // Initialize a log file UNICODE_STRING logFilePathU = {}; RtlInitUnicodeString(&logFilePathU, LogFilePath); OBJECT_ATTRIBUTES oa = {}; InitializeObjectAttributes(&oa, &logFilePathU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, nullptr, nullptr); IO_STATUS_BLOCK ioStatus = {}; status = ZwCreateFile( &Info->LogFileHandle, FILE_APPEND_DATA | SYNCHRONIZE, &oa, &ioStatus, nullptr, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OPEN_IF, FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE, nullptr, 0); if (!NT_SUCCESS(status)) { LogpFinalizeBufferInfo(DeviceObject, Info); return status; } // Initialize a log buffer flush thread. Info->BufferFlushThreadShouldBeAlive = true; status = PsCreateSystemThread(&Info->BufferFlushThreadHandle, GENERIC_ALL, nullptr, nullptr, nullptr, LogpBufferFlushThreadRoutine, Info); if (!NT_SUCCESS(status)) { LogpFinalizeBufferInfo(DeviceObject, Info); return status; } return status;}
开发者ID:2016Sun,项目名称:RemoteWriteMonitor,代码行数:83,
示例28: DriverEntryNTSTATUS NTAPIDriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)/* * FUNCTION: Called by the system to initalize the driver * ARGUMENTS: * DriverObject = object describing this driver * RegistryPath = path to our configuration entries * RETURNS: Success or failure */{ NTSTATUS Status; UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(DEVICE_NAME); TRACE_(NTFS, "DriverEntry(%p, '%wZ')/n", DriverObject, RegistryPath); /* Initialize global data */ NtfsGlobalData = ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_GLOBAL_DATA), 'GRDN'); if (!NtfsGlobalData) { Status = STATUS_INSUFFICIENT_RESOURCES; goto ErrorEnd; } RtlZeroMemory(NtfsGlobalData, sizeof(NTFS_GLOBAL_DATA)); NtfsGlobalData->Identifier.Type = NTFS_TYPE_GLOBAL_DATA; NtfsGlobalData->Identifier.Size = sizeof(NTFS_GLOBAL_DATA); ExInitializeResourceLite(&NtfsGlobalData->Resource); /* Keep trace of Driver Object */ NtfsGlobalData->DriverObject = DriverObject; /* Initialize IRP functions array */ NtfsInitializeFunctionPointers(DriverObject); /* Initialize CC functions array */ NtfsGlobalData->CacheMgrCallbacks.AcquireForLazyWrite = NtfsAcqLazyWrite; NtfsGlobalData->CacheMgrCallbacks.ReleaseFromLazyWrite = NtfsRelLazyWrite; NtfsGlobalData->CacheMgrCallbacks.AcquireForReadAhead = NtfsAcqReadAhead; NtfsGlobalData->CacheMgrCallbacks.ReleaseFromReadAhead = NtfsRelReadAhead; /* Driver can't be unloaded */ DriverObject->DriverUnload = NULL; Status = IoCreateDevice(DriverObject, sizeof(NTFS_GLOBAL_DATA), &DeviceName, FILE_DEVICE_DISK_FILE_SYSTEM, 0, FALSE, &NtfsGlobalData->DeviceObject); if (!NT_SUCCESS(Status)) { WARN_(NTFS, "IoCreateDevice failed with status: %lx/n", Status); goto ErrorEnd; } NtfsGlobalData->DeviceObject->Flags |= DO_DIRECT_IO; /* Register file system */ IoRegisterFileSystem(NtfsGlobalData->DeviceObject); ObReferenceObject(NtfsGlobalData->DeviceObject);ErrorEnd: if (!NT_SUCCESS(Status)) { if (NtfsGlobalData) { ExDeleteResourceLite(&NtfsGlobalData->Resource); ExFreePoolWithTag(NtfsGlobalData, 'GRDN'); } } return Status;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:75,
注:本文中的ExInitializeResourceLite函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ExInterlockedInsertTailList函数代码示例 C++ ExInitializeFastMutex函数代码示例 |