Skip to content

Commit 7e52ad3

Browse files
committed
feat: 在提升失败时抛出 Win32Exception
1 parent 7c7065b commit 7e52ad3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

GrantUiAccess/Plugin.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
using System.ComponentModel;
23
using ClassIsland.Core.Abstractions;
34
using ClassIsland.Core.Attributes;
45
using ClassIsland.Core.Controls.CommonDialog;
@@ -16,7 +17,10 @@ public override void Initialize(HostBuilderContext context, IServiceCollection s
1617
{
1718
var hr = PrepareForUIAccess();
1819
Console.WriteLine(hr);
19-
Marshal.ThrowExceptionForHR(hr);
20+
if (hr != 0)
21+
{
22+
throw new Win32Exception(hr);
23+
}
2024

2125
AppBase.Current.AppStarted += CurrentOnAppStarted;
2226
}

0 commit comments

Comments
 (0)