From 9b1add926c8e7468abcc0cd13d30738cad440de3 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 24 Jun 2018 19:53:20 -0600 Subject: [PATCH] Use custom error codes for Domain Message parse failures --- nx/include/switch/kernel/ipc.h | 4 ++-- nx/include/switch/result.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nx/include/switch/kernel/ipc.h b/nx/include/switch/kernel/ipc.h index bbe195c9..49d28f35 100644 --- a/nx/include/switch/kernel/ipc.h +++ b/nx/include/switch/kernel/ipc.h @@ -636,12 +636,12 @@ static inline Result ipcParseForDomain(IpcParsedCommand* r) { case DomainMessageType_Close: break; default: - return 0x1A60A; + return MAKERESULT(Module_Libnx, LibnxError_DomainMessageUnknownType); } r->ThisObjectId = hdr->ThisObjectId; r->NumObjectIds = hdr->NumObjectIds > 8 ? 8 : hdr->NumObjectIds; if ((uintptr_t)object_ids + sizeof(u32) * r->NumObjectIds - (uintptr_t)armGetTls() >= 0x100) { - return 0x1D60A; + return MAKERESULT(Module_Libnx, LibnxError_DomainMessageTooManyObjectIds); } for(size_t i = 0; i < r->NumObjectIds; i++) r->ObjectIds[i] = object_ids[i]; diff --git a/nx/include/switch/result.h b/nx/include/switch/result.h index 1f8f43fd..a48711bc 100644 --- a/nx/include/switch/result.h +++ b/nx/include/switch/result.h @@ -72,6 +72,8 @@ enum { LibnxError_IncompatSysVer, LibnxError_InitFail_Time, LibnxError_TooManyDevOpTabs, + LibnxError_DomainMessageUnknownType, + LibnxError_DomainMessageTooManyObjectIds, }; /// libnx nvidia error codes