(s)
| 116 | // --- resolve a target string to an absolute address ------------------------- |
| 117 | // "mod+0xoff" | "0xoff@mod" | "0xabs" | "symbolName" |
| 118 | function resolveTarget(s) { |
| 119 | s = String(s).trim(); |
| 120 | try { |
| 121 | if (s.includes("@")) { |
| 122 | const [off, mod] = s.split("@"); |
| 123 | const m = Process.findModuleByName(mod.trim()); |
| 124 | return m ? m.base.add(parseInt(off, 16)) : null; |
| 125 | } |
| 126 | if (s.includes("+")) { |
| 127 | const [mod, off] = s.split("+"); |
| 128 | const m = Process.findModuleByName(mod.trim()); |
| 129 | return m ? m.base.add(parseInt(off, 16)) : null; |
| 130 | } |
| 131 | if (/^0x[0-9a-f]+$/i.test(s)) return ptr(s); |
| 132 | return Module.findGlobalExportByName(s); // symbol name |
| 133 | } catch (e) { return null; } |
| 134 | } |
| 135 | |
| 136 | // module name of a target string, for the exclude step |
| 137 | function targetModuleName(s) { |
no test coverage detected