Bug Fix #102 - Ignore WLAN service disabled
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Disco.Client.Interop.Native
|
|||||||
public const int ERROR_SUCCESS = 0;
|
public const int ERROR_SUCCESS = 0;
|
||||||
public const int ERROR_INVALID_PARAMETER = 87;
|
public const int ERROR_INVALID_PARAMETER = 87;
|
||||||
public const int ERROR_NOT_ENOUGH_MEMORY = 8;
|
public const int ERROR_NOT_ENOUGH_MEMORY = 8;
|
||||||
|
public const int ERROR_SERVICE_NOT_ACTIVE = 1062; // The service has not been started.
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The WlanOpenHandle function opens a connection to the server.
|
/// The WlanOpenHandle function opens a connection to the server.
|
||||||
|
|||||||
@@ -71,6 +71,13 @@ namespace Disco.Client.Interop
|
|||||||
|
|
||||||
// Connect to wireless service
|
// Connect to wireless service
|
||||||
interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out wlanServiceVersion, out wlanHandle);
|
interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out wlanServiceVersion, out wlanHandle);
|
||||||
|
if (interopResult == WlanApi.ERROR_SERVICE_NOT_ACTIVE)
|
||||||
|
{
|
||||||
|
// Indicates the Wlan service has not been started on the client
|
||||||
|
// typically as it is not needed (no wireless adapter) or if it
|
||||||
|
// has been forcibly disabled.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (interopResult != WlanApi.ERROR_SUCCESS)
|
if (interopResult != WlanApi.ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
throw new Exception($"Unable to connect to local wireless service. WlanOpenHandle returned: {interopResult}");
|
throw new Exception($"Unable to connect to local wireless service. WlanOpenHandle returned: {interopResult}");
|
||||||
@@ -156,6 +163,14 @@ namespace Disco.Client.Interop
|
|||||||
|
|
||||||
// Connect to wireless service
|
// Connect to wireless service
|
||||||
interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out wlanServiceVersion, out wlanHandle);
|
interopResult = WlanApi.WlanOpenHandle(WlanApi.WLAN_API_VERSION_2_0, IntPtr.Zero, out wlanServiceVersion, out wlanHandle);
|
||||||
|
if (interopResult == WlanApi.ERROR_SERVICE_NOT_ACTIVE)
|
||||||
|
{
|
||||||
|
// Indicates the Wlan service has not been started on the client
|
||||||
|
// typically as it is not needed (no wireless adapter) or if it
|
||||||
|
// has been forcibly disabled.
|
||||||
|
Presentation.UpdateStatus("Enrolling Device", $"Configuring Wireless Profiles\r\nSkipping, the WLAN service is not enabled", true, -1, 3000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (interopResult != WlanApi.ERROR_SUCCESS)
|
if (interopResult != WlanApi.ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
throw new Exception($"Unable to connect to local wireless service. WlanOpenHandle returned: {interopResult}");
|
throw new Exception($"Unable to connect to local wireless service. WlanOpenHandle returned: {interopResult}");
|
||||||
|
|||||||
Reference in New Issue
Block a user