Skip to content

Commit a5061ff

Browse files
authored
🤖 Merge PR DefinitelyTyped#72819 Sync frida-gum typings with Frida 17 by @oleavr
1 parent c5a870a commit a5061ff

File tree

3 files changed

+29
-1516
lines changed

3 files changed

+29
-1516
lines changed

types/frida-gum/frida-gum-tests.ts

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const nf2 = new NativeFunction(NULL, "void", ["long", "...", "pointer"]);
135135
nf2(34, NULL, nf2, { handle: ptr(0xbeef) });
136136

137137
// $ExpectType NativeFunction<number, [NativePointerValue]>
138-
const puts = new NativeFunction(Module.getExportByName(null, "puts"), "int", ["pointer"]);
138+
const puts = new NativeFunction(Module.getGlobalExportByName("puts"), "int", ["pointer"]);
139139

140140
// $ExpectType NativePointer
141141
const message = Memory.allocUtf8String("Hello!");
@@ -150,7 +150,7 @@ puts.apply(otherPuts, [message]);
150150
puts(message);
151151

152152
// $ExpectType SystemFunction<number, [NativePointerValue, number]>
153-
const open = new SystemFunction(Module.getExportByName(null, "open"), "int", ["pointer", "int"]);
153+
const open = new SystemFunction(Module.getGlobalExportByName("open"), "int", ["pointer", "int"]);
154154

155155
const path = Memory.allocUtf8String("/etc/hosts");
156156

@@ -338,77 +338,6 @@ Stalker.invalidate(Process.getCurrentThreadId(), basicBlockStartAddress);
338338
// $ExpectType boolean
339339
Cloak.hasCurrentThread();
340340

341-
const obj = new ObjC.Object(ptr("0x42"));
342-
343-
// $ExpectType Object
344-
obj;
345-
346-
const b = new ObjC.Block(ptr(0x1234));
347-
b.declare({ retType: "void", argTypes: ["int"] });
348-
b.declare({ types: "v12@?0i8" });
349-
350-
Java.enumerateClassLoadersSync()
351-
.forEach(classLoader => {
352-
// $ExpectType ClassFactory
353-
const factory = Java.ClassFactory.get(classLoader);
354-
interface Props {
355-
myMethod: Java.MethodDispatcher;
356-
myField: Java.Field<number>;
357-
}
358-
// $ExpectType Wrapper<Props>
359-
const MyJavaClass = factory.use<Props>("my.java.class");
360-
// @ts-expect-error
361-
factory.use<{ illegal: string }>("");
362-
// $ExpectType string
363-
MyJavaClass.$className;
364-
// $ExpectType MethodDispatcher<Props>
365-
MyJavaClass.myMethod;
366-
// $ExpectType Wrapper<Props>
367-
MyJavaClass.myMethod.holder;
368-
// $ExpectType Wrapper<Props>
369-
MyJavaClass.myMethod.holder.myField.holder.myMethod.holder;
370-
MyJavaClass.myMethod.implementation = function(...args) {
371-
// $ExpectType MethodDispatcher<Props>
372-
this.myMethod;
373-
// $ExpectType Field<number, Props>
374-
this.myField;
375-
// $ExpectType number
376-
this.myField.value;
377-
};
378-
// $ExpectType Wrapper<Props>
379-
Java.retain(MyJavaClass);
380-
interface AnotherProps {
381-
anotherMethod: Java.MethodDispatcher;
382-
anotherField: Java.Field<string>;
383-
}
384-
const MyAnotherJavaClass = factory.use<AnotherProps>("my.another.java.class");
385-
// $ExpectType Wrapper<AnotherProps>
386-
Java.cast(MyJavaClass, MyAnotherJavaClass);
387-
});
388-
389-
Java.perform(() => {
390-
// $ExpectType void
391-
Java.deoptimizeBootImage();
392-
393-
Java.enumerateMethods("*!*game*/i").forEach(group => {
394-
const factory = Java.ClassFactory.get(group.loader);
395-
group.classes.forEach(klass => {
396-
const C = factory.use(klass.name);
397-
klass.methods.forEach(methodName => {
398-
const method: Java.MethodDispatcher = C[methodName];
399-
method.implementation = function(...args) {
400-
return method.apply(this, args);
401-
};
402-
});
403-
});
404-
});
405-
406-
// $ExpectType Backtrace
407-
Java.backtrace();
408-
// $ExpectType Backtrace
409-
Java.backtrace({ limit: 42 });
410-
});
411-
412341
Process.enumerateThreads().forEach(t => {
413342
t.setHardwareBreakpoint(0, puts);
414343
});

0 commit comments

Comments
 (0)