Solved

How to get a processId from a service handle?

Posted on 2006-11-15
2
796 Views
Last Modified: 2011-10-03

What I am trying to do is take a service that I have a handle too and find out how much memory the service process is currently using.

So I have been able to get lots of info about a service from QueryServiceConfig2 but its not quite enough. From the binary path I could search all services but if the service binary is shared like svchost than I cannot tell which one is the exact process im looking for.

I would think you can get the processId from a serive handle but I havent been able to find any info on that.

Anyone know the solution?
0
Comment
Question by:joele23
2 Comments
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 250 total points
ID: 17953727
You can get a service process handle by calling EnumServicesStatusEx().  That will return a SERVICES_STATUS_PROCESS structure that will give you the PID.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/enumservicesstatusex.asp

-MAHESH
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Drive driver 2 98
STL locale problem in VisualStudio 2015 Release builds. 12 141
L prefix in C++ 8 103
please insert disk adobe master collection6 9 569
The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now