Skip to content

Commit 17bc1b5

Browse files
committed
fix #141
new XPC schema from iOS 15
1 parent 807445b commit 17bc1b5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

agent/SpringBoard.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const xpc_dictionary_get_int64 = new NativeFunction(libxpc.findExportByName('xpc
1313

1414
const xpc_array_create_empty = new NativeFunction(libxpc.findExportByName('xpc_array_create_empty'), 'pointer', []);
1515
const xpc_array_append_value = new NativeFunction(libxpc.findExportByName('xpc_array_append_value'), 'void', ['pointer', 'pointer']);
16+
const xpc_array_get_int64 = new NativeFunction(libxpc.findExportByName('xpc_array_get_int64'), 'int64', ['pointer', 'size_t']);
1617

1718
const xpc_string_create = new NativeFunction(libxpc.findExportByName('xpc_string_create'), 'pointer', ['pointer']);
1819
const xpc_uuid_create = new NativeFunction(libxpc.findExportByName('xpc_uuid_create'), 'pointer', ['pointer']);
@@ -112,11 +113,14 @@ rpc.exports.run = function (pluginIdentifier) {
112113
return reject(new Error(`unexpected error returned from pkd ${xpcDescription(reply)}`));
113114

114115
const pids = xpc_dictionary_get_value(reply, Memory.allocUtf8String('pids'));
115-
if (pids.isNull())
116-
return reject(new Error('pids is null'));
117-
118-
const pid = xpc_dictionary_get_int64(pids, Memory.allocUtf8String(pluginUUIDString));
119-
resolve(pid.toNumber());
116+
if (!pids.isNull())
117+
return resolve(xpc_dictionary_get_int64(pids, Memory.allocUtf8String(pluginUUIDString)).toNumber());
118+
119+
const pidarray = xpc_dictionary_get_value(reply, Memory.allocUtf8String('pidarray'));
120+
if (!pidarray.isNull())
121+
return resolve(xpc_array_get_int64(pidarray, 0).toNumber());
122+
123+
reject(new Error(`unknown schema for XPC reply: ${xpcDescription(reply)}`));
120124
}
121125
}));
122126
});

0 commit comments

Comments
 (0)