bun-memory 1.1.7 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/example/trigger-bot.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FFIType, dlopen } from 'bun:ffi';
|
|
1
|
+
import { CString, FFIType, dlopen, ptr } from 'bun:ffi';
|
|
2
2
|
import { sleep } from 'bun';
|
|
3
3
|
|
|
4
|
-
import Memory from '
|
|
4
|
+
import Memory from '../index.ts';
|
|
5
5
|
|
|
6
6
|
// Get the latest client_dll.json and offsets.json from:
|
|
7
7
|
// https://github.com/a2x/cs2-dumper/tree/main/output
|
|
@@ -9,6 +9,10 @@ import Memory from 'bun-memory';
|
|
|
9
9
|
import ClientDLLJSON from './offsets/client_dll.json';
|
|
10
10
|
import OffsetsJSON from './offsets/offsets.json';
|
|
11
11
|
|
|
12
|
+
// !
|
|
13
|
+
|
|
14
|
+
// !
|
|
15
|
+
|
|
12
16
|
const Delay = 2.5;
|
|
13
17
|
|
|
14
18
|
const { random } = Math;
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "git://github.com/obscuritysrl/bun-memory.git"
|
|
23
23
|
},
|
|
24
24
|
"type": "module",
|
|
25
|
-
"version": "1.1.
|
|
25
|
+
"version": "1.1.9",
|
|
26
26
|
"main": "./index.ts",
|
|
27
27
|
"keywords": [
|
|
28
28
|
"bun",
|
|
@@ -46,5 +46,6 @@
|
|
|
46
46
|
],
|
|
47
47
|
"engines": {
|
|
48
48
|
"bun": ">=1.1.0"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"types": "types/global.d.ts"
|
|
50
51
|
}
|
package/runtime/extensions.ts
CHANGED
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
* ```
|
|
75
75
|
*/
|
|
76
76
|
|
|
77
|
-
import {
|
|
77
|
+
import { type Pointer, ptr } from 'bun:ffi';
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
80
|
* List of binary view constructor functions whose prototypes will be extended
|
|
@@ -236,3 +236,5 @@ constructors.forEach(({ prototype }) => {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
|
+
|
|
240
|
+
export {};
|
package/structs/Memory.ts
CHANGED
|
@@ -363,7 +363,7 @@ class Memory {
|
|
|
363
363
|
|
|
364
364
|
this.ScratchModuleEntry32W.writeUInt32LE(0x438 /* sizeof(MODULEENTRY32W) */);
|
|
365
365
|
|
|
366
|
-
const lpme = this.ScratchModuleEntry32W
|
|
366
|
+
const lpme = this.ScratchModuleEntry32W;
|
|
367
367
|
|
|
368
368
|
const bModule32FirstW = Kernel32.Module32FirstW(hSnapshot, lpme);
|
|
369
369
|
|
|
@@ -376,9 +376,9 @@ class Memory {
|
|
|
376
376
|
const modules: Memory['_modules'] = {};
|
|
377
377
|
|
|
378
378
|
do {
|
|
379
|
-
const modBaseAddr =
|
|
380
|
-
const modBaseSize =
|
|
381
|
-
const szModule =
|
|
379
|
+
const modBaseAddr = lpme.readBigUInt64LE(0x18);
|
|
380
|
+
const modBaseSize = lpme.readUInt32LE(0x20);
|
|
381
|
+
const szModule = lpme.toString('utf16le', 0x30, 0x230).replace(/\0+$/, '');
|
|
382
382
|
|
|
383
383
|
modules[szModule] = Object.freeze({ base: modBaseAddr, name: szModule, size: modBaseSize });
|
|
384
384
|
} while (Kernel32.Module32NextW(hSnapshot, lpme));
|
|
@@ -439,6 +439,7 @@ class Memory {
|
|
|
439
439
|
* @param lengthOrValue - Number of bytes to read (when reading), or `CString` to write (when writing)
|
|
440
440
|
* @returns `CString` when reading, or this `Memory` instance when writing
|
|
441
441
|
*
|
|
442
|
+
* @todo Investigate odd behavior when reading strings longer than `lengthOrValue`.
|
|
442
443
|
* @todo Research and consider alternatives that do not require so many new allocations.
|
|
443
444
|
*
|
|
444
445
|
* @example
|
|
File without changes
|