Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get COM+ Appliacation DLLHOST PID? 1

Status
Not open for further replies.

iulian

Programmer
Dec 27, 2002
3
SE
I have installed several COM+ Applications and I want to get the associated dllhost's PIDs - for some test application.

I use Windows 2000 - I know that COMAdmin has some collection "ApplicationInstances" but this is available only in XP (?) - I can't see it anyway.

Any tips?

Thanks!
 
Check the registry if the object is registered the ID will be in there (search by objects name)
 
If you want to do it interactively, select "COM+ Applications" in Component Services. Then change your view to "Status View".

In .net, pids can be retreived using System.Diagnostics.Process class. Seeing how this class is a wrapper to the Win API, there is probably a way to get them through the Win API in other languages. That may not be the answer you were looking for but it might point you in the right direction.
 
I've managed to get the all process PIDs, including the ones for "dllhost.exe" (using .net) but I can't figure out what dllhost pid relates to what COM+ App.

In fact, I want to have in my application the same data as Component Services shows in the status view.

I've searched in registry, but there is no PID there, just the COM+ Application parameters.
 
You can try process explorer from
They have a tool that allows you to evaluate the handles of a process, and tells you which dlls are loaded. By seeing which dlls are loaded you should be able to verify which PID is which application.

Enjoy!

Galrahn
 
I'm having the same problem. I'm trying to get the process ID for a COM+ Application. The ApplicationInstances opbject is only available with COM+ 1.5, which means only Windows XP or Server 2003, but Component Services in Win2K somehow gets the process ID anyway. I'm trying to do this through VB or C++. I'm not sure if finding the DLL of a particular process will help in this case, because there can be several COM+ Instances running with the same DLL. For example in IIS, when you set an application to run in High Isolation, it runs in its own Process, but if you look at every site running in high, they all run from wam.dll. The only things that seem to be unique is the Application name, whic I don't think will help much in finding the process ID, and the Application ID, which is a GUID. This seems like it could somehow be matched to a running instance of DLL Host, but I have no idea how. If Component Services does it, there must be some way. Any help is greatly appreciated,
 
UPDATE: I just found a command line utility that will give the command line of any running process, given its ProcessID. Using the command line, you can see the switch given to DLLHOST.EXE which looks like this:

/ProcessID:{CLSID_HERE}

which can be matched up to the Key property of the Application. The problem now, is that there is no source code with this utlity I found. Does anyone know how it might work? It seems like it is making calles to OpenProcess, CreateRemoteThread, etc.
 
ummm this might be overly simple but if you want to know the process id of a com object why not ask the com object?
IE write a meathod that returns it and it uses the GetCurrentProcessId API. This will work on XP even with application pools. Now if you don't have access to the code I'm unsure as what to do....you would have to tap into the RPC that are used to create the objects which I'm not sure is possible.
 
Thanks but I don't have access to the code at all. I'm not writing a COM+ component, I'm writing an administration utlity. Actually, I've found two ways of getting the process ID, or, more specifically, how to get the CLSID given a PID, by finding the command line of the application. The first way relies on undocumented indexes into the Process Memory, which is not guaranteed to always work (on future versions of Windows). The second way is to inject code into the running application that calls GetProcessID(). Although it seems rather invasive, I have two source examples of it working, and it's quite fast. Once the CLSID is obtained, it can be matched to the one listed in the admin objects, so this works out pretty well. Thanks anyway :)
 
Ugh I am really off today.. why would I want to call GetCurrentProcessID in a process of which I already know the ID?? I of course meant GetCommandLine/GetCommandLineW
 
You already know the PID, so all you need is:
EnumProcessModules
GetModuleFileNameEx
 
No, I don't need the module names. That wouldn't help me at all because remember that I am trying to match a PID with a specific COM+ Application. Many different COM+ applications can be running from the same EXE and DLL. In fact, what Ia m using this for is mainly for IIS Out-of-Process application roots, which all run from dllhost.exe (which is 'hosting' wam.dll), therefore the module name itself is of no use. Please note also that this issue is solved. Thanks anyway.
 
Brian,
I believe u wrote a c script to get the list of process from clsids. If u can email me the script, it will be great. Even I am having the problem of associating the dll from the the clsid. I did a tlist dllhost |more and it gave me the clsid's of each dllhost. I want to write a script that can associate this clsid with the executables/dlls. Thanks Palonima
 
I was trying to match a COM+ application name with a Process ID. What exactly are you trying to do? And what is tlist? Can I e-mail you about this instead of using the forum?
 
TSBrianS,
How do you match a COM+ application name with a Process ID?
I tried use ComAdminCAtalog object, I can use GetApplicationInstanceIDFromProcessID(pID) to link the COM+ object with PID, but it only works on XP, not on W2k.
Could you share your solution?

I appreciate your help.

new2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top