本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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;
}
示例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;
}
示例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;
}
示例11: IopInitBootLog
VOID
INIT_FUNCTION
IopInitBootLog(BOOLEAN StartBootLog)
{
ExInitializeResourceLite(&IopBootLogResource);
if (StartBootLog) IopStartBootLog();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}