News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

MASM Macro Text Code Line

Started by BolterVi, March 16, 2016, 03:15:42 AM

Previous topic - Next topic

BolterVi

Hello,

I was wondering if it's possible to receive the text of a specific code line with macros as string.

As example (Just random code):

1. mov eax, 4
2. cmp eax, 5
3. jb @F
4. sub eax, 1
5. ...


and with a macro i can receive the code line as text like

m1 macro
    LOCAL t
    t CATSTR <Line 4:>, $-X
    echo t
endm


where $-X stands for the desired line.
The output should be something like:

Line 4:sub eax, 1


Just wondering if something like that is possible, if not it's okay.

Regards,
BolterVi

jj2007

Hi BolterVi,

Welcome to the forum :icon14:

To my knowledge, that is not possible. But if your goal is to display certain lines of your source, or to analyse your sources, there are plenty of other ways to do it. Simple example:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  Recall "MySource.asm", L$()      ; load a textfile into a string array
  Inkey "Line 4: ", L$(4)          ; print line 4 and wait for a key
EndOfCode


What exactly do you want to achieve?

BolterVi

Hey!

Thanks for your fast reply. :)

I thought about creating a small packer/obfusactor by using macros.
As example there would be mutation macros

MUTATION_START
;Example code here:
xor ecx, ecx
@@:
;something here..
inc ecx
cmp ecx, 5
jb @B
MUTATION_END


and the code between those macros is getting mutated.
This was just an idea flying around in my head :)