Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 77a8040

Browse files
committed
Revert "Support unicode encoded version info values"
This reverts commit 1133a8b.
1 parent 24af049 commit 77a8040

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,21 @@ class VersionInfoQuerier {
2525
if (versionInfo == null) {
2626
return null;
2727
}
28-
const List<String> languageCodes = <String>[
29-
'040904e4', // en-US, CP1252
30-
'040904b0', // en-US, Unicode
31-
];
32-
for (final String code in languageCodes) {
33-
final Pointer<Utf16> keyPath = TEXT('\\StringFileInfo\\$code\\$key');
34-
final Pointer<Uint32> length = calloc<Uint32>();
35-
final Pointer<Pointer<Utf16>> valueAddress = calloc<Pointer<Utf16>>();
36-
try {
37-
if (VerQueryValue(versionInfo, keyPath, valueAddress, length) != 0) {
38-
return valueAddress.value.toDartString();
39-
}
40-
} finally {
41-
calloc.free(keyPath);
42-
calloc.free(length);
43-
calloc.free(valueAddress);
28+
const String kEnUsLanguageCode = '040904e4';
29+
final Pointer<Utf16> keyPath =
30+
TEXT('\\StringFileInfo\\$kEnUsLanguageCode\\$key');
31+
final Pointer<Uint32> length = calloc<Uint32>();
32+
final Pointer<Pointer<Utf16>> valueAddress = calloc<Pointer<Utf16>>();
33+
try {
34+
if (VerQueryValue(versionInfo, keyPath, valueAddress, length) == 0) {
35+
return null;
4436
}
37+
return valueAddress.value.toDartString();
38+
} finally {
39+
calloc.free(keyPath);
40+
calloc.free(length);
41+
calloc.free(valueAddress);
4542
}
46-
return null;
4743
}
4844
}
4945

0 commit comments

Comments
 (0)