update cswin32

This commit is contained in:
ppc
2025-06-17 18:23:55 +01:00
parent f0125be89d
commit 435dbad3a5
2 changed files with 10 additions and 3 deletions
+2 -2
View File
@@ -13,7 +13,7 @@
<CompanyName>ppc</CompanyName>
<AssemblyName>amnet</AssemblyName>
<AssemblyTitle>AMNet Server</AssemblyTitle>
<Copyright>Copyright 2024 (c) ppc</Copyright>
<Copyright>Copyright (c) 2024-25 ppc</Copyright>
<Description>Server component for the AMNet IC Card switcher</Description>
</PropertyGroup>
@@ -31,7 +31,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.106">
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.183">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
+8 -1
View File
@@ -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();
}
}