Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Reg-Free COM "Microsoft.Windows.ActCtx" work with scripting - late binding?

I have successfully got Reg-Free COM working using C++ and C# using manifest files i.e. early binding. I am now trying to get this working using late binding. The technique I have found, after much web searching, appears to be using "Microsoft.Windows.ActCtx".

An example I used to test this was MS's "Registration-Free Activation of COM-Based Components" found at http://msdn.microsoft.com/en-us/library/ms973913.aspx to generate the SideBySide example. I then attempted to use a scripting language; VBScript and Python however both have fail in the same way (also tried VBA). The VBScript example is given below:

Set actctx = CreateObject("Microsoft.Windows.ActCtx")
actctx.manifest = "C:\test\client.exe.manifest"

Set SBSObj = actctx.CreateObject("SideBySide.SideBySideClass")
wscript.echo SBSObj.Version

Using something like SysInternals' "Process Monitor" you can see that running the following command (Windows 7 x64):

C:\Windows\SysWOW64\cscript.exe //Nologo C:\test\VBRegFreeTest.vbs

appears to work by loading the manifests and attempt to start looking for the equivalent registry calls and fails to find them. So it appears to partially work. I've also copied wScript.exe to the local directory to rule out directory issues for running application and manifest files.

I've read Microsoft.Windows.ActCtx on Windows Xp and have included the "prodID" in the manifest but it still fails. The manifest files work correctly with C++ and C# examples.

I can't help feeling that the "Microsoft.Windows.ActCtx" has issues. Documentation on this is very limited. Any help on using manifest files with Python or VBScript would be very much appreciated. I would be interested to know if anyone has got "Microsoft.Windows.ActCtx" to work.

like image 379
AlexO Avatar asked Sep 29 '14 10:09

AlexO


1 Answers

  1. Your EXE must have manifest with dependency section describing name and version of COM server, e.g. SideBySide.dll.
  2. If your EXE has internal manifest: Windows 7 will not read external manifest, if internal one exists (Windows XP looks firstly for external manifest).
  3. On Windows 7 the internal manifest of EXE must be changed with dependency to COM server, or internal manifest must be removed from EXE. It is possible with mt.exe from Visual Studio.
  4. SideBySide.dll and SideBySide.dll.manifest must be in the same folder as EXE.
  5. SideBySide.dll.manifest must include progID of COM server in comClass section.

Example of VBS code, using DLL from: Registration-Free Activation of COM Components: A Walkthrough

Dim o
Set o = CreateObject("Microsoft.Windows.ActCtx")

//in example here is a manifest reference: o.manifest = "SideBySide.X.manifest"
//but it does not function by me. By me a dependency is described in manifest of EXE.

Dim obj
Set obj = o.CreateObject("SideBySideLib")
Call MsgBox(obj.Version())
Set obj = Nothing
Set o = Nothing
like image 170
Valler Avatar answered Oct 15 '22 18:10

Valler