Solved

Reading a Memory Location?

Posted on 1999-01-09
10
210 Views
Last Modified: 2010-04-06
I want to be able to read a ROM memory address and place the information into a text string.  For example, if I wanted to read the ROM Date of a PC, I could use debug and dump location F000:FFF0 to view the date.  I would like to be able to assign this date to a string variable.  Any help is appreciated.  Thanks.
0
Comment
Question by:rickofkirkwood
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1355624
Under windows you cannot use the segment:offset way of memory accessing... If you do an app for DOS then you can use it and it is very easy...

for DOS....

var data :array[0..5] of char absolute $F000:FFF0;

writeln(data);

if writeln(data); doesn;t work then you should do this...

for i := 0 to 5 do
  write(data[i]);
writeln;

but I think it would work that way also...

-Viktor
--Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1355625
oppps...

var data :array[0..5] of char absolute $F000:FFF0;

should be

var data :array[0..5] of char absolute $F000:$FFF0;
0
 

Author Comment

by:rickofkirkwood
ID: 1355626
viktornet,

  I tried using your suggestion:
   I created a console app (to run from dos) and kept getting
   "segment/offset not supported" errors.  I have small DOS application that I found in an MS-DOS tips & tricks book that does display the data, but I don't want to shell to DOS and run it.  I suspect there may a way using delphi's memory-mapping methods, but don't know yet.  Thanks for your help and if you have any other ideas, please let me know.  Rick
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 12

Expert Comment

by:rwilson032697
ID: 1355627
Look at VirtualProtectEx et al in the memory management functions API group. You should be able to do what you need to do with these functions...

Cheers,

Raymond
0
 

Author Comment

by:rickofkirkwood
ID: 1355628
Raymond,

  Do you have any code examples to implement this API from Delphi (4.0)?  
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1355629
Sorry, no.
0
 
LVL 2

Accepted Solution

by:
ivi earned 40 total points
ID: 1355630
For Win95/98 only, not for NT:

var Buffer : array[0..64] of DWORD;
    nBytes : DWORD;
    Addr   : Pointer;
begin
  Addr:=Pointer($FFFF0); // 16*Segment+Offset
  FillChar(Buffer,256,0);
  if  ReadProcessMemory(
    GetCurrentProcess(),
    Addr,
    @Buffer,
    256,
    nBytes)
  then   Label1.caption:=IntToHex(Buffer[0],8);
  else Label1.Caption:='False...';

0
 

Author Comment

by:rickofkirkwood
ID: 1355631
Dear Ivi...

I tried your suggestion, but was not successful.  The actual offset is $FFF5 which represents the ROM Date.  I did get an answer from your suggestion so I think we are on the right track.  The answer was "00E05BEA".  Maybe I need to try to convert to text or increase the size of the buffer?  Any ideas?  Thanks.. Rick
0
 
LVL 2

Expert Comment

by:ivi
ID: 1355632
Just use Buffer : array[0..8] of Char;
Addr := $FFFF5;

.
after call:

 Buffer[8]:=#0;
 Label1.caption:=StrPas(Buffer);

In my opinion it works (I see data like 'xx/xx/xx');.
0
 

Author Comment

by:rickofkirkwood
ID: 1355633
Adjusted points to 40
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question