Jump to content

Recommended Posts

Posted

This two following lines:
#RequireAdmin
#AutoIt3Wrapper_UseX64=n

 

not solving this problem

 

Result for:
".NET CLR RuntimeInfo - GetAssemblies.au3" 
 

  Quote

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "L:\CLRv1\.NET CLR RuntimeInfo - GetAssemblies.au3"    
--> Press Ctrl+F11 to Restart or Ctrl+Break -or- F11 to Stop
$oDomain: 1

$sFullName = System.Reflection, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

$iDim = 1

$iLBound = 0
$iUBound = 1
$fFeatures = 0x00000240

$vt = 0x0000000D

$sGUID = {00000000-0000-0000-C000-000000000046}

$pAssembly = 0x03A9FFD0

IsObj( $oAssembly ) = 1

$sFullName = mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

+>15:04:42 AutoIt3.exe ended.rc:0
+>15:04:42 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.065
 

Expand  

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

so I just try an get this:
 

  Quote

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\CLRv1\.NET GUI XPTABLE Assembly.au3"    
--> Press Ctrl+F11 to Restart or Ctrl+Break -or- F11 to Stop
.NET GUI XPTABLE Assembly.au3 (464) : ==> COM Error intercepted !
    err.number is:         0x00000003
    err.windescription:    NULL Pointer assignment
    err.description is:     
    err.source is:         
 

Expand  

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Sure, there is no hurry up.

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

  • Moderators
Posted

So, I will be the first to admit a fair amount of ignorance in this area, although I have been reading through the previous thread to acquaint myself. Is your intent that this would allow access to the entire framework through AutoIt, or just specific tasks? For example, I have been working on connectivity through AutoIt for VMware tasks. If I create a small .Net app and point it to the VMware.Vim namespace, I can then connect to vSphere and do other tasks that most folks would do through PowerCLI. Something like so (pseudo):

using vmware.vim;
using System.Collections.Specialized;

namespace vcenter_inventory {

...form code

vimClient = new vimClientImpl();

}

Is the intent to be able to access CLR through AutoIt and mix-and-match code as desired? Or am I missing the point entirely?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)

@JLogan3o13                   

I guess in theory this would be possible .... but keep in mind that this is still work in progress...

See Example : ".NET Access Custom Assembly.au3" Line 113.

This will give you an idea on how to access a Custom built Assembly.

 

Edited by ptrex
Posted

The intent is to go to mars but lately we have not been on the moon but since 2001 for $20mio dollar you can reach space but lets start with some sky being the limit

  • Access to the entire framework through AutoIt --> examples are seen for powerbasic, foxpro, c++, HP UFT so seems doable
  • @JLogan3o13 PowerCLI seems more logical when you deal with VM stuff but thats up to each others own requirements and personal preferences
    In theory you can write below (be aware on details upper and lowercase)
    Func Example_VIM()
      Local $oAssembly = _CLR_LoadLibrary( "vmware.vim" )
      Local $oVimClient = _CLR_CreateObject( $oAssembly, "vmware.vim.vimClientImpl" )
      ConsoleWrite( "IsObj( $oVimClient ) = " & IsObj( $oVimClient) & @CRLF & @CRLF)
    EndFunc

     

  • For sure we can easily expose non COM registered .NET classes by their CLSID to AutoIt.

It helps if we now get input on all examples and feedback on what works and what not.

Posted

argumentum, Is the ".NET GUI XPTABLE Assembly.au3" working for you? It seems that mLipok has the same problems as you had here.

It seems to be line 444 in CLR.au3 that fails:

$oAssemblyType.InvokeMember_3("LoadFrom", 0x158, 0, 0, $pSafeArray, $pObject)

This is InvokeMember_3 method of the _Type interface. However, the InvokeMember_2 method takes an additional input parameter about culture info. Maybe we need that parameter?

mLipok (and argumentum if the example also fails for you) will you replace line 444 with these two lines:

Local $hResult = $oAssemblyType.InvokeMember_3("LoadFrom", 0x158, 0, 0, $pSafeArray, $pObject)
ConsoleWrite( "$hResult = " & $hResult & @CRLF )

And then report back the error code.

Posted

Sure will try ASAP

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Result:

  Quote

$hResult = -2146232828
.NET GUI XPTABLE Assembly.au3 (467) : ==> COM Error intercepted !
    err.number is:         0x00000003
    err.windescription:    NULL Pointer assignment
    err.description is:     
 

Expand  

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 4/25/2017 at 3:32 PM, BJP said:

Could someone give me an example of how I might use this to connect to a SQL Server via ADO.NET?

Expand  

I do not know, but want to ask you:   Why you do not use ADO.au3 UDF ?

 

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

mLipok, The XPTable.dll issue.

$hResult = -2146232828 = 0x80131604
COR_E_TARGETINVOCATION: Uncaught exception thrown by method called through Reflection.

If you google COR_E_TARGETINVOCATION and LoadFrom, it seems that the error is mainly because LoadFrom cannot find the assembly, the dll-file.

For some reason, LoadFrom does not find the dll file on your PC. I have no idea why. I do not think it has anything to do with missing culture info.

I've tried renaming XPTable.dll to XPTable-a.dll on my PC, and I get exactly the same error: $hResult = -2146232828.

Then I've tried (still with the renamed dll) to investigate the output from the Assembly Binding Log Viewer: fuslogvw.exe (delivered with Windows SDK). From the log file, I can see that if it does not find the dll file, it searches for it in the folder where the running executable is located. That is, in the folder where AutoIt3.exe is located.

Please try the following:

Copy XPTable.dll to the folder where AutoIt is installed and where AutoIt3.exe is located.

Use this line in top of ".NET GUI XPTABLE Assembly.au3" to load the assembly:

Local $oXPTable = _CLR_LoadLibrary("XPTable")

No path, no extension.

This method works on my PC.

Posted (edited)

So I see progress.
I use this testing script:

Local $sXPTable_file = "c:\1\XPTable.dll"
;~  Local $sXPTable_file = "L:\CLRv1\XPTable.dll"
    FileCopy($sXPTable_file, 'C:\Program Files (x86)\AutoIt3\', $FC_OVERWRITE)
    ConsoleWrite("! " & FileExists($sXPTable_file) & @CRLF)
    Local $oXPTable = _CLR_LoadLibrary($sXPTable_file)
;~  Local $oXPTable = _CLR_LoadLibrary("XPTable")
    ConsoleWrite("+Object: " & IsObj($oXPTable) & @CRLF)

    Exit
  Quote

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "L:\CLRv1\.NET GUI XPTABLE Assembly.au3"    
--> Press Ctrl+F11 to Restart or Ctrl+Break -or- F11 to Stop
! 1
$hResult = -2146232828
.NET GUI XPTABLE Assembly.au3 (467) : ==> COM Error intercepted !
    err.number is:         0x00000003
    err.windescription:    NULL Pointer assignment
    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     
    err.lastdllerror is:     0
    err.scriptline is:     467
    err.retcode is:     0x00000000

+Object: 0
+>20:38:31 AutoIt3.exe ended.rc:0
+>20:38:31 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 1.106
 

Expand  


Next I try to swap this two lines:

;~  Local $oXPTable = _CLR_LoadLibrary($sXPTable_file)
    Local $oXPTable = _CLR_LoadLibrary("XPTable")
  Quote

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "L:\CLRv1\.NET GUI XPTABLE Assembly.au3"    
--> Press Ctrl+F11 to Restart or Ctrl+Break -or- F11 to Stop
! 1
$hResult = -2146232828
+Object: 1

+>20:40:09 AutoIt3.exe ended.rc:0
+>20:40:09 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 0.9936
 

Expand  

And this new result fits to your findings:

  On 4/25/2017 at 5:05 PM, LarsJ said:

From the log file, I can see that if it does not find the dll file, it searches for it in the folder where the running executable is located. That is, in the folder where AutoIt3.exe is located.

Expand  

When I comment my Exit line then I get:
 

  Quote

>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "L:\CLRv1\.NET GUI XPTABLE Assembly.au3"    
--> Press Ctrl+F11 to Restart or Ctrl+Break -or- F11 to Stop
! 1
$hResult = -2146232828
+Object: 1
IsObj( $oTable ) = 1
IsObj( $oColumnModel ) = 1
IsObj( $oTableModel ) = 1
IsObj( $oColumn0 ) = 1
IsObj( $oColumn1 ) = 1
IsObj( $oColumn2 ) = 1
VisibleColumnCount = 3
IsObj( $oRow ) = 1
Rows = 1
IsObj( $oCell0 ) = 1
IsObj( $oCell1 ) = 1
IsObj( $oCell2 ) = 1
Cells = 3
+>20:41:31 AutoIt3.exe ended.rc:0
+>20:41:31 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 13.82
 

Expand  

:)

 

but Why I still get:
$hResult = -2146232828

?

 

Edited by mLipok

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
Local $pObject = 0
;$oAssemblyType.InvokeMember_3("LoadFrom", 0x158, 0, 0, $pSafeArray, $pObject)
Local $hResult = $oAssemblyType.InvokeMember_3("LoadFrom", 0x158, 0, 0, $pSafeArray, $pObject) ; <<<< Fails
ConsoleWrite( "$hResult = " & $hResult & @CRLF )

If Not Ptr($pObject) Then
  ; args := ComObjArray(0xC, 1),  args[0] := "System"
  Local $tSafeArrayBound = DllStructCreate($tagSAFEARRAYBOUND)
  Local $pSafeArray, $pSafeArrayData
  DllStructSetData($tSafeArrayBound, "cElements", 1)
  DllStructSetData($tSafeArrayBound, "lLbound", 0)
  $pSafeArray = SafeArrayCreate($VT_VARIANT, 1, $tSafeArrayBound)
  SafeArrayAccessData($pSafeArray, $pSafeArrayData)
  DllStructSetData(DllStructCreate("word", $pSafeArrayData), 1, $VT_BSTR)
  DllStructSetData(DllStructCreate("ptr", $pSafeArrayData + 8), 1, SysAllocString($sAssemblyName))
  SafeArrayUnaccessData($pSafeArray)

  $oAssemblyType.InvokeMember_3("LoadWithPartialName", 0x158, 0, 0, $pSafeArray, $pObject) ; <<<< This line loads the assembly
  ; 0x158 = $BindingFlags_Static + $BindingFlags_Public + $BindingFlags_FlattenHierarchy + $BindingFlags_InvokeMethod
EndIf

 

Posted

@LarsJ any comment to this snippet ?

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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

In this line you must specify the extension:

Local $hResult = $oAssemblyType.InvokeMember_3("LoadFrom", 0x158, 0, 0, $pSafeArray, $pObject)

But since this line does not work for mLipok anyway, we do not care about the extension in his case. And because the line failed $pObject = 0.


In this line extension should not be specified:

$oAssemblyType.InvokeMember_3("LoadWithPartialName", 0x158, 0, 0, $pSafeArray, $pObject)

LoadWithPartialName searches the assembly in the folder where the running executable, AutoIt3.exe, is located. The AutoIt installation folder. If we copy XPTable.dll to this folder LoadWithPartialName can find the assembly.

If XPTable.dll is specified for LoadWithPartialName it'll search for XPTable.dll.dll. If XPTable is specified for LoadWithPartialName it'll search for XPTable.dll.

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
×
×
  • Create New...