0

I'm writing a C# WPF graphical interface that is required, by the client, to use a number of close sourced dependencies. Some of these dependencies do not have 64bit versions. However, there is a segment of the code that requires that it be compiled in 64bit to allow it access to more memory. To overcome this problem I have compiled most of the application in 32bit and for the parts that need to be 64bit I've split them into a separate dll and I've used a COM bridge. I followed the following guide to create the bridge:

https://www.codeproject.com/Tips/1199539/Using-bit-DLLs-in-bit-Processes-Using-Out-of-proce

This all works fine I'm able to invoke methods in the 64bit dll from the 32bit dll via the com bridge. However, I've run into a problem. The 64bit dll that is registered via regasm is unable to access hardware resources.

The COM registered DLL references a set of assemblies that interface with an xray detector. These assemblies enable a .NET program to scan for and connect to xray detector devices connected to the PC. The crux of the problem is this:

When the methods in this 64bit dll are called via the COM bridge the dll is unable to find or connect to the xray hardware connected to the PC. However, if I create a test program that references this assembly directly the problem goes away.

Therefore my question is this: Is there some permission I need to give a COM registered DLL to allow it to access hardware resources?

ThandueL
  • 33
  • 1
  • 1
  • 4
  • No, not at all. How you figured out that it was "unable to find or connect" is absolutely essential information, we can't look over your shoulder across the Internet. – Hans Passant Jun 13 '19 at 22:55
  • The assembly that interfaces with the hardware returns a count of how many active devices are connected via the hardware interface. If I attach the debuger to the com object via the dllhost I can see that count value. In the case of using the dll via the com bridge that value is 0. On the same machine with the same hardware attached that same dll referenced directly returns 1 device. The actual connection process is a black box. The question, however, is why the same piece of code works in one instance and not the other. – ThandueL Jun 14 '19 at 00:57
  • Instead of using the simple surrogate, you could use COM "Component services". It's basically the same surrogate tech underneath, but has a lot of visible features with a UI to configure them easily. You could for example define an identity for the surrogate (the dllhost.exe process) so it can run with the rights/permissions needed: https://stackoverflow.com/questions/52601470/calling-function-from-64bit-app-from-a-32bit-dll/52602821#52602821 https://stackoverflow.com/a/31112442/403671 https://stackoverflow.com/a/54128090/403671 to give you an idea – Simon Mourier Jun 14 '19 at 05:56

0 Answers0