Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Retrieving open COM handles from arbitrary PIDs

2,691 views
Skip to first unread message

SamCPP

unread,
Jun 30, 2008, 9:30:01 PM6/30/08
to
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ü

unread,
Jun 30, 2008, 9:40:33 PM6/30/08
to
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."

"SamCPP" <Sam...@discussions.microsoft.com> schrieb im Newsbeitrag
news:81901330-6456-4E6F...@microsoft.com...

SamCPP

unread,
Jun 30, 2008, 11:26:01 PM6/30/08
to
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

Kerem Gümrükcü

unread,
Jun 30, 2008, 11:44:19 PM6/30/08
to
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."

"SamCPP" <Sam...@discussions.microsoft.com> schrieb im Newsbeitrag

news:C432B69C-8B68-41AC...@microsoft.com...

SamCPP

unread,
Jul 1, 2008, 1:08:01 AM7/1/08
to
Thanks Kerem. I obviously didn't find those threads but I think that is what
I was looking for.

Cheers,

Kerem Gümrükcü

unread,
Jul 1, 2008, 1:14:28 AM7/1/08
to
> 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

Volodymyr M. Shcherbyna

unread,
Jul 2, 2008, 5:47:04 AM7/2/08
to
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)
"SamCPP" <Sam...@discussions.microsoft.com> wrote in message
news:60281A79-D4E2-483D...@microsoft.com...

1984....@gmail.com

unread,
Jun 27, 2013, 4:37:29 AM6/27/13
to
On Tuesday, 1 July 2008 07:00:01 UTC+5:30, SamCPP wrote:
> 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



0 new messages