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


C++ ExAllocateFromNPagedLookasideList函数代码示例

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


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

示例1: LibTCPShutdown

err_t
LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx)
{
    struct lwip_callback_msg *msg;
    err_t ret;

    msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList);
    if (msg)
    {
        KeInitializeEvent(&msg->Event, NotificationEvent, FALSE);

        msg->Input.Shutdown.Connection = Connection;
        msg->Input.Shutdown.shut_rx = shut_rx;
        msg->Input.Shutdown.shut_tx = shut_tx;

        tcpip_callback_with_block(LibTCPShutdownCallback, msg, 1);

        if (WaitForEventSafely(&msg->Event))
            ret = msg->Output.Shutdown.Error;
        else
            ret = ERR_CLSD;

        ExFreeToNPagedLookasideList(&MessageLookasideList, msg);

        return ret;
    }

    return ERR_MEM;
}
开发者ID:RareHare,项目名称:reactos,代码行数:29,代码来源:rostcp.c

示例2: KphProtectAddEntry

/* KphProtectAddEntry
 * 
 * Protects the specified process.
 * 
 * Thread safety: Full
 * IRQL: <= DISPATCH_LEVEL
 */
PKPH_PROCESS_ENTRY KphProtectAddEntry(
    __in PEPROCESS Process,
    __in HANDLE Tag,
    __in LOGICAL AllowKernelMode,
    __in ACCESS_MASK ProcessAllowMask,
    __in ACCESS_MASK ThreadAllowMask
    )
{
    KIRQL oldIrql;
    PKPH_PROCESS_ENTRY entry;
    
    /* Prevent the lookaside list from being freed. */
    if (!ExAcquireRundownProtection(&ProtectedProcessRundownProtect))
        return NULL;
    
    entry = ExAllocateFromNPagedLookasideList(&ProtectedProcessLookasideList);
    /* Lookaside list no longer needed. */
    ExReleaseRundownProtection(&ProtectedProcessRundownProtect);
    
    if (!entry)
        return NULL;
    
    entry->Process = Process;
    entry->CreatorProcess = PsGetCurrentProcess();
    entry->Tag = Tag;
    entry->AllowKernelMode = AllowKernelMode;
    entry->ProcessAllowMask = ProcessAllowMask;
    entry->ThreadAllowMask = ThreadAllowMask;
    
    KeAcquireSpinLock(&ProtectedProcessListLock, &oldIrql);
    InsertHeadList(&ProtectedProcessListHead, &entry->ListEntry);
    KeReleaseSpinLock(&ProtectedProcessListLock, oldIrql);
    
    return entry;
}
开发者ID:andyvand,项目名称:ProcessHacker,代码行数:42,代码来源:protect.c

示例3: LibTCPClose

err_t
LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe, const int callback)
{
    err_t ret;
    struct lwip_callback_msg *msg;

    msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList);
    if (msg)
    {
        KeInitializeEvent(&msg->Event, NotificationEvent, FALSE);

        msg->Input.Close.Connection = Connection;
        msg->Input.Close.Callback = callback;

        if (safe)
            LibTCPCloseCallback(msg);
        else
            tcpip_callback_with_block(LibTCPCloseCallback, msg, 1);

        if (WaitForEventSafely(&msg->Event))
            ret = msg->Output.Close.Error;
        else
            ret = ERR_CLSD;

        ExFreeToNPagedLookasideList(&MessageLookasideList, msg);

        return ret;
    }

    return ERR_MEM;
}
开发者ID:RareHare,项目名称:reactos,代码行数:31,代码来源:rostcp.c

示例4: LibTCPSocket

struct tcp_pcb *
LibTCPSocket(void *arg)
{
    struct lwip_callback_msg *msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList);
    struct tcp_pcb *ret;

    if (msg)
    {
        KeInitializeEvent(&msg->Event, NotificationEvent, FALSE);
        msg->Input.Socket.Arg = arg;

        tcpip_callback_with_block(LibTCPSocketCallback, msg, 1);

        if (WaitForEventSafely(&msg->Event))
            ret = msg->Output.Socket.NewPcb;
        else
            ret = NULL;

        ExFreeToNPagedLookasideList(&MessageLookasideList, msg);

        return ret;
    }

    return NULL;
}
开发者ID:RareHare,项目名称:reactos,代码行数:25,代码来源:rostcp.c

示例5: Filter

VOID __stdcall Filter(ULONG ServiceId, ULONG TableBase, ULONG Argc, ULONG StackAddr) {
	ULONG pid = (ULONG)PsGetCurrentProcessId();
	if (pid == g_nPid) {
		ULONG i;
		PXBoxData pData=(PXBoxData)ExAllocateFromNPagedLookasideList(&g_nPageList);
		if(!pData)
			return;
		
		if (StackAddr < MmUserProbeAddress)
			pData->bFromUser = 1;
		else
			pData->bFromUser = 0;
		
		if (TableBase == (ULONG)KeServiceDescriptorTable.ServiceTableBase)
			pData->bFromSSDT = 1;
		else
			pData->bFromSSDT = 0;

		if (Argc > 16)
			Argc = 16;
		pData->argc = (UCHAR)Argc;
		for (i = 0; i < Argc; ++i)
			pData->args[i] = ((PULONG)StackAddr)[i];

		pData->pid = (ULONG)pid;
		pData->tid = (ULONG)PsGetCurrentThreadId();
		pData->sid = ServiceId;
		KeQuerySystemTime(&pData->time);
		ExInterlockedInsertTailList(&g_linkListHead, &pData->ListEntry, &g_lock);
		KeReleaseSemaphore( &g_keySemaphore, 0, 1, FALSE );
	}
}
开发者ID:340211173,项目名称:hf-2011,代码行数:32,代码来源:XBox.c

示例6: LibTCPListen

PTCP_PCB
LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog)
{
    struct lwip_callback_msg *msg;
    PTCP_PCB ret;

    msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList);
    if (msg)
    {
        KeInitializeEvent(&msg->Event, NotificationEvent, FALSE);
        msg->Input.Listen.Connection = Connection;
        msg->Input.Listen.Backlog = backlog;

        tcpip_callback_with_block(LibTCPListenCallback, msg, 1);

        if (WaitForEventSafely(&msg->Event))
            ret = msg->Output.Listen.NewPcb;
        else
            ret = NULL;

        ExFreeToNPagedLookasideList(&MessageLookasideList, msg);

        return ret;
    }

    return NULL;
}
开发者ID:RareHare,项目名称:reactos,代码行数:27,代码来源:rostcp.c

示例7: ExAllocateFromNPagedLookasideList

void *mm_alloc(size_t size, int flags)
{
	alloc_block *block;
	char        *p_mem = NULL;
	int          i;
	
	if (flags & MEM_FAST)
	{
		for (i = 0; i < NUM_MEM_LISTS; i++) {
			if ((512u << i) < size) continue;
			p_mem = ExAllocateFromNPagedLookasideList(&mem_lists[i]); 
			break;
		}
	}
	if (p_mem == NULL) /* if memory not allocated, allocate from pool */
	{
		if (flags & MEM_SUCCESS)
			p_mem = mm_alloc_success(APOOL_TYPE(flags), ALLOC_SIZE(size), '1_cd'); else
			p_mem = ExAllocatePoolWithTag(APOOL_TYPE(flags), ALLOC_SIZE(size), '1_cd');
		
		if (p_mem == NULL) return NULL;
		flags &= ~MEM_FAST;
	}
	/* memory block must be 16byte aligned */
	if (dSZ(p_mem) & (16-1)) p_mem += 8, flags |= MEM_PADDED;
	/* initialize alloc_block struct */
	block = pv(p_mem);
	block->size  = size;
	block->flags = flags;
	block->index = i;
	/* zero memory if needed */
	if (flags & MEM_ZEROED) memset(block->data, 0, size);
	return &block->data;
}
开发者ID:capturePointer,项目名称:DiskCryptor-1,代码行数:34,代码来源:misc_mem.c

示例8: LibTCPConnect

err_t
LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port)
{
    struct lwip_callback_msg *msg;
    err_t ret;

    msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList);
    if (msg)
    {
        KeInitializeEvent(&msg->Event, NotificationEvent, FALSE);
        msg->Input.Connect.Connection = Connection;
        msg->Input.Connect.IpAddress = ipaddr;
        msg->Input.Connect.Port = port;

        tcpip_callback_with_block(LibTCPConnectCallback, msg, 1);

        if (WaitForEventSafely(&msg->Event))
        {
            ret = msg->Output.Connect.Error;
        }
        else
            ret = ERR_CLSD;

        ExFreeToNPagedLookasideList(&MessageLookasideList, msg);

        return ret;
    }

    return ERR_MEM;
}
开发者ID:RareHare,项目名称:reactos,代码行数:30,代码来源:rostcp.c

示例9: Notification_Recieve

NTSTATUS Notification_Recieve(NOTIFICATION_QUEUE *queue, PIRP irp) {
	PIO_STACK_LOCATION irpstack = IoGetCurrentIrpStackLocation(irp);
	KIRQL irq;

	if(irpstack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(PGNOTIFICATION)) {
		irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL;
		irp->IoStatus.Information = 0;
		IoCompleteRequest(irp, IO_NO_INCREMENT);

		return STATUS_BUFFER_TOO_SMALL;
	}
	
	KeAcquireSpinLock(&queue->lock, &irq);

	if(IsListEmpty(&queue->notification_list)) {
		PGIRPNODE *irpnode;
		KIRQL crirq;

		irpnode = ExAllocateFromNPagedLookasideList(&queue->lookaside);

		InitializeListHead(&irpnode->entry);

		irpnode->irp = irp;
		//irp->Tail.Overlay.DriverContext[0] = irpnode;

		InsertTailList(&queue->irp_list, &irpnode->entry);

		IoMarkIrpPending(irp);

		IoAcquireCancelSpinLock(&crirq);

#pragma warning(push)
#pragma warning(disable:4311 4312)
		//IoSetCancelRoutine generates warnings in 32-bit due to silly macroisms.
		IoSetCancelRoutine(irp, Notification_OnCancel);
#pragma warning(pop)

		IoReleaseCancelSpinLock(crirq);
		
		KeReleaseSpinLock(&queue->lock, irq);

		return STATUS_PENDING;
	}
	else {
		PGNOTIFYNODE *notifynode = (PGNOTIFYNODE*)RemoveHeadList(&queue->notification_list);
		PGNOTIFICATION *notification = irp->AssociatedIrp.SystemBuffer;

		RtlCopyMemory(notification, &notifynode->notification, sizeof(PGNOTIFICATION));
		ExFreeToNPagedLookasideList(&queue->lookaside, notifynode);
		--queue->queued;
		
		KeReleaseSpinLock(&queue->lock, irq);

		irp->IoStatus.Status = STATUS_SUCCESS;
		irp->IoStatus.Information = sizeof(PGNOTIFICATION);
		IoCompleteRequest(irp, IO_NO_INCREMENT);

		return STATUS_SUCCESS;
	}
}
开发者ID:Tudi,项目名称:PG2-firewall,代码行数:60,代码来源:notifyqueue.c

示例10: LfsAllocateNonPagedFcb

INLINE
PNON_PAGED_FCB
LfsAllocateNonPagedFcb (
    )
{
    return (PNON_PAGED_FCB) ExAllocateFromNPagedLookasideList( &GlobalLfs.NonPagedFcbLookasideList );
}
开发者ID:Nevermore2015,项目名称:ndas4windows,代码行数:7,代码来源:lfsstruct.c

示例11: SympAddSymbol

BOOLEAN SympAddSymbol(IN PCHAR pszSymbolName, IN ULONG64 uSymbolAddress, IN ULONG uOffset, IN ULONG uBitPosition, IN ULONG uBitLength)
{
	ASSERTMSG("Cannot add symbol with NULL name", pszSymbolName != NULL);
	ASSERTMSG("SymbolEngine must be initialized prior to this call", bIsSymEngineInitialized == TRUE);

	// it is possible that we got symbol with zero address, offset -1, bit position -1, and length -1 if the symbol was not found during
	// enumeration in user mode. In that case, and only in that case, we return error!
	// NOTE: uSymbolAddress of -1 is used when symbols are initialized in order to send the array of wanted symbols to the user mode
	if(uSymbolAddress == 0 && uOffset == -1 && uBitPosition == -1 && uBitLength == -1)
	{
		KdPrint(("[DEBUG] WARNING - Symbol was probably not found in user mode, cannot add symbol with unknown address and unknown offset\n"));
		return FALSE;
	}

	// if symbol with this name already exists
	if(SympFindSymbol(pszSymbolName) != NULL)
	{
		// don't want to "update" the address -- use SymUpdateSymbol function instead
		KdPrint(("[DEBUG] WARNING - Symbol %s with address 0x%x already exists -- use SymUpdateFunction() to update the address\n", pszSymbolName, uSymbolAddress));
		return TRUE;
	}

	// get memory from lookaside list
	PSYMBOL_ENTRY pSymbolEntry = (PSYMBOL_ENTRY) ExAllocateFromNPagedLookasideList(&SymbolsLookasideList);
	if(pSymbolEntry == NULL)
	{
		KdPrint(("[DEBUG] ERROR - Not enough memory in lookaside list to allocate new symbol entry\n"));
		return FALSE;
	}

	// copy string from passed parameter
	if(RtlStringCbCopyA(pSymbolEntry->Symbol.name, MAX_SYM_NAME, pszSymbolName) == STATUS_INVALID_PARAMETER)
	{
		KdPrint(("[DEBUG] ERROR - Error while copying symbol name to SYMBOL_ENTRY structure\n"));
		return FALSE;
	}

	// copy address from the passed parameter
	pSymbolEntry->Symbol.u64address = uSymbolAddress;

	// copy offset from the passed parameter
	pSymbolEntry->Symbol.uOffset = uOffset;

	// copy bit position from the passed parameter
	pSymbolEntry->Symbol.uBitPosition = uBitPosition;

	// copy bit length from the passed parameter
	pSymbolEntry->Symbol.uBitLength = uBitLength;

	// insert it to list (thread safe)
	ASSERTMSG("Fast mutex acquire must occur at or below APC_LEVEL", KeGetCurrentIrql() <= APC_LEVEL);
	ExAcquireFastMutex(&SymbolsListMutex);
	InsertHeadList(&SymbolsListHead, &pSymbolEntry->ListEntry);
	++uSymbolCount;
	ASSERTMSG("Fast mutex release must occur at APC_LEVEL", KeGetCurrentIrql() == APC_LEVEL);
	ExReleaseFastMutex(&SymbolsListMutex);

	return TRUE;
}
开发者ID:angry7panda,项目名称:dementia-forensics,代码行数:59,代码来源:SymbolEngine.cpp

示例12: ExAllocateFromNPagedLookasideList

void *kmem_cache_alloc(struct kmem_cache *kmc, int flags)
{
	void *buf = NULL;

	buf = ExAllocateFromNPagedLookasideList(&(kmc->npll));

	return buf;
}
开发者ID:girishshilamkar,项目名称:lustre-release,代码行数:8,代码来源:winnt-mem.c

示例13: LibTCPEnqueuePacket

void LibTCPEnqueuePacket(PCONNECTION_ENDPOINT Connection, struct pbuf *p)
{
    PQUEUE_ENTRY qp;

    qp = (PQUEUE_ENTRY)ExAllocateFromNPagedLookasideList(&QueueEntryLookasideList);
    qp->p = p;
    qp->Offset = 0;

    ExInterlockedInsertTailList(&Connection->PacketQueue, &qp->ListEntry, &Connection->Lock);
}
开发者ID:RareHare,项目名称:reactos,代码行数:10,代码来源:rostcp.c

示例14: AllocateFltPacket

FLT_PKT*
AllocateFltPacket()
{
    FLT_PKT* pFltPkt = (FLT_PKT*)ExAllocateFromNPagedLookasideList(&g_PktLookaside);

    if (pFltPkt)
        RtlZeroMemory(pFltPkt, sizeof(*pFltPkt));

    return pFltPkt;
}
开发者ID:mnestratov,项目名称:natflt,代码行数:10,代码来源:parse.c

示例15: LockObject

NTSTATUS TCPSendData
( PCONNECTION_ENDPOINT Connection,
  PCHAR BufferData,
  ULONG SendLength,
  PULONG BytesSent,
  ULONG Flags,
  PTCP_COMPLETION_ROUTINE Complete,
  PVOID Context )
{
    NTSTATUS Status;
    PTDI_BUCKET Bucket;
    KIRQL OldIrql;

    LockObject(Connection, &OldIrql);

    TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Called for %d bytes (on socket %x)\n",
                           SendLength, Connection->SocketContext));

    TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Connection = %x\n", Connection));
    TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Connection->SocketContext = %x\n",
                           Connection->SocketContext));

    Status = TCPTranslateError(LibTCPSend(Connection,
                                          BufferData,
                                          SendLength,
                                          BytesSent,
                                          FALSE));
    
    TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Send: %x, %d\n", Status, SendLength));

    /* Keep this request around ... there was no data yet */
    if (Status == STATUS_PENDING)
    {
        /* Freed in TCPSocketState */
        Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList);
        if (!Bucket)
        {
            UnlockObject(Connection, OldIrql);
            TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Failed to allocate bucket\n"));
            return STATUS_NO_MEMORY;
        }
        
        Bucket->Request.RequestNotifyObject = Complete;
        Bucket->Request.RequestContext = Context;
        
        InsertTailList( &Connection->SendRequest, &Bucket->Entry );
        TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Queued write irp\n"));
    }

    UnlockObject(Connection, OldIrql);

    TI_DbgPrint(DEBUG_TCP, ("[IP, TCPSendData] Leaving. Status = %x\n", Status));

    return Status;
}
开发者ID:Nevermore2015,项目名称:reactos,代码行数:55,代码来源:tcp.c


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