Fixed broken object sending in ipcPrepareHeaderForDomain(), and added serviceSendObject().

This commit is contained in:
yellows8 2018-12-16 18:10:37 -05:00
parent f61e9237e6
commit 3dce07d78c
2 changed files with 12 additions and 1 deletions

View File

@ -652,7 +652,7 @@ static inline void ipcSendObjectId(IpcCommand* cmd, u32 object_id) {
* @return Pointer to the raw embedded data structure in the request, ready to be filled out. * @return Pointer to the raw embedded data structure in the request, ready to be filled out.
*/ */
static inline void* ipcPrepareHeaderForDomain(IpcCommand* cmd, size_t sizeof_raw, u32 object_id) { static inline void* ipcPrepareHeaderForDomain(IpcCommand* cmd, size_t sizeof_raw, u32 object_id) {
void* raw = ipcPrepareHeader(cmd, sizeof_raw + sizeof(DomainMessageHeader)); void* raw = ipcPrepareHeader(cmd, sizeof_raw + sizeof(DomainMessageHeader) + cmd->NumObjectIds*sizeof(u32));
DomainMessageHeader* hdr = (DomainMessageHeader*) raw; DomainMessageHeader* hdr = (DomainMessageHeader*) raw;
u32 *object_ids = (u32*)(((uintptr_t) raw) + sizeof(DomainMessageHeader) + sizeof_raw); u32 *object_ids = (u32*)(((uintptr_t) raw) + sizeof(DomainMessageHeader) + sizeof_raw);

View File

@ -128,6 +128,17 @@ static inline void serviceCreateSubservice(Service* s, Service* parent, IpcParse
} }
} }
/**
* @brief Sends a service object with the specified cmd. This only supports domains.
* @param[in] s Service object to send.
* @param[in] cmd IPC command structure.
*/
static inline void serviceSendObject(Service* s, IpcCommand* cmd) {
if (serviceIsDomain(s) || serviceIsDomainSubservice(s)) {
ipcSendObjectId(cmd, s->object_id);
}
}
/** /**
* @brief Converts a regular service to a domain. * @brief Converts a regular service to a domain.
* @param[in] s Service object. * @param[in] s Service object.