Giter Site home page Giter Site logo

mcode4gcc's Introduction

MCode4GCC

MCode4GCC is an MCode generator using the GCC Compiler.
More about MCode here : http://ahkscript.org/boards/viewtopic.php?f=7&t=32

Screenshots

screenshot

Help

What is MCode?

MCode is short for machine code. Basically, it is compiled code : instructions in binary form for the CPU to execute. The main advantages of MCode is speed and the possibility to execute low-level code, such as Assembly.

Getting started

Currently, there are two MCode functions available for AutoHotkey. Bentschi's version is recommended.

Laszlo's version :
How to use it : http://www.autohotkey.com/board/topic/19483-machine-code-functions-bit-wizardry

MCode(ByRef code, hex) { ; allocate memory and write Machine Code there
	VarSetCapacity(code,StrLen(hex)//2)
	Loop % StrLen(hex)//2
		NumPut("0x" . SubStr(hex,2*A_Index-1,2), code, A_Index-1, "Char")
}

Bentschi's version :
How to use it : http://ahkscript.org/boards/viewtopic.php?f=7&t=32

MCode(mcode) {
	static e := {1:4, 2:1}, c := (A_PtrSize=8) ? "x64" : "x86"
	if (!regexmatch(mcode, "^([0-9]+),(" c ":|.*?," c ":)([^,]+)", m))
		return
	if (!DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e[m1], "ptr", 0, "uint*", s, "ptr", 0, "ptr", 0))
		return
	p := DllCall("GlobalAlloc", "uint", 0, "ptr", s, "ptr")
	if (c="x64")
		DllCall("VirtualProtect", "ptr", p, "ptr", s, "uint", 0x40, "uint*", op)
	if (DllCall("crypt32\CryptStringToBinary", "str", m3, "uint", 0, "uint", e[m1], "ptr", p, "uint*", s, "ptr", 0, "ptr", 0))
		return p
	DllCall("GlobalFree", "ptr", p)
}

Setting up GCC

There are many GCC distributions for the Microsoft Windows Operating System.
Here are some recommended ones :
- MinGW : http://www.mingw.org/wiki/Getting_Started
- TDM-GCC : https://jmeubank.github.io/tdm-gcc/
- Cygwin : https://cygwin.com/install.html

Questions?

Don't be shy to post in the forums. Just ask away!
Post your questions here : http://ahkscript.org/boards/viewtopic.php?f=6&t=4642

Credits

Special thanks to IsNull, fincs, Laszlo, SKAN, Bentschi and kon
Written by joedf ([email protected])
Released under the MIT License

mcode4gcc's People

Contributors

joedf avatar

Stargazers

 avatar

Forkers

poa00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.