mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-21 05:15:47 +00:00
service/vi: Unstub GetDisplayService
This function is also supposed to check its given policy type with the permission of the service itself. This implements the necessary machinery to unstub these functions. Policy::User seems to just be basic access (which is probably why vi:u is restricted to that policy), while the other policy seems to be for extended abilities regarding which displays can be managed and queried, so this is assumed to be for a background compositor (which I've named, appropriately, Policy::Compositor).
This commit is contained in:
parent
93b02f28d8
commit
e86f1653d8
5 changed files with 49 additions and 11 deletions
|
@ -34,6 +34,7 @@
|
|||
namespace Service::VI {
|
||||
|
||||
constexpr ResultCode ERR_OPERATION_FAILED{ErrorModule::VI, 1};
|
||||
constexpr ResultCode ERR_PERMISSION_DENIED{ErrorModule::VI, 5};
|
||||
constexpr ResultCode ERR_UNSUPPORTED{ErrorModule::VI, 6};
|
||||
constexpr ResultCode ERR_NOT_FOUND{ErrorModule::VI, 7};
|
||||
|
||||
|
@ -1203,8 +1204,30 @@ IApplicationDisplayService::IApplicationDisplayService(
|
|||
RegisterHandlers(functions);
|
||||
}
|
||||
|
||||
static bool IsValidServiceAccess(Permission permission, Policy policy) {
|
||||
if (permission == Permission::User) {
|
||||
return policy == Policy::User;
|
||||
}
|
||||
|
||||
if (permission == Permission::System || permission == Permission::Manager) {
|
||||
return policy == Policy::User || policy == Policy::Compositor;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void detail::GetDisplayServiceImpl(Kernel::HLERequestContext& ctx,
|
||||
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger) {
|
||||
std::shared_ptr<NVFlinger::NVFlinger> nv_flinger,
|
||||
Permission permission) {
|
||||
IPC::RequestParser rp{ctx};
|
||||
const auto policy = rp.PopEnum<Policy>();
|
||||
|
||||
if (!IsValidServiceAccess(permission, policy)) {
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
rb.Push(ERR_PERMISSION_DENIED);
|
||||
return;
|
||||
}
|
||||
|
||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
||||
rb.Push(RESULT_SUCCESS);
|
||||
rb.PushIpcInterface<IApplicationDisplayService>(std::move(nv_flinger));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue