News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Macro to alter a certain range of code?

Started by asmftw, April 16, 2008, 07:54:58 PM

Previous topic - Next topic

asmftw

Hello, I was wondering if there is a way to wrap a selected block of code in a macro that will make it be altered. The reason I want to do this is to make a basic packer to protect my application.

For example, my "unpacking" routine will decrease one from each byte:

Unpack PROC lpBase:DWORD, dwSize:DWORD
    mov ecx,[dwSize]
    mov esi,[lpBase]
Unpack_Loop:
    inc dword ptr [esi+ecx] ; Increase each byte by one
    loopd Unpack_Loop
    inc dword ptr [esi]     ; Increase last byte
    ret
Unpack ENDP


So my macro would have to make each byte initially be decreased