Solved

Find mutex owner

Posted on 2008-10-07
9
1,550 Views
Last Modified: 2009-03-24
How can I find the owner of a mutex?  I have a list of mutex names and I want to find the PID/Handle of the mutex owner.  I get ACCESS DENIED when I try to open a mutex or create a new handle to a mutex.

I am running as administrator on XP SP3, with debug privs.
0
Comment
Question by:DSOM
  • 3
  • 2
9 Comments
 
LVL 28

Expert Comment

by:2266180
ID: 22663447
I couldn't find any usable delphi code. however, here is a C++ one that is supposed to work: http://www.experts-exchange.com/Programming/Languages/CPP/Q_20073497.html
another idea, since a mutex handle is jsut another handle, would be to find the thereadid of the creator/owner of that handle. meaning enumerating handles and comparing them with what you have and then checking the owner.
I *think* you can use the enumMetaFile api function. wilson has some nice units that he says doe the job: http://www.wilsonc.demon.co.uk/d7ntutils.htm
0
 
LVL 45

Expert Comment

by:aikimark
ID: 22678315
I think this might be what you are looking for:
http://www.swissdelphicenter.ch/torry/showcode.php?id=2126

There seems to be something wrong with the page this morning, so you can see it in Google's cache:
http://74.125.45.104/search?q=cache:yJIG_4oX8yEJ:www.swissdelphicenter.ch/torry/showcode.php%3Fid%3D2126+Mutex+handle+delphi&hl=en&ct=clnk&cd=31&gl=us
0
 

Author Comment

by:DSOM
ID: 22689482
That doesn't help in this situation.  I have a list of active Mutex and I want to get a handle to each one, not a new handle, but the handle of the original creator of the Mutex so I can map it to a process.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 28

Accepted Solution

by:
2266180 earned 500 total points
ID: 22799252
I tested the code from wilson, doesn't work right.
I did a little digging around and found a PAQ qith a solution from ThievingSix (http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23535337.html) leading to his blog post:
http://w-shadow.com/blog/2006/10/19/listing-all-open-handles/
tested, works. you will notice it prints out all handles with their name and, what you need, owning PID.

I vbelieve starting from there is pretty easy to adapt the code to your needs :)
0
 
LVL 45

Expert Comment

by:aikimark
ID: 23834840
@DSOM

Did you follow the 10/24/08 link posted by ciuly and evaluate the code?
0
 
LVL 45

Expert Comment

by:aikimark
ID: 23891579
I recommend ciuly comment http:#a22799252 be accepted with no points refunded if we don't hear from DSOM.
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi prevent click fast 2 220
Delphi Dbf export problem to a Visual Foxpro application 6 190
Delphi: Connect to running MS Outlook 4 89
Adoquery sql  left join does not work 25 91
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question