Richard Roe
Richard Roe

Reputation: 105

Retrieving name of the service which is running behind the svchost

Is it possible to know the details about the service (name, description, version etc), which is running behind the svchost.exe by process id in C/C++?

Currently I'm going to get list of the running system services and compare their PIDs with the PID of the svchost.exe, which I already have. But I'm not completely sure, that there is no better solution for such kind of task.

Any assistance is appreciated.

Thanks in advance, Richie

Upvotes: 1

Views: 614

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597051

Yes, you will have to compare PIDs. Use EnumServiceStatusEx() to get the PID of each running service. Just know that it is possible for multiple services to share the same process if they were implemented in the same executable and have the SERVICE_WIN32_SHARE_PROCESS flag enabled, so you might sometimes encounter multiple hits.

Upvotes: 2

Related Questions