Results 1 to 2 of 2
  1. #1
    (+)
    (+) is offline
    Senior Member
    Join Date
    Jan 2010
    Location
    Earth
    Posts
    317

    Post Get a functions length 3

    Still cannot follow jumps but better than previous ones.
    You will need the hacker disassembler engine or whatever you want.
    Hacker Disassembler Engine Source Codes

    PHP Code:
    DWORD WINAPI GetFuncLenPBYTE dwFunction )
    {
        
    DWORD OpLen NULL;
        
    DWORD Len NULL;
        
    hde32s hs2;
            
        do
        {
            
    OpLen =  hde32_disasmdwFunction, &hs2 );

            if( *
    dwFunction == 0xC3 || *dwFunction == 0xC2 )
            {
                
    dwFunction +=OpLen;
                
    Len +=OpLen;
                break;
            }

            
    dwFunction +=OpLen;
            
    Len +=OpLen;
        }
        while( 
    );

        return 
    Len;

    Last edited by (+); June 30th, 2012 at 15:38.

  2. #2
    (+)
    (+) is offline
    Senior Member
    Join Date
    Jan 2010
    Location
    Earth
    Posts
    317

    Re: Get a functions length 3

    Here is one by at ColdCristal @ UCForum.

    Code:
     DWORD GetFuncLen(DWORD Addr)
    {
        DWORD Highest = 0;
        DWORD Offset = 0;
        hde32s disasm;
    
        while (true)
        {
            DWORD Target = Offset;
            hde32_disasm((void*)(Addr+Offset), &disasm);
    
            if ((disasm.opcode>=0x70 && disasm.opcode<=0x7F) || disasm.opcode==0xEB)
            {
                Target += disasm.len+(char)disasm.imm.imm8;
            } else if ((disasm.opcode==0x0F && disasm.opcode2>=0x80 && disasm.opcode2<=0x8F) || disasm.opcode==0xE9) {
                Target += disasm.len+(int)disasm.imm.imm32;
            } else if (disasm.opcode==0xC3 || disasm.opcode==0xC2) {
                if (Offset>Highest)
                {
                    Offset += disasm.len;
                    break;
                }
            }
    
            if (Target>Highest)
                Highest = Target;
    
            Offset += disasm.len;
        }
    
        return Offset;
    }

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •