Search the Community
Showing results for tags 'machine code'.
-
I have wrote a lot of binary code library for AutoIt before. I also discover many ways to generate binary code for AutoIt in the past. However, all of them have limitation or need some extra effort. Recently, I think I found the best and easiest way to generate the binary code. So I wrote this UDF, may be my last one about binary code. The Features:Both AutoIt x86 and x64 version are supported.Windows API and static variables can be use (code relocation supported).Decompression at run-time with smallest footprint LZMA decoder.Allocated memory blocks are released automatically.Most C source code works without modification.Two step or one step script generation, very easy to use.How It Works: The C source code must be compiled by MinGW GCC with "-S -masm=intel" option. Output is GAS syntax assembly file.BinaryCall Tool is able to convert the GAS syntax assembly file (*.s) to FASM syntax (*.asm). During the conversion, global symbols will be stored as "Symbol Jump Table" at the head of the file. The output file should be able to be assembled to binary file under command line by FASM.EXE. This syntax conversion is step 1.The step 2 is to assemble the file. BinaryCall Tool will use the embedded FASM to assemble every file twice to generate the relocation table. "BinaryCall.inc" will be included automatically before assembling to detect the Windows API and generate the "API Jump table". All the results will be compressed and converted to AutoIt script output.There are two major functions in the output script. _BinaryCall_Create() function allocates memorys, decompress the binary, relocates the address in memory, and fills the "API Jump Table"._BinaryCall_SymbolList() converts the "Symbol Jump Table" to memory addresses, and then store them as pointers in a DllStruct variable.Finally, we can use DllCallAddress() to call the memory address stored in the DllStruct.Step by Step Tutorial: Write C source code:#include <windows.h> void main() { MessageBox(0, "Hello", "Welcome Message", 1); }Use GCC MinGW 32/64 to compile the source code: gcc -S -masm=intel -m32 MessageBox.cUse BinaryCall Tool "GAS2AU3 Converter", select "MessageBox.s": If Not @AutoItX64 Then Local $Code = '...' Local $Reloc = '...' Local $Symbol[] = ["main"] Local $CodeBase = _BinaryCall_Create($Code, $Reloc) If @Error Then Exit Local $SymbolList = _BinaryCall_SymbolList($CodeBase, $Symbol) If @Error Then Exit EndIfPaste the output script, call the main() in AutoIt: #Include "BinaryCall.au3" ; Paste output here DllCallAddress("none:cdecl", DllStructGetData($SymbolList, "main"))Try to run it! Change Log:v1.0Initial release.v1.1A lot of improvement for GAS2ASM converter and FASM header file.Add many C Run-Time library as inline asm subroutines.Add command-line to argc/argv parser for easy calling main() function.Add ability to redirect stdio.More C source code can work without modification in this version. Following open source projects are tested. And Yes, they can run as binary code library in AutoIt now. SQLite 3.8.5 TCC 0.9.26 PuTTY beta 0.63 v1.2Dynamic-link library (DLL) calling is supported now. If the C program requires a DLL file to run, just put it together with the source file. BinaryCall Tool will searches *.dll and exports all the symbols in these DLL files automatically. Of course, you need these DLL files when run the output script. However, it also works if you loaded them by last version of MemoryDll UDF.To add more Windows API library easily by editing the ini file.Better error handling and more error messages in output script.Add zero padding to avoid short jumps that crash the relocation table.BinaryCall Tool accepts drag and drop files now.Some small bug fixed. BinaryCall 1.0.zip BinaryCall 1.1.zip BinaryCall 1.2.zip
- 33 replies
-
- binary
- machine code
-
(and 1 more)
Tagged with:
-
Version 1.0.0
565 downloads
AutoIt Machine Code Algorithm Collection By Ward, November 11, 2010 in AutoIt Example Scripts Posted November 11, 2010 (edited) I have already published a lot of AutoIt UDF about algorithm, but all of them only support 32 bits or so called X86 system. Recently I got a computer with Windows 7 64 bits, so I finally added X64 support to most of my old projects. Besides, I also added some new. For example, some compression algorithm and SHA3 Candidates. Following are the algorithms list: Checksum CRC16 CRC32 ADLER32 Compression FastLZ LZF LZMA LZMAT MiniLZO QuickLZ Encode Base64 ARC4 XXTEA DES AES Hash Checksums (CRC16/CRC32/ADLER32) MD2 MD4 MD5 SHA1 SHA2 (SHA224/256/384/512) SHA3 Candidates BLAKE BMW (Blue Midnight Wish) CUBEHASH ECHO SHABAL SKEIN Some points to mention: All of the subroutines have one or more examples to demonstrate the usage. Since the function and usage of subroutine are easy to understand. A complete subroutines and parameters list are unavailability now. Sorry for my lazy. All of the subroutines here invoked by Lazycat's method (through CallWindowProc API). My MemoryDLL UDF is not necessary this time. Although MemoryFuncCall (part of MemoryDLL) is still good, but inevitably, it is slower than CallWindowProc. Some subroutines have the same name with my old machine code version UDF. But for some reason, I rearrange the position of the parameters. Please not mix up. If you notice, yes, checksums are duplicated. But they receive different parameters. One is the old style, and another use the same interface as other hashes. Choose what you like, but don't use them in the same time. Some algorithm already supported by the standard UDF "Encryption.au3". But I still provide them, because some system lack of the full support of Windows Crypt Library. If you are looking for only one hash algorithm, for example, used in encryption, I suggested "SHABAL_TINY.au3". Although it is a bit slower then SHABAL, but it is smaller, and it supports different size of output (from 32 to 512 bits).-
- machine code
- algorithm
-
(and 3 more)
Tagged with:
-
Okay, this is exciting. I'm proud to introduce CompileIt - an experimental compiler, that allows to compile AutoIt to machine code. ...Kind of. CompileIt does compilation in a similar way the Glasgow Haskell compiler does: translates the code into a lower-level language (in CompileIt's case it's C), and then compiles the code in that language. Now, this project is still in its infancy, since, although it is simple to use, AutoIt is incredibly complex on the inside (automation, COM, etc.). So, CompileIt can compile only a very small subset of what we know as AutoIt. Here's a list of things CompileIt (partially) supports (or not): Numbers, booleans, strings Some built-in functions If, For and While statements Exporting DLL functions (you can now write DLL's in AutoIt, guys!) No arrays, automation, GUI or COM. A more detailed list is included with CompileIt. CompileIt is written in AutoIt (the compiler interface), JavaScript (parser, executed with ChakraCore), and of course C. GCC is required to compile scripts. After you extract the files, run CompileIt.exe and configure it to work with GCC.
- 12 replies