News:

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

how to write to a specific address in memory?

Started by stanleyheng, March 02, 2007, 12:42:34 PM

Previous topic - Next topic

stanleyheng

hi

for example, i need to write "65h" to the memory location "00401001" (the location in memory containing "64h")
how can i do this? can someone help me please?

start:
    mov eax, 100
    mov ecx, 250
    add ecx, eax
    exit
end start

Disassembly
00401000                       start:
00401000 B864000000    mov     eax,64h
00401005 B9FA000000    mov     ecx,0FAh
0040100A 03C8              add     ecx,eax
0040100C 6A00              push    0
0040100E E801000000    call    fn_00401014
00401013 CC                  int     3
00401014                       fn_00401014:
00401014 FF2500204000 jmp     dword ptr [ExitProcess]

TNick

I suspect you have no previous reading about programming ASM. I would suggest to use links in top right corner.

Regards,
Nick
PS
sinsi, this is what you were talking about? :)

MichaelW

No need to do it the hard way just change the mov eax, 64h in your source to mov eax, 65h and recompile.
eschew obfuscation

stanleyheng

i only started using masm yesterday...
my only previous experience with asm is on a motorola 68000 microprocessor

i need to know this because i need to code some self modifying codes for my final year project...
really appreciate any help...thanks

P1

stanleyheng,

Welcome Aboard   :U

A Search Engine and the Forum Search are your friends.

As far as your first question ....

Quote from: stanleyheng on March 02, 2007, 12:42:34 PMfor example, i need to write "65h" to the memory location "00401001" (the location in memory containing "64h")
Why ?  Please answer completely.

Read the rules please about Reverse Engineering and violation EULAs.  Or is this Homework ?  SMC as Homework ? 

Regards,  P1   :8)

stanleyheng

thanks P1

i'm a final year student for Bachelor of Computer Engineering...
my final year project is on "software code obfuscation and tamper protection" aka anti-Reverse Engineering

i read about SMC from some papers and my supervisor asked me to come out with some SMC for testing.

hope my answer is complete enough...
i have been working on this for 2weeks already...i really hope someone can provide me with more direct solution

Seb

I always thought something like this would work.


mov eax, 0401001h
mov byte ptr [eax], 65h ; word ptr/dword ptr

mnemonic

Quote from: Seb on March 02, 2007, 05:45:33 PM
I always thought something like this would work.


mov eax, 0401001h
mov byte ptr [eax], 65h ; word ptr/dword ptr

Sure, it will work.
It will yield some pretty cool message box saying that your program has performed an illegal action and that it will be closed down now.  :wink
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

evlncrn8

Quote from: mnemonic on March 02, 2007, 06:09:36 PM
Sure, it will work.
It will yield some pretty cool message box saying that your program has performed an illegal action and that it will be closed down now.  :wink

not if the code section is defined as rwe and only if dep is enabled as well...

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

stanleyheng

thanks to Seb and evlncrn8!  :U  :clap:

i got it working!  :bg