mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
enhance lnk program exception handling
This commit is contained in:
@@ -61,9 +61,9 @@ namespace Wox.Plugin.Program.Programs
|
||||
IStream stream;
|
||||
const uint noAttribute = 0x80;
|
||||
const Stgm exclusiveRead = Stgm.Read | Stgm.ShareExclusive;
|
||||
var result = SHCreateStreamOnFileEx(path, exclusiveRead, noAttribute, false, null, out stream);
|
||||
var hResult = SHCreateStreamOnFileEx(path, exclusiveRead, noAttribute, false, null, out stream);
|
||||
|
||||
if (result == Hresult.Ok)
|
||||
if (hResult == Hresult.Ok)
|
||||
{
|
||||
var reader = appxFactory.CreateManifestReader(stream);
|
||||
var manifestApps = reader.GetApplications();
|
||||
@@ -81,6 +81,12 @@ namespace Wox.Plugin.Program.Programs
|
||||
}
|
||||
Apps = apps.Where(a => a.AppListEntry != "none").ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"SHCreateStreamOnFileEx on path: <{path}> failed, HResult error code: {hResult}. Package location: <{Location}>.");
|
||||
var exception = Marshal.GetExceptionForHR((int)hResult);
|
||||
Log.Exception(exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user