@@ -50,28 +50,25 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
50
50
try {
51
51
final currentVersionKey = Registry .openPath (RegistryHive .localMachine,
52
52
path: r'SOFTWARE\Microsoft\Windows NT\CurrentVersion' );
53
- final buildLab = currentVersionKey.getValueAsString ('BuildLab' ) ?? '' ;
54
- final buildLabEx = currentVersionKey.getValueAsString ('BuildLabEx' ) ?? '' ;
55
- final digitalProductIdValue =
56
- currentVersionKey.getValue ('DigitalProductId' );
57
- final digitalProductId = digitalProductIdValue != null &&
58
- digitalProductIdValue.data is Uint8List
59
- ? digitalProductIdValue.data as Uint8List
60
- : Uint8List .fromList ([]);
53
+ final buildLab = currentVersionKey.getStringValue ('BuildLab' ) ?? '' ;
54
+ final buildLabEx = currentVersionKey.getStringValue ('BuildLabEx' ) ?? '' ;
55
+ final digitalProductId =
56
+ currentVersionKey.getBinaryValue ('DigitalProductId' ) ??
57
+ Uint8List .fromList ([]);
61
58
final displayVersion =
62
- currentVersionKey.getValueAsString ('DisplayVersion' ) ?? '' ;
63
- final editionId = currentVersionKey.getValueAsString ('EditionID' ) ?? '' ;
59
+ currentVersionKey.getStringValue ('DisplayVersion' ) ?? '' ;
60
+ final editionId = currentVersionKey.getStringValue ('EditionID' ) ?? '' ;
64
61
final installDate = DateTime .fromMillisecondsSinceEpoch (
65
- 1000 * (currentVersionKey.getValueAsInt ('InstallDate' ) ?? 0 ));
66
- final productId = currentVersionKey.getValueAsString ('ProductID' ) ?? '' ;
67
- var productName = currentVersionKey.getValueAsString ('ProductName' ) ?? '' ;
62
+ 1000 * (currentVersionKey.getIntValue ('InstallDate' ) ?? 0 ));
63
+ final productId = currentVersionKey.getStringValue ('ProductID' ) ?? '' ;
64
+ var productName = currentVersionKey.getStringValue ('ProductName' ) ?? '' ;
68
65
final registeredOwner =
69
- currentVersionKey.getValueAsString ('RegisteredOwner' ) ?? '' ;
70
- final releaseId = currentVersionKey.getValueAsString ('ReleaseId' ) ?? '' ;
66
+ currentVersionKey.getStringValue ('RegisteredOwner' ) ?? '' ;
67
+ final releaseId = currentVersionKey.getStringValue ('ReleaseId' ) ?? '' ;
71
68
72
69
final sqmClientKey = Registry .openPath (RegistryHive .localMachine,
73
70
path: r'SOFTWARE\Microsoft\SQMClient' );
74
- final machineId = sqmClientKey.getValueAsString ('MachineId' ) ?? '' ;
71
+ final machineId = sqmClientKey.getStringValue ('MachineId' ) ?? '' ;
75
72
76
73
GetSystemInfo (systemInfo);
77
74
@@ -138,14 +135,13 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
138
135
// We call this a first time to get the length of the string in characters,
139
136
// so we can allocate sufficient memory.
140
137
final nSize = calloc <DWORD >();
141
- GetComputerNameEx (
142
- COMPUTER_NAME_FORMAT .ComputerNameDnsFullyQualified , nullptr, nSize);
138
+ GetComputerNameEx (ComputerNameDnsFullyQualified , nullptr, nSize);
143
139
144
140
// Now allocate memory for a native string and call this a second time.
145
141
final lpBuffer = wsalloc (nSize.value);
146
142
try {
147
- final result = GetComputerNameEx (
148
- COMPUTER_NAME_FORMAT . ComputerNameDnsFullyQualified , lpBuffer, nSize);
143
+ final result =
144
+ GetComputerNameEx ( ComputerNameDnsFullyQualified , lpBuffer, nSize);
149
145
150
146
if (result != 0 ) {
151
147
return lpBuffer.toDartString ();
0 commit comments