diff --git a/AMNet.Server/AMNet.Server.csproj b/AMNet.Server/AMNet.Server.csproj index 1ee4c27..85373f3 100644 --- a/AMNet.Server/AMNet.Server.csproj +++ b/AMNet.Server/AMNet.Server.csproj @@ -13,7 +13,7 @@ ppc amnet AMNet Server - Copyright 2024 (c) ppc + Copyright (c) 2024-25 ppc Server component for the AMNet IC Card switcher @@ -31,7 +31,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/AMNet.Server/Config.cs b/AMNet.Server/Config.cs index cbefe91..2213b18 100644 --- a/AMNet.Server/Config.cs +++ b/AMNet.Server/Config.cs @@ -50,8 +50,15 @@ internal static class Config // +1 for null terminator var buffer = stackalloc char[(int)maxLength + 1]; var bufferStr = new PWSTR(buffer); + + fixed (char* pSection = section) + fixed (char* pKey = key) + fixed (char* pDefault = @default ?? string.Empty) + fixed (char* pDefaultPath = ConfigFilePath) + { + PInvoke.GetPrivateProfileString(new PCWSTR(pSection), new PCWSTR(pKey), new PCWSTR(pDefault), bufferStr, maxLength + 1, new PCWSTR(pDefaultPath)); + } - PInvoke.GetPrivateProfileString(section, key, @default ?? string.Empty, bufferStr, maxLength + 1, ConfigFilePath); return bufferStr.ToString(); } } \ No newline at end of file