SCRIPT and GetObject

As @vefatica discovered recently, it would appear that GetObject does not work well with the SCRIPT command.

This example;
Set oMath = Nothing
Set oMath = GetObject("script:e:\utils\math.wsc")
Set oMath = Nothing
...executed with;
SCRIPT test.vbs
causes TCC to disappear.

     _x64: 1
   _admin: 1
_elevated: 1

TCC  27.00.18 x64   Windows 10 [Version 10.0.18363.1256]
I went back to;
TCC 15.01.04 Windows XP [Version 5.1.2600]
     _x64: 0
   _admin: 1
_elevated: 0
...and my example with GetObject works.

From TCC v24 to TCC v27, it does not work.

Windows bug (in ntdll, which is replacing TCC's error handler which is why it exits when ntdll crashes). Since Microsoft no longer supports the APIs in question, there's no chance of getting it "fixed".

Old versions of TCC work because they're using an alternate set of APIs which are no longer supported by the Windows SDK.

SCRIPT is pretty much obsolete; Microsoft has abandoned the technology.
Microsoft (R) Windows Script Host Version is currently at version 5.812, and has not been abandoned.
Active scripting is regarded complete, and no longer under active development by Microsoft.

However, the technology is still being supported by Microsoft's Sustaining Engineering Team, which is responsible for bug fixes and security enhancements.

Furthermore, scripting engines will continue to be shipped with future releases of Microsoft Windows and IIS.

It's taken me a while, but I have made a plugin for TCC called ActiveScript, with one command; ascript.
E:\...\plugin>plugin /i activescript
Module:      E:\Documents\PureBasic\ActiveScript\plugin\ActiveScript.dll
Name:        ActiveScript
Author:      Joe Caverly
Description: ActiveScript - TCC Plugin written using Purebasic
Implements:  AScript
Version:     2022.12  Build 29

The TCC Script command does not play well with GetObject.

The ActiveScript plugin does play well with GetObject.

Function TestIt
Set fso = CreateObject ("Scripting.FileSystemObject")
Set stdout = fso.GetStandardStream (1)

Set iWMI = GetObject("WinMgmts:Root\Cimv2")
Set colItems = iWMI.ExecQuery("SELECT * FROM Win32_Process")

If Err.number <> 0 Then
  stdout.WriteLine "Error"
End if

Results = ""

For Each objItem in colItems
  Results = Results + objItem.Name + vbCrLf
TestIt = Results
stdout.WriteLine TestIt
End Function

Thus, I can now use Windows Scripting Components via my plugin;
Set oMath = GetObject("script:e:\utils\math.wsc")

I would like to incorporate the tcommand() interface in my ActiveScript plugin, but after a search of the TCMD SDK, I cannot see any way to do this.

Is it possible for me to include the tcommand() interface in my plugin?

I have attached my ActiveScript plugin for those that are interested.

It is not finished, it is not polished, and is still a work in progress.

Note also that it only works with VBScript (.vbs) files.

     _x64: 1
   _admin: 1
_elevated: 1

TCC  29.00.17 x64   Windows 10 [Version 10.0.19044.2364]


  • activescript.7z
    16.1 KB · Views: 46

Similar threads