Giter Club home page Giter Club logo

mp.au3's Introduction

mp.au3

Yet another multi-process library for AutoIt3

features

  • Easy to use
  • High performance
  • Support IPC, via COM object and message events

usage

Just copy mp.au3 and DLLs from release into your project.

You can build DLL from source, e.g with MSVC:

$ cl /MT /LD /O2 mp.cc user32.lib kernel32.lib oleaut32.lib

how it works?

We emulate the "fork process" technique with CreateProcess().

// Clone current process
CreateProcess(NULL, GetCommandLine()... CREATE_SUSPENDED

To preload data before initialization, we create process with flag CREATE_SUSPENDED to suspend it. Then inject our DLL to it and write memory. Provide only a single DLL to help hacking memory easier.

static int data;
...
WriteProcessMemory(process, &data, &data, sizeof(data) ...
  • data is static and has same base address in different process
  • So address data can be... module.dll + &data

On IPC, we provide a simple IDispatch object to manipulate data in main process. In sub processes, we also use hacking memory.

For message events, we just use headless window message and SendMessage().

example

#NoTrayIcon
#include "mp.au3"

; Initialize.
_MP_Init()

; Get shared data object.
global $oData = _MP_SharedData()

; Check if the process is main.
if _MP_IsMain() then
	main()
else
	sub()
endIf

; Main process.
func main()
	; Set message.
	$oData.message = "Hello bro, I'm here."

	; Fork process.
	local $sub = _MP_Fork()

	; Show message box.
	MsgBox(0, 'Main process', 'Hi guy, sub process.')

	; Wait for sub process exit.
	_MP_Wait($sub)
endFunc

; Sub process.
func sub()
	Sleep(500)
	; Show message data.
	MsgBox(0, 'Sub process', $oData.message)
endFunc

mp.au3's People

Contributors

nomi-san avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

devil4ngle

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.