-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,8 @@ | ||
.idea/ | ||
native/.idea/ | ||
native/target/ | ||
native/cargo.log | ||
native/cross.log | ||
native/main.rs | ||
native/ | ||
dist | ||
|
||
**/*.node | ||
*.js | ||
NativeMemoryReader.node | ||
**/node_modules | ||
**/.DS_Store | ||
npm-debug.log | ||
|
||
npm-debug.log |
This file was deleted.
Oops, something went wrong.
49 changes: 26 additions & 23 deletions
49
packages/tsprocess-rust/index.ts → packages/tsprocess-rust/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,85 @@ | ||
// @ts-ignore | ||
import { MemoryReader as NativeMemoryReader } from './native/index.node'; | ||
const { | ||
MemoryReader: NativeMemoryReader | ||
} = require('./NativeMemoryReader.node'); | ||
|
||
export class MemoryReader { | ||
private nativeReader: NativeMemoryReader; | ||
class MemoryReader { | ||
#nativeReader; | ||
|
||
constructor(processId: number) { | ||
constructor(processId) { | ||
this.nativeReader = new NativeMemoryReader(processId); | ||
} | ||
|
||
public static isProcessExists(processId: number): boolean { | ||
static isProcessExists(processId) { | ||
return NativeMemoryReader.isProcessExists(processId); | ||
} | ||
|
||
public static findProcesses(processName: string): number[] { | ||
static findProcesses(processName) { | ||
return NativeMemoryReader.findProcesses(processName); | ||
} | ||
|
||
public static getProcessPath(processId: number): string { | ||
static getProcessPath(processId) { | ||
return NativeMemoryReader.getProcessPath(processId); | ||
} | ||
|
||
public static getProcessCommandLine(processId: number): string { | ||
static getProcessCommandLine(processId) { | ||
return NativeMemoryReader.getProcessCommandLine(processId); | ||
} | ||
|
||
public findSignature(signature: string): number { | ||
findSignature(signature) { | ||
return this.nativeReader.findSignature(signature); | ||
} | ||
|
||
public readRaw(address: number, length: number): number[] { | ||
readRaw(address, length) { | ||
return this.nativeReader.readRaw(address, length); | ||
} | ||
|
||
public readPointer(address: number): number { | ||
readPointer(address) { | ||
return this.nativeReader.readPointer(address); | ||
} | ||
|
||
public readString(address: number): string { | ||
readString(address) { | ||
return this.nativeReader.readString(address); | ||
} | ||
|
||
public readI8(address: number): number { | ||
readI8(address) { | ||
return this.nativeReader.read_i8(address); | ||
} | ||
|
||
public readI16(address: number): number { | ||
readI16(address) { | ||
return this.nativeReader.read_i16(address); | ||
} | ||
|
||
public readI32(address: number): number { | ||
readI32(address) { | ||
return this.nativeReader.read_i32(address); | ||
} | ||
|
||
public readI64(address: number): number { | ||
readI64(address) { | ||
return this.nativeReader.read_i64(address); | ||
} | ||
|
||
public readU8(address: number): number { | ||
readU8(address) { | ||
return this.nativeReader.read_u8(address); | ||
} | ||
|
||
public readU16(address: number): number { | ||
readU16(address) { | ||
return this.nativeReader.read_u16(address); | ||
} | ||
|
||
public readU32(address: number): number { | ||
readU32(address) { | ||
return this.nativeReader.read_u32(address); | ||
} | ||
|
||
public readU64(address: number): number { | ||
readU64(address) { | ||
return this.nativeReader.read_u64(address); | ||
} | ||
|
||
public readF32(address: number): number { | ||
readF32(address) { | ||
return this.nativeReader.read_f32(address); | ||
} | ||
|
||
public readF64(address: number): number { | ||
readF64(address) { | ||
return this.nativeReader.read_f64(address); | ||
} | ||
} | ||
|
||
module.exports = { MemoryReader }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
{ | ||
"name": "tsprocess-rust", | ||
"version": "0.1.0", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"test": "cargo test", | ||
"cargo-build": "cargo build --manifest-path ./native/Cargo.toml --message-format=json > ./native/cargo.log", | ||
"cross-build": "cross build --manifest-path ./native/Cargo.toml --message-format=json > ./native/cross.log", | ||
"postcargo-build": "neon dist < ./native/cargo.log --out ./dist/native/index.node", | ||
"postcross-build": "neon dist -m ./native/target < cross.log --out ./dist/native/index.node", | ||
"prepare": "npm run build", | ||
"debug": "npm run build", | ||
"build": "npm run cargo-build -- --release && tsc", | ||
"cross": "npm run cross-build -- --release && tsc", | ||
"help": "@neon-rs/cli" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@neon-rs/cli": "0.1.73" | ||
} | ||
} | ||
"name": "tsprocess-rust", | ||
"version": "0.1.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "cargo test", | ||
"cargo-build": "cargo build --manifest-path ./native/Cargo.toml --message-format=json > ./native/cargo.log", | ||
"cross-build": "cross build --manifest-path ./native/Cargo.toml --message-format=json > ./native/cross.log", | ||
"postcargo-build": "neon dist < ./native/cargo.log --out ./dist/NativeMemoryReader.node", | ||
"postcross-build": "neon dist -m ./native/target < cross.log --out ./dist/NativeMemoryReader.node", | ||
"prepare": "npm run cargo-build -- --release", | ||
"debug": "npm run build", | ||
"build": "tsc", | ||
"cross": "npm run cross-build -- --release && tsc", | ||
"help": "@neon-rs/cli" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@neon-rs/cli": "0.1.73" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2020", | ||
"module":"CommonJS", | ||
"sourceMap": true, | ||
"declaration": true, | ||
"allowSyntheticDefaultImports": true, | ||
"declarationDir": "dist", | ||
"outDir": "dist" | ||
}, | ||
"include": [ | ||
"./globals.d.ts" | ||
], | ||
"compilerOptions": { | ||
"lib": [ | ||
"ES2020" | ||
], | ||
"module": "commonjs", | ||
"moduleResolution": "Node", | ||
"allowJs": true, | ||
"esModuleInterop": true, | ||
"outDir": "dist", | ||
"rootDir": "./", | ||
"sourceMap": false, | ||
"declaration": false, | ||
"strict": true, | ||
"noImplicitAny": false, | ||
"target": "ES2020", | ||
"strictPropertyInitialization": false, | ||
"baseUrl": ".", | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"dist", | ||
], | ||
"include": [ | ||
"**/*" | ||
], | ||
} |