Jump to content

File to Base64 String Code Generator v1.20 Build 2020-06-05 (embed your files easily)


UEZ
 Share

Recommended Posts

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!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • 2 weeks later...

@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!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

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

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...