COM Stuff for out of process and/or 64 bit python. #212
Replies: 21 comments 2 replies
-
Tried installing windows sdk with visual studio. That did not work to install oleveiw.exe. |
Beta Was this translation helpful? Give feedback.
-
From bing copilot: 32-bit Registry (Wow6432Node) HKEY_CLASSES_ROOT\Wow6432Node\AppID{9814753D-A78E-4AF9-AB47-7F27B00BC598} 64-bit Registry HKEY_CLASSES_ROOT\AppID{9814753D-A78E-4AF9-AB47-7F27B00BC598} Explanation If you have any more questions or need further assistance, feel free to ask! |
Beta Was this translation helpful? Give feedback.
-
Ok , did that still getting REGDB_E_CLASSNOTREG Class not registered when calling like this: HRESULT hr1 = CoCreateInstance(natlink_clsid, 0, CLSCTX_LOCAL_SERVER, IID_IUnknown, (void**)&pUnk); for both 32 and 64 bit clients. Verify 32-bit and 64-bit Registry Entries: Ensure Proper Registration of the DLL: Check DCOM Configuration: HKEY_CLASSES_ROOT\Wow6432Node\AppID{9814753D-A78E-4AF9-AB47-7F27B00BC598} 64-bit Registry: HKEY_CLASSES_ROOT\AppID{9814753D-A78E-4AF9-AB47-7F27B00BC598} Check for 64-bit Registry Entries: Let me know if you need further assistance or more detailed instructions on any of these steps! Learn more 1 learn.microsoft.com learn.microsoft.com theogray.com forums.codeguru.com forum.inductiveautomation.com How do I |
Beta Was this translation helpful? Give feedback.
-
Woudl the default permissions not be good enough? Default permissions are often sufficient for many COM components, but there are cases where specific permissions need to be set to ensure proper operation, especially when dealing with out-of-process servers and cross-bitness (32-bit to 64-bit) scenarios. Here are a few things to consider:
If you have verified the permissions and are still encountering the Let me know if you need further assistance or more detailed instructions on any of these steps! |
Beta Was this translation helpful? Give feedback.
-
Interesting. So I am using the 32bit client, CoCreateInstance reads HKCR\WOW6432Node\CLSID{dd990001-bb89-11d2-b031-0060088dc929}\InprocServer32 It never queries the AppID Value thought it does query the ThreadingModel value. HKCR\WOW6432Node\CLSID{dd990001-bb89-11d2-b031-0060088dc929}\InprocServer32\ThreadingModel Oddly it queries this value: HKCR\WOW6432Node\CLSID{dd990001-bb89-11d2-b031-0060088dc929}\InprocServer32\InprocServer32 These are a little weird: |
Beta Was this translation helpful? Give feedback.
-
Interesting. So I am using the 32bit client, CoCreateInstance reads HKCR\WOW6432Node\CLSID{dd990001-bb89-11d2-b031-0060088dc929}\InprocServer32 It never queries the AppID Value thought it does query the ThreadingModel value. HKCR\WOW6432Node\CLSID{dd990001-bb89-11d2-b031-0060088dc929}\InprocServer32\ThreadingModel Oddly it queries this value: HKCR\WOW6432Node\CLSID{dd990001-bb89-11d2-b031-0060088dc929}\InprocServer32\InprocServer32 These are a little weird: |
Beta Was this translation helpful? Give feedback.
-
It sounds like the Here are a few things to check and try:
If these steps don't resolve the issue, it might be helpful to provide more details about the exact setup and any additional error messages you are seeing. This can help pinpoint the problem more accurately. Let me know if you need further assistance! |
Beta Was this translation helpful? Give feedback.
-
Ok, CoCreateInstance flagas are part of the problem, which we don't control. https://stackoverflow.com/questions/1881216/can-i-force-my-com-object-to-use-dllsurrogate |
Beta Was this translation helpful? Give feedback.
-
To make your 64-bit COM object callable from a 32-bit COM client, you can use the DllSurrogate mechanism. This involves adding specific registry keys and values. Here are the steps: Locate the CLSID: HKEY_CLASSES_ROOT This setup allows the 32-bit COM client to call the 64-bit COM object by running it in a surrogate process12. |
Beta Was this translation helpful? Give feedback.
-
HKEY_CLASSES_ROOT\WOW6432Node\CLSID{dd100006-6205-11cf-ae61-0000e8a28647}\LocalServer32 What registry additions are required so this can be called from a 64 bit com app? Add the CLSID under the 64-bit registry view: HKEY_CLASSES_ROOT Explanation: If you need further assistance or run into any issues, feel free to ask! 1 Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\CLSID{dd100006-6205-11cf-ae61-0000e8a28647}] [HKEY_CLASSES_ROOT\CLSID{dd100006-6205-11cf-ae61-0000e8a28647}\LocalServer32] [HKEY_CLASSES_ROOT\AppID{dd100006-6205-11cf-ae61-0000e8a28647}] [HKEY_CLASSES_ROOT\WOW6432Node\CLSID{dd100006-6205-11cf-ae61-0000e8a28647}] [HKEY_CLASSES_ROOT\WOW6432Node\CLSID{dd100006-6205-11cf-ae61-0000e8a28647}\LocalServer32] [HKEY_CLASSES_ROOT\WOW6432Node\AppID{dd100006-6205-11cf-ae61-0000e8a28647}] Explanation: Save this content to a file with a .reg extension and then double-click the file to add the entries to the registry. If you need further assistance or run into any issues, feel free to ask! |
Beta Was this translation helpful? Give feedback.
-
Be aware CoPilot isn't that great a programmer. I have found that you only want your classid and appid in the registry section (32 bit Syswow or 64 bit) based on the architecture it is compiled for. If the appid correctly has the DLLSurrogate value of an empty string, then the cross 32/64 bit com calls should be marshalled by COM. |
Beta Was this translation helpful? Give feedback.
-
Copilot Marshalling: Since you are dealing with cross-process communication between 32-bit and 64-bit processes, COM will need to marshal the interface pointers correctly. Ensure that the interface IX is properly marshaled between the two processes. If you have any specific concerns or need further assistance, feel free to ask! |
Beta Was this translation helpful? Give feedback.
-
I need to extract a type lib from a 3d party dll. What I really need to do is marshall some of the interfaces from DragonNaturally Speaking (a Nuance/Microsoft Product) into a 64 bit com object. |
Beta Was this translation helpful? Give feedback.
-
To extract a type library from a third-party DLL and marshal interfaces from Dragon NaturallySpeaking into a 64-bit COM object, you can follow these steps: Extracting the Type Library
Marshalling InterfacesTo marshal interfaces from a 32-bit COM server (Dragon NaturallySpeaking) to a 64-bit COM object, you need to ensure proper marshalling and compatibility:
Here is a basic example in C++: // 32-bit server side
IUnknown* pUnknown = nullptr;
HRESULT hr = CoCreateInstance(CLSID_DragonNaturallySpeaking, nullptr, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pUnknown);
if (SUCCEEDED(hr)) {
IStream* pStream = nullptr;
hr = CreateStreamOnHGlobal(nullptr, TRUE, &pStream);
if (SUCCEEDED(hr)) {
hr = CoMarshalInterface(pStream, IID_IUnknown, pUnknown, MSHCTX_LOCAL, nullptr, MSHLFLAGS_NORMAL);
// Send the stream to the 64-bit server
}
}
// 64-bit server side
IStream* pStream = nullptr; // Receive the stream from the 32-bit server
IUnknown* pUnknown = nullptr;
HRESULT hr = CoUnmarshalInterface(pStream, IID_IUnknown, (void**)&pUnknown);
if (SUCCEEDED(hr)) {
// Use the interface
} Additional Considerations
By following these steps, you should be able to extract the type library from the third-party DLL and marshal the interfaces from Dragon NaturallySpeaking into your 64-bit COM object. If you have any specific questions or need further assistance, feel free to ask! Source: Conversation with Copilot, 2024-10-03 |
Beta Was this translation helpful? Give feedback.
-
The OLE/COM Object Viewer (oleview.exe) is not included directly within Visual Studio 2022, but it is part of the Windows SDK. You can find it in the following directory after installing the Windows SDK:
Here's how you can access it:
Once you have it open, you can use it to view type libraries and interfaces by selecting If you need further assistance or have any other questions, feel free to ask! ¹: OLE/COM Object Viewer - Microsoft Learn Source: Conversation with Copilot, 2024-10-03 |
Beta Was this translation helpful? Give feedback.
-
I finally found the ole com object viewer on my pc! |
Beta Was this translation helpful? Give feedback.
-
To use the OLE/COM Object viewer you need to install the windows sdk and locate it as described above. YOu need to register the DLL it gives an error about, or try running oleview as admin. |
Beta Was this translation helpful? Give feedback.
-
With oleview, was able to find this (picking one of the interfaces in dpeech.h. This gives promise we may be able to marshall the interfaces used by natlink between processes (as always happens between 32 and 64 bit com objects). |
Beta Was this translation helpful? Give feedback.
-
With some more debug statements, in
Likely either DgnDictate or iSRCentral isn't recognized in 64 bit or can't marshall between 64 and 32 bit architectures. I think ISRCentral is from microsoft speach api. There are a couple type libs that can be inspected with OLEVIew. |
Beta Was this translation helpful? Give feedback.
-
This could be part of the puzzle, so 64 bit objects can call into dragon perhaps:
|
Beta Was this translation helpful? Give feedback.
-
There is a .reg file which creates some of the above registry entries in natlink. I am not sure how to resolve those errors above related to IServiceProvider::QueryService. Trying the above with 32 bit might work in an out of process COM server. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions