mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-11 23:06:45 +01:00
Merge pull request #27 from zadjii-msft/dev/crutkas/uiCleanupPart3
Fixing string loader
This commit is contained in:
@@ -10,6 +10,6 @@ namespace AllApps.Programs;
|
||||
internal sealed class Native
|
||||
{
|
||||
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1838:Avoid 'StringBuilder' parameters for P/Invokes", Justification = "<Pending>")]
|
||||
public static extern int SHLoadIndirectString(string pszSource, StringBuilder pszOutBuf, int cchOutBuf, string ppvReserved);
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1838:Avoid 'StringBuilder' parameters for P/Invokes", Justification = "Part of API, can't remove")]
|
||||
public static extern int SHLoadIndirectString(string pszSource, StringBuilder pszOutBuf, int cchOutBuf, IntPtr ppvReserved);
|
||||
}
|
||||
|
||||
@@ -168,13 +168,13 @@ public class UWPApplication : IProgram
|
||||
var outBuffer = new StringBuilder(128);
|
||||
|
||||
var source = $"@{{{packageFullName}? {parsed}}}";
|
||||
var hResult = Native.SHLoadIndirectString(source, outBuffer, outBuffer.Capacity, null);
|
||||
var hResult = Native.SHLoadIndirectString(source, outBuffer, outBuffer.Capacity, IntPtr.Zero);
|
||||
if (hResult != 0)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(parsedFallback))
|
||||
{
|
||||
var sourceFallback = $"@{{{packageFullName}? {parsedFallback}}}";
|
||||
hResult = Native.SHLoadIndirectString(sourceFallback, outBuffer, outBuffer.Capacity, null);
|
||||
hResult = Native.SHLoadIndirectString(sourceFallback, outBuffer, outBuffer.Capacity, IntPtr.Zero);
|
||||
if (hResult == 0) // HRESULT.S_OK
|
||||
{
|
||||
var loaded = outBuffer.ToString();
|
||||
|
||||
Reference in New Issue
Block a user