Skip to content
Merged
Show file tree
Hide file tree
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 @@ -50,28 +50,25 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
try {
final currentVersionKey = Registry.openPath(RegistryHive.localMachine,
path: r'SOFTWARE\Microsoft\Windows NT\CurrentVersion');
final buildLab = currentVersionKey.getValueAsString('BuildLab') ?? '';
final buildLabEx = currentVersionKey.getValueAsString('BuildLabEx') ?? '';
final digitalProductIdValue =
currentVersionKey.getValue('DigitalProductId');
final digitalProductId = digitalProductIdValue != null &&
digitalProductIdValue.data is Uint8List
? digitalProductIdValue.data as Uint8List
: Uint8List.fromList([]);
final buildLab = currentVersionKey.getStringValue('BuildLab') ?? '';
final buildLabEx = currentVersionKey.getStringValue('BuildLabEx') ?? '';
final digitalProductId =
currentVersionKey.getBinaryValue('DigitalProductId') ??
Uint8List.fromList([]);
final displayVersion =
currentVersionKey.getValueAsString('DisplayVersion') ?? '';
final editionId = currentVersionKey.getValueAsString('EditionID') ?? '';
currentVersionKey.getStringValue('DisplayVersion') ?? '';
final editionId = currentVersionKey.getStringValue('EditionID') ?? '';
final installDate = DateTime.fromMillisecondsSinceEpoch(
1000 * (currentVersionKey.getValueAsInt('InstallDate') ?? 0));
final productId = currentVersionKey.getValueAsString('ProductID') ?? '';
var productName = currentVersionKey.getValueAsString('ProductName') ?? '';
1000 * (currentVersionKey.getIntValue('InstallDate') ?? 0));
final productId = currentVersionKey.getStringValue('ProductID') ?? '';
var productName = currentVersionKey.getStringValue('ProductName') ?? '';
final registeredOwner =
currentVersionKey.getValueAsString('RegisteredOwner') ?? '';
final releaseId = currentVersionKey.getValueAsString('ReleaseId') ?? '';
currentVersionKey.getStringValue('RegisteredOwner') ?? '';
final releaseId = currentVersionKey.getStringValue('ReleaseId') ?? '';

final sqmClientKey = Registry.openPath(RegistryHive.localMachine,
path: r'SOFTWARE\Microsoft\SQMClient');
final machineId = sqmClientKey.getValueAsString('MachineId') ?? '';
final machineId = sqmClientKey.getStringValue('MachineId') ?? '';

GetSystemInfo(systemInfo);

Expand Down Expand Up @@ -138,14 +135,13 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
// We call this a first time to get the length of the string in characters,
// so we can allocate sufficient memory.
final nSize = calloc<DWORD>();
GetComputerNameEx(
COMPUTER_NAME_FORMAT.ComputerNameDnsFullyQualified, nullptr, nSize);
GetComputerNameEx(ComputerNameDnsFullyQualified, nullptr, nSize);

// Now allocate memory for a native string and call this a second time.
final lpBuffer = wsalloc(nSize.value);
try {
final result = GetComputerNameEx(
COMPUTER_NAME_FORMAT.ComputerNameDnsFullyQualified, lpBuffer, nSize);
final result =
GetComputerNameEx(ComputerNameDnsFullyQualified, lpBuffer, nSize);

if (result != 0) {
return lpBuffer.toDartString();
Expand Down
2 changes: 1 addition & 1 deletion packages/device_info_plus/device_info_plus/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies:
meta: ^1.8.0
web: ^1.0.0
win32: ^5.5.3
win32_registry: ^1.1.0
win32_registry: ^2.0.1

dev_dependencies:
flutter_lints: ">=4.0.0 <6.0.0"
Expand Down
Loading