Jump to content

Recommended Posts

Posted

I have scite installed with the latest version of autoit,

I downloaded the scripts from here

I put them in my includes folder, and when i tried to run the base64test script, it just errors out and asks me to debug.

Any ideas?

Posted

Are you running the 64bit interpretter? I'm not sure if it's compatible, and I am unable to test on the system I'm typing this on, but I can confirm that the examples work in Windows XP SP3, AutoIt 3.3.6.1

Posted (edited)

First you need to change Include "Base64.au3" to Include <Base64.au3>

Right click and Run Script (x86)

?????????????

Edit: Now I tried to Run same script Results below...

#Include "C:\Program Files (x86)\AutoIt3\Include\Base64.au3" - WORKS

#Include <Base64.au3> - Doesn't work???

Edited by rogue5099
Posted

$Data = 'Hello World!'
ConsoleWrite($Data & @CR)
$Data = _Base64_Encode($Data)
ConsoleWrite($Data & @CR)
$Data = _Base64_Decode($Data)
ConsoleWrite($Data & @CR)

Func _Base64_Decode($sData)

    Local $Ret, $tData

    $Ret = DllCall('crypt32.dll', 'bool', 'CryptStringToBinaryW', 'wstr', $sData, 'dword', 0, 'dword', 1, 'ptr', 0, 'dword*', 0, 'ptr', 0, 'ptr', 0)
    If (@error) Or (Not $Ret[0]) Then
        Return SetError(1, 0, '')
    EndIf
    $tData = DllStructCreate('byte[' & $Ret[5] & ']')
    $Ret = DllCall('crypt32.dll', 'bool', 'CryptStringToBinaryW', 'wstr', $sData, 'dword', 0, 'dword', 1, 'ptr', DllStructGetPtr($tData), 'dword*', $Ret[5], 'ptr', 0, 'ptr', 0)
    If (@error) Or (Not $Ret[0]) Then
        Return SetError(1, 0, '')
    EndIf
    Return BinaryToString(DllStructGetData($tData, 1))
EndFunc   ;==>_Base64_Decode

Func _Base64_Encode($sData)

    Local $Ret, $bData, $tData, $tText

    $bData = StringToBinary($sData)
    $tData = DllStructCreate('byte[' & BinaryLen($bData) & ']')
    DllStructSetData($tData, 1, $bData)
    $Ret = DllCall('crypt32.dll', 'bool', 'CryptBinaryToStringW', 'ptr', DllStructGetPtr($tData), 'dword', DllStructGetSize($tData), 'dword', 1, 'ptr', 0, 'dword*', 0)
    If (@error) Or (Not $Ret[0]) Then
        Return SetError(1, 0, '')
    EndIf
    $tText = DllStructCreate('wchar[' & $Ret[5] & ']')
    $Ret = DllCall('crypt32.dll', 'bool', 'CryptBinaryToStringW', 'ptr', DllStructGetPtr($tData), 'dword', DllStructGetSize($tData), 'dword', 1, 'ptr', DllStructGetPtr($tText), 'dword*', $Ret[5])
    If (@error) Or (Not $Ret[0]) Then
        Return SetError(1, 0, '')
    EndIf
    Return DllStructGetData($tText, 1)
EndFunc   ;==>_Base64_Encode

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
  • Recently Browsing   0 members

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