Jump to content

Use AutoItX as COM ROT object, without regsvr32 registration


Recommended Posts

@argumentum

Try this one :

But change the path of the Manifest location in the script

If it works I will adjust to initial post with the correct settings and setup definitions

ps : Script removed see updated version here 

https://www.autoitscript.com/forum/topic/204813-use-autoitx-as-com-rot-object-without-regsvr32-registration/?do=findComment&comment=1472602

Edited by ptrex
Link to comment
Share on other sites

2 hours ago, ptrex said:

So it runs if you use regsvr32 dynwrap.dll

RegSvr32
---------------------------
The module "dynwrap.dll" was loaded but the call to DllRegisterServer failed with error code 0x80004005.
For more information about this problem, search online using the error code as a search term.

 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

I am sure are doing something wrong,

Keep in mind that this is a 32bit com ONLY object.

So you just can't just run regsvr32. You need to run it from the SysWOW64 folder.

The same for running the Vbsript.

 

Final files and instructions for testing are updated here ;

https://www.autoitscript.com/forum/topic/204813-use-autoitx-as-com-rot-object-without-regsvr32-registration/?do=findComment&comment=1472602

 

Edited by ptrex
Link to comment
Share on other sites

This is the Regfree version in AutoIt

Calling Win API's from the COM object using AutoIt

This is of course 1 bridge too far because we can call Win API from within AutoIt natively...

#AutoIt3Wrapper_UseX64=N

; Initialize COM error handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

Local $oActCtx = ObjCreate("Microsoft.Windows.ActCtx")
$oActCtx.manifest = @ScriptDir & "\dynwrap.sxs.manifest"

ConsoleWrite(@ScriptDir &  "\dynwrap.dll" & @CRLF)

$UserWrap = $oActCtx.CreateObject("DynamicWrapper")

; Call MessageBoxA(), first register the API function
$UserWrap.Register ("USER32.DLL", "MessageBoxA", "I=HsSu", "f=s", "R=l")
; now call the function

Local $oVBS = ObjCreate("ScriptControl")
$oVBS.language = "VBScript"
Global Const $Nothing = $oVBS.eval("Null")
$oVBS = $Nothing

$UserWrap.MessageBoxA ($oVBS, "MessageBox (ANSI)", "From DynaWrap Object", 3)


Func MyErrFunc()
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"COM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)   ; to check for after this function returns
Endfunc

Keep this only for test and demonstration purposes. 😉

 

 

Edited by ptrex
Link to comment
Share on other sites

Link to comment
Share on other sites

Link to comment
Share on other sites

2 hours ago, ptrex said:

This means as of now everyone can start doing DLLCall's from VBScripts in a Portable way ! 😄

Please provide example.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Link to comment
Share on other sites

Link to comment
Share on other sites

@Professor_Bernd  / @argumentum  

Here I posted some examples and documentation on how to use the DynaWrap object to do DLLCalls 

https://www.autoitscript.com/forum/topic/204903-dllcalls-using-vbscripts-possible/

 

Enjoy !

Link to comment
Share on other sites

  • 2 years later...

 

Thought one more try using "Microsoft.Windows.ActCtx" to check if this realy work.
Copy all the three file in C:\Temp folder as @ptrex mention 
- AutoItX3_x64.dll
- AutoItX3.sxs.manifest
- Test.vbs
but it not work giving @error: Library not registered

@ptrex does this really worked for you using AutoItX3_x64.dll ?
It's quite strange why you not got this Error: Library not registered on computer where Autoit never installed :huh2:

Link to comment
Share on other sites

@jugador 

Just tested this script and all runs fine on my PC windows 10

 

#AutoIt3Wrapper_UseX64=Y

; Error Monitoring
Global $oError = ObjEvent("AutoIt.Error", "_ErrFunc")
Func _ErrFunc()
  ConsoleWrite("! COM Error ! Number: 0x" & Hex($oError.number, 8) & " ScriptLine: " & $oError.scriptline & " - " & $oError.windescription & @CRLF)
  Exit
EndFunc    ;==>_ErrFunc

Local $oAutoIt = ObjCreate("Microsoft.Windows.ActCtx")
$oAutoIt.manifest = @ScriptDir&"\AutoItX3.sxs.manifest"

Local $obj = $oAutoIt.CreateObject("AutoItX3.Control")

MsgBox(0, "", "You are now running RegFree AutoItX3.Control Version : " & $obj.Version)

ConsoleWrite($obj.Version & @CRLF)

ConsoleWrite("Are you admin : " & $obj.IsAdmin & @CRLF)

$obj.ToolTip("This is a tooltip", 450, 200)
$obj.Sleep(3000)

$obj = ""
$oAutoIt = ""

 

Link to comment
Share on other sites

@ptrex 
I try again on window7 with this modified manifest file where Autoit is not installed using vbscript.
It's still not working getting error: Library not registered :huh2:

Procedure:
1) Create C:\Temp folder
2) Copy all 3 file
 > AutoItX3.dll
 > AutoItX3.sxs.manifest
 > Test.vbs

AutoItX3.sxs.manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <assemblyIdentity type="win32" name="AutoItX3.sxs" version="1.0.0.0" />
    <file name="AutoItX3.dll">
        <typelib tlbid="{F8937E53-D444-4E71-9275-35B64210CC3B}" resourceid="0" version="1.0" helpdir="" flags="HASDISKIMAGE" />    
        <comClass clsid="{1A671297-FA74-4422-80FA-6C5D8CE4DE04}" threadingModel="Apartment" tlbid="{F8937E53-D444-4E71-9275-35B64210CC3B}" progid="AutoItX3.Control" description="AutoItX3 Class" />        
    </file>
</assembly>

Test.vbs

ExampleA()
Function ExampleA()
    Dim o
    Set o = CreateObject("Microsoft.Windows.ActCtx")
    o.manifest = "C:\Temp\AutoItX3.sxs.manifest"

    Dim obj
    Set obj = o.CreateObject("AutoItX3.Control")
    Msgbox "You are now running AutoItX3.Control Version : " + obj.Version

    Set obj = Nothing
    Set o = Nothing
End Function


I will later compiled your au3 file and test on computer where Autoit not installed.
I think it will also not work.

Link to comment
Share on other sites

Link to comment
Share on other sites

Indeed you are correct it does not run on a machine that has no AutoIT installed.

According to me this has nothing to do with running regfree COM objects ... but rather how the AutoIT developers created the COM dependencies

 I give you this other example I tested succesfully.

The issue with COM objects is as well that you need take in account the bit factor !

I know that the dynwrap is a 32 bit COM object.

so if you would run the vbscript as is you would get this error.

image.png.1cd4147c11d89e7e05f443b88d449016.png

While if you run it as a 32bit vbscript using cscript, all runs well

image.png.ba4337da85bdbfc70c8861a5b86adcf5.png

 

 

 

Dynwrap.zip

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...