首页 > 代码库 > 汇编-获取函数名称

汇编-获取函数名称

printstring macro Var: REQ
    local info
    .code
    if DBGWIN_DEBUG_ON eq 1
        pushad
        invoke szLen, addr Var
        if DBGWIN_EXT_INFO eq 1
            info textequ @CatStr(< !(>, SFileName(), <!, >, %@Line, <!)>)
            ;push eax
            add eax, @SizeStr(&Var)+4+@SizeStr(%info)
        else
            add eax, @SizeStr(&Var)+4
        endif
        invoke GlobalAlloc, GPTR, eax
        mov ebx, eax
        ;invoke FillMemory,ebx,sizeof(var),offset Var
         FillMem ebx, &Var
         invoke szTrim,ebx 
invoke szLen,ebx mov ecx,eax dec ecx invoke szRight,ebx,addr sztextname,ecx ; invoke DebugPrint, ebx invoke GlobalFree, ebx popad endif EXITM ENDM _invoke MACRO funcname:REQ,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20 LOCAL pos,counter .data IFNDEF sz_removetext sz_removetext db 0 ENDIF IFNDEF funcname funcname dd 0 ENDIF .code counter=0 FOR arg,<p20,p19,p18,p17,p16,p15,p14,p13,p12,p11,p10,p9,p8,p7,p6,p5,p4,p3,p2,p1> IFNB <arg> counter=counter+4 pos=@InStr(1,arg,<ADDR >) OR @InStr(1,arg,<addr >) OR @InStr(1,arg,<Addr >) OR @InStr(1,arg,<ADDR >) OR @InStr(1,arg,<addr >) OR @InStr(1,arg,<Addr >) IF pos IF ((OPATTR(@SubStr(arg,%pos+5))) EQ 98) OR ((OPATTR(@SubStr(arg,%pos+5))) EQ 34) lea eax,@SubStr(<arg>,%pos+5) push eax ELSE push OFFSET @SubStr(<arg>,%pos+5) ENDIF ELSE push arg ENDIF ENDIF ENDM pushad xor eax,eax xor ebx,ebx xor ecx,ecx xor edx,edx printstring funcname popad ;PrintDec _dwuser32 ;PrintDec _dwgdi32 ;PrintDec dwcomdlg32 ;PrintDec dwComctl32 ;PrintDec dwoleaut32 ;PrintDec dwmsvcrt ;PrintDec dwshell32 ;PrintDec _dwkernel32 xor edx,edx .while edx<=28 invoke GetProcAddr, dword ptr[_dwuser32+edx] ,addr sztextname .if eax jmp @F .break .endif adc edx,4 .endw @@: .if eax mov funcname,eax call funcname ; ;PrintDec _dwuser32 .elseif eax .endif IF ((OPATTR(funcname)) AND 11100000000y) EQ 00100000000y ; Handle C functions IF counter NE 0 add esp,counter ; correct the stack ENDIF ENDIF