VPN管理代理总是返回零配置文件,而且我似乎无法创建新的配置文件

VpnManagementAgent always returns zero profiles plus I can't seem to create new ones

本文关键字:配置文件 创建 代理 管理 返回 VPN      更新时间:2023-10-16

请注意下面的第二个示例,其中一个在C 中。

注意第三个示例在C#。

好的挖掘后,似乎问题可能存在某种许可问题,因为在调试二进制文件并跳过了一些随机检查之后 - 它显示了我为我的帐户的单个配置文件。是的,有人打电话给GetCurrentPackageFamilyName肯定是在查询某种权限。

这不是我的错,没有背景信息 - 唯一的公共文档在这里。我只是想ping接口。

C变体很复杂,因为我必须调用RoCreateInstance,然后调用Inspectable_QueryInterface,并且要定义自己的IID,因为原始的IID丢失。另外,我需要使用WindowsCreateStringReference和自定义COM处理程序创建自己的字符串。它无助于标题中包含的名称为数千个字符。

基本上,我尝试添加来自VPNProfile接口i查询和填充和XML的配置文件 - 这些尝试的无效。最近,我能够从对象中更新现有的配置文件。

但是,我似乎也无法连接并断开连接。

我唯一可以用所述接口做的有用的是 UpdateProfileFromXmlAsync崩溃了应用:

#define COBJMACROS
#include <roapi.h>
#include <windows.networking.vpn.h>
#include <stdbool.h>
#include <stdio.h>
//Had to manually define my IIDs
//because the definitions are missing from the library
const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent = {0x193696CD,0xA5C4,0x4ABE,0x85,0x2B,0x78,0x5B,0xE4,0xCB,0x3E,0x34};
const IID IID___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile = {0xdac6dd72,0xa5d1,0x56d4,0xaf,0xc4,0x98,0x9f,0x84,0xdc,0xb2,0xb3};
const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile = {0x7875B751,0xB0D7,0x43DB,0x8A,0x93,0xD3,0xFE,0x24,0x79,0xE5,0x6A};
const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile = {0xA4AEE29E,0x6417,0x4333,0x98,0x42,0xF0,0xA6,0x6D,0xB6,0x98,0x02};
const IID IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnChannel = {0x4AC78D07,0xD1A8,0x4303,0xA0,0x91,0xC8,0xD2,0xE0,0x91,0x5B,0xC3};
const IID IID___FIAsyncOperationCompletedHandler_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus = {0x31229f8c,0x709d,0x5017,0x86,0x29,0x57,0xef,0x12,0x89,0xe6,0x16};
const WCHAR pVPNXmlCode[] = 
L"<SyncML xmlns="SYNCML:SYNCML1.2" xmlns:A="syncml:metinf">"
L"  <SyncBody>"
L"    <Atomic>"
L"      <CmdID>10000</CmdID>"
L""
L"      <!-- Configure VPN Server Name or Address (PhoneNumber=) [Comma Separated]-->"
L"      <Add>"
L"        <CmdID>10001</CmdID>"
L"        <Item>"
L"          <Target>"
L"            <LocURI>./Vendor/MSFT/VPNv2/VPN_Demo/ProfileXML</LocURI>"
L"          </Target>"
L"          <Data><VPNProfile>"
L"  <ProfileName>VPN_Demo</ProfileName>"
L"  <NativeProfile>"
L"    <Servers>VPNServer.contoso.com</Servers>"
L"    <NativeProtocolType>Automatic</NativeProtocolType>"
L"    <Authentication>"
L"      <UserMethod>Eap</UserMethod>"
L"      <Eap>"
L"        <Configuration>"
L"<EapHostConfig xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> <EapMethod> <Type xmlns="http://www.microsoft.com/provisioning/EapCommon">25</Type> <VendorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorId> <VendorType xmlns="http://www.microsoft.com/provisioning/EapCommon">0</VendorType> <AuthorId xmlns="http://www.microsoft.com/provisioning/EapCommon">0</AuthorId> </EapMethod> <Config xmlns="http://www.microsoft.com/provisioning/EapHostConfig"> <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"> <Type>25</Type> <EapType xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV1"> <ServerValidation> <DisableUserPromptForServerValidation>false</DisableUserPromptForServerValidation> <ServerNames></ServerNames> </ServerValidation> <FastReconnect>true</FastReconnect> <InnerEapOptional>false</InnerEapOptional> <Eap xmlns="http://www.microsoft.com/provisioning/BaseEapConnectionPropertiesV1"> <Type>13</Type> <EapType xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV1"> <CredentialsSource> <CertificateStore> <SimpleCertSelection>false</SimpleCertSelection> </CertificateStore> </CredentialsSource> <ServerValidation> <DisableUserPromptForServerValidation>false</DisableUserPromptForServerValidation> <ServerNames></ServerNames> </ServerValidation> <DifferentUsername>false</DifferentUsername> <PerformServerValidation xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2">false</PerformServerValidation> <AcceptServerName xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2">false</AcceptServerName> <TLSExtensions xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV2"> <FilteringInfo xmlns="http://www.microsoft.com/provisioning/EapTlsConnectionPropertiesV3"> <EKUMapping> <EKUMap> <EKUName>Unknown Key Usage</EKUName> <EKUOID>1.3.6.1.4.1.311.87</EKUOID> </EKUMap> </EKUMapping> <ClientAuthEKUList Enabled="true"> <EKUMapInList> <EKUName>Unknown Key Usage</EKUName> </EKUMapInList> </ClientAuthEKUList> </FilteringInfo> </TLSExtensions> </EapType> </Eap> <EnableQuarantineChecks>false</EnableQuarantineChecks> <RequireCryptoBinding>false</RequireCryptoBinding> <PeapExtensions> <PerformServerValidation xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">false</PerformServerValidation> <AcceptServerName xmlns="http://www.microsoft.com/provisioning/MsPeapConnectionPropertiesV2">false</AcceptServerName> </PeapExtensions> </EapType> </Eap> </Config> </EapHostConfig>"
L"    </Configuration>"
L"      </Eap>"
L"    </Authentication>"
L"    <RoutingPolicyType>SplitTunnel</RoutingPolicyType>"
L"  </NativeProfile>"
L"  <DomainNameInformationList>"
L"    <DomainName>.contoso.com</DomainName>"
L"    <DNSServers>10.5.5.5</DNSServers>"
L"  </DomainNameInformationList>"
L" <TrafficFilter>  "
L"    <App>%ProgramFiles%Internet Exploreriexplore.exe</App> "
L"  </TrafficFilter> "
L"  <TrafficFilter>  "
L"    <App>Microsoft.MicrosoftEdge_8wekyb3d8bbwe</App>  "
L"  </TrafficFilter>"
L"  <Route>"
L"    <Address>10.0.0.0</Address>"
L"    <PrefixSize>8</PrefixSize>"
L"  </Route>"
L"  <Route>"
L"    <Address>25.0.0.0</Address>"
L"    <PrefixSize>8</PrefixSize>"
L"  </Route>"
L"    <RememberCredentials>true</RememberCredentials>"
L"  </VPNProfile></Data>"
L"        </Item>"
L"      </Add>"
L""
L"    </Atomic>"
L"    <Final/>"
L"  </SyncBody>"
L"</SyncML>"
;

//Completion Handlers

HRESULT QueryInterface(This,riid,ppvObject)void * This;REFIID riid;void **ppvObject; {if(!ppvObject) return E_POINTER;
    return !memcmp(riid, &IID_IUnknown, sizeof *riid) || 
    !memcmp(riid, &IID___FIAsyncOperationCompletedHandler_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus, sizeof *riid) ||
    !memcmp(riid, &IID___FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile, sizeof *riid) ? *ppvObject=This, S_OK 
    : E_NOINTERFACE;}
HANDLE hReady;
(AddRef)(in) void*in; {;}
(Release)(in) void*in; {;}
__x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile *pProfile;
        //Error Handler
HRESULT (InvokeError)(in,asyncInfo,status) void*in;
__FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus *asyncInfo;AsyncStatus status;
{
    enum __x_ABI_CWindows_CNetworking_CVpn_CVpnManagementErrorStatus disconnectstatus;
    __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_GetResults(asyncInfo,&disconnectstatus);
    printf("SET0:%dn%xn",disconnectstatus, GetLastError()),SetEvent(hReady);
    return S_OK;}
        //Profile Sets Handler
HRESULT (InvokeCollect)(in,asyncInfo,status) void*in;
__FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile *asyncInfo;AsyncStatus status;
{__FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile *pResults;
    unsigned int size;
    printf("SET1:%dn",status),
    printf("%xn",__FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_GetResults(asyncInfo, &pResults)),
    __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_Release(asyncInfo),
    __FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_get_Size(pResults,&size),
    printf("Amount of profiles collected %dn",size),
    __FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_Release(pResults),
    SetEvent(hReady);return S_OK;}

__FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile ProfilesRetrieverHandler = 
{(__FIAsyncOperationCompletedHandler_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfileVtbl[1])
        {{QueryInterface,AddRef,Release,InvokeError}}};
(main)()
//Long complex,boring initialization
{__x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent *pVpnMan; HSTRING_HEADER header;
    ULONG idCount; IID*pIdds;
    hReady = CreateEvent(0,true,false,0); __x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile *pProfile;
    __x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile *pNativeProfile;
    ULONG strSize; WCHAR *pRawString;__x_ABI_CWindows_CNetworking_CVpn_CIVpnChannel *pChannel;
    enum __x_ABI_CWindows_CNetworking_CVpn_CVpnManagementErrorStatus disconnectstatus;
    __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus *pVpnManErr;
    IInspectable *pVpnObjInspect; HSTRING string; RoInitialize(RO_INIT_MULTITHREADED),
    //Query for IVpnManagementAgent
    WindowsCreateStringReference(RuntimeClass_Windows_Networking_Vpn_VpnManagementAgent,
        sizeof RuntimeClass_Windows_Networking_Vpn_VpnManagementAgent/sizeof(WCHAR)-1,
        &header, &string), RoActivateInstance(string,&pVpnObjInspect), WindowsDeleteString(string), IInspectable_QueryInterface(pVpnObjInspect,
        &IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent,&pVpnMan),IInspectable_Release(pVpnObjInspect), 

        //Query for IVpnProfile
        WindowsCreateStringReference(RuntimeClass_Windows_Networking_Vpn_VpnNativeProfile,
        sizeof RuntimeClass_Windows_Networking_Vpn_VpnNativeProfile/sizeof(WCHAR)-1,
        &header, &string), RoActivateInstance(string,&pVpnObjInspect),WindowsDeleteString(string),IInspectable_GetIids(pVpnObjInspect,&idCount,&pIdds),
        IInspectable_QueryInterface(pVpnObjInspect, &IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile,&pProfile),IInspectable_Release(pVpnObjInspect),
        //Set Profile name to currently active VPN Profile in my system
        WindowsCreateStringReference(pVPNXmlCode, sizeof pVPNXmlCode/sizeof(WCHAR)-1,&header, &string),WindowsCreateStringReference(L"VPN Connection",
            sizeof L"VPN Connection"/sizeof(WCHAR)-1,&header, &string),__x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_put_ProfileName(pProfile,string),
        WindowsDeleteString(string),
        //Query to IVpnNativeProfile and the back to IVpnProfile - because I can
        printf("%xn",__x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_QueryInterface(pProfile,&IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile,&pNativeProfile)),
        __x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_Release(pProfile),
        printf("%xn",__x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile_QueryInterface(pNativeProfile,&IID___x_ABI_CWindows_CNetworking_CVpn_CIVpnProfile,&pProfile)),
        __x_ABI_CWindows_CNetworking_CVpn_CIVpnNativeProfile_Release(pNativeProfile),

        //The interesting part

        //Try to add profile from XML
        WindowsCreateStringReference(pVPNXmlCode,sizeof pVPNXmlCode/
        sizeof(WCHAR)-1,&header, &string),__x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_AddProfileFromXmlAsync(pVpnMan,string,&pVpnManErr),
        WindowsDeleteString(string),__FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),
        WaitForSingleObject(hReady, INFINITE), ResetEvent(hReady),
        //Try to add profie from previously queried profile
        __x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_AddProfileFromObjectAsync(pVpnMan,pProfile,&pVpnManErr),
        __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),
        WaitForSingleObject(hReady, INFINITE), ResetEvent(hReady),
        //See how many profiles we have
        ProfilesRetrieverHandler.lpVtbl->Invoke = InvokeCollect;
        __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile *pProfiles;
        __x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_GetProfilesAsync(pVpnMan,&pProfiles),
        __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_put_Completed(pProfiles,&ProfilesRetrieverHandler),
        __FIAsyncOperation_1___FIVectorView_1_Windows__CNetworking__CVpn__CIVpnProfile_Release(pProfiles),
        WaitForSingleObject(hReady, INFINITE),ResetEvent(hReady);
        //Try connectiong to our previously named profile
        ProfilesRetrieverHandler.lpVtbl->Invoke = InvokeError,
        __x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_ConnectProfileAsync(pVpnMan,pProfile,&pVpnManErr),
        __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),
        __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_Release(pVpnManErr),
        WaitForSingleObject(hReady, INFINITE),ResetEvent(hReady);
        //For fun crash the application
        ProfilesRetrieverHandler.lpVtbl->Invoke = InvokeError,
        WindowsCreateStringReference(pVPNXmlCode,sizeof pVPNXmlCode/
        sizeof(WCHAR)-1,&header, &string),__x_ABI_CWindows_CNetworking_CVpn_CIVpnManagementAgent_UpdateProfileFromXmlAsync(pVpnMan,string,&pVpnManErr),
        WindowsDeleteString(string),
        __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_put_Completed(pVpnManErr,&ProfilesRetrieverHandler),
        __FIAsyncOperation_1_Windows__CNetworking__CVpn__CVpnManagementErrorStatus_Release(pVpnManErr),
        WaitForSingleObject(hReady, INFINITE),ResetEvent(hReady);
        printf("never reachedn");
}

这是我如何编译上述内容:

cl stackoverflow.c /link RuntimeObject.lib Ole32.lib OleAut32.lib

这是我的C 变体,适用于无法查看上述代码的任何人:

#include <stdio.h>
#include <..cppwinrtwinrtwindows.networking.vpn.h>
using namespace winrt::Windows::Networking::Vpn;
const wchar_t pVPNXmlCode[] = 
L"<SyncML xmlns="SYNCML:SYNCML1.2" xmlns:A="syncml:metinf">"
L"  <SyncBody>"
L"    <Atomic>"
L"      <CmdID>10000</CmdID>"
L""
L"      <!-- Configure VPN Server Name or Address (PhoneNumber=) [Comma Separated]-->"
L"      <Add>"
L"        <CmdID>10001</CmdID>"
L"        <Item>"
L"          <Target>"
L"            <LocURI>./Vendor/MSFT/VPNv2/VPN_Demo/ProfileXML</LocURI>"
L"          </Target>"      
L"          <Data><VPNProfile>"
L"  <ProfileName>VPN_Demo</ProfileName>"
L"  <NativeProfile>"
L"    <Servers>VPNServer.contoso.com</Servers>"
L"    <NativeProtocolType>Automatic</NativeProtocolType>"
L"    <Authentication>"
L"      <UserMethod>Eap</UserMethod>"
L"    </Authentication>"
L"    <RoutingPolicyType>SplitTunnel</RoutingPolicyType>"
L"  </NativeProfile>"
L"  <DomainNameInformationList>"
L"    <DomainName>.contoso.com</DomainName>"
L"    <DNSServers>10.5.5.5</DNSServers>"
L"  </DomainNameInformationList>"
L" <TrafficFilter>  "
L"    <App>%ProgramFiles%Internet Exploreriexplore.exe</App> "
L"  </TrafficFilter> "
L"  <TrafficFilter>  "
L"    <App>Microsoft.MicrosoftEdge_8wekyb3d8bbwe</App>  "
L"  </TrafficFilter>"
L"  <Route>"
L"    <Address>10.0.0.0</Address>"
L"    <PrefixSize>8</PrefixSize>"
L"  </Route>"
L"  <Route>"
L"    <Address>25.0.0.0</Address>"
L"    <PrefixSize>8</PrefixSize>"
L"  </Route>"
L"    <RememberCredentials>true</RememberCredentials>"
L"  </VPNProfile></Data>"
L"        </Item>"
L"      </Add>"
L""
L"    </Atomic>"
L"    <Final/>"
L"  </SyncBody>"
L"</SyncML>"
;
int wmain()
{
    winrt::init_apartment();
    VpnNativeProfile profile;
profile.AlwaysOn(false);
profile.EapConfiguration(L"<EapHostConfig></EapHostConfig>");
profile.NativeProtocolType(VpnNativeProtocolType::L2tp);
profile.ProfileName(L"VPN Connection");
profile.RememberCredentials(true);
profile.RequireVpnClientAppUI(false);
profile.RoutingPolicyType(VpnRoutingPolicyType::ForceAllTrafficOverVpn);
profile.Servers().Append(L"vlus-af1.pointtoserver.com");
profile.RequireVpnClientAppUI(true);
profile.UserAuthenticationMethod(VpnAuthenticationMethod::Certificate);
profile.TunnelAuthenticationMethod(VpnAuthenticationMethod::Certificate);
VpnManagementAgent agent;
wprintf(L"%dn", agent.AddProfileFromXmlAsync(pVPNXmlCode).get());
wprintf(L"%dn", agent.AddProfileFromObjectAsync(profile).get());
auto profiles = agent.GetProfilesAsync().get();
wprintf(L"Found %d profilesn", profiles.Size());
for (auto vp : profiles)
{
    wprintf(L"%dn",agent.DisconnectProfileAsync(vp).get());
    wprintf(L"Found profile %sn", vp.ProfileName().c_str());
}
wprintf(L"%dn", agent.ConnectProfileAsync(profile).get());
wprintf(L"%dn", agent.UpdateProfileFromXmlAsync(pVPNXmlCode).get());
wprintf(L"never reachedn");
}

这是我如何编译上述内容:

cl so.cpp /std:c++latest /link RuntimeObject.lib Ole32.lib OleAut32.lib

这是一个C#变体:

using System;
using Windows;
using Windows.Networking.Vpn;
using System.Threading.Tasks;
using Windows.Networking;
using  System.Threading;
public class entry
{public static async Task Main()
{VpnManagementAgent mgr = new VpnManagementAgent();
    mgr.GetProfilesAsync().Completed = (asyncInfo, asyncStatus) => {Console.WriteLine($"{asyncInfo.GetResults().Count}n");};
    Thread.Sleep(-1);}}

我正在用:

对此进行编译
csc same.cs /r:"C:Program Files (x86)Windows Kits10References10.0.18362.0Windows.Foundation.UniversalApiContract8.0.0.0Windows.Foundation.UniversalApiContract.winmd" /r:System.Runtime.dll /r:"C:Program Files (x86)Windows Kits10References10.0.18362.0Windows.Foundation.FoundationContract3.0.0.0Windows.Foundation.FoundationContract.winmd" /langversion:preview

我正在使用Visual Studio 2019构建工具,并且正在运行Windows Server 2019。

我正在寻找MSFT答案。我如何利用上述接口的任何VPN功能。

这是我的C程序的输出:

0
0
SET0:1
0
SET0:1
0
SET1:1
0
Amount of profiles collected 0
SET0:1
0

1表示VpnManagementErrorStatus_Other。这是C 程序输出:

1
1
Found 0 profiles
1

这是C#变体输出:

0

问题从我没有正确表现出来的事实中引起了问题。

我已经弄清楚与IDA有关,因为有拨打GetCurrentPackageFamilyName的电话,然后在一个函数中进行了其他呼叫,该功能检查了返回值是否被签名(即编号(,如果是没有实际的诉讼。p>这是我的表现,它解决了问题(AppxManifest.xml(:

<?xml version="1.0" encoding="utf-8"?>
<Package
  xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
  xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
  xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
  xmlns:r="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
  xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
  xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4" 
  xmlns:iot2="http://schemas.microsoft.com/appx/manifest/iot/windows10/2"
  IgnorableNamespaces="uap mp r uap5 desktop4 iot2">
  <Identity 
    Name="Sasho648.Internal.RmouseVPN.C" 
    Publisher="CN=Sasho648 Corporation, O=Sasho648 Corporation, L=Sofia, C=BG" 
    Version="1.0.0.0" />
  <mp:PhoneIdentity PhoneProductId="a771635b-3275-47f4-bfc9-72642a9b128b" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
  <Properties>
    <DisplayName>MobileBroadband</DisplayName>
    <PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
    <Logo>water-2748640_1920.png</Logo>
  </Properties>
  <Dependencies>
    <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10240.0" MaxVersionTested="10.0.18362.0" />
  </Dependencies>
  <Resources>
    <Resource Language="en-us"/>
  </Resources>
  <Applications>
    <Application Id="App"
      Executable="rmousevpn.exe"
      EntryPoint="RmouseVPN.App"
      desktop4:SupportsMultipleInstances="true"
      desktop4:Subsystem="console"
      iot2:Subsystem="console" 
      iot2:SupportsMultipleInstances="true">
<Extensions>  
    <uap5:Extension   
      Category="windows.appExecutionAlias">  
      <uap5:AppExecutionAlias desktop4:Subsystem="console">  
        <uap5:ExecutionAlias Alias="rmousevpn.exe" />  
      </uap5:AppExecutionAlias>  
    </uap5:Extension>  
</Extensions>  
      <uap:VisualElements
        DisplayName="vpnExecutioner"
        Square150x150Logo="water-2748640_1920.png"
        Square44x44Logo="water-2748640_1920.png"
        Description="Execute VPNs connections"
        BackgroundColor="#00b2f0">
      </uap:VisualElements>
    </Application>
  </Applications>
  <Capabilities>
      <r:Capability Name="networkingVpnProvider"/>
  </Capabilities>
</Package>

然后,您需要在安全性中启用开发模式,并使用PS添加软件包:

Add-AppxPackage -Path .Appxmanifest.xml -Register