Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-04

FPC and Memory

5 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Pianoman

Yes, this is interisting but I'd like for example to create a memory image of some part of ram to see exactly what is there. In old dos days it was possible to do like for i:=0 to 65535 do for j:=0 to 15 do write(f,mem[i,j]); or similarly. But how can be done this in Windows?

Pianoman----- Original Message -----
From:
To:
Sent: Thursday, April 28, 2005 12:00 PM
Subject: fpc-pascal Digest, Vol 8, Issue 26

Show quoted text 90 lines
Send fpc-pascal mailing list submissions to To subscribe or unsubscribe via the World Wide Web, visit http://lists.freepascal.org/mailman/listinfo/fpc-pascal or, via email, send a message with subject or body 'help' to You can reach the person managing the list at When replying, please edit your Subject line so it is more specific than "Re: Contents of fpc-pascal digest..." Today's Topics: 1. FPC for Win32 and memory (Pianoman) 2. Re: FPC for Win32 and memory (Nico Arag?n) 3. fpc: documentation: Command-line options and switches Reference chart.. (Jan Ruzicka) 4. Re: fpc: documentation: Command-line options and switches Reference chart.. (Michael Van Canneyt) ---------------------------------------------------------------------- Message: 1 Date: Wed, 27 Apr 2005 17:10:32 +0200 From: "Pianoman" Subject: [fpc-pascal] FPC for Win32 and memory To: Message-ID: Content-Type: text/plain; charset="iso-8859-1" Hello , How can I access memory outside of my process for example to monitor some other process? Pianoman ----- Original Message ----- From: To: Sent: Wednesday, April 27, 2005 12:00 PM Subject: fpc-pascal Digest, Vol 8, Issue 25 > Send fpc-pascal mailing list submissions to > > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > or, via email, send a message with subject or body 'help' to > > > You can reach the person managing the list at > > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of fpc-pascal digest..." > > > Today's Topics: > > 1. Re: Error: cannot find -lcurses (Michael Van Canneyt) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 26 Apr 2005 18:12:23 +0200 (CEST) > From: Michael Van Canneyt > Subject: Re: [fpc-pascal] Error: cannot find -lcurses > To: FPC-Pascal users discussions > Message-ID: > Content-Type: TEXT/PLAIN; charset=US-ASCII > > > > On Sun, 24 Apr 2005, Greenblatt wrote: > > > Hi, > > > > I have a problem with FreePascal 1.0.10 under SuSE 9.1. If I want to > > compile source code, which makes use of the keyboard unit, I get the > > following error message: > > > > /usr/bin/ld: cannot find -lcurses > > Pong(46) Error: Error while linking > > Closing script ppas.sh > > > > Since I'm a beginner concerning Pascal and don't know the

inner-working

Show quoted text 47 lines
> > of the compiler, I ask you for help. > > You need to install the ncurses development package. (it's called ncurses-devel) > > Michael. > > > > ------------------------------ > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > End of fpc-pascal Digest, Vol 8, Issue 25 > ***************************************** > > > > __________ Informacia od NOD32 1.1079 (20050426) __________ > > Tato sprava bola preverena antivirusovym systemom NOD32. > http://www.eset.sk > > ------------------------------ Message: 2 Date: Wed, 27 Apr 2005 21:34:46 +0200 From: Nico Arag?n Subject: Re: [fpc-pascal] FPC for Win32 and memory To: FPC-Pascal users discussions Message-ID: Content-Type: text/plain; charset="iso-8859-1" El Miércoles, 27 de Abril de 2005 17:10, Pianoman escribió: > Hello , How can I access memory outside of my process for example to > monitor some other process? You should execute the process that you want to debug using the debug API. I've searched for "win32 api create process debug" in Google and found

these

Show quoted text 5 lines

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndebug/htm l/msdn_debugEH.asp

Show quoted text 93 lines
Hope that helps! -- saludos, Nico Aragón ------------------------------ Message: 3 Date: Wed, 27 Apr 2005 23:31:20 -0400 From: Jan Ruzicka Subject: [fpc-pascal] fpc: documentation: Command-line options and switches Reference chart.. To: FPC-Pascal users discussions Message-ID: Content-Type: text/plain; charset=US-ASCII; format=flowed Hi looking around FPC documentation I came across http://www.freepascal.org/docs-html/chart/chart.html The "Command-line options and switches Reference chart.." page It needs at least HTML header/footer and <pre> tag. I don't like complainers so here is my cleanup attempt http://home.comcast.net/~jan.ruzicka/chart.html Jan ------------------------------ Message: 4 Date: Thu, 28 Apr 2005 10:00:51 +0200 (Romance Daylight Time) From: Michael Van Canneyt Subject: Re: [fpc-pascal] fpc: documentation: Command-line options and switches Reference chart.. To: FPC-Pascal users discussions Message-ID: Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Wed, 27 Apr 2005, Jan Ruzicka wrote: > Hi > > looking around FPC documentation I came across > http://www.freepascal.org/docs-html/chart/chart.html > > The "Command-line options and switches Reference chart.." page > > It needs at least HTML header/footer and <pre> tag. > > I don't like complainers so here is my cleanup attempt > http://home.comcast.net/~jan.ruzicka/chart.html Thanks. But the file is generated from LaTeX, so the next version would override your changes :/ However, I'll look into it. Michael. ------------------------------ _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal End of fpc-pascal Digest, Vol 8, Issue 26 ***************************************** __________ Informacia od NOD32 1.1080 (20050428) __________ Tato sprava bola preverena antivirusovym systemom NOD32. http://www.eset.sk

Reply by email

Alexey Pavluchenko
to Pianoman

Hello Pianoman,

Thursday, April 28, 2005, 1:44:43 PM, you wrote:

P> Yes, this is interisting but I'd like for example to create a memory image P> of some part of ram to see exactly what is there. In old dos days it was P> possible to do like for i:=0 to 65535 do for j:=0 to 15 do P> write(f,mem[i,j]); or similarly. But how can be done this in Windows?

Here's an excerpt from WinAPI reference:

=== cut ===
The ReadProcessMemory function reads memory in a specified process. The entire area to be read must be accessible, or the operation fails.

BOOL ReadProcessMemory(

HANDLE hProcess, // handle of the process whose memory is read LPCVOID lpBaseAddress, // address to start reading LPVOID lpBuffer, // address of buffer to place read data DWORD cbRead, // number of bytes to read
LPDWORD lpNumberOfBytesRead // address of number of bytes read

   );

Parameters

hProcess

Identifies an open handle of a process whose memory is read. The handle must have PROCESS_VM_READ access to the process.

lpBaseAddress

Points to the base address in the specified process to be read. Before any data transfer occurs, the system verifies that all data in the base address and memory of the specified size is accessible for read access. If this is the case, the function proceeds; otherwise, the function fails.

lpBuffer

Points to a buffer that receives the contents from the address space of the specified process.

cbRead

Specifies the requested number of bytes to read from the specified process.

lpNumberOfBytesRead

Points to the actual number of bytes transferred into the specified buffer. If lpNumberOfBytesRead is NULL, the parameter is ignored.

Return Value

If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError.
The function fails if the requested read operation crosses into an area of the process that is inaccessible.

Remarks

ReadProcessMemory copies the data in the specified address range from the address space of the specified process into the specified buffer of the current process. Any process that has a handle with PROCESS_VM_READ access can call the function. The process whose address space is read is typically, but not necessarily, being debugged.
The entire area to be read must be accessible. If it is not, the function fails as noted previously.

See Also

WriteProcessMemory
=== cut ===

Best regards, Alexey

Reply by email

Tomas Hajny

On Thu, April 28, 2005 13:52, Alexey Pavluchenko said:

Show quoted text 12 lines
P> Yes, this is interisting but I'd like for example to create a memory image P> of some part of ram to see exactly what is there. In old dos days it was P> possible to do like for i:=0 to 65535 do for j:=0 to 15 do P> write(f,mem[i,j]); or similarly. But how can be done this in Windows? Here's an excerpt from WinAPI reference: === cut === The ReadProcessMemory function reads memory in a specified process. The entire area to be read must be accessible, or the operation fails.

.
.

Alternatively, you can create shared memory area (memory mapped file) - see e.g.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/creating_named_shared_memory.asp for Win32 API example.

Tomas

Reply by email

Marco van de Voort
to Pianoman: Yes, this is interisting but I'd like for example to create a memory image of some part…

[ Charset ISO-8859-1 unsupported, converting... ]

Yes, this is interisting but I'd like for example to create a memory image of some part of ram to see exactly what is there. In old dos days it was possible to do like for i:=0 to 65535 do for j:=0 to 15 do write(f,mem[i,j]); or similarly. But how can be done this in Windows?

Not like this. There are some ways via win32 api calls probably, but these are probably privileged (requires adminstrator rights)

I'd search for "physical memory access" or so on MSDN.

Reply by email

Tomas Hajny
to Marco van de Voort

Subject: Re: [fpc-pascal] FPC and Memory
To: FPC-Pascal users discussions
Date sent: Sun, 1 May 2005 12:27:30 +0200 (CEST) From: (Marco van de Voort)
Send reply to: FPC-Pascal users discussions

Show quoted text 11 lines
[ Charset ISO-8859-1 unsupported, converting... ] > Yes, this is interisting but I'd like for example to create a memory > image of some part of ram to see exactly what is there. In old dos > days it was possible to do like for i:=0 to 65535 do for j:=0 to 15 > do write(f,mem[i,j]); or similarly. But how can be done this in > Windows? Not like this. There are some ways via win32 api calls probably, but these are probably privileged (requires adminstrator rights) I'd search for "physical memory access" or so on MSDN.

Although I'm no Win32 programmer, I'd expect that "physical memory access" should be only possible from drivers (and that wouldn't help here anyway, because one doesn't know the real "physical memory address" used by the other process). Accessing memory of another process (without special support in this process) is probably only possible through the debugging API mentioned by somebody else (which needs NT privilege for debugging). Another (IMHO better) alternative could be by using shared memory (allocated as such in the "monitored" process), or by providing hooks in the monitored process for enquiring the current status. These hooks could be provided by having a dedicated thread in the monitored process listening for requests sent through a named pipe (local only, very easy to setup) or a TCP/IP socket (allows remote monitoring too, but somewhat more overhead).

Tomas

Reply by email