TCS
TCS

Reputation: 5900

struct which a HANDLE points to

I tried without success to find information about the structs that HANDLEs point to. For example, CreateFile() returns a HANDLE (== void*) that I think points to a struct with information about the file. Same thing for processes and threads and every HANDLE.

So, where can I find information about the structs that the HANDLE points to?

Thanks! :-)

Upvotes: 3

Views: 2839

Answers (4)

Tugrul Ates
Tugrul Ates

Reputation: 9687

The HANDLE type in WINAPI is an opaque pointer utilized to hide implementation details from the programmer. It is usually a bad idea to write code that depends on the internals behind an opaque pointer since one of its uses is the ability for the API provider to change those internals without breaking any user code. Even if you find a way to read/write data behind them, it is not impossible for a new OS update to invalidate your software.

Upvotes: 5

Puppy
Puppy

Reputation: 146940

You cannot access the internals of the struct - it may not even exist in your process. This is the point of using HANDLEs- so that you can't do this.

Upvotes: 2

Jörgen Sigvardsson
Jörgen Sigvardsson

Reputation: 4887

You can read more about Windows handles here: http://msdn.microsoft.com/en-us/library/ms724485(v=vs.85).aspx

Upvotes: 0

Gabe
Gabe

Reputation: 86718

The HANDLE is just a number that is used inside the kernel to lookup data (maybe in a tree or hash table) about the object. It is not a pointer. In order to learn about the object, you have to use a kernel-mode debugging tool. If that's what you're looking for, please edit your question to clarify.

Upvotes: 2

Related Questions