在UWP应用程序中是否可以从IVpnProfile获取ConnectionStatus?

Pau*_*hin 11 vpn uwp c++-winrt

我有以下WinRT代码,可以很好地发现活动的VPN配置文件:

VpnManagementAgent vpn;
auto profiles = vpn.GetProfilesAsync().get();
wprintf(L"Found %d profiles\n", profiles.Size());
for (auto vp : profiles)
{
    wprintf(L"Found profile %s\n", vp.ProfileName().c_str());
}
Run Code Online (Sandbox Code Playgroud)

我想检查ConnectionStatus,但这在IVpnProfile接口上不可用。我尝试添加以下内容无济于事,因为具体的VpnPlugInProfile和VpnNativeProfile类中的ConnectionStatus可用:

VpnPlugInProfile pp = vp.as<VpnPlugInProfile>();
if (pp != nullptr)
    wprintf(L"ConnectionStatus = %d\n", pp.ConnectionStatus());
Run Code Online (Sandbox Code Playgroud)

这只是给出一个无效的句柄错误。

有没有办法从IVpnProfile获取ConnectionStatus?

PES*_*SFT 0

提示:无效句柄错误是 Windows 中的一个错误;它已被修复,并且该修复已在下​​层进行了维护(可能针对 RS5 和 19H1)