Sign in to follow this  
Idov

SymFromAddr returns weird displacement...

Recommended Posts

Hi!
I'm using SymFromAddr (C++/Windows) and although it returns "true" and it seems
to find a symbol name (I don't know if it's the correct one), it returns a very large displacement value (such as 18446744073709551615 = 2 ^64 - 1) or sometimes just 0.

MSDN says:
Displacement [out, optional]
The displacement from the beginning of the symbol, or zero.

why am I getting these values and what does displacement = 0 mean?

thanks :)

Share this post


Link to post
Share on other sites
Have you considered that the number might be signed? In other words, that it's not a "very large displacement value" but a negative number? The 0 probably means that the symbol doesn't exist or isn't loaded or something along those lines.

Share this post


Link to post
Share on other sites
Quote:
Original post by LessBread
Have you considered that the number might be signed? In other words, that it's not a "very large displacement value" but a negative number? The 0 probably means that the symbol doesn't exist or isn't loaded or something along those lines.


But displacement is a DWORD64 (which is defined as unsigned __int64)
and SymFromAddr returns true so I suppose it can't be an error...

Share this post


Link to post
Share on other sites
The documentation says:
Quote:

Remarks
All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

Does this have any implications for your program?

Share this post


Link to post
Share on other sites
Quote:
Original post by rip-off
The documentation says:
Quote:

Remarks
All DbgHelp functions, such as this one, are single threaded. Therefore, calls from more than one thread to this function will likely result in unexpected behavior or memory corruption. To avoid this, you must synchronize all concurrent calls from more than one thread to this function.

Does this have any implications for your program?


no, my program is single-threaded...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this