mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Add type definitions for frida-gum (#35911)
* Add type definitions for frida-gum
Consumed through frida-compile, e.g. like this:
https://github.com/oleavr/frida-agent-example
* Delete redundant declare keywords
This commit is contained in:
committed by
Andrew Casey
parent
d689e2b616
commit
fc5a3acff8
54
types/frida-gum/frida-gum-tests.ts
Normal file
54
types/frida-gum/frida-gum-tests.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
Frida.version; // $ExpectType string
|
||||
|
||||
const otherPuts = new NativeCallback(() => {
|
||||
return 0;
|
||||
}, "int", ["pointer"]);
|
||||
|
||||
const puts = new NativeFunction(Module.getExportByName(null, "puts"), "int", ["pointer"]);
|
||||
|
||||
// $ExpectType NativeFunction
|
||||
puts;
|
||||
|
||||
const message = Memory.allocUtf8String("Hello!");
|
||||
|
||||
// $ExpectType NativePointer
|
||||
message;
|
||||
|
||||
// $ExpectType NativeReturnValue
|
||||
puts.call(otherPuts, message);
|
||||
|
||||
// $ExpectType NativeReturnValue
|
||||
puts.apply(otherPuts, [message]);
|
||||
|
||||
// $ExpectType NativeReturnValue
|
||||
puts(message);
|
||||
|
||||
const open = new SystemFunction(Module.getExportByName(null, "open"), "int", ["pointer", "int"]);
|
||||
|
||||
// $ExpectType SystemFunction
|
||||
open;
|
||||
|
||||
const path = Memory.allocUtf8String("/etc/hosts");
|
||||
const result = open(path, 0) as UnixSystemFunctionResult;
|
||||
|
||||
// $ExpectType NativeReturnValue
|
||||
result.value;
|
||||
|
||||
// $ExpectType number
|
||||
result.errno;
|
||||
|
||||
Interceptor.attach(puts, {
|
||||
onEnter(args) {
|
||||
// $ExpectType NativePointer[]
|
||||
args;
|
||||
},
|
||||
onLeave(retval) {
|
||||
// $ExpectType InvocationReturnValue
|
||||
retval;
|
||||
}
|
||||
});
|
||||
|
||||
const obj = new ObjC.Object(ptr("0x42"));
|
||||
|
||||
// $ExpectType Object
|
||||
obj;
|
||||
6673
types/frida-gum/index.d.ts
vendored
Normal file
6673
types/frida-gum/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
23
types/frida-gum/tsconfig.json
Normal file
23
types/frida-gum/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"frida-gum-tests.ts"
|
||||
]
|
||||
}
|
||||
6
types/frida-gum/tslint.json
Normal file
6
types/frida-gum/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-const-enum": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user