Jump to content

.NET Common Language Runtime (CLR) Framework


ptrex
 Share

Recommended Posts

Here is a more Advanced example using the  Ribbon .NET Assembly using  CLR Library

Features :
• Easy to use (WYSIWYG)
• Compatible with .net 2.0 and above
• Easy to integrate in an application
• Support different layout Themes : Office 2007 / 2010 / 2013
 

Documentation :

New Site : https://github.com/RibbonWinForms/RibbonWinForms

Old Site : https://www.codeproject.com/Articles/364272/Easily-Add-a-Ribbon-into-a-WinForms-Application-Cs?fid=1704255&df=90&mpp=25&sort=Position&view=Normal&spc=Relaxed&fr=101&prof=True

Movie : shows how to use it in VS using C#

 

Result :

image-3.png

 image-4.png

CLR using the PS Automation Assembly :

#AutoIt3Wrapper_UseX64=y

#include "CLR.Au3"
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

Local $str = "Q0xTCiMgaHR0cHM6Ly9naXRodWIuY29tL1JpYmJvbldpbkZvcm1zL1JpYmJvbldpbkZvcm1zCiMgc2VlIGhlcmUgZm9yIHRpcHMgCiMgaHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1PUHJqN2MxQ1lJZwoKJFJ1bnNwYWNlID0gW3J1bnNwYWNlZmFjdG9yeV06OkNyZWF0ZVJ1bnNwYWNlKCkKCiRSdW5zcGFjZS5BcGFydG1lbnRTdGF0ZSA9ICJTVEEiICMgQ2hhbmdlIGhlcmUgIQokUnVuc3BhY2UuVGhyZWFkT3B0aW9ucyA9ICJSZXVzZVRocmVhZCIKCiRQb3dlclNoZWxsID0gW3Bvd2Vyc2hlbGxdOjpDcmVhdGUoKQoKJFBvd2VyU2hlbGwuUnVuc3BhY2UgPSAkUnVuc3BhY2UKCiRSdW5zcGFjZS5PcGVuKCkKCiRob3N0LlJ1bnNwYWNlLlRocmVhZE9wdGlvbnMudmFsdWVfXwokUnVuc3BhY2UuUnVuc3BhY2VTdGF0ZUluZm8KCiMgU3RhcnQgCiRzdHJpbmcgPSB7IAoKQWRkLVR5cGUgLVBhdGggKCIkUFdEXFN5c3RlbS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MS5TbWFsbEltYWdlID0gW1N5c3RlbS5EcmF3aW5nLkltYWdlXTo6RnJvbUZpbGUoIiRQV0RcU2F2ZUl0ZW0ucG5nIikgCiMgKChTeXN0ZW0uRHJhd2luZy5JbWFnZSkocmVzb3VyY2VzLkdldE9iamVjdCgicmliYm9uQnV0dG9uMS5TbWFsbEltYWdlIikpKTsKJEJ1dHRvbjEuVGV4dCA9ICJyaWJib25CdXR0b24xIjsKCiRCdXR0b24xLmFkZF9jbGljayh7CiAgICAkbWVzc2FnZWJveHJlcGx5ID0gW1N5c3RlbS5XaW5kb3dzLkZvcm1zLk1lc3NhZ2VCb3hdOjpTaG93KCJEbyB5b3Ugd2lzaCB0byBjb250aW51ZSA/IiwiV2VsY29tZSIsMykKfSkKCiMgcmliYm9uVGFiMgokVGFiMi5UZXh0ID0gInJpYmJvblRhYjIiOwoKJGZvcm0uQ29udHJvbHMuQWRkKCRyaWJib24pCgokZm9ybS5SZXN1bWVMYXlvdXQoJGZhbHNlKQoKJGZvcm0uU2hvd0RpYWxvZygpCn0KCiNFbmQKClt2b2lkXSRQb3dlclNoZWxsLkFkZFNjcmlwdCgkc3RyaW5nKQoKJFBvd2VyU2hlbGwuSW52b2tlKCkgCgokUG93ZXJTaGVsbC5FbmRJbnZva2UKCiRSdW5zcGFjZS5DbG9zZSgpCiRQb3dlcnNoZWxsLkRpc3Bvc2UoKQ=="
ConsoleWrite($str & @CRLF)

$str = _Base64Decode($str)

_Run_PSHost_Script(BinaryToString($str,1))


Func _Run_PSHost_Script($PSScript)
    Local $oAssembly = _CLR_LoadLibrary("System.Management.Automation")
    ConsoleWrite("!$oAssembly: " & IsObj($oAssembly) & @CRLF)

    ; Create Object
    Local $pAssemblyType = 0
    $oAssembly.GetType_2("System.Management.Automation.PowerShell", $pAssemblyType)
    ConsoleWrite("$pAssemblyType = " & Ptr($pAssemblyType) & @CRLF)

    Local $oActivatorType = ObjCreateInterface($pAssemblyType, $sIID_IType, $sTag_IType)
    ConsoleWrite("IsObj( $oAssemblyType ) = " & IsObj($oActivatorType) & @TAB & @CRLF)

    ; Create Object
    Local $pObjectPS = 0
    $oActivatorType.InvokeMember_3("Create", 0x158, 0, 0, 0, $pObjectPS)
    ConsoleWrite("IsObject: " & IsObj($pObjectPS) & @TAB & "$pObject: " & ObjName($pObjectPS) & @CRLF)


; <<<<<<<<<<<<<<<<<<< PS COMMAND HERE >>>>>>>>>>>>>>>>>>>>
    $pObjectPS.AddScript($PSScript) ; Add Script here
;~  ConsoleWrite($PSScript & @CRLF)

    $objAsync = $pObjectPS.BeginInvoke ; (2); ($oActivatorType,$oActivatorType)

    While $objAsync.IsCompleted = False
;~          ConsoleWrite($objAsync.IsCompleted & @CRLF)
        ContinueLoop
    WEnd
        ConsoleWrite("Completed : " & $objAsync.IsCompleted & @CRLF)

    $objPsCollection = $pObjectPS.EndInvoke($objAsync)
;~  ConsoleWrite("$objPsCollection: " & IsObj($objPsCollection) & @TAB & "$objPsCollection: " & ObjName($objPsCollection) & " - " & ObjName($objPsCollection,6) & " - " & ObjName($objPsCollection,3) & @CRLF)

EndFunc


Func _Base64Decode($input_string)

    Local $struct = DllStructCreate("int;int;int")
    Local $dwFlags = 1 ; Base64, no headers

    DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
            "str", $input_string, _
            "int", StringLen($input_string), _
            "int", $dwFlags, _
            "ptr", 0, _
            "ptr", DllStructGetPtr($struct, 1), _
            "ptr", DllStructGetPtr($struct, 2), _
            "ptr", DllStructGetPtr($struct, 3))

    Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")

    DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
            "str", $input_string, _
            "int", StringLen($input_string), _
            "int", $dwFlags, _
            "ptr", DllStructGetPtr($a), _
            "ptr", DllStructGetPtr($struct, 1), _
            "ptr", DllStructGetPtr($struct, 2), _
            "ptr", DllStructGetPtr($struct, 3))

    Return DllStructGetData($a, 1)

EndFunc   ;==>_Base64Decode

 

Downloads :

RB Assembly here :

https://github.com/RibbonWinForms/RibbonWinForms/releases

Many thanks for the developer of the Ribbon .NET Assembly !

 

Enjoy !

ptrex

 

Link to comment
Share on other sites

Here is an other more advanced Example that uses the SSRS Reporting .NET Assembly using  CLR Library

Features :

• Multiple Data Sources available
• Can run in REMOTE or LOCAL Mode
• Export possible to XLS(X) / DOC(X) / PDF

Result :

image-2.png

image-2.png

image-1.png

CLR using the PS Automation Assembly :

#AutoIt3Wrapper_UseX64=y

#include "..\CLR.Au3"
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

Local $str = _Base64Decode("JFJ1bnNwYWNlID0gW3J1bnNwYWNlZmFjdG9yeV06OkNyZWF0ZVJ1bnNwYWNlKCkNCg0KJFJ1bnNwYWNlLkFwYXJ0bWVudFN0YXRlID0gIlNUQSIgIyBDaGFuZ2UgaGVyZSAhDQokUnVuc3BhY2UuVGhyZWFkT3B0aW9ucyA9ICJSZXVzZVRocmVhZCINCg0KJFBvd2VyU2hlbGwgPSBbcG93ZXJzaGVsbF06OkNyZWF0ZSgpDQoNCiRQb3dlclNoZWxsLnJ1bnNwYWNlID0gJFJ1bnNwYWNlDQoNCiRSdW5zcGFjZS5PcGVuKCkNCg0KJHN0cmluZyA9IHsgDQpBZGQtVHlwZSAtUGF0aCAiQzpcV0lORE9XU1xhc3NlbWJseVxHQUNfTVNJTFxNaWNyb3NvZnQuUmVwb3J0Vmlld2VyLldpbkZvcm1zXDEyLjAuMC4wX184OTg0NWRjZDgwODBjYzkxXE1pY3Jvc29mdC5SZXBvcnRWaWV3ZXIuV2luRm9ybXMuZGxsIg0KQWRkLVR5cGUgLVBhdGggIkM6XF9cQXBwc1xfUG93ZXJTaGVsbFxfR1VJIEZvcm1zXC5ORVQgU1NSUyBSZXBvcnQgU2VydmVyXFN5c3RlbS5EYXRhLlNRTGl0ZS5kbGwiDQojIEFkZC1UeXBlIC1QYXRoICJDOlxQcm9ncmFtRGF0YVxMSU5RUGFkXERyaXZlcnNcRGF0YUNvbnRleHRcN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3QgV2luZG93cy5Gb3Jtcy5Gb3JtICAgICAgICAgICAgDQogICAgICAgICAgICAgDQojd2UncmUgZ29pbmcgdG8gbWFrZSBpdCBqdXN0IHNsaWdodGx5IGJpZ2dlciB0aGFuICAgICAgICAgICAgIA0KJGZvcm0uSGVpZ2h0ID0gODEwICAgICAgICAgICAgDQokZm9ybS5XaWR0aD0gMTIxMCAgICAgICAgICAgIA0KJGZvcm0uQ29udHJvbHMuQWRkKCRydikgICAgICAgICAgICANCiRydi5TaG93KCkgICAgICAgICAgICANCiRmb3JtLlNob3dEaWFsb2coKSAgICAgICAgICAgIA0KDQoNCiRzcWwuRGlzcG9zZSgpDQokY29uLkNsb3NlKCkNCn0NCg0KDQpbdm9pZF0kUG93ZXJTaGVsbC5BZGRTY3JpcHQoJHN0cmluZykNCg0KJFBvd2VyU2hlbGwuSW52b2tlKCkgDQo=")


_Run_PSHost_Script(BinaryToString($str,1))


Func _Run_PSHost_Script($PSScript)
    Local $oAssembly = _CLR_LoadLibrary("System.Management.Automation")
    ConsoleWrite("!$oAssembly: " & IsObj($oAssembly) & @CRLF)

    ; Create Object
    Local $pAssemblyType = 0
    $oAssembly.GetType_2("System.Management.Automation.PowerShell", $pAssemblyType)
    ConsoleWrite("$pAssemblyType = " & Ptr($pAssemblyType) & @CRLF)

    Local $oActivatorType = ObjCreateInterface($pAssemblyType, $sIID_IType, $sTag_IType)
    ConsoleWrite("IsObj( $oAssemblyType ) = " & IsObj($oActivatorType) & @TAB & @CRLF)

    ; Create Object
    Local $pObjectPS = 0
    $oActivatorType.InvokeMember_3("Create", 0x158, 0, 0, 0, $pObjectPS)
    ConsoleWrite("IsObject: " & IsObj($pObjectPS) & @TAB & "$pObject: " & ObjName($pObjectPS) & @CRLF)


; <<<<<<<<<<<<<<<<<<< PS COMMAND HERE >>>>>>>>>>>>>>>>>>>>
    $pObjectPS.AddScript($PSScript) ; Add Script here
;~  ConsoleWrite($PSScript & @CRLF)

    $objAsync = $pObjectPS.BeginInvoke ; (2); ($oActivatorType,$oActivatorType)

    While $objAsync.IsCompleted = False
;~          ConsoleWrite($objAsync.IsCompleted & @CRLF)
        ContinueLoop
    WEnd
        ConsoleWrite("Completed : " & $objAsync.IsCompleted & @CRLF)

    $objPsCollection = $pObjectPS.EndInvoke($objAsync)
;~  ConsoleWrite("$objPsCollection: " & IsObj($objPsCollection) & @TAB & "$objPsCollection: " & ObjName($objPsCollection) & " - " & ObjName($objPsCollection,6) & " - " & ObjName($objPsCollection,3) & @CRLF)

EndFunc


Func _Base64Decode($input_string)

    Local $struct = DllStructCreate("int;int;int")
    Local $dwFlags = 1 ; Base64, no headers

    DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
            "str", $input_string, _
            "int", StringLen($input_string), _
            "int", $dwFlags, _
            "ptr", 0, _
            "ptr", DllStructGetPtr($struct, 1), _
            "ptr", DllStructGetPtr($struct, 2), _
            "ptr", DllStructGetPtr($struct, 3))

    Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")

    DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
            "str", $input_string, _
            "int", StringLen($input_string), _
            "int", $dwFlags, _
            "ptr", DllStructGetPtr($a), _
            "ptr", DllStructGetPtr($struct, 1), _
            "ptr", DllStructGetPtr($struct, 2), _
            "ptr", DllStructGetPtr($struct, 3))

    Return DllStructGetData($a, 1)

EndFunc   ;==>_Base64Decode

Downloads :

SSRS Assembly here :

2008 / 2010 / 2012 or 2015 

Many thanks for the developer(s) of the SSRS .NET Assembly !

 

Enjoy !

ptrex

Link to comment
Share on other sites

  • 2 months later...

I guess you didn't read that link that was posted to you earlier. is it on the list of things to do? most likely not. there are other UDFs that allow you to run .NET code as well as load DLLs

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

  • 3 months later...
  • 3 years later...
  • 4 months later...

Hello,

I need to validate domain credentials.

I use PS code :

Add-Type -AssemblyName System.DirectoryServices.AccountManagement
$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext('domain')
$DS.ValidateCredentials($UserName, $Password, "Negotiate")

I try to do same thing in AutoIt but it doesn't work :

#include <CLR.au3>
#include <CLR Constants.au3>

test()

Func test()
    Local $oAssembly = _CLR_LoadLibrary("System.DirectoryServices.AccountManagement")
     ConsoleWrite("$oAssembly: " & IsObj($oAssembly) & @CRLF)

    Local $oTest = _CLR_CreateObject($oAssembly, "System.DirectoryServices.AccountManagement.PrincipalContext")
    ConsoleWrite("IsObj = " & IsObj($oTest) & @CRLF )

    Local $oTest2 = _CLR_CreateObject($oAssembly, "System.DirectoryServices.AccountManagement.PrincipalContext", "domain")
    ConsoleWrite("IsObj = " & IsObj($oTest2) & @CRLF )
EndFunc   ;==>test

Do you know why ?
image.png.4ea3a70abe509c98395989e0e748f56e.pngimage.png.eb328334d3c0eb74052eb926574b1363.png

Link to comment
Share on other sites

  • 1 year later...
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

×
×
  • Create New...