4

I have registered several DLLs specific to Unicom Dimensions / IBM SPSS Data Collection Desktop 7 (x64) software and verify the Classes are showing up under HKCR/Classes as well as HKLM.

enter image description here

Dumpbin.exe indicates the following dependencies, , I don't see anything that looks out of sorts here, i.e., nothing that's specific to the Unicom software that might not have been registered etc.

Image has the following dependencies

KERNEL32.dll
USER32.dll
GDI32.dll
COMDLG32.dll
ADVAPI32.dll
ole32.dll
OLEAUT32.dll
ATL100.DLL
SHLWAPI.dll
MSVCP100.dll
MSVCR100.dll

But when trying to instantiate from VBA (Excel 2016, 32b) it fails with a 429, ActiveX can't create Object:

Dim exp as Object
Set exp = CreateObject("ExportExcel.Export")

I can instantiate from python (64b 3.7):

from win32com import client
exp = client.Dispatch("ExportExcel.Export")

Is this as simple as having 32b Excel and 64b Dimensions? Could I solve this via 64b Excel installation?

Unicom's documentation indicates that this is the proper way to instantiate the class (the example uses early binding, I've tried both to no avail).

' ---- Export the Tables ----
    Dim MYEXPORT As ExportExcelLib.Export
    Set MYEXPORT = New ExportExcelLib.Export
    Export MYEXPORT, TableXml, PropertyXml

Further, Unicom provides its own "mrScriptBasic" language which is based on Visual Basic. As you might expect, they also use a CreateObject function to instantiate classes. Within their scripting software, this function works as expected and returns a proper instance of the class.

Update

I've attempted to force it through dllhost as Noodles mentions in comments. I've run the .bat as an administrator:

REM _Enable.bat
REM This file merges reg_script.reg using the Reg.exe command.
REM This allows 32b program to call a 64b dll via surrogate
REM It is a per user setting but Regedit doesn't allow non admins to run it
reg import "reg_script.reg"
Pause

And this imports the reg_script.reg file as follows:

Windows Registry Editor Version 5.00
;reg_script.reg
[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}]
@="ExportExcel"
"AppID"="{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}"

[HKEY_CURRENT_USER\SOFTWARE\Classes\Wow6432Node\AppID\{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}]
"DllSurrogate"=""

[HKEY_CURRENT_USER\SOFTWARE\Classes\AppID\{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}]
"DllSurrogate"=""

Error persists whether I attempt to use the class name or GUID.

David Zemens
  • 53,033
  • 11
  • 81
  • 130
  • Looks very, very suspiciously like a bitness issue. – Mathieu Guindon Apr 12 '19 at 22:08
  • 1
    Assuming it *is* a bitness issue, 64-bit Excel install should indeed fix it. – Mathieu Guindon Apr 12 '19 at 22:13
  • Yeah it does now. I've spent the better part of a day pulling my hair out and literally came across that while I was throwing in the towel (i.e., asking a Q on SO). In fact, I'm almost certain that's the issue now. I can instantiate from 64b Unicom software, or from 64b python. Didn't even cross my mind that Excel might be 32b here... – David Zemens Apr 12 '19 at 22:15
  • You can by still use it from 32 bit excel by forcing it into dllhost. See https://pastebin.com/x4S2ewiA for using 32 bit in 64 bit - the entries are the same. – Noodles Apr 12 '19 at 23:39
  • @Noodles I'm not sure I understand that pastebin. Comments indicate "two files follow" but there don't appear to be two files there. Any chance you can mock up a suitable example? [This](https://techtalk.gfi.com/32bit-object-64bit-environment/) seems to walk through the manual steps. – David Zemens Apr 13 '19 at 01:37
  • There is a batch file and a reg file on that page. You have to copy and paste. – Noodles Apr 13 '19 at 02:04
  • @Noodles gotcha. OK, so, I've used those (modifying the GUID of course) but the same error happens. – David Zemens Apr 14 '19 at 20:30
  • It's Dimensions you have to register not Excel. Excel is an EXE so can be used by 32 or 64 bit programs. You want to force Dimensions .dlls into DLLHost's EXE. DLLs are called directly in memory, COM has gotten out of the way after loading the file. EXE are marshaled by COM. – Noodles Apr 14 '19 at 20:42
  • @Noodles right. The DLL I'm registering here is a Dimensions DLL. I guess I don't understand what you're saying I need to do here. How do I force these dlls into DLLHost's exe? – David Zemens Apr 14 '19 at 20:49
  • 1
    It's the CLASSID of the DLL. It must have entries linking it to an appid in both 32 and 64 bit (and the right bitness one will have files etc specified as well). And the APPID must appear in both 32 and 64 bit, and DllSurrogate must appear in both. **I don't see the 32 bit CLASSID in your reg file**. – Noodles Apr 14 '19 at 21:50

2 Answers2

2

I had the same problem and it was solved using solution described in following web page: https://techtalk.gfi.com/32bit-object-64bit-environment/

In case of un-availablity of web page, I copy its main paragraph here:

To do this, it involves a small number of simple registry hacks:

  • Locate your COM object GUID under the HKey_Classes_Root\Wow6432Node\CLSID[GUID]

  • Once located add a new REG_SZ (string) Value. Name should be AppID and data should be the same COM object GUID you have just searched for

  • Add a new key under HKey_Classes_Root\Wow6432Node\AppID\ The new key should be called the same as the com object GUID

  • Under the new key you just added, add a new REG_SZ (string) Value, and call it DllSurrogate. Leave the value empty

  • Create a new Key under HKey_Local_Machine\Software\Classes\AppID\ Again the new key should be called the same as the COM object’s GUID. No values are necessary to be added under this key.

That’s it, your COM Object should now be accessible from a 64bit environment and can be used like a regular COM Object.

1
Windows Registry Editor Version 5.00
;reg_script.reg
[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}]
"AppID"="{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}"

[HKEY_CURRENT_USER\SOFTWARE\Classes\Wow6432Node\CLSID\{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}]
"AppID"="{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}"

[HKEY_CURRENT_USER\SOFTWARE\Classes\Wow6432Node\AppID\{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}]
"DllSurrogate"=""

[HKEY_CURRENT_USER\SOFTWARE\Classes\AppID\{AE2E32FA-FB29-4C42-BFF9-7ACFA1AB0A1B}]
"DllSurrogate"=""

If the GUID is right.

Noodles
  • 264
  • 2
  • 3
  • OK, seems to be working as long as I `CreateObject("ExportExcel.Export")` rather than the GUID. Not sure if the .bat/.reg worked, I ended up entering the keys manually & rebooting, but seems to be working. Cheers. – David Zemens Apr 15 '19 at 13:25