Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine whether a COM is a In-Proc or LocalServer

I got an application that use a COM library, just wondering how can I know whether that application use that COM library as a LocalServer or In-Proc?

I looked at the code being constructed in this way:

DATCOMLib::ITEmulationPtr pTE(__uuidof(DATCOMLib::TEmulation));
like image 734
Budi Mulyawan Avatar asked Mar 26 '13 00:03

Budi Mulyawan


2 Answers

It depends partly on what execution context you supply when you create your object - see here for more details: http://msdn.microsoft.com/en-us/library/windows/desktop/ms693716(v=vs.85).aspx

You can look up the class id for your component in the registry and check whether it has a LocalServer sub-key. So in your case you would look for:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{CLSID of DATACOMLib::TEmulation}\LocalServer

If it is an In Proc COM component it will instead have the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{CLSID of DATACOMLib::TEmulation}\InProcServer32

Check this documentation for more details: http://msdn.microsoft.com/en-us/library/aa908849.aspx

like image 140
Peter R Avatar answered Nov 10 '22 15:11

Peter R


It can be find out using multiple ways

  1. From looking at the code - check what is the class context passed when calling "CreateInstance" or "CoCreateInstance" - (CLSCTX_INPROC_XXXX then it is inproc server means it is DLL which will be loaded into calling applications process address space. CLSCTX_LOCAL_SERVER, CLSCTX_REMOTE_SERVER - then it is COM server running as a separate process. There are some #defines which combines one or more flags. Just google it)

    ITEmulationPtr.CreateInstance(uuid(TEmulation), 0, CLSCTX_XXX)

  2. If you have access to machine on which COM component is installed then you can follow steps given by Peter in above answer

like image 38
MLS Avatar answered Nov 10 '22 14:11

MLS