@@ -50,28 +50,25 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
5050 try {
5151 final currentVersionKey = Registry .openPath (RegistryHive .localMachine,
5252 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 ([]);
6158 final displayVersion =
62- currentVersionKey.getValueAsString ('DisplayVersion' ) ?? '' ;
63- final editionId = currentVersionKey.getValueAsString ('EditionID' ) ?? '' ;
59+ currentVersionKey.getStringValue ('DisplayVersion' ) ?? '' ;
60+ final editionId = currentVersionKey.getStringValue ('EditionID' ) ?? '' ;
6461 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' ) ?? '' ;
6865 final registeredOwner =
69- currentVersionKey.getValueAsString ('RegisteredOwner' ) ?? '' ;
70- final releaseId = currentVersionKey.getValueAsString ('ReleaseId' ) ?? '' ;
66+ currentVersionKey.getStringValue ('RegisteredOwner' ) ?? '' ;
67+ final releaseId = currentVersionKey.getStringValue ('ReleaseId' ) ?? '' ;
7168
7269 final sqmClientKey = Registry .openPath (RegistryHive .localMachine,
7370 path: r'SOFTWARE\Microsoft\SQMClient' );
74- final machineId = sqmClientKey.getValueAsString ('MachineId' ) ?? '' ;
71+ final machineId = sqmClientKey.getStringValue ('MachineId' ) ?? '' ;
7572
7673 GetSystemInfo (systemInfo);
7774
@@ -138,14 +135,13 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
138135 // We call this a first time to get the length of the string in characters,
139136 // so we can allocate sufficient memory.
140137 final nSize = calloc <DWORD >();
141- GetComputerNameEx (
142- COMPUTER_NAME_FORMAT .ComputerNameDnsFullyQualified , nullptr, nSize);
138+ GetComputerNameEx (ComputerNameDnsFullyQualified , nullptr, nSize);
143139
144140 // Now allocate memory for a native string and call this a second time.
145141 final lpBuffer = wsalloc (nSize.value);
146142 try {
147- final result = GetComputerNameEx (
148- COMPUTER_NAME_FORMAT . ComputerNameDnsFullyQualified , lpBuffer, nSize);
143+ final result =
144+ GetComputerNameEx ( ComputerNameDnsFullyQualified , lpBuffer, nSize);
149145
150146 if (result != 0 ) {
151147 return lpBuffer.toDartString ();
0 commit comments