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


C++ DbgPrint函数代码示例

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


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

示例1: TrCreateAssignmentNode

ACPI_PARSE_OBJECT *
TrCreateAssignmentNode (
    ACPI_PARSE_OBJECT       *Target,
    ACPI_PARSE_OBJECT       *Source)
{
    ACPI_PARSE_OBJECT       *TargetOp;
    ACPI_PARSE_OBJECT       *SourceOp1;
    ACPI_PARSE_OBJECT       *SourceOp2;
    ACPI_PARSE_OBJECT       *Operator;


    DbgPrint (ASL_PARSE_OUTPUT,
        "\nTrCreateAssignmentNode  Line [%u to %u] Source %s Target %s\n",
        Source->Asl.LineNumber, Source->Asl.EndLine,
        UtGetOpName (Source->Asl.ParseOpcode),
        UtGetOpName (Target->Asl.ParseOpcode));

    TrSetNodeFlags (Target, NODE_IS_TARGET);

    switch (Source->Asl.ParseOpcode)
    {
    /*
     * Only these operators can be optimized because they have
     * a target operand
     */
    case PARSEOP_ADD:
    case PARSEOP_AND:
    case PARSEOP_DIVIDE:
    case PARSEOP_INDEX:
    case PARSEOP_MOD:
    case PARSEOP_MULTIPLY:
    case PARSEOP_NOT:
    case PARSEOP_OR:
    case PARSEOP_SHIFTLEFT:
    case PARSEOP_SHIFTRIGHT:
    case PARSEOP_SUBTRACT:
    case PARSEOP_XOR:

        break;

    /* Otherwise, just create a normal Store operator */

    default:

        goto CannotOptimize;
    }

    /*
     * Transform the parse tree such that the target is moved to the
     * last operand of the operator
     */
    SourceOp1 = Source->Asl.Child;
    SourceOp2 = SourceOp1->Asl.Next;

    /* NOT only has one operand, but has a target */

    if (Source->Asl.ParseOpcode == PARSEOP_NOT)
    {
        SourceOp2 = SourceOp1;
    }

    /* DIVIDE has an extra target operand (remainder) */

    if (Source->Asl.ParseOpcode == PARSEOP_DIVIDE)
    {
        SourceOp2 = SourceOp2->Asl.Next;
    }

    TargetOp = SourceOp2->Asl.Next;

    /*
     * Can't perform this optimization if there already is a target
     * for the operator (ZERO is a "no target" placeholder).
     */
    if (TargetOp->Asl.ParseOpcode != PARSEOP_ZERO)
    {
        goto CannotOptimize;
    }

    /* Link in the target as the final operand */

    SourceOp2->Asl.Next = Target;
    Target->Asl.Parent = Source;

    return (Source);


CannotOptimize:

    Operator = TrAllocateNode (PARSEOP_STORE);
    TrLinkChildren (Operator, 2, Source, Target);

    /* Set the appropriate line numbers for the new node */

    Operator->Asl.LineNumber        = Target->Asl.LineNumber;
    Operator->Asl.LogicalLineNumber = Target->Asl.LogicalLineNumber;
    Operator->Asl.LogicalByteOffset = Target->Asl.LogicalByteOffset;
    Operator->Asl.Column            = Target->Asl.Column;

    return (Operator);
//.........这里部分代码省略.........
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:101,代码来源:asltree.c

示例2: ExpWaitForResourceDdk

VOID
ExpWaitForResourceDdk (
    IN PNTDDK_ERESOURCE   Resource,
    IN PVOID        Object
    )
/*++

Routine Description:

    The routine waits on the Resource's object to be set.  If the
    wait is too long the current owners of the resoruce are boosted
    in priority.

Arguments:

    Resource - Supplies the resource

    Object - Event or Semaphore to wait on

Return Value:

    None

--*/
{
    KIRQL       OldIrql;
    NTSTATUS    Status;
    ULONG       i;


    Resource->ContentionCount += 1;

    i = 0;
    for (; ;) {
        Status = KeWaitForSingleObject (
                        Object,
                        Executive,
                        KernelMode,
                        FALSE,
                        &ExpTimeout );

        if (Status != STATUS_TIMEOUT) {
            break;
        }

        if (i++ >= ExpResourceTimeoutCount) {
            i = 0;

            DbgPrint("Resource @ %lx\n", Resource);
            DbgPrint(" ActiveCount = %04lx  Flags = %s%s%s\n",
                Resource->ActiveCount,
                IsOwnedExclusive(Resource)   ? "IsOwnedExclusive " : "",
                "",
                IsExclusiveWaiting(Resource) ? "ExclusiveWaiter "  : ""
            );

            DbgPrint(" NumberOfExclusiveWaiters = %04lx\n", Resource->NumberOfExclusiveWaiters);

            DbgPrint("  Thread = %08lx, Count = %02x\n",
                Resource->OwnerThreads[0],
                Resource->OwnerCounts[0] );

            DbgBreakPoint();
            DbgPrint("EX - Rewaiting\n");
        }

        //
        //  Give owning thread(s) a priority boost
        //

        AcquireResourceLock( Resource, &OldIrql );

        if (IsBoostAllowed(Resource) && IsOwnedExclusive(Resource)) {

            //
            //  Only one thread, boost it
            //

            KeBoostPriorityThread((PKTHREAD) Resource->OwnerThreads[0],
                                  ERESOURCE_INCREMENT );
        }

        ReleaseResourceLock( Resource, OldIrql );

        //
        //  Loop and wait some more
        //
    }

    //
    //  Wait was statisfied
    //

    ASSERT(NT_SUCCESS(Status));
    return ;
}
开发者ID:BillTheBest,项目名称:WinNT4,代码行数:96,代码来源:ddkresrc.c

示例3: TriggerNullPointerDereference

/// <summary>
/// Trigger the Null Pointer Dereference Vulnerability
/// </summary>
/// <param name="UserBuffer">The pointer to user mode buffer</param>
/// <returns>NTSTATUS</returns>
NTSTATUS TriggerNullPointerDereference(IN PVOID UserBuffer) {
    ULONG UserValue = 0;
    ULONG MagicValue = 0xBAD0B0B0;
    NTSTATUS Status = STATUS_SUCCESS;
    PNULL_POINTER_DEREFERENCE NullPointerDereference = NULL;

    PAGED_CODE();

    __try {
        // Verify if the buffer resides in user mode
        ProbeForRead(UserBuffer,
                     sizeof(NULL_POINTER_DEREFERENCE),
                     (ULONG)__alignof(NULL_POINTER_DEREFERENCE));

        // Allocate Pool chunk
        NullPointerDereference = (PNULL_POINTER_DEREFERENCE)
                                  ExAllocatePoolWithTag(NonPagedPool,
                                                        sizeof(NULL_POINTER_DEREFERENCE),
                                                        (ULONG)POOL_TAG);

        if (!NullPointerDereference) {
            // Unable to allocate Pool chunk
            DbgPrint("[-] Unable to allocate Pool chunk\n");

            Status = STATUS_NO_MEMORY;
            return Status;
        }
        else {
            DbgPrint("[+] Pool Tag: %s\n", STRINGIFY(POOL_TAG));
            DbgPrint("[+] Pool Type: %s\n", STRINGIFY(NonPagedPool));
            DbgPrint("[+] Pool Size: 0x%X\n", sizeof(NULL_POINTER_DEREFERENCE));
            DbgPrint("[+] Pool Chunk: 0x%p\n", NullPointerDereference);
        }

        // Get the value from user mode
        UserValue = *(PULONG)UserBuffer;

        DbgPrint("[+] UserValue: 0x%p\n", UserValue);
        DbgPrint("[+] NullPointerDereference: 0x%p\n", NullPointerDereference);

        // Validate the magic value
        if (UserValue == MagicValue) {
            NullPointerDereference->Value = UserValue;
            NullPointerDereference->Callback = &NullPointerDereferenceObjectCallback;

            DbgPrint("[+] NullPointerDereference->Value: 0x%p\n", NullPointerDereference->Value);
            DbgPrint("[+] NullPointerDereference->Callback: 0x%p\n", NullPointerDereference->Callback);
        }
        else {
            DbgPrint("[+] Freeing NullPointerDereference Object\n");
            DbgPrint("[+] Pool Tag: %s\n", STRINGIFY(POOL_TAG));
            DbgPrint("[+] Pool Chunk: 0x%p\n", NullPointerDereference);

            // Free the allocated Pool chunk
            ExFreePoolWithTag((PVOID)NullPointerDereference, (ULONG)POOL_TAG);

            // Set to NULL to avoid dangling pointer
            NullPointerDereference = NULL;
        }

#ifdef SECURE
        // Secure Note: This is secure because the developer is checking if
        // 'NullPointerDereference' is not NULL before calling the callback function
        if (NullPointerDereference) {
            NullPointerDereference->Callback();
        }
#else
        DbgPrint("[+] Triggering Null Pointer Dereference\n");

        // Vulnerability Note: This is a vanilla Null Pointer Dereference vulnerability
        // because the developer is not validating if 'NullPointerDereference' is NULL
        // before calling the callback function
        NullPointerDereference->Callback();
#endif
    }
    __except (EXCEPTION_EXECUTE_HANDLER) {
        Status = GetExceptionCode();
        DbgPrint("[-] Exception Code: 0x%X\n", Status);
    }

    return Status;
}
开发者ID:HMSH00D,项目名称:HackSysExtremeVulnerableDriver,代码行数:87,代码来源:NullPointerDereference.c

示例4: CgAmlWriteWalk

static ACPI_STATUS
CgAmlWriteWalk (
    ACPI_PARSE_OBJECT       *Op,
    UINT32                  Level,
    void                    *Context)
{

    /*
     * Print header at level 0. Alignment assumes 32-bit pointers
     */
    if (!Level)
    {
        DbgPrint (ASL_TREE_OUTPUT,
            "Final parse tree used for AML output:\n");
        DbgPrint (ASL_TREE_OUTPUT,
            "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr    Child    Parent   Flags    AcTyp    Final Col L\n",
            76, " ");
    }

    /* Debug output */

    DbgPrint (ASL_TREE_OUTPUT,
        "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
    UtPrintFormattedName (Op->Asl.ParseOpcode, Level);

    if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG    ||
        Op->Asl.ParseOpcode == PARSEOP_NAMESTRING ||
        Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
    {
        DbgPrint (ASL_TREE_OUTPUT,
            "%10.32s      ", Op->Asl.ExternalName);
    }
    else
    {
        DbgPrint (ASL_TREE_OUTPUT, "                ");
    }

        DbgPrint (ASL_TREE_OUTPUT,
        "%08X %04X %04X %01X     %04X  %04X %04X   %04X    %08X %08X %08X %08X %08X %04X  %02d  %02d\n",
                /* 1  */ (UINT32) Op->Asl.Value.Integer,
                /* 2  */ Op->Asl.ParseOpcode,
                /* 3  */ Op->Asl.AmlOpcode,
                /* 4  */ Op->Asl.AmlOpcodeLength,
                /* 5  */ Op->Asl.AmlPkgLenBytes,
                /* 6  */ Op->Asl.AmlLength,
                /* 7  */ Op->Asl.AmlSubtreeLength,
                /* 8  */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
                /* 9  */ Op,
                /* 10 */ Op->Asl.Child,
                /* 11 */ Op->Asl.Parent,
                /* 12 */ Op->Asl.CompileFlags,
                /* 13 */ Op->Asl.AcpiBtype,
                /* 14 */ Op->Asl.FinalAmlLength,
                /* 15 */ Op->Asl.Column,
                /* 16 */ Op->Asl.LineNumber);

    /* Generate the AML for this node */

    CgWriteNode (Op);
    return (AE_OK);
}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:61,代码来源:aslcodegen.c

示例5: _dump_context

static VOID
_dump_context(PCONTEXT pc)
{
#ifdef _M_IX86
   /*
    * Print out the CPU registers
    */
   DbgPrint("CS:EIP %x:%x\n", pc->SegCs&0xffff, pc->Eip );
   DbgPrint("DS %x ES %x FS %x GS %x\n", pc->SegDs&0xffff, pc->SegEs&0xffff,
	    pc->SegFs&0xffff, pc->SegGs&0xfff);
   DbgPrint("EAX: %.8x   EBX: %.8x   ECX: %.8x\n", pc->Eax, pc->Ebx, pc->Ecx);
   DbgPrint("EDX: %.8x   EBP: %.8x   ESI: %.8x   ESP: %.8x\n", pc->Edx,
	    pc->Ebp, pc->Esi, pc->Esp);
   DbgPrint("EDI: %.8x   EFLAGS: %.8x\n", pc->Edi, pc->EFlags);
#elif defined(_M_AMD64)
   DbgPrint("CS:RIP %x:%I64x\n", pc->SegCs&0xffff, pc->Rip );
   DbgPrint("DS %x ES %x FS %x GS %x\n", pc->SegDs&0xffff, pc->SegEs&0xffff,
	    pc->SegFs&0xffff, pc->SegGs&0xfff);
   DbgPrint("RAX: %I64x   RBX: %I64x   RCX: %I64x RDI: %I64x\n", pc->Rax, pc->Rbx, pc->Rcx, pc->Rdi);
   DbgPrint("RDX: %I64x   RBP: %I64x   RSI: %I64x   RSP: %I64x\n", pc->Rdx, pc->Rbp, pc->Rsi, pc->Rsp);
   DbgPrint("R8: %I64x   R9: %I64x   R10: %I64x   R11: %I64x\n", pc->R8, pc->R9, pc->R10, pc->R11);
   DbgPrint("R12: %I64x   R13: %I64x   R14: %I64x   R15: %I64x\n", pc->R12, pc->R13, pc->R14, pc->R15);
   DbgPrint("EFLAGS: %.8x\n", pc->EFlags);
#elif defined(_M_ARM)
   DbgPrint("PC:  %08lx   LR:  %08lx   SP:  %08lx\n", pc->Pc);
   DbgPrint("R0:  %08lx   R1:  %08lx   R2:  %08lx   R3:  %08lx\n", pc->R0, pc->R1, pc->R2, pc->R3);
   DbgPrint("R4:  %08lx   R5:  %08lx   R6:  %08lx   R7:  %08lx\n", pc->R4, pc->R5, pc->R6, pc->R7);
   DbgPrint("R8:  %08lx   R9:  %08lx   R10: %08lx   R11: %08lx\n", pc->R8, pc->R9, pc->R10, pc->R11);
   DbgPrint("R12: %08lx   CPSR: %08lx  FPSCR: %08lx\n", pc->R12, pc->Cpsr, pc->R1, pc->Fpscr, pc->R3);
#else
#error "Unknown architecture"
#endif
}
开发者ID:Strongc,项目名称:reactos,代码行数:33,代码来源:except.c

示例6: PrPreprocessInputFile

static void
PrPreprocessInputFile (
    void)
{
    UINT32                  Status;
    char                    *Token;
    char                    *ReplaceString;
    PR_DEFINE_INFO          *DefineInfo;
    ACPI_SIZE               TokenOffset;
    char                    *Next;
    int                     OffsetAdjust;


    PrGetNextLineInit ();

    /* Scan source line-by-line and process directives. Then write the .i file */

    while ((Status = PrGetNextLine (Gbl_Files[ASL_FILE_INPUT].Handle)) != ASL_EOF)
    {
        Gbl_CurrentLineNumber++;
        Gbl_LogicalLineNumber++;

        if ((Status == ASL_WITHIN_COMMENT) ||
            (Status == ASL_BLANK_LINE))
        {
            goto WriteEntireLine;
        }

        /* Need a copy of the input line for strok() */

        strcpy (Gbl_MainTokenBuffer, Gbl_CurrentLineBuffer);
        Token = PrGetNextToken (Gbl_MainTokenBuffer, PR_TOKEN_SEPARATORS, &Next);
        OffsetAdjust = 0;

        /* All preprocessor directives must begin with '#' */

        if (Token && (*Token == '#'))
        {
            if (strlen (Token) == 1)
            {
                Token = PrGetNextToken (NULL, PR_TOKEN_SEPARATORS, &Next);
            }
            else
            {
                Token++;    /* Skip leading # */
            }

            /* Execute the directive, do not write line to output file */

            PrDoDirective (Token, &Next);
            continue;
        }

        /*
         * If we are currently within the part of an IF/ELSE block that is
         * FALSE, ignore the line and do not write it to the output file.
         * This continues until an #else or #endif is encountered.
         */
        if (Gbl_IgnoringThisCodeBlock)
        {
            continue;
        }

        /* Match and replace all #defined names within this source line */

        while (Token)
        {
            DefineInfo = PrMatchDefine (Token);
            if (DefineInfo)
            {
                if (DefineInfo->Body)
                {
                    /* This is a macro */

                    DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
                        "Matched Macro: %s->%s\n",
                        Gbl_CurrentLineNumber, DefineInfo->Identifier,
                        DefineInfo->Replacement);

                    PrDoMacroInvocation (Gbl_MainTokenBuffer, Token,
                        DefineInfo, &Next);
                }
                else
                {
                    ReplaceString = DefineInfo->Replacement;

                    /* Replace the name in the original line buffer */

                    TokenOffset = Token - Gbl_MainTokenBuffer + OffsetAdjust;
                    PrReplaceData (
                        &Gbl_CurrentLineBuffer[TokenOffset], strlen (Token),
                        ReplaceString, strlen (ReplaceString));

                    /* Adjust for length difference between old and new name length */

                    OffsetAdjust += strlen (ReplaceString) - strlen (Token);

                    DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID
                        "Matched #define: %s->%s\n",
                        Gbl_CurrentLineNumber, Token,
//.........这里部分代码省略.........
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:101,代码来源:prscan.c

示例7: DispatchIoctl

NTSTATUS DispatchIoctl(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
{
	NTSTATUS ntStatus=STATUS_UNSUCCESSFUL;

    PIO_STACK_LOCATION     irpStack=NULL;
	LUID sedebugprivUID;
	ULONG IoControlCode;

	irpStack = IoGetCurrentIrpStackLocation(Irp);
	IoControlCode = irpStack->Parameters.DeviceIoControl.IoControlCode;
		
    switch(IoControlCode)
    {
		
		case IOCTL_CE_ULTIMAP2:
			{
				struct input
				{
					UINT32 PID;	
					UINT32 Size;
					UINT32 RangeCount;
					UINT32 NoPMI;
					UINT32 UserMode;
					UINT32 KernelMode;
					URANGE Ranges[8];
					WCHAR OutputPath[200];
				} *inp = Irp->AssociatedIrp.SystemBuffer;
				int i;

				DbgPrint("IOCTL_CE_ULTIMAP2 V2");
				for (i = 0; i < (int)(inp->RangeCount); i++)
					DbgPrint("%d=%p -> %p", i, (PVOID)inp->Ranges[i].StartAddress, (PVOID)inp->Ranges[i].EndAddress);

				SetupUltimap2(inp->PID, inp->Size, inp->OutputPath, inp->RangeCount, inp->Ranges, inp->NoPMI, inp->UserMode, inp->KernelMode);

				ntStatus = STATUS_SUCCESS;
				break;
			}

		case IOCTL_CE_ULTIMAP2_WAITFORDATA:
		{			
			ULONG timeout = *(ULONG *)Irp->AssociatedIrp.SystemBuffer;
			PULTIMAP2DATAEVENT output = Irp->AssociatedIrp.SystemBuffer;
			DbgPrint("IOCTL_CE_ULTIMAP2_WAITFORDATA\n");
			output->Address = 0;

			ntStatus = ultimap2_waitForData(timeout, output);

			break;
		}

		case IOCTL_CE_ULTIMAP2_LOCKFILE:
		{
			
			int cpunr = *(int *)Irp->AssociatedIrp.SystemBuffer;
			DbgPrint("IOCTL_CE_ULTIMAP2_LOCKFILE\n");
			ultimap2_LockFile(cpunr);

			ntStatus = STATUS_SUCCESS;
			break;
		}

		case IOCTL_CE_ULTIMAP2_RELEASEFILE:
		{			
			int cpunr = *(int *)Irp->AssociatedIrp.SystemBuffer;
			DbgPrint("IOCTL_CE_ULTIMAP2_RELEASEFILE\n");
			ultimap2_ReleaseFile(cpunr);

			ntStatus = STATUS_SUCCESS;				
			break;
		}

		case IOCTL_CE_ULTIMAP2_GETTRACESIZE:
		{
			DbgPrint("IOCTL_CE_ULTIMAP2_GETTRACESIZE\n");
			*(UINT64*)Irp->AssociatedIrp.SystemBuffer = ultimap2_GetTraceFileSize();
			ntStatus = STATUS_SUCCESS;
			break;
		}

		case IOCTL_CE_ULTIMAP2_RESETTRACESIZE:
		{
			DbgPrint("IOCTL_CE_ULTIMAP2_RESETTRACESIZE\n");
			ultimap2_ResetTraceFileSize();
			ntStatus = STATUS_SUCCESS;
			break;
		}


		case IOCTL_CE_ULTIMAP2_CONTINUE:
		{			
			int cpunr=*(int*)Irp->AssociatedIrp.SystemBuffer;
			DbgPrint("IOCTL_CE_ULTIMAP2_CONTINUE\n");
			ntStatus = ultimap2_continue(cpunr);

			break;
		}

		case IOCTL_CE_ULTIMAP2_FLUSH:
		{			
//.........这里部分代码省略.........
开发者ID:cheat-engine,项目名称:cheat-engine,代码行数:101,代码来源:IOPLDispatcher.c

示例8: AnlgCaptureFilterCreate

NTSTATUS AnlgCaptureFilterCreate(IN PKSFILTER Filter, IN PIRP Irp) 
{
    NTSTATUS Status = STATUS_SUCCESS;

    if(!Filter)
    {
	return STATUS_UNSUCCESSFUL;
    }
    if(!Irp)
    {
	return STATUS_UNSUCCESSFUL;
    }
    
    
    PKSDEVICE pKsDevice = KsFilterGetDevice(Filter);
    if(!pKsDevice)
    {
	return Status;
    }
    BOOL pPinDirection[5] = {FALSE, FALSE, TRUE, TRUE, TRUE};
    KSPIN_MEDIUM pMediumList[5] = 
    {
	{
	    GUID_XBarPinMediumVideoOut, 0, 0
	},
	{
	    GUID_XBarPinMediumAudioOut, 0, 0
	},
	{
	    GUID_AnlgCapturePinMediumVideoOut, 0, 0
	},
	{
	    GUID_AnlgCapturePinMediumAudioOut, 0, 0
	},
	{
	    GUID_AnlgCapturePinMediumVBIOut, 0, 0
	}
    };
    
    GUID pCategoryList[5]; 
    pCategoryList[0] = PINNAME_VIDEO_CAPTURE;
    pCategoryList[1] = PINNAME_VIDEO_CAPTURE;
    pCategoryList[2] = PINNAME_VIDEO_CAPTURE;
    pCategoryList[3] = PINNAME_VIDEO_CAPTURE;
    pCategoryList[4] = PINNAME_VIDEO_CAPTURE;


	DbgPrint("SWTANALOG-CaptureFilterCreate");

    Status = KsRegisterFilterWithNoKSPins(
                 pKsDevice->PhysicalDeviceObject,
		 &KSCATEGORY_VIDEO,
		 5,
		 pPinDirection,
		 pMediumList,
		 pCategoryList
		 );

    if(!NT_SUCCESS(Status))
    {
	return Status;
    }

    return Status;

}
开发者ID:kcrazy,项目名称:winekit,代码行数:66,代码来源:anlgcapture.cpp

示例9: VideoOutIntersectDataFormat

static
NTSTATUS
VideoOutIntersectDataFormat(
    IN PVOID piKSFilter,                    //Pointer to KS filter structure.
    IN PIRP pIrp,                           //Pointer to data intersection
                                            //property request.
    IN PKSP_PIN pPinInstance,               //Pinter to structure indicating
                                            //pin in question.
    IN PKSDATARANGE pCallerDataRange,       //Pointer to the caller data
                                            //structure that should be
                                            //intersected.
    IN PKSDATARANGE pDescriptorDataRange,   //Pointer to the descriptor data

    IN DWORD dwBufferSize,                  //Size in bytes of the target
                                            //buffer structure. For size
                                            //queries, this value will be zero.
    OUT OPTIONAL PVOID pData,               //Pointer to the target data
                                            //structure representing the best
                                            //format in the intersection.
    OUT PDWORD pdwDataSize                  //Pointer to size of target data
                                            //format structure.
     )
{

	PKSFILTER pKSFilter = (PKSFILTER) piKSFilter;

	//invalid parameters?
    if( !pKSFilter || !pIrp || !pPinInstance ||
        !pCallerDataRange || !pDescriptorDataRange || !pdwDataSize )
    {
		DbgPrint("SWTANALOG-Capture VideoOut UNSUCCESSFUL");
        return STATUS_UNSUCCESSFUL;
    }

    NTSTATUS Status = STATUS_UNSUCCESSFUL;

    //set output data size
    if (IsEqualGUID(pDescriptorDataRange->Specifier,
		    KSDATAFORMAT_SPECIFIER_VIDEOINFO)) 
	{    

		//*** start intersection ***//

		//check if given datarange GUID matches to our datarange information
		if( pCallerDataRange->FormatSize != sizeof(KS_DATARANGE_VIDEO) )
		{
			DbgPrint("SWTANALOG-Capture VideoOut NO_MATCH 1");
			return STATUS_NO_MATCH;
		}

		//map given data ranges on video information structures
		//for some reason only a subpart of the KS_DATARANGE_VIDEO is used for intersection
		//this subpart is casted to KS_DATAFORMAT_VIDEOINFOHEADER and contains only
		//KSDATAFORMAT and KS_VIDEOINFOHEADER, see pTargetVideoDataRange
		PKS_DATARANGE_VIDEO pCallerVideoDataRange =
			reinterpret_cast <PKS_DATARANGE_VIDEO> (pCallerDataRange);
		PKS_DATARANGE_VIDEO pDescriptorVideoDataRange =
			reinterpret_cast <PKS_DATARANGE_VIDEO> (pDescriptorDataRange);
		PKS_DATAFORMAT_VIDEOINFOHEADER pTargetVideoDataRange =
			reinterpret_cast <PKS_DATAFORMAT_VIDEOINFOHEADER> (pData);

		//check if all other important fields match
		if( pCallerVideoDataRange->bFixedSizeSamples        !=
			pDescriptorVideoDataRange->bFixedSizeSamples        ||
			pCallerVideoDataRange->bTemporalCompression     !=
			pDescriptorVideoDataRange->bTemporalCompression     ||
			pCallerVideoDataRange->StreamDescriptionFlags   !=
			pDescriptorVideoDataRange->StreamDescriptionFlags   ||
			pCallerVideoDataRange->MemoryAllocationFlags    !=
			pDescriptorVideoDataRange->MemoryAllocationFlags    ||

			(RtlCompareMemory(&pCallerVideoDataRange->ConfigCaps,
			&pDescriptorVideoDataRange->ConfigCaps,
			sizeof(KS_VIDEO_STREAM_CONFIG_CAPS))) !=
			sizeof(KS_VIDEO_STREAM_CONFIG_CAPS)    )
		{
			DbgPrint("SWTANALOG-Capture VideoOut NO_MATCH 2");
			return STATUS_NO_MATCH;
		}

		{
			ULONG VideoHeaderSize = KS_SIZE_VIDEOHEADER(
				&pCallerVideoDataRange->VideoInfoHeader
				);
			ULONG DataRangeSize = 
				FIELD_OFFSET(KS_DATARANGE_VIDEO, VideoInfoHeader) +
				VideoHeaderSize;
			if (
				VideoHeaderSize < pCallerVideoDataRange->
				VideoInfoHeader.bmiHeader.biSize ||
				DataRangeSize < VideoHeaderSize ||
				DataRangeSize > pCallerVideoDataRange->
				DataRange.FormatSize
				)
			{
				DbgPrint("SWTANALOG-Capture VideoOut INVALID_PARAMETER 1");
				return STATUS_INVALID_PARAMETER;
			}
		}

//.........这里部分代码省略.........
开发者ID:kcrazy,项目名称:winekit,代码行数:101,代码来源:anlgcapture.cpp

示例10: MpSetMiniportAttributes

NDIS_STATUS
MpSetMiniportAttributes(
    __in  PHWT_ADAPTER                Adapter
    )
{
    NDIS_STATUS                 ndisStatus = NDIS_STATUS_SUCCESS;
    NDIS_MINIPORT_ADAPTER_ATTRIBUTES    miniportAttributes;
    NDIS_PM_CAPABILITIES        pmCapabilities;    

    NdisZeroMemory(&miniportAttributes, sizeof(miniportAttributes));
        
    miniportAttributes.GeneralAttributes.Header.Type = NDIS_OBJECT_TYPE_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES;
    miniportAttributes.GeneralAttributes.Header.Revision = NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2;
    miniportAttributes.GeneralAttributes.Header.Size = NDIS_SIZEOF_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_2;
    
    miniportAttributes.GeneralAttributes.MediaType = NdisMedium802_3;
    miniportAttributes.GeneralAttributes.PhysicalMediumType = NdisPhysicalMediumUnspecified;    
    
    miniportAttributes.GeneralAttributes.MtuSize = 1500;
    miniportAttributes.GeneralAttributes.MaxXmitLinkSpeed = XMIT_SPEED;
    miniportAttributes.GeneralAttributes.MaxRcvLinkSpeed = RECV_SPEED;
    miniportAttributes.GeneralAttributes.XmitLinkSpeed = RECV_SPEED;
    miniportAttributes.GeneralAttributes.RcvLinkSpeed = RECV_SPEED;
    miniportAttributes.GeneralAttributes.MediaConnectState = MediaConnectStateConnected;
    miniportAttributes.GeneralAttributes.MediaDuplexState = MediaDuplexStateFull;
    miniportAttributes.GeneralAttributes.LookaheadSize = 1500;
    
    NdisZeroMemory(&pmCapabilities, sizeof(NDIS_PM_CAPABILITIES));
    pmCapabilities.Header.Type = NDIS_OBJECT_TYPE_DEFAULT;
    pmCapabilities.Header.Revision = NDIS_PM_CAPABILITIES_REVISION_1;
    pmCapabilities.Header.Size = NDIS_SIZEOF_NDIS_PM_CAPABILITIES_REVISION_1;
    miniportAttributes.GeneralAttributes.PowerManagementCapabilitiesEx = &pmCapabilities;

    miniportAttributes.GeneralAttributes.MacOptions = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA | 
                                                            NDIS_MAC_OPTION_TRANSFERS_NOT_PEND |
                                                            NDIS_MAC_OPTION_NO_LOOPBACK;

    miniportAttributes.GeneralAttributes.SupportedPacketFilters = NDIS_PACKET_TYPE_DIRECTED |
                                                            NDIS_PACKET_TYPE_MULTICAST |
                                                            NDIS_PACKET_TYPE_ALL_MULTICAST |
                                                            NDIS_PACKET_TYPE_BROADCAST;

    miniportAttributes.GeneralAttributes.MaxMulticastListSize = 32;
    miniportAttributes.GeneralAttributes.MacAddressLength = sizeof(DOT11_MAC_ADDRESS);

    NdisMoveMemory(
        &miniportAttributes.GeneralAttributes.PermanentMacAddress,
        Adapter->CurrentAddress,
        sizeof(DOT11_MAC_ADDRESS));

    NdisMoveMemory(
        &miniportAttributes.GeneralAttributes.CurrentMacAddress,
        Adapter->CurrentAddress, 
        sizeof(DOT11_MAC_ADDRESS)
        );
    miniportAttributes.GeneralAttributes.RecvScaleCapabilities = NULL;
    miniportAttributes.GeneralAttributes.AccessType = NET_IF_ACCESS_BROADCAST;
    miniportAttributes.GeneralAttributes.DirectionType = NET_IF_DIRECTION_SENDRECEIVE;
    miniportAttributes.GeneralAttributes.IfType = IF_TYPE_ETHERNET_CSMACD;
    miniportAttributes.GeneralAttributes.IfConnectorPresent = TRUE;
    miniportAttributes.GeneralAttributes.DataBackFillSize = 8;

    MpQuerySupportedOidsList(
        &miniportAttributes.GeneralAttributes.SupportedOidList, 
        &miniportAttributes.GeneralAttributes.SupportedOidListLength);

    ndisStatus = NdisMSetMiniportAttributes(
            Adapter->AdapterHandle,
            &miniportAttributes
            );
    if (ndisStatus != NDIS_STATUS_SUCCESS)
    {
        DbgPrint("Failed to set general attributes");
    }
    return ndisStatus;
}
开发者ID:PaulJing,项目名称:Sora,代码行数:76,代码来源:mp_pnp_6x.c

示例11: SetRanges

void SetRanges(const PBRANGES *ranges, int block)
{
	PBIPRANGE *nranges, *oldranges;
	ULONG ncount, labelsid;
	KIRQL irq;

	DbgPrint("pbfilter:  > SetRanges\n");
	if(ranges && ranges->count > 0)
	{
		DbgPrint("pbfilter:    found some ranges\n");
		ncount = ranges->count;
		labelsid = ranges->labelsid;

		DbgPrint("pbfilter:    allocating memory from nonpaged pool");
		nranges = ExAllocatePoolWithTag(NonPagedPool, ranges->count * sizeof(PBIPRANGE), '02GP');
		if (nranges == NULL)
		{
			DbgPrint("pbfilter:    ERROR: SetRanges() can't allocate nranges memory from NonPagedPool!!");
			DbgPrint("  count:[%d], size:[%d]\n", ranges->count, sizeof(PBIPRANGE));
			return;
		}

		DbgPrint("pbfilter:    copying ranges into driver\n");
		RtlCopyMemory(nranges, ranges->ranges, ranges->count * sizeof(PBIPRANGE));
		DbgPrint("pbfilter:    done setting up new ranges\n");
	}
	else
	{
		DbgPrint("pbfilter:    no ranges specified\n");
		ncount = 0;
		labelsid = 0xFFFFFFFF;
		nranges = NULL;
	}

	DbgPrint("pbfilter:    acquiring rangeslock...\n");
	KeAcquireSpinLock(&g_internal->rangeslock, &irq);
	DbgPrint("pbfilter:    ...rangeslock acquired\n");

	if(block)
	{
		DbgPrint("pbfilter:    block list\n");
		oldranges = g_internal->blockedcount ? g_internal->blockedranges : NULL;

		g_internal->blockedcount = ncount;
		g_internal->blockedranges = nranges;
		g_internal->blockedlabelsid = labelsid;
	}
	else
	{
		DbgPrint("pbfilter:    allow list\n");
		oldranges = g_internal->allowedcount ? g_internal->allowedranges : NULL;

		g_internal->allowedcount = ncount;
		g_internal->allowedranges = nranges;
		g_internal->allowedlabelsid = labelsid;
	}

	DbgPrint("pbfilter:    releasing rangeslock...\n");
	KeReleaseSpinLock(&g_internal->rangeslock, irq);
	DbgPrint("pbfilter:    ...rangeslock released\n");

	if(oldranges) {
		DbgPrint("pbfilter:    freeing oldranges\n");
		ExFreePoolWithTag(oldranges, '02GP');
	}
	DbgPrint("pbfilter:  < SetRanges\n");
}
开发者ID:wowngasb,项目名称:kl_tool,代码行数:67,代码来源:common.c

示例12: MPInitializeEx

NDIS_STATUS 
MPInitializeEx(
    __in  NDIS_HANDLE             AdapterHandle,
    __in  NDIS_HANDLE             MiniportDriverContext,
    __in  PNDIS_MINIPORT_INIT_PARAMETERS     MiniportInitParameters
    )
{
    PHWT_ADAPTER    newAdapter = NULL;
    NDIS_STATUS     ndisStatus;
    UNREFERENCED_PARAMETER(MiniportDriverContext);

    DbgPrint("[HWTest]: MPInitializeEx -->\n");
    do
    {
        
        ndisStatus = MpAllocateAdapter(AdapterHandle, &newAdapter);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            DbgPrint("[HWTest]: MpAllocateAdapter return %08x\n", ndisStatus);
            break;
        }
        
        ndisStatus = NICInitializeAdapter(newAdapter, AdapterHandle);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            DbgPrint("[HWTest]: NICInitializeAdapter return %08x\n", ndisStatus);
            ndisStatus = NDIS_STATUS_FAILURE;
            break;
        }

        ndisStatus = MpSetRegistrationAttributes(newAdapter);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            DbgPrint("[HWTest]: MpSetRegistrationAttributes return %08x\n", ndisStatus);
            break;
        }

        ndisStatus = MpSetMiniportAttributes(newAdapter);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            DbgPrint("[HWTest]: MpSetMiniportAttributes return %08x\n", ndisStatus);
            break;
        }

        ndisStatus = VNicAllocateNdisPort(AdapterHandle, &newAdapter->PortNumber);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            DbgPrint("[HWTest]: VNicAllocateNdisPort return %08x\n", ndisStatus);
            break;
        }

    } while (FALSE);
    
    if (ndisStatus != NDIS_STATUS_SUCCESS)
    {
        if (newAdapter != NULL)
        {
            VNicFreeNdisPort(newAdapter);
            NICCleanAdapter(newAdapter);
            MpFreeAdapter(newAdapter);
            NdisWriteErrorLogEntry(AdapterHandle, NDIS_ERROR_CODE_HARDWARE_FAILURE, 0);
        }
    }
    else
    {
        NICAttachAdapter(newAdapter);
        NICRegisterDevice();
    }

    DbgPrint("[HWTest]: MPInitializeEx return %08x\n", ndisStatus);
    return ndisStatus;
}
开发者ID:PaulJing,项目名称:Sora,代码行数:72,代码来源:mp_pnp_6x.c

示例13: TrCreateNode

ACPI_PARSE_OBJECT *
TrCreateNode (
    UINT32                  ParseOpcode,
    UINT32                  NumChildren,
    ...)
{
    ACPI_PARSE_OBJECT       *Op;
    ACPI_PARSE_OBJECT       *Child;
    ACPI_PARSE_OBJECT       *PrevChild;
    va_list                 ap;
    UINT32                  i;
    BOOLEAN                 FirstChild;


    va_start (ap, NumChildren);

    /* Allocate one new node */

    Op = TrAllocateNode (ParseOpcode);

    DbgPrint (ASL_PARSE_OUTPUT,
        "\nCreateNode  Ln/Col %u/%u NewParent %p Child %u Op %s  ",
        Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));

    /* Some extra debug output based on the parse opcode */

    switch (ParseOpcode)
    {
    case PARSEOP_DEFINITIONBLOCK:

        RootNode = Op;
        DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->");
        break;

    case PARSEOP_OPERATIONREGION:

        DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->");
        break;

    case PARSEOP_OR:

        DbgPrint (ASL_PARSE_OUTPUT, "OR->");
        break;

    default:

        /* Nothing to do for other opcodes */

        break;
    }

    /* Link the new node to its children */

    PrevChild = NULL;
    FirstChild = TRUE;
    for (i = 0; i < NumChildren; i++)
    {
        /* Get the next child */

        Child = va_arg (ap, ACPI_PARSE_OBJECT *);
        DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child);

        /*
         * If child is NULL, this means that an optional argument
         * was omitted. We must create a placeholder with a special
         * opcode (DEFAULT_ARG) so that the code generator will know
         * that it must emit the correct default for this argument
         */
        if (!Child)
        {
            Child = TrAllocateNode (PARSEOP_DEFAULT_ARG);
        }

        /* Link first child to parent */

        if (FirstChild)
        {
            FirstChild = FALSE;
            Op->Asl.Child = Child;
        }

        /* Point all children to parent */

        Child->Asl.Parent = Op;

        /* Link children in a peer list */

        if (PrevChild)
        {
            PrevChild->Asl.Next = Child;
        };

        /*
         * This child might be a list, point all nodes in the list
         * to the same parent
         */
        while (Child->Asl.Next)
        {
            Child = Child->Asl.Next;
            Child->Asl.Parent = Op;
//.........这里部分代码省略.........
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:101,代码来源:asltree.c

示例14: TrCreateConstantLeafNode

ACPI_PARSE_OBJECT *
TrCreateConstantLeafNode (
    UINT32                  ParseOpcode)
{
    ACPI_PARSE_OBJECT       *Op = NULL;
    time_t                  CurrentTime;
    char                    *StaticTimeString;
    char                    *TimeString;
    char                    *Filename;


    switch (ParseOpcode)
    {
    case PARSEOP___LINE__:

        Op = TrAllocateNode (PARSEOP_INTEGER);
        Op->Asl.Value.Integer = Op->Asl.LineNumber;
        break;

    case PARSEOP___PATH__:

        Op = TrAllocateNode (PARSEOP_STRING_LITERAL);

        /* Op.Asl.Filename contains the full pathname to the file */

        Op->Asl.Value.String = Op->Asl.Filename;
        break;

    case PARSEOP___FILE__:

        Op = TrAllocateNode (PARSEOP_STRING_LITERAL);

        /* Get the simple filename from the full path */

        FlSplitInputPathname (Op->Asl.Filename, NULL, &Filename);
        Op->Asl.Value.String = Filename;
        break;

    case PARSEOP___DATE__:

        Op = TrAllocateNode (PARSEOP_STRING_LITERAL);

        /* Get a copy of the current time */

        CurrentTime = time (NULL);
        StaticTimeString = ctime (&CurrentTime);
        TimeString = UtLocalCalloc (strlen (StaticTimeString) + 1);
        strcpy (TimeString, StaticTimeString);

        TimeString[strlen(TimeString) -1] = 0;  /* Remove trailing newline */
        Op->Asl.Value.String = TimeString;
        break;

    default: /* This would be an internal error */

        return (NULL);
    }

    DbgPrint (ASL_PARSE_OUTPUT,
        "\nCreateConstantLeafNode  Ln/Col %u/%u NewNode %p  Op %s  Value %8.8X%8.8X  \n",
        Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName (ParseOpcode),
        ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
    return (Op);
}
开发者ID:iHaD,项目名称:DragonFlyBSD,代码行数:64,代码来源:asltree.c

示例15: TrSetOpIntegerValue

ACPI_PARSE_OBJECT *
TrSetOpIntegerValue (
    UINT32                  ParseOpcode,
    ACPI_PARSE_OBJECT       *Op)
{

    if (!Op)
    {
        return (NULL);
    }

    DbgPrint (ASL_PARSE_OUTPUT,
        "\nUpdateOp: Old - %s, New - %s\n",
        UtGetOpName (Op->Asl.ParseOpcode),
        UtGetOpName (ParseOpcode));

    /* Assign new opcode and name */

    if (Op->Asl.ParseOpcode == PARSEOP_ONES)
    {
        switch (ParseOpcode)
        {
        case PARSEOP_BYTECONST:

            Op->Asl.Value.Integer = ACPI_UINT8_MAX;
            break;

        case PARSEOP_WORDCONST:

            Op->Asl.Value.Integer = ACPI_UINT16_MAX;
            break;

        case PARSEOP_DWORDCONST:

            Op->Asl.Value.Integer = ACPI_UINT32_MAX;
            break;

        /* Don't need to do the QWORD case */

        default:

            /* Don't care about others */
            break;
        }
    }

    Op->Asl.ParseOpcode = (UINT16) ParseOpcode;
    UtSetParseOpName (Op);

    /*
     * For the BYTE, WORD, and DWORD constants, make sure that the integer
     * that was passed in will actually fit into the data type
     */
    switch (ParseOpcode)
    {
    case PARSEOP_BYTECONST:

        UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX);
        Op->Asl.Value.Integer &= ACPI_UINT8_MAX;
        break;

    case PARSEOP_WORDCONST:

        UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX);
        Op->Asl.Value.Integer &= ACPI_UINT16_MAX;
        break;

    case PARSEOP_DWORDCONST:

        UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX);
        Op->Asl.Value.Integer &= ACPI_UINT32_MAX;
        break;

    default:

        /* Don't care about others, don't need to check QWORD */

        break;
    }

    /* Converter: if this is a method invocation, turn off capture comments */

    if (AcpiGbl_CaptureComments &&
        (ParseOpcode == PARSEOP_METHODCALL))
    {
        Gbl_CommentState.CaptureComments = FALSE;
    }

    return (Op);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:90,代码来源:asltree.c


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