Sign in to follow this  
Followers 0
phatzilla

Base64 Scripts not working for some reason...

7 posts in this topic

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?

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  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

Share this post


Link to post
Share on other sites

I'm actually on Win XP SP3 32 BIT

Share this post


Link to post
Share on other sites

Any other ideas guys?

Share this post


Link to post
Share on other sites

$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

Share this post


Link to post
Share on other sites

Yashid, Appreciate the reply mate, tried it on another PC and it worked, guess my main pc needs a cleanin'

Share this post


Link to post
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
Sign in to follow this  
Followers 0