Jump to content

Make AU3 from DLL


Gerifield
 Share

Recommended Posts

This program generate an includable au3 file from a dll.

(The result au3 file is like the "SQLite.dll.au3")

You can call your "unpacker" like this:

_dll_create_AU3NAME("unpacked dll name.dll")

For example if you save "mydll.au3", and include it into your program, use this command:

_dll_create_mydll("dllname.dll") -> This will create "dllname.dll", and that'll be the original dll.

Code:

$dllname = FileOpenDialog("Open",@Scriptdir,"*.* (*.*)")

If FileExists($dllname) Then
    $au3_out = FileSaveDialog("Save",@Scriptdir,"AU3 (*.au3)",16)
Else
    Exit
EndIf

If $au3_out <> "" Then

$readin = FileOpen($dllname,16)
$holder = FileRead($readin)
FileClose($readin)
$holder=StringReplace($holder,"0x","",1)
;MsgBox(0,"",$holder)
$tester = FileOpen("test.txt",17)
FileWrite($tester,$holder)
FileClose($tester)


$reopen = FileOpen("test.txt",0)
$au3_gen = FileOpen($au3_out,6)
$fname = StringSplit($au3_out,"\")
$fn = StringSplit($fname[$fname[0]],".")

FileWrite($au3_gen,"Func _dll_create_"&$fn[1]&"($n)"&@CRLF)
FileWrite($au3_gen,'$dll_data=""'&@CRLF)
$holder2=""
While 1
    $holder2=FileRead($reopen,600)
    If @error == -1 Then
    ;MsgBox(0,"","End Of Read!")
        ExitLoop
    EndIf
    $holder2=StringReplace($holder2,"0x","",1)
    FileWrite($au3_gen,'$dll_data&="'&$holder2&'"'&@CRLF)
    $holder2=""
WEnd
FileClose($reopen)
FileDelete("test.txt"); -> If you want the dll binary source, don't delete the test.txt
FileWrite($au3_gen,@CRLF&'$writer=FileOpen($n,2)'&@CRLF)
FileWrite($au3_gen,'$dll_data = "0x" & $dll_data'&@CRLF)
FileWrite($au3_gen,'FileWrite($writer,Binary($dll_data))'&@CRLF)
FileWrite($au3_gen,'FileClose($writer)'&@CRLF&'EndFunc')

FileClose($au3_gen)

EndIf

I know, this code works like FileInstall, but I think it'll be useful for somebody.... :mellow:

This program works with any file, BUT the au3 size is bigger, than the original file!

(Dll, exe, jpg...)

I know, that's not the best way, but it works!

Sorry, but i don't speak English very well... :SExamples:SQLite with guiMake AU3 from DLL

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

  • Recently Browsing   0 members

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