/* * Copyright (c) 2018-2019 Atmosphère-NX * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include #include enum DmntCmd { DebugMonitor_Cmd_BreakDebugProcess = 0, DebugMonitor_Cmd_TerminateDebugProcess = 1, DebugMonitor_Cmd_CloseHandle = 2, DebugMonitor_Cmd_LoadImage = 3, DebugMonitor_Cmd_GetProcessId = 4, DebugMonitor_Cmd_GetProcessHandle = 5, DebugMonitor_Cmd_WaitSynchronization = 6, DebugMonitor_Cmd_GetDebugEvent = 7, DebugMonitor_Cmd_GetProcessModuleInfo = 8, DebugMonitor_Cmd_GetProcessList = 9, DebugMonitor_Cmd_GetThreadList = 10, DebugMonitor_Cmd_GetDebugThreadContext = 11, DebugMonitor_Cmd_ContinueDebugEvent = 12, DebugMonitor_Cmd_ReadDebugProcessMemory = 13, DebugMonitor_Cmd_WriteDebugProcessMemory = 14, DebugMonitor_Cmd_SetDebugThreadContext = 15, DebugMonitor_Cmd_GetDebugThreadParam = 16, DebugMonitor_Cmd_InitializeThreadInfo = 17, DebugMonitor_Cmd_SetHardwareBreakPoint = 18, DebugMonitor_Cmd_QueryDebugProcessMemory = 19, DebugMonitor_Cmd_GetProcessMemoryDetails = 20, DebugMonitor_Cmd_AttachByProgramId = 21, DebugMonitor_Cmd_AttachOnLaunch = 22, DebugMonitor_Cmd_GetDebugMonitorProcessId = 23, DebugMonitor_Cmd_GetJitDebugProcessList = 25, DebugMonitor_Cmd_CreateCoreDump = 26, DebugMonitor_Cmd_GetAllDebugThreadInfo = 27, DebugMonitor_Cmd_TargetIO_FileOpen = 29, DebugMonitor_Cmd_TargetIO_FileClose = 30, DebugMonitor_Cmd_TargetIO_FileRead = 31, DebugMonitor_Cmd_TargetIO_FileWrite = 32, DebugMonitor_Cmd_TargetIO_FileSetAttributes = 33, DebugMonitor_Cmd_TargetIO_FileGetInformation = 34, DebugMonitor_Cmd_TargetIO_FileSetTime = 35, DebugMonitor_Cmd_TargetIO_FileSetSize = 36, DebugMonitor_Cmd_TargetIO_FileDelete = 37, DebugMonitor_Cmd_TargetIO_FileMove = 38, DebugMonitor_Cmd_TargetIO_DirectoryCreate = 39, DebugMonitor_Cmd_TargetIO_DirectoryDelete = 40, DebugMonitor_Cmd_TargetIO_DirectoryRename = 41, DebugMonitor_Cmd_TargetIO_DirectoryGetCount = 42, DebugMonitor_Cmd_TargetIO_DirectoryOpen = 43, DebugMonitor_Cmd_TargetIO_DirectoryGetNext = 44, DebugMonitor_Cmd_TargetIO_DirectoryClose = 45, DebugMonitor_Cmd_TargetIO_GetFreeSpace = 46, DebugMonitor_Cmd_TargetIO_GetVolumeInformation = 47, DebugMonitor_Cmd_InitiateCoreDump = 48, DebugMonitor_Cmd_ContinueCoreDump = 49, DebugMonitor_Cmd_AddTTYToCoreDump = 50, DebugMonitor_Cmd_AddImageToCoreDump = 51, DebugMonitor_Cmd_CloseCoreDump = 52, DebugMonitor_Cmd_CancelAttach = 53, }; class DebugMonitorService final : public IServiceObject { private: Result BreakDebugProcess(Handle debug_hnd); Result TerminateDebugProcess(Handle debug_hnd); Result CloseHandle(Handle debug_hnd); Result GetProcessId(Out out_pid, Handle hnd); Result GetProcessHandle(Out out_hnd, u64 pid); Result WaitSynchronization(Handle hnd, u64 ns); Result TargetIO_FileOpen(OutBuffer out_hnd, InBuffer path, int open_mode, u32 create_mode); Result TargetIO_FileClose(InBuffer hnd); Result TargetIO_FileRead(InBuffer hnd, OutBuffer out_data, Out out_read, u64 offset); Result TargetIO_FileWrite(InBuffer hnd, InBuffer data, Out out_written, u64 offset); Result TargetIO_FileSetAttributes(InBuffer path, InBuffer attributes); Result TargetIO_FileGetInformation(InBuffer path, OutBuffer out_info, Out is_directory); Result TargetIO_FileSetTime(InBuffer path, u64 create, u64 access, u64 modify); Result TargetIO_FileSetSize(InBuffer path, u64 size); Result TargetIO_FileDelete(InBuffer path); Result TargetIO_FileMove(InBuffer path0, InBuffer path1); public: DEFINE_SERVICE_DISPATCH_TABLE { MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), // MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), //MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), // MakeServiceCommandMeta(), }; };