problem using COM object in VBScript from v16 x64 TCC but not from v15 32-bit TCC

Jun 3, 2008
121
1
Temecula, CA
I've got a home-grown COM component, PEIVersion.dll, that works fine from VB6 (yes, VB6) programs. It also works fine in a VBScript, Version.vbc, when I execute it from a 32-bit installation of TCC 15.01.52 on Windows 7.

Code:
->type c:\Utils\version.vbc
Dim sFile, sVersion, ArgObj, StdOut, i, fso, version
Set ArgObj = WScript.Arguments
Set StdOut = WScript.StdOut
Set fso = CreateObject("Scripting.FileSystemObject")
Set version = CreateObject("PEIVersionDLL.PEIVersion")
For i = 0 To ArgObj.Count - 1
  sFile = ArgObj.Item(i)
  sVersion = GetVersion(sFile)
  WScript.Echo sFile & " is version " & sVersion
Next
Set fso = Nothing
Set version = Nothing
WScript.Quit (0)
Function GetVersion(PathSpec)
  Dim temp
  If fso.FileExists(PathSpec) Then
    temp = version.GetPEIVersion(PathSpec)
    If Len(temp) Then
      GetVersion = temp
    Else
      GetVersion = "*** No version information available. ***"
    End If
  Else
    GetVersion = "*** File not found. ***"
  End If
End Function

Here is the execution under TCC 15, 32-bit:

Code:
->ver
TCC 15.01.52 Windows 7 [Version 6.1.7601]
->assoc .vbc
.VBC=VBCFile

->ftype vbcfile
vbcfile="C:\Windows\System32\CScript.exe" "%1" %*
 
->which version
version is an executable extension : C:\Windows\system32\cscript.exe /nologo c:\Utils\Version.vbc
 
->version c:\Emacs\bin\emacs.exe
c:\Emacs\bin\emacs.exe is version 24.3.0.0

When I run the same script on the same Windows 7 64-bit machine, but under TCC v16 x64, the script reports that it can't create the PEIVersionDLL.PEIVersion object.

Code:
->ver
TCC 16.00.36 x64 Windows 7 [Version 6.1.7601]

->assoc .vbc
.VBC=VBCFile

->ftype vbcfile
vbcfile="C:\Windows\System32\CScript.exe" "%1" %*
->which version
version is an executable extension : C:\Windows\system32\cscript.exe /nologo c:\Utils\Version.vbc

->version c:\Emacs\bin\emacs.exe
C:\Utils\Version.vbc(6, 1) Microsoft VBScript runtime error: ActiveX component can't create object: 'PEIVersionDLL.PEIVersion'

Is there something about the COM registration that is different for the 64-bit TCC versus the 32-bit TCC, or is it something else? Anyone have any ideas on how I might fix or even troubleshoot this?
 

samintz

Scott Mintz
May 20, 2008
1,495
16
Solon, OH, USA
On my PC, Win7 Ultimate x64 SP1, I have the following instances of CSCRIPT.EXE:
Code:
C:\Windows\SysWOW64\cscript.exe
C:\Windows\System32\cscript.exe
C:\Windows\winsxs\amd64_microsoft-windows-scripting_31bf3856ad364e35_6.1.7600.16385_none_a45d44bd1a0af822\cscript.exe
C:\Windows\winsxs\amd64_microsoft-windows-scripting_31bf3856ad364e35_6.1.7601.18283_none_a6418c4d17334828\cscript.exe
C:\Windows\winsxs\amd64_microsoft-windows-scripting_31bf3856ad364e35_6.1.7601.22480_none_a6c82a2030539914\cscript.exe
C:\Windows\winsxs\wow64_microsoft-windows-scripting_31bf3856ad364e35_6.1.7601.18283_none_b096369f4b940a23\cscript.exe
C:\Windows\winsxs\wow64_microsoft-windows-scripting_31bf3856ad364e35_6.1.7601.22480_none_b11cd47264b45b0f\cscript.exe
That tells me there are both 32-bit and 64-bit versions of cscript.exe. Can 64-bit VBScript interop with 32 bit COM objects?

Try invoking the 32-bit cscript directly by calling the version in the SysWOW64 directory.

-Scott
 
Jun 3, 2008
121
1
Temecula, CA
Try invoking the 32-bit cscript directly by calling the version in the SysWOW64 directory.

Well, it works now, but it doesn't work. Let me demonstrate.

I typed in the new FTYPE command to reset it to use the SysWOW64 version of cscript.exe for the .vbc file extension, which uses FTYPE of VBCFile. If I query FTYPE for all entries (and then grep just for the VBCFile entry, it looks proper. But if I just use the FTYPE VBCFile command, it says it will use the System32 version. Huh???

Code:
->ftype vbcfile
vbcfile="C:\Windows\System32\CScript.exe" "%1" %*
 
->ftype | grep -i vbcfile
(standard input):VBCFile="C:\Windows\SysWOW64\cscript.exe" "%1" %*

What gives?

Well, if I invoke cscript.exe from the SysWOW64 directory, then version.vbc works.

Code:
->c:\windows\SysWOW64\cscript.exe /nologo c:\Utils\Version.vbc c:\Emacs\bin\emacs.exe
c:\Emacs\bin\emacs.exe is version 24.3.0.0

First, what's going on here, and second, what steps do I need to take to force .vbc files to use the SysWOW64 version of cscript.exe?
 
Jun 3, 2008
121
1
Temecula, CA
Well, for the moment I have a workaround, but it's not good enough for long-term because it's slow. I have the old TCC 32-bit installed, so I just use that TCC /c to execute it:

Code:
->alias version
iff %_x64 = 1 then %+ "c:\Program Files (x86)\JPSoft\TCMD\tcc.exe" /c Version %$ %+ else %+ Version.vbc %$ %+ endiff
 
Similar threads
Thread starter Title Forum Replies Date
x13 Problem listing repository files using DIR http(s)://... Support 8
R A problem using find in list when word wrap? Support 2
Dick Johnson Weird Color Problem Support 8
fishman@panix.com Problem with 27.15 Support 2
M Problem with VSDevCmd.bat in VS 16.7.3 Support 0
R Problem with @INT[ value] in V26 Support 9
M Selecting test "off by one" problem in Take command Support 4
Alpengreis UTF-8 problem in TCC related to Python Support 7
K_Meinhard Small problem in german IDE 26 Support 3
B Problem with color in nested shells Support 1
Joe Caverly Problem creating and switching to a DESKTOP Support 9
vefatica Another popup problem Support 10
Alpengreis ffind dialog (/W) problem Support 4
Alpengreis [TCMD v25.00.24] Small space problem with the DE translation in Prefs-GUI Support 1
Alpengreis [TCMD v25.00.24] Problem with copy and paste and the # char via mouse in TCC Support 6
A Problem with functions @int @decimal and identifying Powershell as a shell. Support 12
B IF command problem in tcexit.btm Support 9
fishman@panix.com Problem at Startup of TCC Support 3
P Problem with SFTP copies Support 7
P Problem with FTP copies Support 10
Jay Sage Problem with Context Menu Copy+Paste+Run Key Assignment Support 7
R Problem with %_do_loop in nested do loops Support 2
fishman@panix.com New Problem with later Windows 10 Support 10
Peter Murschall A little problem with LEAVE and COMMENT Support 5
M Handling of %~I problem Support 4
WinLanEm FOR problem Support 18
K Problem With SCRPUT /u Support 3
vefatica What's TCMD's problem with ^e[0m? Support 13
Peter Murschall IDE: RTL with non-English resources-problem is back in Build 28 Support 4
rps Regex problem: \xnn not recognized as a hex character Support 0
rps PRIORITY LOW problem Support 1
old coot Regex problem: \xnn not recognized as a hex character Support 12
vefatica Another problem with build 22. Support 3
Alpengreis [23.x] Download-Problem Support 2
S Problem with " Support 3
C Problem navigating forums Support 11
Joe Caverly Problem with TEE in v22 Support 2
Alpengreis Problem with thousands delimiter and colors Support 17
M Take Command 18, migrating to another machine, license problem. Support 1
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
rps How to? @search problem Support 2
WinLanEm @SELECT problem Support 6
T Fixed Problem with use of Batch parameters in the IDE Support 1
Oz Solomon Problem with "list" Support 14
S V21.24 theme problem Support 2
Alpengreis Problem if command prompt is not legacy Support 4
Alpengreis TCMD.INI: The "super hidden" problem ... Support 6
G Odd problem - screen brightness Support 4
rps V20 In-process pipes problem Support 8
Alpengreis Again theme problem [v20.0.21]? Support 11

Similar threads