-1

I am developing a .NET code that will run on client's PC. The code must call COM object allready registered at Client's PC for the purpose of another program. So I only need to share a registered component.

I got the same distributive with COM component that client has, installed it on my development machine and referenced it in my Visual Studio. The code works well on my PC and multiple instances of my program don't create multiple instances of COM object (pslist shows several MyProgram.exe processes but only one COM process).

When I build my program it also includes referenced COM component. After I distribute it to Client's PC and run, pslist shows that there are two processes running COM component. I.e. Client runs his own program that uses his COM object and my program also creates its own COM process. This is bad because I still need one process at Client's PC that runs COM component. Both client's program and my program are started as the same user.

I do suspect that COM component included with my build is being registered at runtime on Client's PC with another ObjectID (but actually comes from the same install package) and OS doesn't recognize it as the same component that allready runs. Need a help to diagnose the very source of this issue and fix it.

Thank you

Viacheslav
  • 11
  • 2
  • How is your COM object written? C++? C#? native? managed? How is it declaring itself to COM runtime? That may be by design in your component. As you see there are many ways to register as a COM out-of-process server: https://msdn.microsoft.com/en-us/library/windows/desktop/ms679697.aspx we need more info. As for the deployment issue, we definitely can't help, you'll have to look by yourself (but calling for the same CLSID will not create two different COM objects) – Simon Mourier Apr 12 '18 at 07:47
  • Thank you for your response.Unfortunately I have a COM as given and don't know how it is written. By the way on the development pc multiple instances of program don't create multiple COM processes – Viacheslav Apr 12 '18 at 07:52
  • But does this component is changed over time, or is it the same binary, that runs as one instance on dev machines and as multiple on client machines? – Simon Mourier Apr 12 '18 at 07:57
  • The same binary. I installed it to client and use in my app – Viacheslav Apr 12 '18 at 08:02
  • Can I somehow not include COM in my build and force to use that one installed on target PC? – Viacheslav Apr 12 '18 at 08:07
  • Now I tried to create multiple instancies of my program at client's PC. The first instance do creates another process with COM but subsequent ones don't. – Viacheslav Apr 12 '18 at 08:14
  • Could both programs on client machine run in different security context? (UAC, etc.) or in different bitness (x86 vs x64) – Simon Mourier Apr 12 '18 at 08:14
  • I found out that two instances use the same source: C:\Windows\system32>wmic process where "name='DevNet.exe'" get ProcessID,ExecutablePath ExecutablePath ProcessId c:\PROGRA~1\Metra\DevNet\DevNet.exe 7536 c:\PROGRA~1\Metra\DevNet\DevNet.exe 6728 Will check UAC and bitness – Viacheslav Apr 12 '18 at 08:45
  • Both programs that start different COM-object processes are 32-bit (OS is 32-bit Windows 7), both under the same user. UAC level is "asInvoker" – Viacheslav Apr 12 '18 at 10:35
  • Solved out. Running the same program on user's PC didn't result in multiple COM instances. But 'psexec' at user's PC and 'runas' target user did. Thank you, Simon for your help! You could not know that I was trying to run program the same way! Is my fault. – Viacheslav Apr 13 '18 at 11:52

1 Answers1

1

Solved out. Running the same program on user's PC didn't result in multiple COM instances. But 'psexec' at user's PC and 'runas' target user did. Thank you, Simon for your help! You could not know that I was trying to run program the same way! Is my fault.

Viacheslav
  • 11
  • 2