Discussion:
Retrieving open COM handles from arbitrary PIDs
(too old to reply)
SamCPP
2008-07-01 01:30:01 UTC
Permalink
Hi,

I am trying to build a diagnostic utility for an application that I have
written in C++ (Win32). The application uses a COM port but on occasion, the
COM port may be locked by another application.

I can successfully retrieve all currently running PIDs (and their associated
image names) but is there any way to retrieve any open handles to COM ports
that they may have? The sysinternals program "handle" does not retrieve
handles to COM ports.

Thanks,
Sam
Kerem Gümrükcü
2008-07-01 01:40:33 UTC
Permalink
Hi Sam,

try "Process Explorer",...

Press Ctrl+H for handles in lower pane
and Ctrl+D for loaded libaries,...

You can also search for handles by
pressing Ctrl+F

Regards

Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi,
I am trying to build a diagnostic utility for an application that I have
written in C++ (Win32). The application uses a COM port but on occasion, the
COM port may be locked by another application.
I can successfully retrieve all currently running PIDs (and their associated
image names) but is there any way to retrieve any open handles to COM ports
that they may have? The sysinternals program "handle" does not retrieve
handles to COM ports.
Thanks,
Sam
SamCPP
2008-07-01 03:26:01 UTC
Permalink
Hi Kerem,

Thanks for your reply. I see that I can locate the file through process
explorer but how can I obtain that information programmatically (in my Win32
application)?

Thanks,
Sam
Post by Kerem Gümrükcü
Hi Sam,
try "Process Explorer",...
Press Ctrl+H for handles in lower pane
and Ctrl+D for loaded libaries,...
You can also search for handles by
pressing Ctrl+F
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi,
I am trying to build a diagnostic utility for an application that I have
written in C++ (Win32). The application uses a COM port but on occasion,
the
Post by SamCPP
COM port may be locked by another application.
I can successfully retrieve all currently running PIDs (and their
associated
Post by SamCPP
image names) but is there any way to retrieve any open handles to COM
ports
Post by SamCPP
that they may have? The sysinternals program "handle" does not retrieve
handles to COM ports.
Thanks,
Sam
Kerem Gümrükcü
2008-07-01 03:44:19 UTC
Permalink
Hi Sam,

there are some "partially" undocumented apis for this:
http://www.woodmann.com/forum/showthread.php?t=6318
http://forum.sysinternals.com/forum_posts.asp?TID=14546&KW=open+handles
http://forum.sysinternals.com/forum_posts.asp?TID=14268&KW=open+handles

I see you are a member of sysinternals forum. You will
find a lot of information about this topic there, you also can
ask individuals there how they did something,...

But these examples are good enough,...

Hope this Helps,...

Regards

Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi Kerem,
Thanks for your reply. I see that I can locate the file through process
explorer but how can I obtain that information programmatically (in my Win32
application)?
Thanks,
Sam
Post by Kerem Gümrükcü
Hi Sam,
try "Process Explorer",...
Press Ctrl+H for handles in lower pane
and Ctrl+D for loaded libaries,...
You can also search for handles by
pressing Ctrl+F
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi,
I am trying to build a diagnostic utility for an application that I ha
ve
Post by SamCPP
Post by Kerem Gümrükcü
Post by SamCPP
written in C++ (Win32). The application uses a COM port but on occasion,
the
Post by SamCPP
COM port may be locked by another application.
I can successfully retrieve all currently running PIDs (and their
associated
Post by SamCPP
image names) but is there any way to retrieve any open handles to COM
ports
Post by SamCPP
that they may have? The sysinternals program "handle" does not retrieve
handles to COM ports.
Thanks,
Sam
SamCPP
2008-07-01 05:08:01 UTC
Permalink
Thanks Kerem. I obviously didn't find those threads but I think that is what
I was looking for.

Cheers,
Sam
Post by Kerem Gümrükcü
Hi Sam,
http://www.woodmann.com/forum/showthread.php?t=6318
http://forum.sysinternals.com/forum_posts.asp?TID=14546&KW=open+handles
http://forum.sysinternals.com/forum_posts.asp?TID=14268&KW=open+handles
I see you are a member of sysinternals forum. You will
find a lot of information about this topic there, you also can
ask individuals there how they did something,...
But these examples are good enough,...
Hope this Helps,...
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi Kerem,
Thanks for your reply. I see that I can locate the file through process
explorer but how can I obtain that information programmatically (in my
Win32
Post by SamCPP
application)?
Thanks,
Sam
Post by Kerem Gümrükcü
Hi Sam,
try "Process Explorer",...
Press Ctrl+H for handles in lower pane
and Ctrl+D for loaded libaries,...
You can also search for handles by
pressing Ctrl+F
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi,
I am trying to build a diagnostic utility for an application that I ha
ve
Post by SamCPP
Post by Kerem Gümrükcü
Post by SamCPP
written in C++ (Win32). The application uses a COM port but on
occasion,
Post by SamCPP
Post by Kerem Gümrükcü
the
Post by SamCPP
COM port may be locked by another application.
I can successfully retrieve all currently running PIDs (and their
associated
Post by SamCPP
image names) but is there any way to retrieve any open handles to COM
ports
Post by SamCPP
that they may have? The sysinternals program "handle" does not
retrieve
Post by SamCPP
Post by Kerem Gümrükcü
Post by SamCPP
handles to COM ports.
Thanks,
Sam
Kerem Gümrükcü
2008-07-01 05:14:28 UTC
Permalink
Post by SamCPP
Thanks Kerem. I obviously didn't find those threads but I think that is what
I was looking for.
You are welcome Sam,...sometimes we know what we want, but
sometimes we dont know how to ask,...maybe you did not search
for your solution with the right words,...now you know,...and tell others
if they want to know the same stuff,...;-)


Regards

Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Volodymyr M. Shcherbyna
2008-07-02 09:47:04 UTC
Permalink
Be careful with undocumented functions and structures. Sometimes it is worth
to show user msg box saying that the COM port is busy then peering inside
"prone to change staff".
--
Volodymyr, blog: http://www.shcherbyna.com/
(This posting is provided "AS IS" with no warranties, and confers no
rights)
Post by SamCPP
Thanks Kerem. I obviously didn't find those threads but I think that is what
I was looking for.
Cheers,
Sam
Post by Kerem Gümrükcü
Hi Sam,
http://www.woodmann.com/forum/showthread.php?t=6318
http://forum.sysinternals.com/forum_posts.asp?TID=14546&KW=open+handles
http://forum.sysinternals.com/forum_posts.asp?TID=14268&KW=open+handles
I see you are a member of sysinternals forum. You will
find a lot of information about this topic there, you also can
ask individuals there how they did something,...
But these examples are good enough,...
Hope this Helps,...
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi Kerem,
Thanks for your reply. I see that I can locate the file through process
explorer but how can I obtain that information programmatically (in my
Win32
Post by SamCPP
application)?
Thanks,
Sam
Post by Kerem Gümrükcü
Hi Sam,
try "Process Explorer",...
Press Ctrl+H for handles in lower pane
and Ctrl+D for loaded libaries,...
You can also search for handles by
pressing Ctrl+F
Regards
Kerem
--
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Post by SamCPP
Hi,
I am trying to build a diagnostic utility for an application that I ha
ve
Post by SamCPP
Post by Kerem Gümrükcü
Post by SamCPP
written in C++ (Win32). The application uses a COM port but on
occasion,
Post by SamCPP
Post by Kerem Gümrükcü
the
Post by SamCPP
COM port may be locked by another application.
I can successfully retrieve all currently running PIDs (and their
associated
Post by SamCPP
image names) but is there any way to retrieve any open handles to COM
ports
Post by SamCPP
that they may have? The sysinternals program "handle" does not
retrieve
Post by SamCPP
Post by Kerem Gümrükcü
Post by SamCPP
handles to COM ports.
Thanks,
Sam
1***@gmail.com
2013-06-27 08:37:29 UTC
Permalink
Hi,I am trying to build a diagnostic utility for an application that I have written in C++ (Win32). The application uses a COM port but on occasion, the COM port may be locked by another application.I can successfully retrieve all currently running PIDs (and their associated image names) but is there any way to retrieve any open handles to COM ports that they may have? The sysinternals program "handle" does not retrieve handles to COM ports.Thanks,Sam
Can you help me out link is not working http://forum.sysinternals.com/forum_posts.asp?TID=14268&KW=open+handles
Loading...