SymInitialize returns "INVALID HANDLE"

Started by
6 comments, last by Idov 13 years, 6 months ago
Hi!
I'm trying to get symbols of a process using "SymGetSymFromAddr64"
but before that, when i try to initialize the whole thing with "SymInitialize(m_processHandle, NULL, TRUE)" I get error code 6 (invalid handle)

which is pretty strange because just before that I get this handle from "CreateProcessA" and I even double-checked that the handle refers to my process
with "GetProcessId"...
does anybody know what could be the problem?
thanks :)
Advertisement
What does GetLastError() say?

I'm stupid, didn't read [grin]

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Shot in the dark: are you calling SymInitialize on your handle more than once?
Quote:Original post by the_edd
Shot in the dark: are you calling SymInitialize on your handle more than once?


no...
Since loading symbols for a given process is an usual thing for a debugger to do, I assume that you're writing some kind of a debugger.

Quoting from the docs:

Quote:
If the application is a debugger, use the process handle for the process being debugged. Do not use the handle returned by GetCurrentProcess when debugging another process, because calling functions like SymLoadModuleEx can have unexpected results.


Does your project follow this guideline?

Niko Suni

Quote:Original post by Nik02
Since loading symbols for a given process is an usual thing for a debugger to do, I assume that you're writing some kind of a debugger.

Quoting from the docs:

Quote:
If the application is a debugger, use the process handle for the process being debugged. Do not use the handle returned by GetCurrentProcess when debugging another process, because calling functions like SymLoadModuleEx can have unexpected results.


Does your project follow this guideline?


yes :(
Is the target process separate from the process in which you call SymInitialize, though? If it is, have you checked that you have debug privileges to the target?

Niko Suni

yes, it is a different process and I do have debug privileges (I get them in a LIB component I made, if it makes a difference).

This topic is closed to new replies.

Advertisement