mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-21 11:02:45 +02:00
fs.mitm: Add domain support (closes #202)
This commit is contained in:
parent
c66fc1ab8a
commit
b8ac9a8fcf
@ -459,7 +459,9 @@ struct Encoder<std::tuple<Args...>> {
|
|||||||
raw = (decltype(raw))ipcPrepareHeader(&out_command, sizeof(*raw) + size_in_raw_data_for_arguments<Args... >::value - sizeof(Result));
|
raw = (decltype(raw))ipcPrepareHeader(&out_command, sizeof(*raw) + size_in_raw_data_for_arguments<Args... >::value - sizeof(Result));
|
||||||
} else {
|
} else {
|
||||||
raw = (decltype(raw))ipcPrepareHeaderForDomain(&out_command, sizeof(*raw) + size_in_raw_data_for_arguments<Args... >::value + (num_out_sessions_in_arguments<Args... >::value * sizeof(u32)) - sizeof(Result), 0);
|
raw = (decltype(raw))ipcPrepareHeaderForDomain(&out_command, sizeof(*raw) + size_in_raw_data_for_arguments<Args... >::value + (num_out_sessions_in_arguments<Args... >::value * sizeof(u32)) - sizeof(Result), 0);
|
||||||
*((DomainMessageHeader *)((uintptr_t)raw - sizeof(DomainMessageHeader))) = {0};
|
auto resp_header = (DomainResponseHeader *)((uintptr_t)raw - sizeof(DomainResponseHeader));
|
||||||
|
*resp_header = {0};
|
||||||
|
resp_header->NumObjectIds = num_out_sessions_in_arguments<Args... >::value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -474,7 +476,13 @@ struct Encoder<std::tuple<Args...>> {
|
|||||||
if (R_FAILED(rc)) {
|
if (R_FAILED(rc)) {
|
||||||
std::fill(tls, tls + 0x100, 0x00);
|
std::fill(tls, tls + 0x100, 0x00);
|
||||||
ipcInitialize(&out_command);
|
ipcInitialize(&out_command);
|
||||||
raw = (decltype(raw))ipcPrepareHeader(&out_command, sizeof(raw));
|
if (domain_owner != NULL) {
|
||||||
|
raw = (decltype(raw))ipcPrepareHeaderForDomain(&out_command, sizeof(raw), 0);
|
||||||
|
auto resp_header = (DomainResponseHeader *)((uintptr_t)raw - sizeof(DomainResponseHeader));
|
||||||
|
*resp_header = {0};
|
||||||
|
} else {
|
||||||
|
raw = (decltype(raw))ipcPrepareHeader(&out_command, sizeof(raw));
|
||||||
|
}
|
||||||
raw->magic = SFCO_MAGIC;
|
raw->magic = SFCO_MAGIC;
|
||||||
raw->result = rc;
|
raw->result = rc;
|
||||||
}
|
}
|
||||||
@ -526,7 +534,7 @@ Result WrapIpcCommandImpl(Class *this_ptr, IpcParsedCommand& r, IpcCommand &out_
|
|||||||
auto args = Decoder<OutArgs, InArgsWithoutThis>::Decode(r, out_command, pointer_buffer);
|
auto args = Decoder<OutArgs, InArgsWithoutThis>::Decode(r, out_command, pointer_buffer);
|
||||||
auto result = std::apply( [=](auto&&... args) { return (this_ptr->*IpcCommandImpl)(args...); }, args);
|
auto result = std::apply( [=](auto&&... args) { return (this_ptr->*IpcCommandImpl)(args...); }, args);
|
||||||
DomainOwner *down = NULL;
|
DomainOwner *down = NULL;
|
||||||
if (r.IsDomainMessage) {
|
if (r.IsDomainRequest) {
|
||||||
down = this_ptr->get_owner();
|
down = this_ptr->get_owner();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,12 +118,12 @@ class ISession : public IWaitable {
|
|||||||
IpcCommand c;
|
IpcCommand c;
|
||||||
ipcInitialize(&c);
|
ipcInitialize(&c);
|
||||||
|
|
||||||
if (r.IsDomainMessage && this->active_object == NULL) {
|
if (r.IsDomainRequest && this->active_object == NULL) {
|
||||||
return 0xF601;
|
return 0xF601;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (r.IsDomainMessage && r.MessageType == DomainMessageType_Close) {
|
if (r.IsDomainRequest && r.InMessageType == DomainMessageType_Close) {
|
||||||
this->domain->delete_object(this->active_object);
|
this->domain->delete_object(this->active_object);
|
||||||
this->active_object = NULL;
|
this->active_object = NULL;
|
||||||
struct {
|
struct {
|
||||||
@ -198,11 +198,11 @@ class ISession : public IWaitable {
|
|||||||
Result retval = ipcParse(&r);
|
Result retval = ipcParse(&r);
|
||||||
if (R_SUCCEEDED(retval)) {
|
if (R_SUCCEEDED(retval)) {
|
||||||
if (this->is_domain && (r.CommandType == IpcCommandType_Request || r.CommandType == IpcCommandType_RequestWithContext)) {
|
if (this->is_domain && (r.CommandType == IpcCommandType_Request || r.CommandType == IpcCommandType_RequestWithContext)) {
|
||||||
retval = ipcParseForDomain(&r);
|
retval = ipcParseDomainRequest(&r);
|
||||||
if (!r.IsDomainMessage || r.ThisObjectId >= DOMAIN_ID_MAX) {
|
if (!r.IsDomainRequest || r.InThisObjectId >= DOMAIN_ID_MAX) {
|
||||||
retval = 0xF601;
|
retval = 0xF601;
|
||||||
} else {
|
} else {
|
||||||
this->active_object = this->domain->get_domain_object(r.ThisObjectId);
|
this->active_object = this->domain->get_domain_object(r.InThisObjectId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this->active_object = this->service_object;
|
this->active_object = this->service_object;
|
||||||
|
Loading…
Reference in New Issue
Block a user