News:

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

Mangle tool help

Started by Magnum, December 09, 2011, 01:14:27 AM

Previous topic - Next topic

Magnum

I found Hutch's Mangle tool.

I got as far as inserting the procedure and prototype, but don't understand
the rest.

Can the text be used in a MessageBox ?

HOW DO YOU USE THIS TOOL ?

Paste your text into the edit window and press the toolbar conversion button (The Gear)
then type in the proc name you require.

Add a prototype for the procedure then call the procedure when your application needs
the text. The return value in EAX is the memory address that the results are written to.

When you have finished with the text, free the memory with the API function GlobalFree()
or use the MASM32 macro "free".
Have a great day,
                         Andy

Tedd

Store the mangled text as if it were a normal string in your program.
When you need the original string, pass the mangled version to the function to decode it, store the return value.
Use the return value as a pointer to the original string (e.g. pass it directly to the messagebox.)
Call GlobalFree with the returned value, to free it.

For efficiency, mangle a group of strings at once, then demangle them at the start of your program and use them without needing to demangle each time; remember to free the block at the end.
No snowflake in an avalanche feels responsible.

Magnum

Is this the right way to use GlobalFree ?

start:

call Mangle ; Return value in EAX is the memory address that the results are written to.

invoke  MessageBox, NULL,eax,addr Box, MB_OK

invoke GlobalFree,NULL ; free up memory

invoke ExitProcess,0

Mangle proc

    LOCAL pMem  :DWORD

    push ebx
    push esi
    push edi

    mov pMem, alloc(17) ; 17 bytes of memory

    mov esi, pMem

    mov DWORD PTR [esi+4], 1836171052
    mov DWORD PTR [esi+12], 2053203587
    mov DWORD PTR [esi+0], 2676751432
    mov DWORD PTR [esi+8], 2201283713
Have a great day,
                         Andy

dedndave

.data?
hMemBlock dd ?

.code
;
;
;
call Mangle ; Return value in EAX is the memory address that the results are written to.
mov hMemBlock,eax

invoke  MessageBox, NULL,eax,addr Box, MB_OK

invoke GlobalFree,hMemBlock ; free up memory

of course, hMemBlock can be a local variable or otherwise stored on the stack