GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 16-Mar-2005, 08:13
madtown55 madtown55 is offline
New Member
 
Join Date: Mar 2005
Posts: 2
madtown55 is on a distinguished road

Accessing a specific memory address


I am attempting to read and write to a specific memory location. My first attempt was as follows:

CPP / C++ / C Code:
int main(int argc, char *argv[]) { 
int *num1; 
void *p; 
p = reinterpret_cast< void* > (0x04e27e74); 
num1 = (int*)p; 
printf("0x4e27e74=0x%x\n", *num1); 
return 0; 
} 

but every time I run the code to see what is in the memory location I get an access violation exception. I though of using MK_FP, but I do not know what the segment address of this memory address is or how to figure it out.

Basically the above code segment is what I want to do, except I also want to write to the specific location, but it does not work. All sugestions are welcomed.

Madtown54
Last edited by LuciWiz : 16-Mar-2005 at 10:19. Reason: Please insert your C code between [c] & [/c] tags
  #2  
Old 16-Mar-2005, 08:32
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,720
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by madtown55
I am attempting to read and write to a specific memory location.
but every time I run the code to see what is in the memory location I get an access violation exception.

Madtown54


"Modern" operating systems (any Windows > 98/ME, Linux, BSD, etc.) will not allow user programs to have direct access to hardware resources (memory, i/o devices, etc.)

Regards,

Dave
  #3  
Old 16-Mar-2005, 08:41
madtown55 madtown55 is offline
New Member
 
Join Date: Mar 2005
Posts: 2
madtown55 is on a distinguished road
Thanks for your response Dave. How would you suggest I best accomplish what I am trying to do then?
  #4  
Old 16-Mar-2005, 12:37
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,720
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by madtown55
Thanks for your response Dave. How would you suggest I best accomplish what I am trying to do then?

Learn about device drivers (Microsoft DDK is a place to start. Lots of books.)

Regards,

Dave
 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] How to hide e-mail address from SPAM Bots BobbyDouglas Web Design Forum 40 13-Feb-2006 09:44
Why seg fault in char array? nusstu C Programming Language 11 24-Aug-2004 16:10
A Comprehensive Digest of C++ mithunjacob C++ Forum 39 20-Jun-2004 19:09
Rebase - Must Get! BobbyDouglas Miscellaneous Programming Forum 0 18-Aug-2003 04:57

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:42.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.