Hi, this maybe sounds crazy but i ll just start :tongue:

I want to read out a part of memory that i cant access using delphi.
I thought maybe an external asm programm may work.
I want to move the information beginning from memory address A -> ending at memory address B to begin at the memory address C.

Memory address C will be where my delphi prog has its memory, and i create a great array or such with dummy values that will get magically filled with the information that lies between address A and B. The addresses will vary so i would need to hand them over to the asm prog via command line if possible or some other way.
Problem is i have no idea how to code in asm. I installed masm but figured it will take long untill i can do something decent.
Someone can help me?

Oh and why cant i use alt + Q anymore since i installed masm? Always the masm editor pops up?
Posted on 2004-08-05 10:25:03 by zerog
MemCopy proc uses edi esi ecx, lpDest,lpSource,nBytes


cld
mov edi,[lpDest]
mov esi,[lpSource]
mov ecx,[nBytes]

; do the evenly divisible ones
shr ecx,2
rep movsd

; do the remainder
mov ecx,[nBytes]
and ecx,3
rep movsb
RET
MemCopy ENDP
Posted on 2004-08-05 10:33:46 by donkey
If the memory reading/dumping/whatever cannot be done in delphi, it cannot be done with assembly either.

MASM installer puts shortcut on your desktop without asking for, probably this shortcut is tied to the hotkey alt+q.
Posted on 2004-08-05 10:55:14 by f0dder

MemCopy proc uses edi esi ecx, lpDest,lpSource,nBytes



Thx! But how do i use that in a asm prog? And how do i get input from the command line?



If the memory reading/dumping/whatever cannot be done in delphi, it cannot be done with assembly either.
MASM installer puts shortcut on your desktop without asking for, probably this shortcut is tied to the hotkey alt+q.


Well im not sure if it cant be done in delphi, but I cant do it :P I thought a little asm prog would be less complicated.
I can read the memory region with a hexeditor, if a hexeditor can do that im sure asm can that too.
And thx for the shortcut tip, i deleted it and my @ works again :)
Posted on 2004-08-05 11:10:58 by zerog
Thx! But how do i use that in a asm prog? And how do i get input from the command line?


You can use GetCL in a console app to get commandline info but it really makes no difference. The memory in your Delphi app is private to it's process. If you wish to affect it with an external application, you first have to open the process, then you can use ReadPRocessMemory, WriteProcessMemory as long as you have appropriate access rights. If you wish to copy to another location that has not been allocated you must allocate the memory using VirtualAllocEx in NT or ordinal imports using 9x. There are alot of posts here on how to do that.
Posted on 2004-08-05 11:40:42 by donkey
there's a "block" or "memory" copy routine in the pascal runtimes - can't remember the exact name, but you should be able to find it in the online help. Copying memory from one location to another is a single-line operation. You might need some typecasts, and if you're dealing with another process' memory it's a bit more work... but it's certainly all doable from pascal with zero assembly code.
Posted on 2004-08-05 11:51:02 by f0dder
If I am not wrong, you want to read the memory in a separate process or something like that? Something that some hexeditors can do. Am I correct?
Posted on 2004-08-05 12:10:47 by roticv
copy memory from process A (delphi app) to Process B (Memory block) ??? :? :?
Posted on 2004-08-05 12:57:44 by wizzra
Well i want to read out the BIOS of my gfx card. Mines is stored from $00001005 to $000102DC in main memory.
I dont know if a process uses that area. But i know in a hexeditor i can enter goto $00001005 and i can see it.
So it must be possible for windows programs to read there.

If i use inline assembler i get access violation on the mov al, line :



function readhex (address:integer):byte;
begin
asm
mov eax, address
mov al, [eax]
mov @result, al
end;
end;


Probaly its because im missing VirtualAllocEx?
But VirtualAllocEx seems to need a handle on a target proccess, and i dont know which proccess uses the mem region of the gfx card bios.
Posted on 2004-08-05 12:58:23 by zerog