@zsa233/frida-analykit-agent 2.0.0
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/LICENSE +21 -0
- package/README.md +5 -0
- package/package.json +41 -0
- package/src/api/android.ts +80 -0
- package/src/bridges.ts +18 -0
- package/src/cmodule/scan_adrp.c +81 -0
- package/src/cmodule/scan_adrp.ts +118 -0
- package/src/config.ts +56 -0
- package/src/consts.ts +31 -0
- package/src/elf/insn.ts +61 -0
- package/src/elf/module.ts +751 -0
- package/src/elf/struct.ts +271 -0
- package/src/elf/tools.ts +33 -0
- package/src/elf/verifier.ts +74 -0
- package/src/elf/xref.ts +360 -0
- package/src/func.ts +32 -0
- package/src/helper.ts +685 -0
- package/src/index.ts +10 -0
- package/src/jni/env.ts +1439 -0
- package/src/jni/struct.ts +217 -0
- package/src/lib/libc.ts +161 -0
- package/src/lib/libssl.ts +95 -0
- package/src/message.ts +26 -0
- package/src/net/ssl.ts +360 -0
- package/src/net/struct.ts +51 -0
- package/src/net/tools.ts +0 -0
- package/src/process.ts +137 -0
- package/src/rpc.ts +268 -0
- package/src/runtime-globals.d.ts +11 -0
- package/src/utils/array_pointer.ts +102 -0
- package/src/utils/queue.ts +102 -0
- package/src/utils/scan.ts +103 -0
- package/src/utils/std.ts +165 -0
- package/src/utils/text_endec.ts +35 -0
- package/src/utils/utils.ts +111 -0
package/src/jni/env.ts
ADDED
|
@@ -0,0 +1,1439 @@
|
|
|
1
|
+
import { Java } from "../bridges.js"
|
|
2
|
+
import { IndirectRefKind, JNI_VT } from "./struct.js"
|
|
3
|
+
import { nativeFunctionOptions } from '../consts.js'
|
|
4
|
+
import { help, NativePointerObject } from "../helper.js"
|
|
5
|
+
import { setGlobalProperties } from '../config.js'
|
|
6
|
+
import { NP, EnvJvmti, VMApi } from "../api/android.js"
|
|
7
|
+
|
|
8
|
+
function getThreadFromEnv(env: Java.Env): NativePointer {
|
|
9
|
+
return env.handle.add(Process.pointerSize).readPointer()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
interface nativeFunc {
|
|
14
|
+
handle: NativePointer
|
|
15
|
+
impl: AnyFunction
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
class MirrorObject extends NativePointerObject {
|
|
19
|
+
constructor(handle: NativePointer) {
|
|
20
|
+
super(handle)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
interface JObjectTypeArg {
|
|
27
|
+
parent?: jobject | null
|
|
28
|
+
isStatic?: boolean
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class jobject extends NativePointerObject {
|
|
32
|
+
protected _parent: jobject | null
|
|
33
|
+
protected _class: jclass | undefined
|
|
34
|
+
protected _isStatic: boolean = false
|
|
35
|
+
protected _deleted: boolean = false
|
|
36
|
+
|
|
37
|
+
constructor(handle: NativePointer, {
|
|
38
|
+
parent = null,
|
|
39
|
+
isStatic = parent?._isStatic || false,
|
|
40
|
+
}: JObjectTypeArg = {}) {
|
|
41
|
+
super(handle)
|
|
42
|
+
this._parent = parent
|
|
43
|
+
this._isStatic = isStatic
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
$unwrap(): { [key: string]: any } {
|
|
47
|
+
return {
|
|
48
|
+
isStatic: this._isStatic,
|
|
49
|
+
parent: this._parent,
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
$toString(): any {
|
|
54
|
+
const result = JNIEnv.CallObjectMethod(this, JNIEnv.javaLangObject().toString)
|
|
55
|
+
const utf16 = result.$jstring.toUTF16String()
|
|
56
|
+
const str = utf16.toString()
|
|
57
|
+
utf16.release()
|
|
58
|
+
result.$unref()
|
|
59
|
+
return str
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get $IndirectRefKind(): number {
|
|
63
|
+
return Number(this._handle.and(JniEnv.kKindMask))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
$bind(kws: {isStatic?: boolean, parent?: jobject | null}): this {
|
|
67
|
+
const opt = {...this.$unwrap(), ...kws}
|
|
68
|
+
return new (this.constructor as { new(obj: any, opt?: {[key: string]: any}): any })(this._handle, opt)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get $class(): jclass {
|
|
72
|
+
if(this._class !== undefined) {
|
|
73
|
+
return this._class
|
|
74
|
+
}
|
|
75
|
+
const cls = JNIEnv.GetObjectClass(this._handle).$globalRef().$jclass.$bind({ parent: this, isStatic: this._isStatic })
|
|
76
|
+
this._class = cls
|
|
77
|
+
return cls
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
$method(name: string, sig: string): jmethodID {
|
|
81
|
+
return JNIEnv.GetMethodID(this.$class, name, sig)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
$methodID(methodId: any): jobject {
|
|
85
|
+
return JNIEnv.ToReflectedMethod(this.$class, methodId, this._isStatic).$bind({parent: this})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
$getName(): string {
|
|
89
|
+
const handle = this
|
|
90
|
+
const javaLang = this._parent === null ? JNIEnv.javaLangClass() : JNIEnv.javaLangReflectMethod()
|
|
91
|
+
const result = JNIEnv.CallObjectMethod(handle, javaLang.getName)
|
|
92
|
+
const utf16 = result.$jstring.toUTF16String()
|
|
93
|
+
const str = utf16.toString()
|
|
94
|
+
utf16.release()
|
|
95
|
+
result.$unref()
|
|
96
|
+
return str
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
get $jstring(): jstring { return new jstring(this.$handle, this.$unwrap()) }
|
|
100
|
+
|
|
101
|
+
get $jobject(): jobject { return new jobject(this.$handle, this.$unwrap()) }
|
|
102
|
+
|
|
103
|
+
get $jclass(): jclass { return new jclass(this.$handle, this.$unwrap()) }
|
|
104
|
+
|
|
105
|
+
get $jint(): jint { return new jint(this.$handle) }
|
|
106
|
+
|
|
107
|
+
get $jfloat(): jfloat { return new jfloat(this.$handle) }
|
|
108
|
+
|
|
109
|
+
get $jdouble(): jdouble { return new jdouble(this.$handle) }
|
|
110
|
+
|
|
111
|
+
get $jbyte(): jbyte { return new jbyte(this.$handle) }
|
|
112
|
+
|
|
113
|
+
get $jchar(): jchar { return new jchar(this.$handle) }
|
|
114
|
+
|
|
115
|
+
get $jlong(): jlong { return new jlong(this.$handle) }
|
|
116
|
+
|
|
117
|
+
get $jshort(): jshort { return new jshort(this.$handle) }
|
|
118
|
+
|
|
119
|
+
get $jboolean(): jboolean { return new jboolean(this.$handle) }
|
|
120
|
+
|
|
121
|
+
get $jobjectArray(): jobjectArray { return new jobjectArray(this.$handle) }
|
|
122
|
+
|
|
123
|
+
$decode(thread: jobject | NativePointer | null = null): MirrorObject {
|
|
124
|
+
return JNIEnv.DecodeJObject(thread, this)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
$unref(){
|
|
128
|
+
if(this._deleted) {
|
|
129
|
+
return true
|
|
130
|
+
}
|
|
131
|
+
this._deleted = true
|
|
132
|
+
switch(this.$IndirectRefKind) {
|
|
133
|
+
case IndirectRefKind.kHandleScopeOrInvalid:
|
|
134
|
+
case IndirectRefKind.kLocal:
|
|
135
|
+
JNIEnv.DeleteLocalRef(this)
|
|
136
|
+
break
|
|
137
|
+
case IndirectRefKind.kGlobal:
|
|
138
|
+
JNIEnv.DeleteGlobalRef(this)
|
|
139
|
+
break
|
|
140
|
+
case IndirectRefKind.kWeakGlobal:
|
|
141
|
+
JNIEnv.DeleteWeakGlobalRef(this)
|
|
142
|
+
break
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
$globalRef(): jobject {
|
|
147
|
+
if(this.$IndirectRefKind === IndirectRefKind.kGlobal) {
|
|
148
|
+
return this
|
|
149
|
+
}
|
|
150
|
+
const glo = JNIEnv.NewGlobalRef(this)
|
|
151
|
+
const handle = ptr(glo.$handle.toString())
|
|
152
|
+
Script.bindWeak(glo.$handle, ()=>{
|
|
153
|
+
JNIEnv.DeleteGlobalRef(handle)
|
|
154
|
+
})
|
|
155
|
+
this.$unref()
|
|
156
|
+
return glo
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
toString(){
|
|
160
|
+
return `<jobject: ${this.$handle}>[${this.$IndirectRefKind}]`
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
export class jmethod extends jobject {
|
|
166
|
+
constructor(handle: NativePointer, opt: {[key: string]: any}={}) {
|
|
167
|
+
if(!('parent' in opt)) {
|
|
168
|
+
opt.parent = new jobject(NULL)
|
|
169
|
+
}
|
|
170
|
+
super(handle, opt)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
toString() {
|
|
174
|
+
return `<jmethod: ${this.$handle}>[${this.$IndirectRefKind}]`
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
export class jclass extends jobject {
|
|
180
|
+
constructor(handle: NativePointer, {isStatic = false}: JObjectTypeArg = {}) {
|
|
181
|
+
super(handle, {isStatic})
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
toString() {
|
|
185
|
+
return `<jclass: ${this.$handle}>[${this.$IndirectRefKind}]`
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
$methodID(methodId: any): jobject {
|
|
189
|
+
return JNIEnv.ToReflectedMethod(this, methodId, this._isStatic).$bind({parent: this})
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
$method(name: string, sig: string): jmethodID {
|
|
193
|
+
return JNIEnv.GetMethodID(this, name, sig)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
$toString(): any {
|
|
197
|
+
const isExcept = JNIEnv.ExceptionCheck()
|
|
198
|
+
if(isExcept) {
|
|
199
|
+
return ''
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if(this.$handle.isNull() || JNIEnv.IsSameObject(this, NULL)) {
|
|
203
|
+
return ''
|
|
204
|
+
}
|
|
205
|
+
const result = JNIEnv.CallObjectMethod(this, JNIEnv.javaLangObject().toString)
|
|
206
|
+
const utf16 = result.$jstring.toUTF16String()
|
|
207
|
+
const str = utf16.toString()
|
|
208
|
+
utf16.release()
|
|
209
|
+
result.$unref()
|
|
210
|
+
return str
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
$getName(): string {
|
|
214
|
+
const handle = this._parent ? this._parent : this
|
|
215
|
+
const javaLang = JNIEnv.javaLangClass()
|
|
216
|
+
const result = JNIEnv.CallObjectMethod(handle, javaLang.getName)
|
|
217
|
+
const utf16 = result.$jstring.toUTF16String()
|
|
218
|
+
const str = utf16.toString()
|
|
219
|
+
utf16.release()
|
|
220
|
+
result.$unref()
|
|
221
|
+
return str
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
}
|
|
225
|
+
export class jstring extends jobject {
|
|
226
|
+
private _str: string | undefined
|
|
227
|
+
|
|
228
|
+
toString(): string {
|
|
229
|
+
if(this.$handle.isNull() || this._str !== undefined) {
|
|
230
|
+
return this._str || ''
|
|
231
|
+
}
|
|
232
|
+
const utf16 = this.toUTF16String()
|
|
233
|
+
const str = utf16.toString()
|
|
234
|
+
this._str = str
|
|
235
|
+
return str
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
[Symbol.toPrimitive](hint: string) {
|
|
239
|
+
if (hint === "string") {
|
|
240
|
+
return `<jstring: ${this.$handle}>[${this.$IndirectRefKind}]`
|
|
241
|
+
}
|
|
242
|
+
return "default"
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
toUTF16String(): UTF16JString {
|
|
246
|
+
return new UTF16JString(this)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
toUTF8String(): UTF8JString {
|
|
250
|
+
return new UTF8JString(this)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
export class jmethodID extends jobject {
|
|
255
|
+
$getName(): string {
|
|
256
|
+
const handle = this._parent
|
|
257
|
+
const javaLang = JNIEnv.javaLangReflectMethod()
|
|
258
|
+
const result = JNIEnv.CallObjectMethod(handle, javaLang.getName)
|
|
259
|
+
const utf16 = result.$jstring.toUTF16String()
|
|
260
|
+
const str = utf16.toString()
|
|
261
|
+
utf16.release()
|
|
262
|
+
result.$unref()
|
|
263
|
+
return str
|
|
264
|
+
}
|
|
265
|
+
toString(): string { return `<jmethodID: ${this.$handle}>[${this.$IndirectRefKind}]` }
|
|
266
|
+
}
|
|
267
|
+
export class jboolean extends NativePointerObject {
|
|
268
|
+
toBool(): boolean {
|
|
269
|
+
return this._handle.toInt32() !== 0
|
|
270
|
+
}
|
|
271
|
+
toString(): string { return `<jboolean: ${this.$handle}>` }
|
|
272
|
+
}
|
|
273
|
+
export class jbyte extends NativePointerObject {
|
|
274
|
+
toByte(): number {
|
|
275
|
+
return this._handle.toInt32()
|
|
276
|
+
}
|
|
277
|
+
toString(): string { return `<jbyte: ${this.$handle}>` }
|
|
278
|
+
}
|
|
279
|
+
export class jchar extends NativePointerObject {
|
|
280
|
+
toChar(): number {
|
|
281
|
+
return this._handle.toInt32()
|
|
282
|
+
}
|
|
283
|
+
toString(): string { return `<jchar: ${this.$handle}>` }
|
|
284
|
+
}
|
|
285
|
+
export class jdouble extends NativePointerObject {
|
|
286
|
+
toDouble(): number {
|
|
287
|
+
return Number(this._handle)
|
|
288
|
+
}
|
|
289
|
+
toString(): string { return `<jdouble: ${this.$handle}>` }
|
|
290
|
+
}
|
|
291
|
+
export class jfloat extends NativePointerObject {
|
|
292
|
+
toFloat(): number {
|
|
293
|
+
return Number(this._handle)
|
|
294
|
+
}
|
|
295
|
+
toString(): string { return `<jfloat: ${this.$handle}>` }
|
|
296
|
+
}
|
|
297
|
+
export class jint extends NativePointerObject {
|
|
298
|
+
toInt(): number {
|
|
299
|
+
return Number(this._handle)
|
|
300
|
+
}
|
|
301
|
+
toString(): string { return `<jint: ${this.$handle}>` }
|
|
302
|
+
}
|
|
303
|
+
export class jlong extends NativePointerObject {
|
|
304
|
+
toLong(): number {
|
|
305
|
+
return Number(this._handle)
|
|
306
|
+
}
|
|
307
|
+
toString(): string { return `<jlong: ${this.$handle}>` }
|
|
308
|
+
}
|
|
309
|
+
export class jshort extends NativePointerObject {
|
|
310
|
+
toShort(): number {
|
|
311
|
+
return Number(this._handle)
|
|
312
|
+
}
|
|
313
|
+
toString(): string { return `<jshort: ${this.$handle}>` }
|
|
314
|
+
}
|
|
315
|
+
export class jvoid extends NativePointerObject {
|
|
316
|
+
toString(): string { return `<jvoid: ${this.$handle}>` }
|
|
317
|
+
}
|
|
318
|
+
export class jthrowable extends jobject {
|
|
319
|
+
toString(): string { return `<jthrowable: ${this.$handle}>` }
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
export class jvalue {
|
|
325
|
+
private _handle: NativePointer
|
|
326
|
+
constructor(handle: NativePointer) {
|
|
327
|
+
this._handle = handle
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
$index(offset: number): NativePointer {
|
|
331
|
+
return this._handle.add(offset * Process.pointerSize).readPointer()
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
jobject(offset: number): jobject {
|
|
335
|
+
return new jobject(this.$index(offset))
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
jstring(offset: number): jstring {
|
|
339
|
+
return new jstring(this.$index(offset))
|
|
340
|
+
}
|
|
341
|
+
toString(): string { return `<jvalue: ${this._handle}>` }
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
export abstract class jarray<T> extends NativePointerObject {
|
|
346
|
+
protected readonly _pointerSize: number = Process.pointerSize
|
|
347
|
+
protected readonly _wrapper?: { new(handle: NativePointer): T }
|
|
348
|
+
constructor(handle: NativePointer) {
|
|
349
|
+
super(handle)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
$index(index: number): T {
|
|
353
|
+
return new this._wrapper!(this._handle.add(index * this._pointerSize).readPointer())
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export class jobjectArray extends jarray<jobject> {
|
|
358
|
+
protected readonly _wrapper: { new(handle: NativePointer): jobject } = jobject
|
|
359
|
+
$index(index: number): jobject {
|
|
360
|
+
return JNIEnv.GetObjectArrayElement(this.$handle, index)
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
export class jbooleanArray extends jarray<jboolean> {
|
|
364
|
+
protected readonly _pointerSize: number = 1
|
|
365
|
+
protected readonly _wrapper: { new(handle: NativePointer): jboolean } = jboolean
|
|
366
|
+
}
|
|
367
|
+
export class jbyteArray extends jarray<jbyte> {
|
|
368
|
+
protected readonly _pointerSize: number = 1
|
|
369
|
+
protected readonly _wrapper: { new(handle: NativePointer): jbyte } = jbyte
|
|
370
|
+
}
|
|
371
|
+
export class jcharArray extends jarray<jchar> {
|
|
372
|
+
protected readonly _pointerSize: number = 2
|
|
373
|
+
protected readonly _wrapper: { new(handle: NativePointer): jchar } = jchar
|
|
374
|
+
}
|
|
375
|
+
export class jdoubleArray extends jarray<jdouble> {
|
|
376
|
+
protected readonly _pointerSize: number = 8
|
|
377
|
+
protected readonly _wrapper: { new(handle: NativePointer): jdouble } = jdouble
|
|
378
|
+
}
|
|
379
|
+
export class jfloatArray extends jarray<jfloat> {
|
|
380
|
+
protected readonly _pointerSize: number = 4
|
|
381
|
+
protected readonly _wrapper: { new(handle: NativePointer): jfloat } = jfloat
|
|
382
|
+
}
|
|
383
|
+
export class jintArray extends jarray<jint> {
|
|
384
|
+
protected readonly _pointerSize: number = 4
|
|
385
|
+
protected readonly _wrapper: { new(handle: NativePointer): jint } = jint
|
|
386
|
+
}
|
|
387
|
+
export class jlongArray extends jarray<jlong> {
|
|
388
|
+
protected readonly _pointerSize: number = 8
|
|
389
|
+
protected readonly _wrapper: { new(handle: NativePointer): jlong } = jlong
|
|
390
|
+
}
|
|
391
|
+
export class jshortArray extends jarray<jshort> {
|
|
392
|
+
protected readonly _pointerSize: number = 2
|
|
393
|
+
protected readonly _wrapper: { new(handle: NativePointer): jshort } = jshort
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
export function unwrapJvalueArgs(args: jvalue, n: number): (any|NativePointer)[] {
|
|
398
|
+
const list: any[] = []
|
|
399
|
+
for(let i = 0; i < n; i++) {
|
|
400
|
+
list.push(args.$index(i))
|
|
401
|
+
}
|
|
402
|
+
return list
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
// utf16
|
|
408
|
+
class UTF16JString {
|
|
409
|
+
protected _length: number | null = null
|
|
410
|
+
protected _jstr: jstring
|
|
411
|
+
protected _str: string | null = null
|
|
412
|
+
protected _cstrPtr: NativePointer = NULL
|
|
413
|
+
protected _released: boolean = false
|
|
414
|
+
|
|
415
|
+
protected readonly $getString = JNIEnv.GetStringChars
|
|
416
|
+
protected readonly $readString = (p: NativePointer, len: number)=>p.readUtf16String(len)
|
|
417
|
+
protected readonly $releaser = JNIEnv.ReleaseStringChars
|
|
418
|
+
|
|
419
|
+
constructor(jstr: jstring) {
|
|
420
|
+
this._jstr = jstr
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
get $length(): number {
|
|
424
|
+
return this._length !== null ? this._length : (this._length = JNIEnv.GetStringLength(this._jstr).toInt())
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
toString(): string {
|
|
428
|
+
if(this._str !== null) {
|
|
429
|
+
return this._str
|
|
430
|
+
}
|
|
431
|
+
const cstr = this.$getString(this._jstr)
|
|
432
|
+
this._cstrPtr = cstr
|
|
433
|
+
this._str = this.$readString(cstr, this.$length)
|
|
434
|
+
return this._str || ''
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
isNull(): boolean {
|
|
438
|
+
return this._jstr?.$handle.isNull()
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
release(){
|
|
442
|
+
if(this._cstrPtr.isNull()) {
|
|
443
|
+
return false
|
|
444
|
+
}
|
|
445
|
+
return this._released ? true : (
|
|
446
|
+
this._released = true,
|
|
447
|
+
this.$releaser(this._jstr, this._cstrPtr),
|
|
448
|
+
true
|
|
449
|
+
)
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// utf8
|
|
454
|
+
class UTF8JString extends UTF16JString {
|
|
455
|
+
protected readonly $getString = JNIEnv.GetStringUTFChars
|
|
456
|
+
protected readonly $readString = (p: NativePointer, len: number)=>p.readUtf8String(len)
|
|
457
|
+
protected readonly $releaser = JNIEnv.ReleaseStringUTFChars
|
|
458
|
+
|
|
459
|
+
get $length(): number {
|
|
460
|
+
return this._length !== null ? this._length : (this._length = JNIEnv.GetStringUTFLength(this._jstr).toInt())
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
toString(): string {
|
|
464
|
+
return (this._str !== null ? this._str : (this._str = this._jstr.$handle.readUtf16String(this.$length))) || ''
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
interface javaLangClass {
|
|
470
|
+
readonly handle: NativePointer
|
|
471
|
+
readonly getName: NativePointer
|
|
472
|
+
readonly getSimpleName: NativePointer
|
|
473
|
+
readonly getGenericSuperclass: NativePointer
|
|
474
|
+
readonly getDeclaredConstructors: NativePointer
|
|
475
|
+
readonly getDeclaredMethods: NativePointer
|
|
476
|
+
readonly getDeclaredFields: NativePointer
|
|
477
|
+
readonly isArray: NativePointer
|
|
478
|
+
readonly isPrimitive: NativePointer
|
|
479
|
+
readonly isInterface: NativePointer
|
|
480
|
+
readonly getComponentType: NativePointer
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
interface javaLangObject {
|
|
484
|
+
readonly handle: NativePointer
|
|
485
|
+
readonly toString: NativePointer
|
|
486
|
+
readonly getClass: NativePointer
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
interface javaLangReflectMethod {
|
|
490
|
+
readonly getName: NativePointer
|
|
491
|
+
readonly getGenericParameterTypes: NativePointer
|
|
492
|
+
readonly getParameterTypes: NativePointer
|
|
493
|
+
readonly getReturnType: NativePointer // not set
|
|
494
|
+
readonly getGenericReturnType: NativePointer
|
|
495
|
+
readonly getGenericExceptionTypes: NativePointer
|
|
496
|
+
readonly getModifiers: NativePointer
|
|
497
|
+
readonly isVarArgs: NativePointer
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
interface javaLangReflectField {
|
|
501
|
+
readonly getName: NativePointer
|
|
502
|
+
readonly getType: NativePointer
|
|
503
|
+
readonly getGenericType: NativePointer
|
|
504
|
+
readonly getModifiers: NativePointer
|
|
505
|
+
readonly toString: NativePointer
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
interface javaLangReflectConstructor {
|
|
509
|
+
readonly getGenericParameterTypes: NativePointer
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
interface javaLangReflectTypeVariable {
|
|
513
|
+
readonly handle: NativePointer
|
|
514
|
+
readonly getName: NativePointer
|
|
515
|
+
readonly getBounds: NativePointer
|
|
516
|
+
readonly getGenericDeclaration: NativePointer
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
interface javaLangReflectWildcardType {
|
|
520
|
+
readonly handle: NativePointer
|
|
521
|
+
readonly getLowerBounds: NativePointer
|
|
522
|
+
readonly getUpperBounds: NativePointer
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
interface javaLangReflectGenericArrayType {
|
|
526
|
+
readonly handle: NativePointer
|
|
527
|
+
readonly getGenericComponentType: NativePointer
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
interface javaLangReflectParameterizedType {
|
|
531
|
+
readonly handle: NativePointer
|
|
532
|
+
readonly getActualTypeArguments: NativePointer
|
|
533
|
+
readonly getRawType: NativePointer
|
|
534
|
+
readonly getOwnerType: NativePointer
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
interface javaLangString {
|
|
538
|
+
readonly handle: NativePointer
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
interface JniEnv extends Java.Env {
|
|
543
|
+
javaLangClass(): javaLangClass
|
|
544
|
+
javaLangObject(): javaLangObject
|
|
545
|
+
javaLangReflectMethod(): javaLangReflectMethod
|
|
546
|
+
javaLangReflectField(): javaLangReflectField
|
|
547
|
+
javaLangReflectConstructor(): javaLangReflectConstructor
|
|
548
|
+
javaLangReflectTypeVariable(): javaLangReflectTypeVariable
|
|
549
|
+
javaLangReflectWildcardType(): javaLangReflectWildcardType
|
|
550
|
+
javaLangReflectGenericArrayType(): javaLangReflectGenericArrayType
|
|
551
|
+
javaLangReflectParameterizedType(): javaLangReflectParameterizedType
|
|
552
|
+
javaLangString(): javaLangString
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function CLZ(val: number): number{
|
|
556
|
+
val = val >>> 0
|
|
557
|
+
return val === 0 ? 32 : 32 - val.toString(2).length
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function MinimumBitsToStore(value: number): number{
|
|
561
|
+
return (value === 0 ? -1 : (32 - 1 - CLZ(value))) + 1
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
function proxyCallMethod<RetType>(
|
|
565
|
+
env: JniEnvBase,
|
|
566
|
+
offMethod: number,
|
|
567
|
+
constructor: { new(obj: any): RetType } | null = null,
|
|
568
|
+
{
|
|
569
|
+
retType = 'pointer',
|
|
570
|
+
argTypes = ['pointer', 'pointer', 'pointer', 'pointer']
|
|
571
|
+
}: { retType?: string, argTypes?: string[] } = {}
|
|
572
|
+
) {
|
|
573
|
+
const method = function (this: Java.Env, impl: AnyFunction, ...args: any[]): RetType {
|
|
574
|
+
return impl(this.handle, ...args)
|
|
575
|
+
}
|
|
576
|
+
return env.$proxy(method, retType, argTypes, offMethod, constructor)
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function proxyCallNonvirtualMethod<RetType>(
|
|
580
|
+
env: JniEnvBase,
|
|
581
|
+
offMethod: number,
|
|
582
|
+
constructor: { new(obj: any): RetType } | null = null,
|
|
583
|
+
{
|
|
584
|
+
retType = 'pointer',
|
|
585
|
+
argTypes = ['pointer', 'pointer', 'pointer', 'pointer', 'pointer']
|
|
586
|
+
}: { retType?: string, argTypes?: string[] } = {}
|
|
587
|
+
) {
|
|
588
|
+
return proxyCallMethod<RetType>(env, offMethod, constructor, { retType, argTypes })
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
const callMethodVariadicArgTypes = ['pointer', 'pointer', 'pointer', '...', 'pointer']
|
|
592
|
+
const callNonvirtualMethodVariadictArgTypes = ['pointer', 'pointer', 'pointer', 'pointer', '...', 'pointer']
|
|
593
|
+
|
|
594
|
+
abstract class JniEnvBase {
|
|
595
|
+
protected static readonly cacheClass: { [key: string]: jclass } = {}
|
|
596
|
+
private static readonly ptrSize = Process.pointerSize
|
|
597
|
+
static readonly kKindBits = MinimumBitsToStore(IndirectRefKind.kLastKind)
|
|
598
|
+
static readonly kKindMask = (1 << JniEnvBase.kKindBits) - 1
|
|
599
|
+
|
|
600
|
+
private readonly _vm?: Java.VM
|
|
601
|
+
|
|
602
|
+
constructor(vm?: Java.VM) {
|
|
603
|
+
this._vm = vm
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
get $env(): Java.Env {
|
|
607
|
+
return this.$vm.getEnv()
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
get $vm(): Java.VM {
|
|
611
|
+
return this._vm ? this._vm : Java.vm
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// JNIEnvExt::
|
|
615
|
+
// [0] *JNINativeInterface
|
|
616
|
+
// [1] Thread * self_
|
|
617
|
+
get $thread(): NativePointer {
|
|
618
|
+
return this.$env.handle.add(JniEnvBase.ptrSize).readPointer()
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
$proxy<RetType>(
|
|
622
|
+
wrapFunc: (this: Java.Env, impl: AnyFunction, ...args: any[]) => RetType,
|
|
623
|
+
retType: any, argTypes: any[], index: number,
|
|
624
|
+
constructor: { new(obj: any, opt?: {[key: string]: any}): RetType } | null = null,
|
|
625
|
+
optBuilder?: (...args: any[]) => {[key: string]: any},
|
|
626
|
+
): ((...args: any[]) => RetType) & { $handle: NativePointer | undefined } {
|
|
627
|
+
let cache: nativeFunc | null = null
|
|
628
|
+
|
|
629
|
+
const getCache = () => {
|
|
630
|
+
const env = this.$env
|
|
631
|
+
if (cache === null) {
|
|
632
|
+
const p: NativePointer = env.handle.readPointer()
|
|
633
|
+
const handle = p.add(index * JniEnvBase.ptrSize).readPointer()
|
|
634
|
+
const impl = new NativeFunction(
|
|
635
|
+
handle,
|
|
636
|
+
retType, argTypes, nativeFunctionOptions,
|
|
637
|
+
)
|
|
638
|
+
cache = {
|
|
639
|
+
handle: handle,
|
|
640
|
+
impl: impl,
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
return cache
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const func = (...args: any[]): RetType => {
|
|
647
|
+
const env = this.$env
|
|
648
|
+
const cache = getCache()
|
|
649
|
+
const result = wrapFunc.apply(env, [cache.impl, ...args.map(v => v instanceof NativePointerObject ? v.$handle : v)])
|
|
650
|
+
if (constructor === null) {
|
|
651
|
+
return result
|
|
652
|
+
}
|
|
653
|
+
let opt = {}
|
|
654
|
+
if(optBuilder) {
|
|
655
|
+
opt = optBuilder(...args)
|
|
656
|
+
}
|
|
657
|
+
return new constructor(result, opt)
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
Object.defineProperty(func, '$handle', {
|
|
661
|
+
get: function () {
|
|
662
|
+
return getCache()?.handle
|
|
663
|
+
}
|
|
664
|
+
})
|
|
665
|
+
return (func as ((...args: any[]) => RetType) & {
|
|
666
|
+
$handle: NativePointer | undefined
|
|
667
|
+
})
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
$symbol<RetType>(
|
|
671
|
+
wrapFunc: (this: Java.Env, impl: AnyFunction, ...args: any[]) => RetType,
|
|
672
|
+
retType: any, argTypes: any[], symbol: string,
|
|
673
|
+
constructor: { new(obj: any): RetType } | null = null,
|
|
674
|
+
): ((...args: any[]) => RetType) & { $handle: NativePointer | undefined } {
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
let cache: nativeFunc | null = null
|
|
678
|
+
|
|
679
|
+
const getCache = () => {
|
|
680
|
+
if (cache === null) {
|
|
681
|
+
const find = Java.api.find || ((name) => {
|
|
682
|
+
const module = Java.api.module
|
|
683
|
+
let address = module.findExportByName(name)
|
|
684
|
+
if (address === null) {
|
|
685
|
+
address = module.findSymbolByName(name)
|
|
686
|
+
}
|
|
687
|
+
return address
|
|
688
|
+
})
|
|
689
|
+
const handle = find(symbol)
|
|
690
|
+
if (!handle) {
|
|
691
|
+
throw `symbol[${symbol}] 不存在于 art/dalvik so中`
|
|
692
|
+
}
|
|
693
|
+
const impl = new NativeFunction(
|
|
694
|
+
handle,
|
|
695
|
+
retType, argTypes, nativeFunctionOptions,
|
|
696
|
+
)
|
|
697
|
+
cache = {
|
|
698
|
+
handle: handle,
|
|
699
|
+
impl: impl,
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
return cache
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
const func = (...args: any[]): RetType => {
|
|
706
|
+
const env = this.$env
|
|
707
|
+
const cache = getCache()
|
|
708
|
+
const result = wrapFunc.apply(env, [cache.impl, ...args.map(v => v instanceof NativePointerObject ? v.$handle : v)])
|
|
709
|
+
if (constructor === null) {
|
|
710
|
+
return result
|
|
711
|
+
}
|
|
712
|
+
return new constructor(result)
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
Object.defineProperty(func, '$handle', {
|
|
716
|
+
get: function () {
|
|
717
|
+
return getCache()?.handle
|
|
718
|
+
}
|
|
719
|
+
})
|
|
720
|
+
return (func as ((...args: any[]) => RetType) & {
|
|
721
|
+
$handle: NativePointer | undefined
|
|
722
|
+
})
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
abstract class JniEnvCaller extends JniEnvBase {
|
|
729
|
+
constructor(vm?: Java.VM) {
|
|
730
|
+
super(vm)
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// jobject CallObjectMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
734
|
+
readonly CallObjectMethod = proxyCallMethod(this, JNI_VT.CallObjectMethod, jobject, { argTypes: callMethodVariadicArgTypes })
|
|
735
|
+
// jobject CallObjectMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
736
|
+
readonly CallObjectMethodV = proxyCallMethod(this, JNI_VT.CallObjectMethodV, jobject)
|
|
737
|
+
// jobject CallObjectMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
738
|
+
readonly CallObjectMethodA = proxyCallMethod(this, JNI_VT.CallObjectMethodA, jobject)
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
// jboolean CallBooleanMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
742
|
+
readonly CallBooleanMethod = proxyCallMethod(this, JNI_VT.CallBooleanMethod, jboolean, { argTypes: callMethodVariadicArgTypes })
|
|
743
|
+
// jboolean CallBooleanMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
744
|
+
readonly CallBooleanMethodV = proxyCallMethod(this, JNI_VT.CallBooleanMethodV, jboolean)
|
|
745
|
+
// jboolean CallBooleanMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
746
|
+
readonly CallBooleanMethodA = proxyCallMethod(this, JNI_VT.CallBooleanMethodA, jboolean)
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
// jbyte CallByteMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
750
|
+
readonly CallByteMethod = proxyCallMethod(this, JNI_VT.CallBooleanMethod, jbyte, { argTypes: callMethodVariadicArgTypes })
|
|
751
|
+
// jbyte CallByteMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
752
|
+
readonly CallByteMethodV = proxyCallMethod(this, JNI_VT.CallByteMethodV, jbyte)
|
|
753
|
+
// jbyte CallByteMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
754
|
+
readonly CallByteMethodA = proxyCallMethod(this, JNI_VT.CallByteMethodA, jbyte)
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
// jchar CallCharMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
758
|
+
readonly CallCharMethod = proxyCallMethod(this, JNI_VT.CallCharMethod, jchar, { argTypes: callMethodVariadicArgTypes })
|
|
759
|
+
// jchar CallCharMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
760
|
+
readonly CallCharMethodV = proxyCallMethod(this, JNI_VT.CallCharMethodV, jchar)
|
|
761
|
+
// jchar CallCharMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
762
|
+
readonly CallCharMethodA = proxyCallMethod(this, JNI_VT.CallCharMethodA, jchar)
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
// jshort CallShortMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
767
|
+
readonly CallShortMethod = proxyCallMethod(this, JNI_VT.CallShortMethod, jshort, { argTypes: callMethodVariadicArgTypes })
|
|
768
|
+
// jshort CallShortMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
769
|
+
readonly CallShortMethodV = proxyCallMethod(this, JNI_VT.CallShortMethodV, jshort)
|
|
770
|
+
// jshort CallShortMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
771
|
+
readonly CallShortMethodA = proxyCallMethod(this, JNI_VT.CallShortMethodA, jshort)
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
// jint CallIntMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
775
|
+
readonly CallIntMethod = proxyCallMethod(this, JNI_VT.CallIntMethod, jint, { argTypes: callMethodVariadicArgTypes })
|
|
776
|
+
// jint CallIntMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
777
|
+
readonly CallIntMethodV = proxyCallMethod(this, JNI_VT.CallIntMethodV, jint)
|
|
778
|
+
// jint CallIntMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
779
|
+
readonly CallIntMethodA = proxyCallMethod(this, JNI_VT.CallIntMethodA, jint)
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
// jlong CallLongMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
783
|
+
readonly CallLongMethod = proxyCallMethod(this, JNI_VT.CallLongMethod, jint, { argTypes: callMethodVariadicArgTypes })
|
|
784
|
+
// jlong CallLongMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
785
|
+
readonly CallLongMethodV = proxyCallMethod(this, JNI_VT.CallLongMethodV, jint)
|
|
786
|
+
// jlong CallLongMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
787
|
+
readonly CallLongMethodA = proxyCallMethod(this, JNI_VT.CallLongMethodA, jint)
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
// jfloat CallFloatMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
791
|
+
readonly CallFloatMethod = proxyCallMethod(this, JNI_VT.CallFloatMethod, jfloat, { argTypes: callMethodVariadicArgTypes })
|
|
792
|
+
// jfloat CallFloatMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
793
|
+
readonly CallFloatMethodV = proxyCallMethod(this, JNI_VT.CallFloatMethodV, jfloat)
|
|
794
|
+
// jfloat CallFloatMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
795
|
+
readonly CallFloatMethodA = proxyCallMethod(this, JNI_VT.CallFloatMethodA, jfloat)
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
// jdouble CallDoubleMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
799
|
+
readonly CallDoubleMethod = proxyCallMethod(this, JNI_VT.CallDoubleMethod, jdouble, { argTypes: callMethodVariadicArgTypes })
|
|
800
|
+
// jdouble CallDoubleMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
801
|
+
readonly CallDoubleMethodV = proxyCallMethod(this, JNI_VT.CallDoubleMethodV, jdouble)
|
|
802
|
+
// jdouble CallDoubleMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
803
|
+
readonly CallDoubleMethodA = proxyCallMethod(this, JNI_VT.CallDoubleMethodA, jdouble)
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
// void CallVoidMethod(JNIEnv* env, jobject obj, jmethodID mid, ...)
|
|
807
|
+
readonly CallVoidMethod = proxyCallMethod(this, JNI_VT.CallVoidMethod, jvoid, { argTypes: callMethodVariadicArgTypes })
|
|
808
|
+
// void CallVoidMethodV(JNIEnv* env, jobject obj, jmethodID mid, va_list args)
|
|
809
|
+
readonly CallVoidMethodV = proxyCallMethod(this, JNI_VT.CallVoidMethodV, jvoid)
|
|
810
|
+
// void CallVoidMethodA(JNIEnv* env, jobject obj, jmethodID mid, const jvalue* args)
|
|
811
|
+
readonly CallVoidMethodA = proxyCallMethod(this, JNI_VT.CallVoidMethodA, jvoid)
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
// jobject CallNonvirtualObjectMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
815
|
+
readonly CallNonvirtualObjectMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualObjectMethod, jobject, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
816
|
+
// jobject CallNonvirtualObjectMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
817
|
+
readonly CallNonvirtualObjectMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualObjectMethodV, jobject)
|
|
818
|
+
// jobject CallNonvirtualObjectMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
819
|
+
readonly CallNonvirtualObjectMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualObjectMethodA, jobject)
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
// jboolean CallNonvirtualBooleanMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
823
|
+
readonly CallNonvirtualBooleanMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualBooleanMethod, jboolean, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
824
|
+
// jboolean CallNonvirtualBooleanMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
825
|
+
readonly CallNonvirtualBooleanMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualBooleanMethodV, jboolean)
|
|
826
|
+
// jboolean CallNonvirtualBooleanMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
827
|
+
readonly CallNonvirtualBooleanMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualBooleanMethodA, jboolean)
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
// jbyte CallNonvirtualByteMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
831
|
+
readonly CallNonvirtualByteMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualByteMethod, jbyte, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
832
|
+
// jbyte CallNonvirtualByteMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
833
|
+
readonly CallNonvirtualByteMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualByteMethodV, jbyte)
|
|
834
|
+
// jbyte CallNonvirtualByteMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
835
|
+
readonly CallNonvirtualByteMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualByteMethodA, jbyte)
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
// jchar CallNonvirtualCharMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
839
|
+
readonly CallNonvirtualCharMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualCharMethod, jchar, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
840
|
+
// jchar CallNonvirtualCharMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
841
|
+
readonly CallNonvirtualCharMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualCharMethodV, jchar)
|
|
842
|
+
// jchar CallNonvirtualCharMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
843
|
+
readonly CallNonvirtualCharMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualCharMethodA, jchar)
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
// jshort CallNonvirtualShortMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
847
|
+
readonly CallNonvirtualShortMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualShortMethod, jshort, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
848
|
+
// jshort CallNonvirtualShortMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
849
|
+
readonly CallNonvirtualShortMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualShortMethodV, jshort)
|
|
850
|
+
// jshort CallNonvirtualShortMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
851
|
+
readonly CallNonvirtualShortMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualShortMethodA, jshort)
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
// jint CallNonvirtualIntMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
855
|
+
readonly CallNonvirtualIntMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualIntMethod, jint, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
856
|
+
// jint CallNonvirtualIntMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
857
|
+
readonly CallNonvirtualIntMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualIntMethodV, jint)
|
|
858
|
+
// jint CallNonvirtualIntMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
859
|
+
readonly CallNonvirtualIntMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualIntMethodA, jint)
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
// jlong CallNonvirtualLongMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
863
|
+
readonly CallNonvirtualLongMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualLongMethod, jlong, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
864
|
+
// jlong CallNonvirtualLongMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
865
|
+
readonly CallNonvirtualLongMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualLongMethodV, jlong)
|
|
866
|
+
// jlong CallNonvirtualLongMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
867
|
+
readonly CallNonvirtualLongMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualLongMethodA, jlong)
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
// jfloat CallNonvirtualFloatMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
871
|
+
readonly CallNonvirtualFloatMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualFloatMethod, jfloat, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
872
|
+
// jfloat CallNonvirtualFloatMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
873
|
+
readonly CallNonvirtualFloatMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualFloatMethodV, jfloat)
|
|
874
|
+
// jfloat CallNonvirtualFloatMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
875
|
+
readonly CallNonvirtualFloatMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualFloatMethodA, jfloat)
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
// jdouble CallNonvirtualDoubleMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
879
|
+
readonly CallNonvirtualDoubleMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualDoubleMethod, jdouble, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
880
|
+
// jdouble CallNonvirtualDoubleMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
881
|
+
readonly CallNonvirtualDoubleMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualDoubleMethodV, jdouble)
|
|
882
|
+
// jdouble CallNonvirtualDoubleMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
883
|
+
readonly CallNonvirtualDoubleMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualDoubleMethodA, jdouble)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
// jvoid CallNonvirtualVoidMethod(JNIEnv* env, jobject obj, jclass, jmethodID mid, ...)
|
|
887
|
+
readonly CallNonvirtualVoidMethod = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualVoidMethod, jvoid, { argTypes: callNonvirtualMethodVariadictArgTypes })
|
|
888
|
+
// jvoid CallNonvirtualVoidMethodV(JNIEnv* env, jobject obj, jclass, jmethodID mid, va_list args)
|
|
889
|
+
readonly CallNonvirtualVoidMethodV = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualVoidMethodV, jvoid)
|
|
890
|
+
// jvoid CallNonvirtualVoidMethodA(JNIEnv* env, jobject obj, jclass, jmethodID mid, const jvalue* args)
|
|
891
|
+
readonly CallNonvirtualVoidMethodA = proxyCallNonvirtualMethod(this, JNI_VT.CallNonvirtualVoidMethodA, jvoid)
|
|
892
|
+
|
|
893
|
+
|
|
894
|
+
// jobject CallStaticObjectMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
895
|
+
readonly CallStaticObjectMethod = proxyCallMethod(this, JNI_VT.CallStaticObjectMethod, jobject, { argTypes: callMethodVariadicArgTypes })
|
|
896
|
+
// jobject CallStaticObjectMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
897
|
+
readonly CallStaticObjectMethodV = proxyCallMethod(this, JNI_VT.CallStaticObjectMethodV, jobject)
|
|
898
|
+
// jobject CallStaticObjectMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
899
|
+
readonly CallStaticObjectMethodA = proxyCallMethod(this, JNI_VT.CallStaticObjectMethodA, jobject)
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
// jboolean CallStaticBooleanMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
903
|
+
readonly CallStaticBooleanMethod = proxyCallMethod(this, JNI_VT.CallStaticBooleanMethod, jboolean, { argTypes: callMethodVariadicArgTypes })
|
|
904
|
+
// jboolean CallStaticBooleanMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
905
|
+
readonly CallStaticBooleanMethodV = proxyCallMethod(this, JNI_VT.CallStaticBooleanMethodV, jboolean)
|
|
906
|
+
// jboolean CallStaticBooleanMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
907
|
+
readonly CallStaticBooleanMethodA = proxyCallMethod(this, JNI_VT.CallStaticBooleanMethodA, jboolean)
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
// jbyte CallStaticByteMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
911
|
+
readonly CallStaticByteMethod = proxyCallMethod(this, JNI_VT.CallStaticByteMethod, jbyte, { argTypes: callMethodVariadicArgTypes })
|
|
912
|
+
// jbyte CallStaticByteMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
913
|
+
readonly CallStaticByteMethodV = proxyCallMethod(this, JNI_VT.CallStaticByteMethodV, jbyte)
|
|
914
|
+
// jbyte CallStaticByteMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
915
|
+
readonly CallStaticByteMethodA = proxyCallMethod(this, JNI_VT.CallStaticByteMethodA, jbyte)
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
// jchar CallStaticCharMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
919
|
+
readonly CallStaticCharMethod = proxyCallMethod(this, JNI_VT.CallStaticCharMethod, jchar, { argTypes: callMethodVariadicArgTypes })
|
|
920
|
+
// jchar CallStaticCharMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
921
|
+
readonly CallStaticCharMethodV = proxyCallMethod(this, JNI_VT.CallStaticCharMethodV, jchar)
|
|
922
|
+
// jchar CallStaticCharMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
923
|
+
readonly CallStaticCharMethodA = proxyCallMethod(this, JNI_VT.CallStaticCharMethodA, jchar)
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
// jshort CallStaticShortMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
928
|
+
readonly CallStaticShortMethod = proxyCallMethod(this, JNI_VT.CallStaticShortMethod, jshort, { argTypes: callMethodVariadicArgTypes })
|
|
929
|
+
// jshort CallStaticShortMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
930
|
+
readonly CallStaticShortMethodV = proxyCallMethod(this, JNI_VT.CallStaticShortMethodV, jshort)
|
|
931
|
+
// jshort CallStaticShortMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
932
|
+
readonly CallStaticShortMethodA = proxyCallMethod(this, JNI_VT.CallStaticShortMethodA, jshort)
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
// jint CallStaticIntMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
936
|
+
readonly CallStaticIntMethod = proxyCallMethod(this, JNI_VT.CallStaticIntMethod, jint, { argTypes: callMethodVariadicArgTypes })
|
|
937
|
+
// jint CallStaticIntMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
938
|
+
readonly CallStaticIntMethodV = proxyCallMethod(this, JNI_VT.CallStaticIntMethodV, jint)
|
|
939
|
+
// jint CallStaticIntMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
940
|
+
readonly CallStaticIntMethodA = proxyCallMethod(this, JNI_VT.CallStaticIntMethodA, jint)
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
// jlong CallStaticLongMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
944
|
+
readonly CallStaticLongMethod = proxyCallMethod(this, JNI_VT.CallStaticLongMethod, jint, { argTypes: callMethodVariadicArgTypes })
|
|
945
|
+
// jlong CallStaticLongMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
946
|
+
readonly CallStaticLongMethodV = proxyCallMethod(this, JNI_VT.CallStaticLongMethodV, jint)
|
|
947
|
+
// jlong CallStaticLongMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
948
|
+
readonly CallStaticLongMethodA = proxyCallMethod(this, JNI_VT.CallStaticLongMethodA, jint)
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
// jfloat CallStaticFloatMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
952
|
+
readonly CallStaticFloatMethod = proxyCallMethod(this, JNI_VT.CallStaticFloatMethod, jfloat, { argTypes: callMethodVariadicArgTypes })
|
|
953
|
+
// jfloat CallStaticFloatMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
954
|
+
readonly CallStaticFloatMethodV = proxyCallMethod(this, JNI_VT.CallStaticFloatMethodV, jfloat)
|
|
955
|
+
// jfloat CallStaticFloatMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
956
|
+
readonly CallStaticFloatMethodA = proxyCallMethod(this, JNI_VT.CallStaticFloatMethodA, jfloat)
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
// jdouble CallStaticDoubleMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
960
|
+
readonly CallStaticDoubleMethod = proxyCallMethod(this, JNI_VT.CallStaticDoubleMethod, jdouble, { argTypes: callMethodVariadicArgTypes })
|
|
961
|
+
// jdouble CallStaticDoubleMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
962
|
+
readonly CallStaticDoubleMethodV = proxyCallMethod(this, JNI_VT.CallStaticDoubleMethodV, jdouble)
|
|
963
|
+
// jdouble CallStaticDoubleMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
964
|
+
readonly CallStaticDoubleMethodA = proxyCallMethod(this, JNI_VT.CallStaticDoubleMethodA, jdouble)
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
// void CallStaticVoidMethod(JNIEnv* env, jclass, jmethodID mid, ...)
|
|
968
|
+
readonly CallStaticVoidMethod = proxyCallMethod(this, JNI_VT.CallStaticVoidMethod, jvoid, { argTypes: callMethodVariadicArgTypes })
|
|
969
|
+
// void CallStaticVoidMethodV(JNIEnv* env, jclass, jmethodID mid, va_list args)
|
|
970
|
+
readonly CallStaticVoidMethodV = proxyCallMethod(this, JNI_VT.CallStaticVoidMethodV, jvoid)
|
|
971
|
+
// void CallStaticVoidMethodA(JNIEnv* env, jclass, jmethodID mid, const jvalue* args)
|
|
972
|
+
readonly CallStaticVoidMethodA = proxyCallMethod(this, JNI_VT.CallStaticVoidMethodA, jvoid)
|
|
973
|
+
|
|
974
|
+
// jfieldID GetFieldID(JNIEnv* env, jclass java_class, const char* name, const char* sig)
|
|
975
|
+
readonly GetFieldID = this.$proxy(function (impl: AnyFunction, java_class: any, name: string, sig: string): jobject {
|
|
976
|
+
return impl(this.handle, java_class, Memory.allocUtf8String(name), Memory.allocUtf8String(sig))
|
|
977
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'pointer'], JNI_VT.GetFieldID, jobject)
|
|
978
|
+
|
|
979
|
+
// jfieldID GetStaticFieldID(JNIEnv* env, jclass java_class, const char* name, const char* sig)
|
|
980
|
+
readonly GetStaticFieldID = this.$proxy(function (impl: AnyFunction, java_class: any, name: string, sig: string): jobject {
|
|
981
|
+
return impl(this.handle, java_class, Memory.allocUtf8String(name), Memory.allocUtf8String(sig))
|
|
982
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'pointer'], JNI_VT.GetStaticFieldID, jobject)
|
|
983
|
+
|
|
984
|
+
// jobject GetObjectField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
985
|
+
readonly GetObjectField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jobject {
|
|
986
|
+
return impl(this.handle, obj, fid)
|
|
987
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetObjectField, jobject)
|
|
988
|
+
|
|
989
|
+
// jboolean GetBooleanField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
990
|
+
readonly GetBooleanField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jboolean {
|
|
991
|
+
return impl(this.handle, obj, fid)
|
|
992
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetBooleanField, jboolean)
|
|
993
|
+
|
|
994
|
+
// jbyte GetByteField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
995
|
+
readonly GetByteField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jbyte {
|
|
996
|
+
return impl(this.handle, obj, fid)
|
|
997
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetByteField, jbyte)
|
|
998
|
+
|
|
999
|
+
// jchar GetCharField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
1000
|
+
readonly GetCharField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jchar {
|
|
1001
|
+
return impl(this.handle, obj, fid)
|
|
1002
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetCharField, jchar)
|
|
1003
|
+
|
|
1004
|
+
// jshort GetShortField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
1005
|
+
readonly GetShortField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jshort {
|
|
1006
|
+
return impl(this.handle, obj, fid)
|
|
1007
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetShortField, jshort)
|
|
1008
|
+
|
|
1009
|
+
// jint GetIntField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
1010
|
+
readonly GetIntField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jint {
|
|
1011
|
+
return impl(this.handle, obj, fid)
|
|
1012
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetIntField, jint)
|
|
1013
|
+
|
|
1014
|
+
// jlong GetLongField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
1015
|
+
readonly GetLongField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jlong {
|
|
1016
|
+
return impl(this.handle, obj, fid)
|
|
1017
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetLongField, jlong)
|
|
1018
|
+
|
|
1019
|
+
// jfloat GetFloatField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
1020
|
+
readonly GetFloatField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jfloat {
|
|
1021
|
+
return impl(this.handle, obj, fid)
|
|
1022
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetFloatField, jfloat)
|
|
1023
|
+
|
|
1024
|
+
// jdouble GetDoubleField(JNIEnv* env, jobject obj, jfieldID fid)
|
|
1025
|
+
readonly GetDoubleField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jdouble {
|
|
1026
|
+
return impl(this.handle, obj, fid)
|
|
1027
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetDoubleField, jdouble)
|
|
1028
|
+
|
|
1029
|
+
// jobject GetStaticObjectField(JNIEnv* env, jclass, jfieldID fid)
|
|
1030
|
+
readonly GetStaticObjectField = this.$proxy(function (impl: AnyFunction, cls: any, fid: any): jobject {
|
|
1031
|
+
return impl(this.handle, cls, fid)
|
|
1032
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticObjectField, jobject)
|
|
1033
|
+
|
|
1034
|
+
// jboolean GetStaticBooleanField(JNIEnv* env, jclass, jfieldID fid)
|
|
1035
|
+
readonly GetStaticBooleanField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jboolean {
|
|
1036
|
+
return impl(this.handle, obj, fid)
|
|
1037
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticBooleanField, jboolean)
|
|
1038
|
+
|
|
1039
|
+
// jbyte GetStaticByteField(JNIEnv* env, jclass, jfieldID fid)
|
|
1040
|
+
readonly GetStaticByteField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jbyte {
|
|
1041
|
+
return impl(this.handle, obj, fid)
|
|
1042
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticByteField, jbyte)
|
|
1043
|
+
|
|
1044
|
+
// jchar GetStaticCharField(JNIEnv* env, jclass, jfieldID fid)
|
|
1045
|
+
readonly GetStaticCharField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jchar {
|
|
1046
|
+
return impl(this.handle, obj, fid)
|
|
1047
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticCharField, jchar)
|
|
1048
|
+
|
|
1049
|
+
// jshort GetStaticShortField(JNIEnv* env, jclass, jfieldID fid)
|
|
1050
|
+
readonly GetStaticShortField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jshort {
|
|
1051
|
+
return impl(this.handle, obj, fid)
|
|
1052
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticShortField, jshort)
|
|
1053
|
+
|
|
1054
|
+
// jint GetStaticIntField(JNIEnv* env, jclass, jfieldID fid)
|
|
1055
|
+
readonly GetStaticIntField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jint {
|
|
1056
|
+
return impl(this.handle, obj, fid)
|
|
1057
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticIntField, jint)
|
|
1058
|
+
|
|
1059
|
+
// jlong GetStaticLongField(JNIEnv* env, jclass, jfieldID fid)
|
|
1060
|
+
readonly GetStaticLongField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jlong {
|
|
1061
|
+
return impl(this.handle, obj, fid)
|
|
1062
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticLongField, jlong)
|
|
1063
|
+
|
|
1064
|
+
// jfloat GetStaticFloatField(JNIEnv* env, jclass, jfieldID fid)
|
|
1065
|
+
readonly GetStaticFloatField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jfloat {
|
|
1066
|
+
return impl(this.handle, obj, fid)
|
|
1067
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticFloatField, jfloat)
|
|
1068
|
+
|
|
1069
|
+
// jdouble GetStaticDoubleField(JNIEnv* env, jclass, jfieldID fid)
|
|
1070
|
+
readonly GetStaticDoubleField = this.$proxy(function (impl: AnyFunction, obj: any, fid: any): jdouble {
|
|
1071
|
+
return impl(this.handle, obj, fid)
|
|
1072
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStaticDoubleField, jdouble)
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
// static jclass FindClass(JNIEnv* env, const char* name)
|
|
1076
|
+
readonly FindClass = this.$proxy(function (impl: AnyFunction, name: string): jclass {
|
|
1077
|
+
const result = impl(this.handle, Memory.allocUtf8String(name))
|
|
1078
|
+
this.throwIfExceptionPending()
|
|
1079
|
+
return result
|
|
1080
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.FindClass, jclass)
|
|
1081
|
+
|
|
1082
|
+
// jobject ToReflectedMethod(jclass cls, jmethodID methodID, jboolean isStatic)
|
|
1083
|
+
readonly ToReflectedMethod = this.$proxy(function (impl: AnyFunction, klass: any, methodId: any, isStatic: boolean): jobject {
|
|
1084
|
+
return impl(this.handle, klass, methodId, isStatic ? 1 : 0)
|
|
1085
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'uint8'], JNI_VT.ToReflectedMethod, jobject, ($0, $1, isStatic)=>({isStatic}))
|
|
1086
|
+
|
|
1087
|
+
// jclass GetSuperclass(JNIEnv* env, jclass java_class)
|
|
1088
|
+
readonly GetSuperclass = this.$proxy(function (impl: AnyFunction, java_class: any): jclass {
|
|
1089
|
+
return impl(this.handle, java_class)
|
|
1090
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.GetSuperclass, jclass)
|
|
1091
|
+
|
|
1092
|
+
// jobject NewObject(JNIEnv* env, jclass java_class, jmethodID mid, ...)
|
|
1093
|
+
readonly NewObject = this.$proxy(function (impl: AnyFunction, java_class: any, mid: any, ...args: any): jobject {
|
|
1094
|
+
return impl(this.handle, java_class, mid, ...args)
|
|
1095
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', '...', 'pointer'], JNI_VT.NewObject, jobject)
|
|
1096
|
+
|
|
1097
|
+
// jobject NewObjectV(JNIEnv* env, jclass java_class, jmethodID mid, va_list args)
|
|
1098
|
+
readonly NewObjectV = this.$proxy(function (impl: AnyFunction, java_class: any, mid: any, args: any): jobject {
|
|
1099
|
+
return impl(this.handle, java_class, mid, args)
|
|
1100
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'pointer'], JNI_VT.NewObjectV, jobject)
|
|
1101
|
+
|
|
1102
|
+
// jobject NewObjectA(JNIEnv* env, jclass java_class, jmethodID mid, const jvalue* args)
|
|
1103
|
+
readonly NewObjectA = this.$proxy(function (impl: AnyFunction, java_class: any, mid: any, args: any): jobject {
|
|
1104
|
+
return impl(this.handle, java_class, mid, args)
|
|
1105
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'pointer'], JNI_VT.NewObjectA, jobject)
|
|
1106
|
+
|
|
1107
|
+
// jclass GetObjectClass(jobject obj)
|
|
1108
|
+
readonly GetObjectClass = this.$proxy(function (impl: AnyFunction, obj: any): jclass {
|
|
1109
|
+
return impl(this.handle, obj)
|
|
1110
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.GetObjectClass, jclass)
|
|
1111
|
+
|
|
1112
|
+
// jmethodID GetMethodID(jclass clazz, const char *name, const char *sig)
|
|
1113
|
+
readonly GetMethodID = this.$proxy(function (impl: AnyFunction, klass: any, name: string, sig: string): jmethodID {
|
|
1114
|
+
return impl(this.handle, klass, Memory.allocUtf8String(name), Memory.allocUtf8String(sig))
|
|
1115
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'pointer'], JNI_VT.GetMethodID, jmethodID)
|
|
1116
|
+
|
|
1117
|
+
// static jmethodID GetStaticMethodID(JNIEnv* env, jclass java_class, const char* name, const char* sig)
|
|
1118
|
+
readonly GetStaticMethodID = this.$proxy(function (impl: AnyFunction, java_class: any, name: string, sig: string): jmethodID {
|
|
1119
|
+
return impl(this.handle, java_class, Memory.allocUtf8String(name), Memory.allocUtf8String(sig))
|
|
1120
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'pointer'], JNI_VT.GetStaticMethodID, jmethodID)
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
// static const jchar* GetStringChars(JNIEnv* env, jstring java_string, jboolean* is_copy)
|
|
1124
|
+
readonly GetStringChars = this.$proxy(function (impl: AnyFunction, str: any): NativePointer {
|
|
1125
|
+
return impl(this.handle, str, NULL)
|
|
1126
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStringChars, NativePointer)
|
|
1127
|
+
|
|
1128
|
+
// jsize GetStringLength(JNIEnv* env, jstring java_string)
|
|
1129
|
+
readonly GetStringLength = this.$proxy(function (impl: AnyFunction, java_string: any): jint {
|
|
1130
|
+
return impl(this.handle, java_string)
|
|
1131
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.GetStringLength, jint)
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
// void ReleaseStringChars(JNIEnv* env, jstring java_string, const jchar* chars)
|
|
1135
|
+
readonly ReleaseStringChars = this.$proxy(function (impl: AnyFunction, java_string: any, chars: any): void {
|
|
1136
|
+
return impl(this.handle, java_string, chars)
|
|
1137
|
+
}, 'void', ['pointer', 'pointer', 'pointer'], JNI_VT.ReleaseStringChars)
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
// const char* GetStringUTFChars(jstring str, jboolean *isCopy)
|
|
1141
|
+
readonly GetStringUTFChars = this.$proxy(function (impl: AnyFunction, str: any): NativePointer {
|
|
1142
|
+
return impl(this.handle, str, NULL)
|
|
1143
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStringUTFChars, NativePointer)
|
|
1144
|
+
|
|
1145
|
+
// jsize GetStringUTFLength(JNIEnv* env, jstring java_string)
|
|
1146
|
+
readonly GetStringUTFLength = this.$proxy(function (impl: AnyFunction, java_string: any): jint {
|
|
1147
|
+
return impl(this.handle, java_string)
|
|
1148
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.GetStringUTFLength, jint)
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
// void ReleaseStringUTFChars(JNIEnv*, jstring, const char* chars)
|
|
1152
|
+
readonly ReleaseStringUTFChars = this.$proxy(function (impl: AnyFunction, chars: any): void {
|
|
1153
|
+
return impl(this.handle, chars)
|
|
1154
|
+
}, 'void', ['pointer', 'pointer'], JNI_VT.ReleaseStringUTFChars)
|
|
1155
|
+
|
|
1156
|
+
// jsize GetArrayLength(JNIEnv* env, jarray java_array)
|
|
1157
|
+
readonly GetArrayLength = this.$proxy(function (impl: AnyFunction, java_array: any): jint {
|
|
1158
|
+
return impl(this.handle, java_array)
|
|
1159
|
+
}, 'int', ['pointer', 'pointer'], JNI_VT.GetArrayLength, jint)
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
// jobject GetObjectArrayElement(JNIEnv* env, jobjectArray java_array, jsize index)
|
|
1163
|
+
readonly GetObjectArrayElement = this.$proxy(function (impl: AnyFunction, java_array: any, index: number): jobject {
|
|
1164
|
+
return impl(this.handle, java_array, index)
|
|
1165
|
+
}, 'pointer', ['pointer', 'pointer', 'int'], JNI_VT.GetObjectArrayElement, jobject)
|
|
1166
|
+
|
|
1167
|
+
makeObjectArrayElements(java_array: NativePointer): jobjectArray {
|
|
1168
|
+
return new jobjectArray(java_array)
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
// jboolean* GetBooleanArrayElements(JNIEnv* env, jbooleanArray array, jboolean* is_copy)
|
|
1172
|
+
readonly GetBooleanArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jbooleanArray {
|
|
1173
|
+
return impl(this.handle, java_array, NULL)
|
|
1174
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetBooleanArrayElements, jbooleanArray)
|
|
1175
|
+
|
|
1176
|
+
// jbyte* GetByteArrayElements(JNIEnv* env, jbyteArray array, jboolean* is_copy)
|
|
1177
|
+
readonly GetByteArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jbyteArray {
|
|
1178
|
+
return impl(this.handle, java_array, NULL)
|
|
1179
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetByteArrayElements, jbyteArray)
|
|
1180
|
+
|
|
1181
|
+
// jchar* GetCharArrayElements(JNIEnv* env, jcharArray array, jboolean* is_copy)
|
|
1182
|
+
readonly GetCharArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jcharArray {
|
|
1183
|
+
return impl(this.handle, java_array, NULL)
|
|
1184
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetCharArrayElements, jcharArray)
|
|
1185
|
+
|
|
1186
|
+
// jdouble* GetDoubleArrayElements(JNIEnv* env, jdoubleArray array, jboolean* is_copy)
|
|
1187
|
+
readonly GetDoubleArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jdoubleArray {
|
|
1188
|
+
return impl(this.handle, java_array, NULL)
|
|
1189
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetDoubleArrayElements, jdoubleArray)
|
|
1190
|
+
|
|
1191
|
+
// jfloat* GetFloatArrayElements(JNIEnv* env, jfloatArray array, jboolean* is_copy)
|
|
1192
|
+
readonly GetFloatArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jfloatArray {
|
|
1193
|
+
return impl(this.handle, java_array, NULL)
|
|
1194
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetFloatArrayElements, jfloatArray)
|
|
1195
|
+
|
|
1196
|
+
// jint* GetIntArrayElements(JNIEnv* env, jintArray array, jboolean* is_copy)
|
|
1197
|
+
readonly GetIntArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jintArray {
|
|
1198
|
+
return impl(this.handle, java_array, NULL)
|
|
1199
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetIntArrayElements, jintArray)
|
|
1200
|
+
|
|
1201
|
+
// jlong* GetLongArrayElements(JNIEnv* env, jlongArray array, jboolean* is_copy)
|
|
1202
|
+
readonly GetLongArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jlongArray {
|
|
1203
|
+
return impl(this.handle, java_array, NULL)
|
|
1204
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetLongArrayElements, jlongArray)
|
|
1205
|
+
|
|
1206
|
+
// jshort* GetShortArrayElements(JNIEnv* env, jshortArray array, jboolean* is_copy)
|
|
1207
|
+
readonly GetShortArrayElements = this.$proxy(function (impl: AnyFunction, java_array: any): jshortArray {
|
|
1208
|
+
return impl(this.handle, java_array, NULL)
|
|
1209
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetShortArrayElements, jshortArray)
|
|
1210
|
+
|
|
1211
|
+
|
|
1212
|
+
// void ReleaseBooleanArrayElements(JNIEnv* env, jbooleanArray array, jboolean* elements, jint mode)
|
|
1213
|
+
readonly ReleaseBooleanArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1214
|
+
return impl(this.handle, array, elements, mode)
|
|
1215
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseBooleanArrayElements)
|
|
1216
|
+
|
|
1217
|
+
// void ReleaseByteArrayElements(JNIEnv* env, jbyteArray array, jbyte* elements, jint mode)
|
|
1218
|
+
readonly ReleaseByteArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1219
|
+
return impl(this.handle, array, elements, mode)
|
|
1220
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseByteArrayElements)
|
|
1221
|
+
|
|
1222
|
+
// void ReleaseCharArrayElements(JNIEnv* env, jcharArray array, jchar* elements, jint mode)
|
|
1223
|
+
readonly ReleaseCharArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1224
|
+
return impl(this.handle, array, elements, mode)
|
|
1225
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseCharArrayElements)
|
|
1226
|
+
|
|
1227
|
+
// void ReleaseFloatArrayElements(JNIEnv* env, jfloatArray array, jfloat* elements, jint mode)
|
|
1228
|
+
readonly ReleaseFloatArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1229
|
+
return impl(this.handle, array, elements, mode)
|
|
1230
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseFloatArrayElements)
|
|
1231
|
+
|
|
1232
|
+
// void ReleaseDoubleArrayElements(JNIEnv* env, jdoubleArray array, jdouble* elements, jint mode)
|
|
1233
|
+
readonly ReleaseDoubleArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1234
|
+
return impl(this.handle, array, elements, mode)
|
|
1235
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseDoubleArrayElements)
|
|
1236
|
+
|
|
1237
|
+
// void ReleaseIntArrayElements(JNIEnv* env, jintArray array, jint* elements, jint mode)
|
|
1238
|
+
readonly ReleaseIntArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1239
|
+
return impl(this.handle, array, elements, mode)
|
|
1240
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseIntArrayElements)
|
|
1241
|
+
|
|
1242
|
+
// void ReleaseLongArrayElements(JNIEnv* env, jlongArray array, jlong* elements, jint mode)
|
|
1243
|
+
readonly ReleaseLongArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1244
|
+
return impl(this.handle, array, elements, mode)
|
|
1245
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseLongArrayElements)
|
|
1246
|
+
|
|
1247
|
+
// void ReleaseShortArrayElements(JNIEnv* env, jshortArray array, jshort* elements, jint mode)
|
|
1248
|
+
readonly ReleaseShortArrayElements = this.$proxy(function (impl: AnyFunction, array: any, elements: any, mode: number): void {
|
|
1249
|
+
return impl(this.handle, array, elements, mode)
|
|
1250
|
+
}, 'void', ['pointer', 'pointer', 'pointer', 'int'], JNI_VT.ReleaseShortArrayElements)
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
// static const jchar* GetStringCritical(JNIEnv* env, jstring java_string, jboolean* is_copy)
|
|
1255
|
+
readonly GetStringCritical = this.$proxy(function (impl: AnyFunction, str: any): string {
|
|
1256
|
+
return impl(this.handle, str, NULL).readCString()
|
|
1257
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.GetStringCritical)
|
|
1258
|
+
|
|
1259
|
+
// jint Throw(JNIEnv* env, jthrowable java_exception)
|
|
1260
|
+
readonly Throw = this.$proxy(function (impl: AnyFunction, java_exception: any): jint {
|
|
1261
|
+
return impl(this.handle, java_exception)
|
|
1262
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.Throw, jint)
|
|
1263
|
+
|
|
1264
|
+
// jint ThrowNew(JNIEnv* env, jclass c, const char* msg)
|
|
1265
|
+
readonly ThrowNew = this.$proxy(function (impl: AnyFunction, c: any, msg: string): jint {
|
|
1266
|
+
const cMsg = Memory.allocUtf8String(msg)
|
|
1267
|
+
help.$error(`[ThrowNew]c[${c}], msg[${msg}]`)
|
|
1268
|
+
return impl(this.handle, c, cMsg)
|
|
1269
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.ThrowNew, jint)
|
|
1270
|
+
|
|
1271
|
+
// jthrowable ExceptionOccurred(JNIEnv* env)
|
|
1272
|
+
readonly ExceptionOccurred = this.$proxy(function (impl: AnyFunction): jthrowable {
|
|
1273
|
+
return impl(this.handle)
|
|
1274
|
+
}, 'pointer', ['pointer'], JNI_VT.ExceptionOccurred, jthrowable)
|
|
1275
|
+
|
|
1276
|
+
// void ExceptionDescribe(JNIEnv* env)
|
|
1277
|
+
readonly ExceptionDescribe = this.$proxy(function (impl: AnyFunction): void {
|
|
1278
|
+
return impl(this.handle)
|
|
1279
|
+
}, 'void', ['pointer'], JNI_VT.ExceptionDescribe)
|
|
1280
|
+
|
|
1281
|
+
// void ExceptionClear(JNIEnv* env)
|
|
1282
|
+
readonly ExceptionClear = this.$proxy(function (impl: AnyFunction): void {
|
|
1283
|
+
return impl(this.handle)
|
|
1284
|
+
}, 'void', ['pointer'], JNI_VT.ExceptionClear)
|
|
1285
|
+
|
|
1286
|
+
// jboolean ExceptionCheck(JNIEnv* env)
|
|
1287
|
+
readonly ExceptionCheck = this.$proxy(function (impl: AnyFunction): boolean {
|
|
1288
|
+
return impl(this.handle).toUInt32() != 0
|
|
1289
|
+
}, 'pointer', ['pointer'], JNI_VT.ExceptionCheck)
|
|
1290
|
+
|
|
1291
|
+
// void FatalError(JNIEnv*, const char* msg)
|
|
1292
|
+
readonly FatalError = this.$proxy(function (impl: AnyFunction, msg: string): void {
|
|
1293
|
+
return impl(this.handle, Memory.allocUtf8String(msg))
|
|
1294
|
+
}, 'pointer', ['pointer'], JNI_VT.FatalError)
|
|
1295
|
+
|
|
1296
|
+
// jint PushLocalFrame(JNIEnv* env, jint capacity)
|
|
1297
|
+
readonly PushLocalFrame = this.$proxy(function (impl: AnyFunction, capacity: number): jint {
|
|
1298
|
+
return impl(this.handle, capacity)
|
|
1299
|
+
}, 'int', ['pointer', 'int'], JNI_VT.PushLocalFrame, jint)
|
|
1300
|
+
|
|
1301
|
+
// jobject PopLocalFrame(JNIEnv* env, jobject java_survivor)
|
|
1302
|
+
readonly PopLocalFrame = this.$proxy(function (impl: AnyFunction, java_survivor: NativePointer): jobject {
|
|
1303
|
+
return impl(this.handle, java_survivor)
|
|
1304
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.PopLocalFrame, jobject)
|
|
1305
|
+
|
|
1306
|
+
// static jobject NewGlobalRef(JNIEnv* env, jobject obj)
|
|
1307
|
+
readonly NewGlobalRef = this.$proxy(function (impl: AnyFunction, obj: any): jobject {
|
|
1308
|
+
return impl(this.handle, obj)
|
|
1309
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.NewGlobalRef, jobject)
|
|
1310
|
+
|
|
1311
|
+
// static jboolean IsSameObject(JNIEnv* env, jobject obj1, jobject obj2)
|
|
1312
|
+
readonly IsSameObject = this.$proxy(function (impl: AnyFunction, obj1: any, obj2: any): boolean {
|
|
1313
|
+
return impl(this.handle, obj1, obj2) != 0
|
|
1314
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'], JNI_VT.IsSameObject)
|
|
1315
|
+
|
|
1316
|
+
// jobject JNIEnvExt::NewLocalRef(mirror::Object* obj)
|
|
1317
|
+
readonly NewLocalRef = this.$proxy(function (impl: AnyFunction, obj: any): jobject {
|
|
1318
|
+
return impl(this.handle, obj)
|
|
1319
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.NewLocalRef, jobject)
|
|
1320
|
+
|
|
1321
|
+
|
|
1322
|
+
// static void DeleteGlobalRef(JNIEnv* env, jobject obj)
|
|
1323
|
+
readonly DeleteGlobalRef = this.$proxy(function (impl: AnyFunction, obj: any): void {
|
|
1324
|
+
impl(this.handle, obj)
|
|
1325
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.DeleteGlobalRef)
|
|
1326
|
+
|
|
1327
|
+
// void DeleteLocalRef(JNIEnv* env, jobject obj)
|
|
1328
|
+
readonly DeleteLocalRef = this.$proxy(function (impl: AnyFunction, obj: any): void {
|
|
1329
|
+
impl(this.handle, obj)
|
|
1330
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.DeleteLocalRef)
|
|
1331
|
+
|
|
1332
|
+
// static void DeleteWeakGlobalRef(JNIEnv* env, jweak obj)
|
|
1333
|
+
readonly DeleteWeakGlobalRef = this.$proxy(function (impl: AnyFunction, obj: any): void {
|
|
1334
|
+
impl(this.handle, obj)
|
|
1335
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.DeleteWeakGlobalRef)
|
|
1336
|
+
|
|
1337
|
+
// jint RegisterNatives(JNIEnv* env, jclass java_class, const JNINativeMethod* methods, jint method_count)
|
|
1338
|
+
readonly RegisterNatives = this.$proxy(function (impl: AnyFunction, java_class: any, methods: any, method_count: any): jint {
|
|
1339
|
+
return impl(this.handle, java_class, methods, method_count)
|
|
1340
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer', 'pointer'], JNI_VT.RegisterNatives, jint)
|
|
1341
|
+
|
|
1342
|
+
// jint UnregisterNatives(JNIEnv* env, jclass java_class)
|
|
1343
|
+
readonly UnregisterNatives = this.$proxy(function (impl: AnyFunction, java_class: any): jint {
|
|
1344
|
+
return impl(this.handle, java_class)
|
|
1345
|
+
}, 'pointer', ['pointer', 'pointer'], JNI_VT.UnregisterNatives, jint)
|
|
1346
|
+
|
|
1347
|
+
|
|
1348
|
+
// ObjPtr<mirror::Object> JavaVMExt::DecodeGlobal(IndirectRef ref)
|
|
1349
|
+
readonly DecodeGlobal = this.$symbol(function (impl: AnyFunction, obj: any): MirrorObject {
|
|
1350
|
+
return impl(this.vm.handle, obj)
|
|
1351
|
+
}, 'pointer', ['pointer', 'pointer'],
|
|
1352
|
+
'_ZN3art9JavaVMExt12DecodeGlobalEPv', MirrorObject,
|
|
1353
|
+
)
|
|
1354
|
+
|
|
1355
|
+
// ObjPtr<mirror::Object> Thread::DecodeJObject(jobject obj)
|
|
1356
|
+
readonly DecodeJObject = this.$symbol(function (impl: AnyFunction, thread: NativePointer | null = null, obj: any): MirrorObject {
|
|
1357
|
+
const th = thread ? thread : getThreadFromEnv(this)
|
|
1358
|
+
return impl(th, obj)
|
|
1359
|
+
}, 'pointer', ['pointer', 'pointer'],
|
|
1360
|
+
'_ZNK3art6Thread13DecodeJObjectEP8_jobject', MirrorObject,
|
|
1361
|
+
)
|
|
1362
|
+
|
|
1363
|
+
// jobject JavaVMExt::AddGlobalRef(Thread* self, ObjPtr<mirror::Object> obj)
|
|
1364
|
+
readonly AddGlobalRef = this.$symbol(function (impl: AnyFunction, thread: NativePointer | null = null, obj: any): jobject {
|
|
1365
|
+
const th = thread ? thread : getThreadFromEnv(this)
|
|
1366
|
+
return impl(this.vm.handle, th, obj)
|
|
1367
|
+
}, 'pointer', ['pointer', 'pointer', 'pointer'],
|
|
1368
|
+
'_ZN3art9JavaVMExt12AddGlobalRefEPNS_6ThreadENS_6ObjPtrINS_6mirror6ObjectEEE', jobject,
|
|
1369
|
+
)
|
|
1370
|
+
|
|
1371
|
+
// IndirectReferenceTable::IndirectReferenceTable(size_t max_count, IndirectRefKind desired_kind, ResizableCapacity resizable, std::string * error_msg)
|
|
1372
|
+
readonly IndirectReferenceTable_$new = this.$symbol(function (impl: AnyFunction, self: any, max_count: any, desired_kind: any, resizable: any, error_msg: any): NativePointer {
|
|
1373
|
+
return impl(self, max_count, desired_kind, resizable, error_msg)
|
|
1374
|
+
}, 'pointer', ['pointer', 'size_t', 'pointer', 'pointer', 'pointer'],
|
|
1375
|
+
'_ZN3art22IndirectReferenceTableC2EmNS_15IndirectRefKindENS0_17ResizableCapacityEPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE', NativePointer,
|
|
1376
|
+
)
|
|
1377
|
+
|
|
1378
|
+
// IndirectReferenceTable::~IndirectReferenceTable
|
|
1379
|
+
readonly IndirectReferenceTable_$del = this.$symbol(function (impl: AnyFunction, self: any): void {
|
|
1380
|
+
return impl(self)
|
|
1381
|
+
}, 'void', ['pointer'],
|
|
1382
|
+
'_ZN3art22IndirectReferenceTableD2Ev',
|
|
1383
|
+
)
|
|
1384
|
+
|
|
1385
|
+
// bool IndirectReferenceTable::Resize(size_t new_size, std::string* error_msg)
|
|
1386
|
+
readonly IndirectReferenceTable_Resize = this.$symbol(function (impl: AnyFunction, new_size: any, error_msg: any): boolean {
|
|
1387
|
+
return impl(new_size, error_msg)
|
|
1388
|
+
}, 'bool', ['size_t', 'pointer'],
|
|
1389
|
+
'_ZN3art22IndirectReferenceTable6ResizeEmPNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE',
|
|
1390
|
+
)
|
|
1391
|
+
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
|
|
1395
|
+
class JniEnv extends JniEnvCaller {
|
|
1396
|
+
private static _javaLangReflectMethod: javaLangReflectMethod
|
|
1397
|
+
|
|
1398
|
+
constructor(vm ?: Java.VM) {
|
|
1399
|
+
super(vm)
|
|
1400
|
+
const that = this
|
|
1401
|
+
return new Proxy(this, {
|
|
1402
|
+
get(target: any, prop: string) {
|
|
1403
|
+
if (prop in target) {
|
|
1404
|
+
return target[prop as keyof JniEnv]
|
|
1405
|
+
}
|
|
1406
|
+
const env = that.$vm.getEnv()
|
|
1407
|
+
return env[prop as keyof Java.Env]
|
|
1408
|
+
}
|
|
1409
|
+
})
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
$clone(): JniEnv {
|
|
1413
|
+
return new JniEnv(this.$vm)
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
javaLangReflectMethod(): javaLangReflectMethod {
|
|
1417
|
+
if (!JniEnv._javaLangReflectMethod) {
|
|
1418
|
+
const cache = this.$env.javaLangReflectMethod()
|
|
1419
|
+
// patch
|
|
1420
|
+
const jcls = this.FindClass('java/lang/reflect/Method')
|
|
1421
|
+
const methodID = this.GetMethodID(jcls, 'getReturnType', '()Ljava/lang/Class;')
|
|
1422
|
+
cache.getReturnType = methodID
|
|
1423
|
+
JniEnv._javaLangReflectMethod = cache
|
|
1424
|
+
jcls.$unref()
|
|
1425
|
+
}
|
|
1426
|
+
return JniEnv._javaLangReflectMethod
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
export const JNIEnv = new JniEnv()
|
|
1432
|
+
|
|
1433
|
+
|
|
1434
|
+
setGlobalProperties({
|
|
1435
|
+
'JNIEnv': JNIEnv,
|
|
1436
|
+
|
|
1437
|
+
'jobject': jobject,
|
|
1438
|
+
'jclass': jclass,
|
|
1439
|
+
})
|