原始 06/06/2018 cmets 在此处(请参阅下面的更新):
Microsoft 已弃用 WLAN HostedNetwork 功能,它不是
可用于 Win10 驱动程序。要在 Win10 中使用旧模型,您必须
查找并安装 2015 年的驱动程序(8.1 或更早版本,具体取决于
供应商)。
Win10驱动模型将HostedNetwork的机制改为
基于 WiFi Direct,并从应用程序开发人员手中夺走了控制权
将此功能移至内核。如果有一些样品可用
你四处挖掘,展示了如何使用 Modern-com (RT) UWP 应用程序
库来配置 WiFi Direct HostedNetwork。这是一个皮塔饼,
微软没有解释,大多数人不理解
在网络上对此发表评论,这看起来像是一个两步
微软失败,产品功能被削减以进行出货
团队之间的日程安排和重组改变了所有权和计划
WiFi和热点。 WiFi 直接启用 - 理论上 - 更简单
设备之间的配对和身份验证模型。但目前
实施涉及蓝牙,因此值得怀疑
除了支持有限的移动设备 WiFi 2.0 场景。如果你
正在使用无头设备或物联网设备场景这是
坏了。
我不得不在这方面做很多工作。如果您可以选择
WiFi 硬件,我强烈推荐使用
英特尔驱动程序(它们很可靠)。
如果您的场景允许 UX,您可能会发现此 App Store 应用很有帮助
相互作用。
http://www.topuwp.com/windowsapps/wifi-direct-access-point/598084.html
=====================
2020 年 2 月 27 日更新该故事...
当Hosted network supported : No 时,legacy 托管网络 支持在您的适配器上不可用,因为您在 Windows 10 等中具有 WiFi Direct。在这种情况下,您需要了解并使用这个很少评论 WiFi Direct 支持的部分:
https://docs.microsoft.com/en-us/uwp/api/windows.networking.networkoperators.networkoperatortetheringmanager.createfromconnectionprofile
HotSpot 设置的命令行:start ms-settings:network-mobilehotspot
有关 PowerShell 以编程方式访问 WinRT HotSpot API 的文章
enable Win10 inbuild hotspot by cmd/batch/powershell
关键词:“虚拟 Wi-Fi”、SoftAP、AdHoc IBSS、MobileHotSpot、netsh wlan HostedNetwork
=====================
如果没有如下有效的C++/WinRT 代码示例,这将是不完整的:
#include <winrt/Windows.Networking.Connectivity.h>
#include <winrt/Windows.Networking.NetworkOperators.h>
#include <winrt/Windows.Devices.WiFiDirect.h>
#include <winrt/Windows.Security.Credentials.h>
namespace winrt { // /ZW embed in :<winrt> when `Windows` is ambiguously defined
static void af_winrt_wifi_hotspot_test() {
// start ms-settings:network-mobilehotspot
init_apartment(); // apartment_type::multi_threaded
if (false /* play as you wish to test this all in simple c++ console app, I used clang */) {
auto publisher = Windows::Devices::WiFiDirect::WiFiDirectAdvertisementPublisher();
auto advertisement = publisher.Advertisement();
advertisement.ListenStateDiscoverability(Windows::Devices::WiFiDirect::WiFiDirectAdvertisementListenStateDiscoverability::Intensive);
advertisement.IsAutonomousGroupOwnerEnabled(true);
auto legacySettings = advertisement.LegacySettings();
legacySettings.IsEnabled(true);
legacySettings.Ssid(L"your-hotspot-name");
auto credential = Windows::Security::Credentials::PasswordCredential(); credential.Password(L"the-password!");
legacySettings.Passphrase(credential);
publisher.Start();
}
else {
auto connectionProfile{ Windows::Networking::Connectivity::NetworkInformation::GetInternetConnectionProfile() };
auto tetheringManager = Windows::Networking::NetworkOperators::NetworkOperatorTetheringManager::CreateFromConnectionProfile(connectionProfile);
auto credential = Windows::Security::Credentials::PasswordCredential(); credential.Password(L"the-password!");
auto conf = Windows::Networking::NetworkOperators::NetworkOperatorTetheringAccessPointConfiguration();
conf.Ssid(L"I-Own-You"); conf.Passphrase(credential.Password());
auto oldConf = tetheringManager.GetCurrentAccessPointConfiguration();
auto oldSsid = oldConf.Ssid(); auto oldPwd = oldConf.Passphrase();
tetheringManager.ConfigureAccessPointAsync(conf); // Sets new ssid/pwd here
switch (tetheringManager.TetheringOperationalState()) {
case Windows::Networking::NetworkOperators::TetheringOperationalState::Off: {
auto ioAsync = tetheringManager.StartTetheringAsync();
auto fResult = ioAsync.get();
}
break;
case Windows::Networking::NetworkOperators::TetheringOperationalState::On: {
// auto ioAsync = tetheringManager.StopTetheringAsync();
// auto fResult = ioAsync.get();
}
break;
case Windows::Networking::NetworkOperators::TetheringOperationalState::InTransition:
default:
break;
}
}
clear_factory_cache();
uninit_apartment();
}
}
在此处查找与 WiFiDirectAdvertisementPublisher 相关的旧版 Microsoft 示例:
网络上的文章如此之多,WiFi-Direct 造成的混乱如此之多。
我花了整整两天时间才弄清楚这一切。在我看来,这很多。
微软(我曾在该公司担任架构师)没有理由不创建一个关于这个非常受欢迎的主题的博客。更不用说简单地使 netsh 和 Ad Hoc Wifi 兼容支持,而不是让开发人员、最终用户和开发人员。
-- 享受 大卫
以上内容非常简洁,并公开了适用于所有场景的工作 c++/WinRT 代码。
[我现在将这个捆绑在 EdgeS 中:EdgeShell/EdgeScript/afm-scm 工具集]
[]5