Jump to content
  • Advertisement
Sign in to follow this  
AndiDog

Enumerating process's handles

This topic is 4020 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can I enumerate a process's handles (and determine if they are file handles)? I found out NtQuerySystemInformation returns the number of handles owned by a process and there's a SYSTEM_HANDLE_INFORMATION struct in ntapi.h, but no documentation at MSDN (Link to documentation). What I wanna do is close a specific file handle so the file can be read by another program.

Share this post


Link to post
Share on other sites
Advertisement
Unless you are the author of both programs (in which case you could implement some other kind of inter-process communication to do what you want to do), that sounds like a terrible idea.

Share this post


Link to post
Share on other sites
So to speak, I am the author of both programs - program A that owns the file handle and program B (coded by myself) that executes code in program A (this part already works!).

I do only have to find out how to search for handles as if it were my own program ;)

Share this post


Link to post
Share on other sites
Since you own the code, couldn't program A just keep a list of the file handles it opens? Then program B can tell program A to close them.

Share this post


Link to post
Share on other sites
Oh, you got me wrong. I don't own the code of program A.

Program A is a third-party program that opens a file and thus locks it.

I want to unlock this file with program B. Program B opens a thread in program A (CreateRemoteThread) so it can execute code as if I coded program A.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!