Jump to content

Using AutoIT with our registering the DLL


SilentSnake
 Share

Recommended Posts

Hi, 

 

on my target machine, i don´t have admin privileges. So I am looking for a way to make use of the autoit functionality without the need of register the dll with regsvr32. Does anybody have an idea? I already tried this way, but get an InvalidCastException. I am thankful for any hints or tips. :)

 

Best regards,

SilentSnake

Link to comment
Share on other sites

You mean using activex object ?

 

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

I have no glue, I would use any method thad works. :) I don´t know much about this autoit dll. Is it a question of individual usage, if it is an ActiveX object or a COM object? 

I built a minimal visual studio project to show my problem: https://teimotronic.de:501/sharing/pilOiMudv

Steps to reproduce: 

  1. register the autoitx3.dll in the console with admin rights (regsvr32 autoitx3.dll)
  2. Build the project and run it. It should work fine. 
  3. Unregister the dll (regsvr32 -u autoitx3.dll)
  4. Start the previous built version and see the exception. It complains about a missing interface. :( Does anybody has an idea?
Edited by SilentSnake
Link to comment
Share on other sites

I think you should to read this:
https://msdn.microsoft.com/en-us/library/ms165432.aspx

But I'm not VisualStudio user... (nor C, C++ , C#) so my hint may not be the right ones.

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

It has to be registered or you can't call it's methods and whatnot. I hate COM anyway. you can easily register it on client machines though, so what's the problem? distribute it with your app and register it.

you need to go read about COM and how it works. I don't think anyone around here will help with bypassing any kind of security btw.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

  • 5 months later...

Hi SilentSnake

I know this it old topic, but I was searching for same question in last week and I found my answer in some stackoverflow posts and one old topic on here. So for others that seeking for the same question, I hope this will help you:

You do not need to register AutoItX3.DLL or AutoitX3_64.DLL files in the target computers. In this old topic show how to use methods inside those two dll's directly: C# use of the dll, some idears for you. and I use same way in my simple app in C# and test it on other computers without registering any dll.

using System;
using System.Runtime.InteropServices;
using AutoIt;

namespace SendKeyCommand
{
    internal static class Program 
    {
        [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
        private static extern int AU3_WinMenuSelectItemByHandle(IntPtr intPtr
            ,  string item1
            ,  string item2 = ""
            ,  string item3 = ""
            ,  string item4 = ""
            ,  string item5 = ""
            ,  string item6 = ""
            ,  string item7 = ""
            ,  string item8 = "");

        [DllImport("AutoItX3.dll", SetLastError = true, CharSet = CharSet.Auto)]
        private static extern int AU3_WinMenuSelectItem(string title
            ,  string text
            ,  string item1
            ,  string item2 = ""
            ,  string item3 = ""
            ,  string item4 = ""
            ,  string item5 = ""
            ,  string item6 = ""
            ,  string item7 = ""
            ,  string item8 = "");

        private static void Main()
        {
            var intPtr = AutoItX.WinGetHandle("μTorrent");
            if (intPtr != IntPtr.Zero)
            {
                AU3_WinMenuSelectItemByHandle(intPtr, "&File", "E&xit");
                // Or:
                // AU3_WinMenuSelectItem("μTorrent", "", "&File", "E&xit");
            }
        }
    }
}

All methods in these two libraries "AutoItX3.DLL or AutoitX3_64.DLL" listed inside of AutoItX3_DLL.h file under Autoit\AutoitX3 folder.

Note this: There are some methods with postfix "...ByHandle" they are overloaded methods that we do not use them with that name in Autoit but you have to specify them in C# just like I did in above sample on "AU3_WinMenuSelectItemByHandle" method.

Still, you can add a reference to this "AutoItX3.Assembly.dll" file without any problem. This file does not need any registration on target computers. [I think] You can do the same thing for any *.dll by using DllImportAttribute [DllImport("DllFilename")]. For more info :MSDN DllImportAttribute.

For more info please check my solved problem: "[SOLVED] WinMenuSelectItem method cannot find in C#"

 

Happy Coding!

IgImAx

 

Teach Others to learn more yourself

My eBooks and Articles in Persian: IgImAx Home! * and more here

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...