protected static void MakeObject(ServiceCtx context, IpcService obj) { IpcService service = context.Session.Service; obj.TrySetServer(service.Server); if (service._isDomain) { context.Response.ObjectIds.Add(service.Add(obj)); } else { KSession session = new KSession(context.Device.System.KernelContext); session.ClientSession.Service = obj; if (context.Process.HandleTable.GenerateHandle(session.ClientSession, out int handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } session.ServerSession.DecrementReferenceCount(); session.ClientSession.DecrementReferenceCount(); context.Response.HandleDesc = IpcHandleDesc.MakeMove(handle); } }
protected void MakeObject(ServiceCtx context, IpcService obj) { obj.TrySetServer(_parent.Server); if (_parent._isDomain) { obj._parent = _parent; context.Response.ObjectIds.Add(_parent.Add(obj)); } else { context.Device.System.KernelContext.Syscall.CreateSession(false, 0, out int serverSessionHandle, out int clientSessionHandle); obj.Server.AddSessionObj(serverSessionHandle, obj); context.Response.HandleDesc = IpcHandleDesc.MakeMove(clientSessionHandle); } }