[path_provider_windows] Update to ffi 2.0.0 (#5853)

* Use Win32 type aliases

* Generated file update

* Bump version

* Bump pub dependency in path_provider_linux

* Add integration_test dev dependency

* Revert "Add integration_test dev dependency"

This reverts commit 40e77789de8fb98fd07f4f054ed3fa1521dc29be.

* Address review comments
diff --git a/packages/path_provider/path_provider_linux/CHANGELOG.md b/packages/path_provider/path_provider_linux/CHANGELOG.md
index c9c4bb3..b69ec90 100644
--- a/packages/path_provider/path_provider_linux/CHANGELOG.md
+++ b/packages/path_provider/path_provider_linux/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.1.7
+
+* Bumps ffi dependency to match path_provider_windows.
+
 ## 2.1.6
 
 * Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors
@@ -54,20 +58,24 @@
 
 * Check in linux/ directory for example/
 
-## 0.1.1	- NOT PUBLISHED
+## 0.1.1 - NOT PUBLISHED
+
 * Reverts changes on 0.1.0, which broke the tree.
 
+## 0.1.0 - NOT PUBLISHED
 
-## 0.1.0	- NOT PUBLISHED
 * This release updates getApplicationSupportPath to use the application ID instead of the executable name.
   * No migration is provided, so any older apps that were using this path will now have a different directory.
 
 ## 0.0.1+2
+
 * This release updates the example to depend on the endorsed plugin rather than relative path
 
 ## 0.0.1+1
+
 * This updates the readme and pubspec and example to reflect the endorsement of this implementation of `path_provider`
 
 ## 0.0.1
+
 * The initial implementation of path\_provider for Linux
   * Implements getApplicationSupportPath, getApplicationDocumentsPath, getDownloadsPath, and getTemporaryPath
diff --git a/packages/path_provider/path_provider_linux/pubspec.yaml b/packages/path_provider/path_provider_linux/pubspec.yaml
index 46e248f..c0b7954 100644
--- a/packages/path_provider/path_provider_linux/pubspec.yaml
+++ b/packages/path_provider/path_provider_linux/pubspec.yaml
@@ -2,7 +2,7 @@
 description: Linux implementation of the path_provider plugin
 repository: https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_linux
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
-version: 2.1.6
+version: 2.1.7
 
 environment:
   sdk: ">=2.12.0 <3.0.0"
@@ -16,7 +16,7 @@
         dartPluginClass: PathProviderLinux
 
 dependencies:
-  ffi: ^1.1.2
+  ffi: ">=1.1.2 <3.0.0"
   flutter:
     sdk: flutter
   path: ^1.8.0
diff --git a/packages/path_provider/path_provider_windows/CHANGELOG.md b/packages/path_provider/path_provider_windows/CHANGELOG.md
index f48093b..3967c38 100644
--- a/packages/path_provider/path_provider_windows/CHANGELOG.md
+++ b/packages/path_provider/path_provider_windows/CHANGELOG.md
@@ -1,6 +1,7 @@
-## 2.0.7
+## 2.1.0
 
-* Added support for unicode encoded VERSIONINFO
+* Upgrades `package:ffi` dependency to 2.0.0.
+* Added support for unicode encoded VERSIONINFO.
 * Minor fixes for new analysis options.
 
 ## 2.0.6
diff --git a/packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake b/packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake
index 4d10c25..b93c4c3 100644
--- a/packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake
+++ b/packages/path_provider/path_provider_windows/example/windows/flutter/generated_plugins.cmake
@@ -5,6 +5,9 @@
 list(APPEND FLUTTER_PLUGIN_LIST
 )
 
+list(APPEND FLUTTER_FFI_PLUGIN_LIST
+)
+
 set(PLUGIN_BUNDLED_LIBRARIES)
 
 foreach(plugin ${FLUTTER_PLUGIN_LIST})
@@ -13,3 +16,8 @@
   list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
   list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
 endforeach(plugin)
+
+foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
+  add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
+  list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
+endforeach(ffi_plugin)
diff --git a/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart b/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart
index 9a8b0cf..6a9c138 100644
--- a/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart
+++ b/packages/path_provider/path_provider_windows/lib/src/path_provider_windows_real.dart
@@ -50,7 +50,7 @@
     }
     final Pointer<Utf16> keyPath =
         TEXT('\\StringFileInfo\\$language$encoding\\$key');
-    final Pointer<Uint32> length = calloc<Uint32>();
+    final Pointer<UINT> length = calloc<UINT>();
     final Pointer<Pointer<Utf16>> valueAddress = calloc<Pointer<Utf16>>();
     try {
       if (VerQueryValue(versionInfo, keyPath, valueAddress, length) == 0) {
@@ -192,10 +192,9 @@
     String? companyName;
     String? productName;
 
-    final Pointer<Utf16> moduleNameBuffer =
-        calloc<Uint16>(MAX_PATH + 1).cast<Utf16>();
-    final Pointer<Uint32> unused = calloc<Uint32>();
-    Pointer<Uint8>? infoBuffer;
+    final Pointer<Utf16> moduleNameBuffer = wsalloc(MAX_PATH + 1);
+    final Pointer<DWORD> unused = calloc<DWORD>();
+    Pointer<BYTE>? infoBuffer;
     try {
       // Get the module name.
       final int moduleNameLength =
@@ -208,7 +207,7 @@
       // From that, load the VERSIONINFO resource
       final int infoSize = GetFileVersionInfoSize(moduleNameBuffer, unused);
       if (infoSize != 0) {
-        infoBuffer = calloc<Uint8>(infoSize);
+        infoBuffer = calloc<BYTE>(infoSize);
         if (GetFileVersionInfo(moduleNameBuffer, 0, infoSize, infoBuffer) ==
             0) {
           calloc.free(infoBuffer);
diff --git a/packages/path_provider/path_provider_windows/pubspec.yaml b/packages/path_provider/path_provider_windows/pubspec.yaml
index a995b9f..4e99be7 100644
--- a/packages/path_provider/path_provider_windows/pubspec.yaml
+++ b/packages/path_provider/path_provider_windows/pubspec.yaml
@@ -2,11 +2,11 @@
 description: Windows implementation of the path_provider plugin
 repository: https://github.com/flutter/plugins/tree/main/packages/path_provider/path_provider_windows
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
-version: 2.0.7
+version: 2.1.0
 
 environment:
-  sdk: ">=2.12.0 <3.0.0"
-  flutter: ">=2.8.0"
+  sdk: ">=2.17.0 <3.0.0"
+  flutter: ">=3.0.0"
 
 flutter:
   plugin:
@@ -16,7 +16,7 @@
         dartPluginClass: PathProviderWindows
 
 dependencies:
-  ffi: ^1.0.0
+  ffi: ^2.0.0
   flutter:
     sdk: flutter
   path: ^1.8.0