From 5148010c1e715a11a796b83a9c526e90a7493433 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sat, 2 Mar 2024 18:16:40 +0000 Subject: [PATCH] Write data properly --- .../Services/Sockets/Sfdnsres/IResolver.cs | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs index f83e478789..32bad9a807 100644 --- a/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs +++ b/src/Ryujinx.HLE/HOS/Services/Sockets/Sfdnsres/IResolver.cs @@ -166,6 +166,13 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres return GetAddrInfoRequestImpl(context, responseBufferPosition, responseBufferSize, false, 0, 0); } + [CommandCmif(7)] + // GetNameInfoRequest + public ResultCode GetNameInfoRequest(ServiceCtx context) + { + return GetNameInfoRequestImpl(context, false); + } + [CommandCmif(8)] // GetCancelHandleRequest(u64, pid) -> u32 public ResultCode GetCancelHandleRequest(ServiceCtx context) @@ -247,9 +254,7 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres [CommandCmif(13)] public ResultCode GetNameInfoRequestWithOptions(ServiceCtx context) { - Logger.Stub?.PrintStub(LogClass.ServiceSfdnsres); - - return ResultCode.Success; + return GetNameInfoRequestImpl(context, true); } [CommandCmif(14)] // 5.0.0+ @@ -668,6 +673,26 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Sfdnsres return region.Memory.Span.Length - data.Length; } + private static ResultCode GetNameInfoRequestImpl( + ServiceCtx context, + bool withOptions) + { + if (!context.Device.Configuration.EnableInternetAccess) + { + Logger.Info?.Print(LogClass.ServiceSfdnsres, "Guest network access disabled, DNS Blocked."); + + WriteResponse(context, withOptions, 0, GaiError.NoData, NetDbError.NoAddress); + + return ResultCode.Success; + } + + Logger.Info?.PrintStub(LogClass.ServiceSfdnsres); + + WriteResponse(context, withOptions, 0, GaiError.NoData, NetDbError.NoAddress); + + return ResultCode.Success; + } + private static void WriteResponse( ServiceCtx context, bool withOptions,