Skip to content

Commit f689c9c

Browse files
committed
Fix for down-level
1 parent 5eaeeca commit f689c9c

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Microsoft.Toolkit.Uwp.Notifications/Toasts/Compat/Desktop/Win32AppInfo.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,29 @@ public static Win32AppInfo Get()
3737

3838
// First get the app ID
3939
IApplicationResolver appResolver = (IApplicationResolver)new CAppResolver();
40-
appResolver.GetAppIDForProcess(Convert.ToUInt32(process.Id), out string appId, out _, out _, out _);
40+
appResolver.GetAppIDForProcess(Convert.ToUInt32(process.Id), out string appId, out _, out bool explicitAppId, out _);
4141

42-
// Use app ID (or hashed app ID) as AUMID
43-
string aumid = appId.Length > AUMID_MAX_LENGTH ? HashAppId(appId) : appId;
42+
string aumid;
43+
44+
// If it has an explicit app ID
45+
if (explicitAppId)
46+
{
47+
// Use as-is
48+
aumid = appId;
49+
}
50+
else
51+
{
52+
// Otherwise, it's a full-path, like C:\Program Files\..., and for versions 19042 and older of
53+
// Windows 10, we can't use a full path - Issue #3870, so we change it to not be recognized as a path.
54+
aumid = appId.Replace('\\', '/');
55+
}
56+
57+
// If the AUMID is too long
58+
if (aumid.Length > AUMID_MAX_LENGTH)
59+
{
60+
// Hash the AUMID
61+
aumid = HashAppId(aumid);
62+
}
4463

4564
// Then try to get the shortcut (for display name and icon)
4665
IShellItem shortcutItem = null;

0 commit comments

Comments
 (0)