Base address

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2007
Posts: 200
Reputation: shouvik.d is an unknown quantity at this point 
Solved Threads: 6
shouvik.d's Avatar
shouvik.d shouvik.d is offline Offline
Posting Whiz in Training

Base address

 
0
  #1
Jan 24th, 2007
Hi all,

we al know the preffered load address of any proj is 0x00400000 and DLL is 0x10000000. now if the OS is unable to use this address it relocates the project.
now i have a need to use the Rva+Base address of all the methods available in a class within a project. One method is reading the map file but say if u don't have the address available so relocation takes place hence the safest way is to dynamicaly obtain it

hence i want to know is there any way of obtaining the base address or the load address of a process. if at all you feel this is not a viable solution then can i obtain the current address from the mangled names like ?show@disp@@QAEXXZ for a public method show belonging to class disp as per VC++ conventions.

undname just gives the resolved name but its of no use in callin a function. so can you people just help me out

for a better idea u can refer
1)Mangled Name

2)Private Access
Regards
Shouvik
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,442
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1474
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Base address

 
0
  #2
Jan 24th, 2007
You want the address of a function?
  1. int foo()
  2. {
  3. // blabla
  4. return something;
  5. }
  6.  
  7. // pointer to the function
  8. int (*fn)();
  9.  
  10. // set pointer
  11. fn = foo;

You can also get pointers to class methods. I have not used them so I'm not sure how they work.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 200
Reputation: shouvik.d is an unknown quantity at this point 
Solved Threads: 6
shouvik.d's Avatar
shouvik.d shouvik.d is offline Offline
Posting Whiz in Training

Re: Base address

 
0
  #3
Jan 24th, 2007
I think you didn't get my question correctly. I need the Load address of a process. So that i can calculate the Rva+Base address
please refer to the links i'd provided in my posts
Regards
Shouvik
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,442
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1474
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Base address

 
0
  #4
Jan 24th, 2007
The people as codeproject.com seems to have answered your question quite adequately. I see no point in rehashing something that was already posted over there.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 200
Reputation: shouvik.d is an unknown quantity at this point 
Solved Threads: 6
shouvik.d's Avatar
shouvik.d shouvik.d is offline Offline
Posting Whiz in Training

Re: Base address

 
-1
  #5
Jan 24th, 2007
you needn't have taken pains to post this too.
Regards
Shouvik
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 200
Reputation: shouvik.d is an unknown quantity at this point 
Solved Threads: 6
shouvik.d's Avatar
shouvik.d shouvik.d is offline Offline
Posting Whiz in Training

Re: Base address

 
0
  #6
Jan 25th, 2007
Originally Posted by Ancient Dragon View Post
The people as codeproject.com seems to have answered your question quite adequately. I see no point in rehashing something that was already posted over there.
Firstly though this is a follow up of the previous thread but it's nowhere near to rehashing...

secondly my private access is done whereby I did not perform any malicious activities

Still after this I really thank all of those who poured in suggestions and criticisms because both are complementary.

Thanks to all for there precious time spending on this thread. Will meet you guys in some other thread
Regards
Shouvik
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC