------------------------------------------------------------------------------------------------
-----------------------------------WLAN.API-------------------------------------
頭文件:Wlanapi.h
思路:打開、配置、關閉,三步走。
第一步:
//打開句柄
WlanOpenHandle
DWORD WINAPI WlanOpenHandle(
_In_ DWORD dwClientVersion,
_Reserved_ PVOID pReserved,
_Out_ PDWORD pdwNegotiatedVersion,
_Out_ PHANDLE phClientHandle
);
第二步:WlanHostedNetworkInitSettings、WlanHostedNetworkSetProperty
//配置
WlanHostedNetworkInitSettings
The WlanHostedNetworkInitSettings function configures
and persists to storage the network connection settings
(SSID and maximum number of peers, for example)
on the wireless Hosted Network if these settings are not already configured.
DWORD WINAPI WlanHostedNetworkInitSettings(
_In_ HANDLE hClientHandle,
_Out_opt_ PWLAN_HOSTED_NETWORK_REASON pFailReason,
_Reserved_ PVOID pvReserved
);
WlanHostedNetworkSetProperty
The WlanHostedNetworkSetProperty function sets static properties of the wireless Hosted Network.
DWORD WINAPI WlanHostedNetworkSetProperty(
_In_ HANDLE hClientHandle,
_In_ WLAN_HOSTED_NETWORK_OPCODE OpCode,
_In_ DWORD dwDataSize,
_In_ PVOID pvData,
_Out_opt_ PWLAN_HOSTED_NETWORK_REASON pFailReason,
_Reserved_ PVOID pvReserved
);
第一key是由系統生成的;
需要設置第二key:WlanHostedNetworkSetSecondaryKey即密碼。
WlanHostedNetworkSetSecondaryKey函数配置无线承载网络将使用的辅助安全密钥。
DWORD WINAPI WlanHostedNetworkSetSecondaryKey(
_In_ HANDLE hClientHandle,
_In_ DWORD dwKeyLength,
_In_ PUCHAR pucKeyData,
_In_ BOOL bIsPassPhrase,
_In_ BOOL bPersistent,
_Out_opt_ PWLAN_HOSTED_NETWORK_REASON pFailReason,
_Reserved_ PVOID pvReserved
);
//開啟AP
WlanHostedNetworkForceStart function
The WlanHostedNetworkForceStart function transitions the wireless Hosted Network to the wlan_hosted_network_active state without associating the request with the application's calling handle.
DWORD WINAPI WlanHostedNetworkForceStart(
_In_ HANDLE hClientHandle,
_Out_opt_ PWLAN_HOSTED_NETWORK_REASON pFailReason,
_Reserved_ PVOID pvReserved
);
//WlanHostedNetworkStartUsing
WlanHostedNetworkStartUsing function
The WlanHostedNetworkStartUsing function starts the wireless Hosted Network.
DWORD WINAPI WlanHostedNetworkStartUsing(
_In_ HANDLE hClientHandle,
_Out_opt_ PWLAN_HOSTED_NETWORK_REASON pFailReason,
_Reserved_ PVOID pvReserved
);
關閉
WlanHostedNetworkForceStop
The WlanHostedNetworkForceStop function transitions the wireless Hosted Network to the wlan_hosted_network_idle without associating the request with the application's calling handle.
DWORD WINAPI WlanHostedNetworkForceStop(
_In_ HANDLE hClientHandle,
_Out_opt_ PWLAN_HOSTED_NETWORK_REASON pFailReason,
_Reserved_ PVOID pvReserved
);
WlanCloseHandle
The WlanCloseHandle function closes a connection to the server.
DWORD WINAPI WlanCloseHandle(
_In_ HANDLE hClientHandle,
_Reserved_ PVOID pReserved
);
------------------------------------------------------------------------