kna

High-performance easy native access from Kotlin

License

License

GroupId

GroupId

org.jire
ArtifactId

ArtifactId

kna
Last Version

Last Version

0.4.2
Release Date

Release Date

Type

Type

jar
Description

Description

kna
High-performance easy native access from Kotlin
Project URL

Project URL

https://github.com/Jire/kna/
Source Code Management

Source Code Management

https://github.com/Jire/kna/

Download kna

How to add to project

<!-- https://jarcasting.com/artifacts/org.jire/kna/ -->
<dependency>
    <groupId>org.jire</groupId>
    <artifactId>kna</artifactId>
    <version>0.4.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.jire/kna/
implementation 'org.jire:kna:0.4.2'
// https://jarcasting.com/artifacts/org.jire/kna/
implementation ("org.jire:kna:0.4.2")
'org.jire:kna:jar:0.4.2'
<dependency org="org.jire" name="kna" rev="0.4.2">
  <artifact name="kna" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jire', module='kna', version='0.4.2')
)
libraryDependencies += "org.jire" % "kna" % "0.4.2"
[org.jire/kna "0.4.2"]

Dependencies

compile (1)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.21

runtime (5)

Group / Artifact Type Version
net.java.dev.jna : jna jar 5.6.0
net.java.dev.jna : jna-platform jar 5.6.0
it.unimi.dsi : fastutil jar 8.4.4
net.openhft : chronicle-core jar 2.20.125
org.openjdk.jmh : jmh-core jar 1.25

Project Modules

There are no modules declared in this project.

KNA (Kotlin Native Access)

High-performance easy native access from Kotlin

Build Status License

Currently still under development -- documentation and unit tests are missing.


Using from Gradle

Gradle Kotlin:

implementation("org.jire", "kna", "0.4.2")

Gradle Groovy:

implementation group: 'org.jire', name: 'kna', version: '0.4.2'

Attaching to a process

You can attach to a process using a name (executable file name):

val process = Attach.byName("process.exe")!!

Or you can attach using a process ID (PID):

val process = Attach.byID(123)!!

Attaching to modules of a process

You can use .modules() off a process to acquire attached modules.

val modules = process.modules()

Consider that each call to .modules() will reload all modules unless you specify attach as false like so:

val modules = process.modules(attach = false)

From the attached modules you can use .byName(moduleName) to select a certain module:

val module = modules.byName("module.dll")

Reading from processes & modules

You can use the implicit data type to read from an address:

val someByte: Byte = process[0x100]
val someInt: Int = process[0x101]
val someFloat: Float = process[0x105]
val someBoolean: Boolean = process[0x109]

The implicit type also works when passing arguments or using if expressions:

if (process[0x321]) // Boolean type inferred
	sin(process[0x555]) // Double type inferred

Sometimes it's easier or necessary to use explicit types:

val someByte = process.byte(0x100)
val someInt = process.int(0x101)
val someFloat = process.float(0x105)
val someBoolean = process.boolean(0x109)

Writing to processes & modules

You can use "implicit" writing with the set operator.

something[0x100] = 1.toByte()
something[0x101] = 1
something[0x105] = 1F
something[0x109] = true

There are no "explicit" writes, as the "implicit" writes are simply method overloads.

Versions

Version
0.4.2
0.4.1
0.4.0
0.3.0
0.2.2