Sign in to follow this  
Followers 0

File to Base64 String Code Generator v1.20 Build 2015-01-20 (embed your files easily)


121 posts in this topic




#2 ·  Posted

Very similar to this script:

I make use of Base64 encoding features, the compression is much better!

João Carlos.


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#3 ·  Posted

I wanted to try your example but when mouse is over bottom button, merlin disapears...


AutoIt Version : 3.3.14.0 SciTE 3.5.4 WIN8.1 X64

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Very similar to this script:

I make use of Base64 encoding features, the compression is much better!

João Carlos.

Indeed, very similar script. Well, I implemented also a Base64 version but the compression wasn't better. Have a look here: Base64 version

Either I missed something or it is as it is.

I wanted to try your example but when mouse is over bottom button, merlin disapears...

This appears with Windows XP only. Just move these 2 lines

_WinAPI_DeleteObject($Bmp_Logo)
_WinAPI_DeleteObject($Bmp_Button)

to

Case $GUI_EVENT_CLOSE
            _WinAPI_DeleteObject($Bmp_Logo)
            _WinAPI_DeleteObject($Bmp_Button)
            GUIDelete($hGUI)
            Exit

and should work. Btw, the button looks awful on WinXP :D

Thanks for your feedback!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#5 ·  Posted

@UEZ

I have a sample image with 296 KB when converted with your script the size is 573 KB and with my script is 397 KB!

João Carlos.


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#6 ·  Posted

Changed the code from binary string to base64 string to save some more bytes :D

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#7 ·  Posted

Share this post


Link to post
Share on other sites

#8 ·  Posted

Very good, my sample image is now 384KB with your script!

João Carlos.


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Your first version worked fine, this one crashes on my Win7-64bit while converting.

Strange, because I'm using Win7 x64 in general, too! Which file your are converting and on which stage it is crashing (while compression or base64 converting)? What is the error code?

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

It crashes in the _Base64Encode() function. I've got DEP activated, and I guess you're missing a _MemVirtualAlloc() for the codebuffer there.

Edit: Btw, this one came exactly at the right time and the "File to Hex Binary Converter" version went right into :D, thanks a lot! I'll switch to the Base64 on the next release.

Edit #2:

Add #include <Memory.au3> at the top and change the _Base64Encode() function to this :oops:...

Func _Base64Encode($Data, $LineBreak = 0)
    Local $Opcode = "0x5589E5FF7514535657E8410000004142434445464748494A4B4C4D4E4F505152" _
                                  & "535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778" _
                                  & "797A303132333435363738392B2F005A8B5D088B7D108B4D0CE98F0000000FB6" _
                                  & "33C1EE0201D68A06880731C083F901760C0FB6430125F0000000C1E8040FB633" _
                                  & "83E603C1E60409C601D68A0688470183F90176210FB6430225C0000000C1E806" _
                                  & "0FB6730183E60FC1E60209C601D68A06884702EB04C647023D83F90276100FB6" _
                                  & "730283E63F01D68A06884703EB04C647033D8D5B038D7F0483E903836DFC0475" _
                                  & "0C8B45148945FC66B80D0A66AB85C90F8F69FFFFFFC607005F5E5BC9C21000"
    Local $pProc = _MemVirtualAlloc(0, BinaryLen($Opcode), $MEM_COMMIT, $PAGE_EXECUTE_READWRITE)
    Local $CodeBuffer = DllStructCreate("byte[" & BinaryLen($Opcode) & "]",$pProc)
    DllStructSetData($CodeBuffer, 1, $Opcode)
    $Data = Binary($Data)
    Local $Input = DllStructCreate("byte[" & BinaryLen($Data) & "]")
    DllStructSetData($Input, 1, $Data)
    $LineBreak = Floor($LineBreak / 4) * 4
    Local $OputputSize = Ceiling(BinaryLen($Data) * 4 / 3)
    $OputputSize = $OputputSize + Ceiling($OputputSize / $LineBreak) * 2 + 4
    Local $Ouput = DllStructCreate("char[" & $OputputSize & "]")
    DllCall("user32.dll", "none", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), "ptr", DllStructGetPtr($Input), "int", BinaryLen($Data), "ptr", DllStructGetPtr($Ouput), "uint", $LineBreak)
    _MemVirtualFree($pProc, BinaryLen($Opcode), $MEM_DECOMMIT)
    Return DllStructGetData($Ouput, 1)
EndFunc   ;==>_Base64Encode
Edited by KaFu

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Fixed some bugs (no base64 conversation on small files and checkbox logic issues) and added DEP check to add program to the exclusion list to avoid hard crash.

Edit: I will add the modified _Base64Encode() function by KaFu in the next release!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#12 ·  Posted

Grrr, sorry, found another bug when compression is unselected! Last 2 lines of the function have been forgotten! :D

Br,

UEZ :oops:


Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#13 ·  Posted

Updated to v0.94 Build 2011-11-01 Beta.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#14 ·  Posted

Updated to v0.99 -> added multi file support.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#15 ·  Posted

Updated to v0.99 -> added multi file support.

Br,

UEZ

Now yes: it's perfect! Thank you...

João Carlos.


http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

@jscript: your are welcome.

Updated to v1.00 final and changed name to File to Base64 String Code Generator.

If you find bugs or have any suggestions please let me know!

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#17 ·  Posted

Very nice script!

Would suggest to check if compression reduced size, if not continue with uncompressed data.

Share this post


Link to post
Share on other sites

#18 ·  Posted

Very nice script!

Would suggest to check if compression reduced size, if not continue with uncompressed data.

Thanks for you suggestion - makes sense!

Next release will check whether compression increases the size and skip to uncompressed binary automatically!

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯

Share this post


Link to post
Share on other sites

#19 ·  Posted

UEZ, you are giving me credit for base64 code but that code is not mine as far as I know. The only base64 code I have ever used in that form is Ward's and it's inside AutoItObject.au3, working in both x86 and x64 versions of interpreter.

I have written base64 UDF code using Windows API for, but not this.


 

.

eMyvnE

Share this post


Link to post
Share on other sites

#20 ·  Posted

You're right, seems to be Wards code and I would recommend to switch to Wards code as these functions support x64 as well :D (+ this is already DEP save).

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