Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'dart:ffi';

import 'package:ffi/ffi.dart';
import 'package:network_info_plus/src/windows_structs.dart';
import 'package:win32/win32.dart';
import 'package:network_info_plus_platform_interface/network_info_plus_platform_interface.dart';
import 'package:win32/win32.dart';

typedef WlanQuery =
String? Function(
Expand Down Expand Up @@ -62,10 +62,12 @@ class NetworkInfoPlusWindowsPlugin extends NetworkInfoPlatform {
}

for (var i = 0; i < ppInterfaceList.value.ref.dwNumberOfItems; i++) {
final pInterfaceGuid = calloc<GUID>()
..ref.setGUID(
ppInterfaceList.value.ref.InterfaceInfo[i].InterfaceGuid.toString(),
);
final pInterfaceGuid = ppInterfaceList
.value
.ref
.InterfaceInfo[i]
.InterfaceGuid
.toNative();

const opCode = WLAN_INTF_OPCODE(
7,
Expand Down Expand Up @@ -98,7 +100,8 @@ class NetworkInfoPlusWindowsPlugin extends NetworkInfoPlatform {
}
return null;
} finally {
WlanFreeMemory(ppInterfaceList);
WlanFreeMemory(ppInterfaceList.value);
free(ppInterfaceList);
closeHandle();
}
}
Expand Down Expand Up @@ -194,18 +197,18 @@ class NetworkInfoPlusWindowsPlugin extends NetworkInfoPlatform {
try {
GetAdaptersAddresses(
family,
GET_ADAPTERS_ADDRESSES_FLAGS(0),
const GET_ADAPTERS_ADDRESSES_FLAGS(0),
null,
ulSize,
);
pIpAdapterAddress = HeapAlloc(
GetProcessHeap().value,
HEAP_FLAGS(0),
const HEAP_FLAGS(0),
ulSize.value,
).cast();
GetAdaptersAddresses(
family,
GET_ADAPTERS_ADDRESSES_FLAGS(0),
const GET_ADAPTERS_ADDRESSES_FLAGS(0),
pIpAdapterAddress,
ulSize,
);
Expand Down Expand Up @@ -247,18 +250,18 @@ class NetworkInfoPlusWindowsPlugin extends NetworkInfoPlatform {
try {
GetAdaptersAddresses(
AF_INET,
GET_ADAPTERS_ADDRESSES_FLAGS(0),
const GET_ADAPTERS_ADDRESSES_FLAGS(0),
null,
ulSize,
);
pIpAdapterAddress = HeapAlloc(
GetProcessHeap().value,
HEAP_FLAGS(0),
const HEAP_FLAGS(0),
ulSize.value,
).cast();
GetAdaptersAddresses(
AF_INET,
GET_ADAPTERS_ADDRESSES_FLAGS(0),
const GET_ADAPTERS_ADDRESSES_FLAGS(0),
pIpAdapterAddress,
ulSize,
);
Expand Down Expand Up @@ -325,18 +328,18 @@ class NetworkInfoPlusWindowsPlugin extends NetworkInfoPlatform {
try {
GetAdaptersAddresses(
AF_INET,
GET_ADAPTERS_ADDRESSES_FLAGS(0x80),
const GET_ADAPTERS_ADDRESSES_FLAGS(0x80),
null,
ulSize,
);
pIpAdapterAddress = HeapAlloc(
GetProcessHeap().value,
HEAP_FLAGS(0),
const HEAP_FLAGS(0),
ulSize.value,
).cast();
GetAdaptersAddresses(
AF_INET,
GET_ADAPTERS_ADDRESSES_FLAGS(0x80),
const GET_ADAPTERS_ADDRESSES_FLAGS(0x80),
pIpAdapterAddress,
ulSize,
);
Expand Down
Loading