mitm/cfg: pass around override status for decision-making
This commit is contained in:
@@ -107,21 +107,16 @@ Result smAtmosphereMitmDeclareFuture(SmServiceName name) {
|
||||
return _smAtmosphereCmdInServiceNameNoOut(name, smGetServiceSession(), 65006);
|
||||
}
|
||||
|
||||
Result smAtmosphereMitmAcknowledgeSession(Service *srv_out, u64 *pid_out, u64 *tid_out, SmServiceName name) {
|
||||
Result smAtmosphereMitmAcknowledgeSession(Service *srv_out, void *_out, SmServiceName name) {
|
||||
struct {
|
||||
u64 pid;
|
||||
u64 tid;
|
||||
} out;
|
||||
u64 process_id;
|
||||
u64 program_id;
|
||||
u64 keys_held;
|
||||
u64 flags;
|
||||
} *out = _out;
|
||||
|
||||
Result rc = serviceDispatchInOut(&g_smAtmosphereMitmSrv, 65003, name, out,
|
||||
return serviceDispatchInOut(&g_smAtmosphereMitmSrv, 65003, name, *out,
|
||||
.out_num_objects = 1,
|
||||
.out_objects = srv_out,
|
||||
);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (pid_out) *pid_out = out.pid;
|
||||
if (tid_out) *tid_out = out.tid;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ void smAtmosphereCloseSession(Service *srv);
|
||||
Result smAtmosphereMitmInstall(Service *fwd_srv, Handle *handle_out, Handle *query_out, SmServiceName name);
|
||||
Result smAtmosphereMitmUninstall(SmServiceName name);
|
||||
Result smAtmosphereMitmDeclareFuture(SmServiceName name);
|
||||
Result smAtmosphereMitmAcknowledgeSession(Service *srv_out, u64 *pid_out, u64 *tid_out, SmServiceName name);
|
||||
Result smAtmosphereMitmAcknowledgeSession(Service *srv_out, void *info_out, SmServiceName name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
namespace ams::sm::manager {
|
||||
|
||||
/* Manager API. */
|
||||
Result RegisterProcess(os::ProcessId process_id, ncm::ProgramId program_id, const void *acid, size_t acid_size, const void *aci, size_t aci_size) {
|
||||
return smManagerAtmosphereRegisterProcess(static_cast<u64>(process_id), static_cast<u64>(program_id), acid, acid_size, aci, aci_size);
|
||||
Result RegisterProcess(os::ProcessId process_id, ncm::ProgramId program_id, cfg::OverrideStatus status, const void *acid, size_t acid_size, const void *aci, size_t aci_size) {
|
||||
static_assert(sizeof(status) == sizeof(CfgOverrideStatus), "CfgOverrideStatus definition");
|
||||
return smManagerAtmosphereRegisterProcess(static_cast<u64>(process_id), static_cast<u64>(program_id), reinterpret_cast<const CfgOverrideStatus *>(&status), acid, acid_size, aci, aci_size);
|
||||
}
|
||||
|
||||
Result UnregisterProcess(os::ProcessId process_id) {
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace ams::sm::mitm {
|
||||
});
|
||||
}
|
||||
|
||||
Result AcknowledgeSession(Service *out_service, os::ProcessId *out_process_id, ncm::ProgramId *out_program_id, ServiceName name) {
|
||||
Result AcknowledgeSession(Service *out_service, MitmProcessInfo *out_info, ServiceName name) {
|
||||
return impl::DoWithMitmAcknowledgementSession([&]() {
|
||||
return smAtmosphereMitmAcknowledgeSession(out_service, &out_process_id->value, &out_program_id->value, impl::ConvertName(name));
|
||||
return smAtmosphereMitmAcknowledgeSession(out_service, reinterpret_cast<void *>(out_info), impl::ConvertName(name));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,12 @@ Result smManagerAtmosphereEndInitialDefers(void) {
|
||||
return serviceDispatch(smManagerGetServiceSession(), 65000);
|
||||
}
|
||||
|
||||
Result smManagerAtmosphereRegisterProcess(u64 pid, u64 tid, const void *acid_sac, size_t acid_sac_size, const void *aci_sac, size_t aci_sac_size) {
|
||||
Result smManagerAtmosphereRegisterProcess(u64 pid, u64 tid, const CfgOverrideStatus *status, const void *acid_sac, size_t acid_sac_size, const void *aci_sac, size_t aci_sac_size) {
|
||||
const struct {
|
||||
u64 pid;
|
||||
u64 tid;
|
||||
} in = { pid, tid };
|
||||
CfgOverrideStatus status;
|
||||
} in = { pid, tid, *status };
|
||||
return serviceDispatchIn(smManagerGetServiceSession(), 65002, in,
|
||||
.buffer_attrs = {
|
||||
SfBufferAttr_In | SfBufferAttr_HipcMapAlias,
|
||||
|
||||
@@ -11,8 +11,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
u64 keys_held;
|
||||
u64 flags;
|
||||
} CfgOverrideStatus;
|
||||
|
||||
Result smManagerAtmosphereEndInitialDefers(void);
|
||||
Result smManagerAtmosphereRegisterProcess(u64 pid, u64 tid, const void *acid_sac, size_t acid_sac_size, const void *aci_sac, size_t aci_sac_size);
|
||||
Result smManagerAtmosphereRegisterProcess(u64 pid, u64 tid, const CfgOverrideStatus *status, const void *acid_sac, size_t acid_sac_size, const void *aci_sac, size_t aci_sac_size);
|
||||
Result smManagerAtmosphereHasMitm(bool *out, SmServiceName name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user