0
votes

I've legacy 32-bit COM component (Basically DLL) which has a dependency on msvbvm50.dll (In-build COM component in 32 bit windows). Now, I want to use this DLL in my code/application hosted on 64-bit windows 7.

As described in this and this, I tried using 32-bit tools (c:\windows\syswow64\regsvr32.exe) to register them to registry. I also made sure the entry exist in registry (using syswow64\regedit32.exe) at HKey_Classes_Root\Wow6432Node\CLSID[GUID] with AppID registered with DLL GUID and DLLSurrogate is enabled at HKey_Classes_Root\Wow6432Node\AppID[GUID]

However, The problem is - Whenever I try to use this component in my VBScript as

SET variable = CreateObject(DLLComponent.DLLObject)

My 'variable' value always comes as empty. Just to confirm, when try to locate the component using Process explorer, I couldn't find any of the DLLHost process running this component which suspect me that it is not loaded at first place.

Can anyone suggest where i'm going wrong? What additional steps i can perform to get this working or debugging for root cause?

FYI -

My Classic ASP application (Which is using VSScript to load this COM component) is hosted on IIS 7 in 64-bit Windows 7 Machine.

1
It's easier to debug using WSH. Can you create the component using a VBScript running under the 32-bit WSH (windows/syswow64/wscript.exe)? If so, it must be registered properly and then you can switch your focus to ASP/IIS settings.Bond
I just with if @HansPassant could answer this.vabz

1 Answers

0
votes

I use this code at the top of all of my scripts as most of the scripts i run interact with COM components.

If you pass arguments to your scripts you will need to modify. This checks for the syswow folder(64 bit) and reruns the script as 32 bit if it's not already by runs C:\Windows\SysWow64\wscript.exe instead of the default on 64 bit machines of C:\Windows\System32\wscript.exe.

'Check for 64 bit and run as 32 bit if needed.
'On error resume next

Set oFso = CreateObject("Scripting.FileSystemObject")
Set oWs = CreateObject("WScript.Shell")

If InStr(LCase(WScript.FullName), "c:\windows\system32\") And oFso.FolderExists("C:\Windows\SysWow64") Then     
    oWs.Run "C:\Windows\SysWow64\WScript.exe """ & WScript.ScriptFullName & """"
    WScript.Quit
End If

If this resolved your issue and the COM component is working correctly in wscript then you need to update IIS to run at 32 bit instead of 64 bit.

Goto IIS manager -> Application pools -> Select the apppool you want and -> Advanced Settings.

In there there's a setting called enable 32bit apps. If that's true, that means the worker process is forced to run in 32bit.

enter image description here