Zebediah Figura : setupapi: Check for compatible platforms in SetupDiBuildDriverInfoList().
Alexandre Julliard
julliard at winehq.org
Tue May 21 16:45:22 CDT 2019
Module: wine
Branch: master
Commit: d22e7d6a4e56f2e1331f3a327e38275924a32990
URL: https://source.winehq.org/git/wine.git/?a=commit;h=d22e7d6a4e56f2e1331f3a327e38275924a32990
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Mon May 20 23:55:44 2019 -0500
setupapi: Check for compatible platforms in SetupDiBuildDriverInfoList().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/setupapi/devinst.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c
index d46aa82..c979f51 100644
--- a/dlls/setupapi/devinst.c
+++ b/dlls/setupapi/devinst.c
@@ -4111,10 +4111,37 @@ static BOOL device_matches_id(const struct device *device, const WCHAR *id_type,
return FALSE;
}
+static BOOL version_is_compatible(const WCHAR *version)
+{
+ const WCHAR *machine_ext = NtPlatformExtension + 1, *p;
+ size_t len = strlenW(version);
+ BOOL wow64;
+
+ /* We are only concerned with architecture. */
+ if ((p = strchrW(version, '.')))
+ len = p - version;
+
+ if (!strncmpiW(version, NtExtension + 1, len))
+ return TRUE;
+
+ if (IsWow64Process(GetCurrentProcess(), &wow64) && wow64)
+ {
+#ifdef __i386__
+ static const WCHAR wow_ext[] = {'N','T','a','m','d','6','4',0};
+ machine_ext = wow_ext;
+#elif defined(__arm__)
+ static const WCHAR wow_ext[] = {'N','T','a','r','m','6','4',0};
+ machine_ext = wow_ext;
+#endif
+ }
+
+ return !strncmpiW(version, machine_ext, len);
+}
+
static void enum_compat_drivers_from_file(struct device *device, const WCHAR *path)
{
static const WCHAR manufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0};
- WCHAR mfg_name[LINE_LEN], mfg_key[LINE_LEN], mfg_key_ext[LINE_LEN], id[MAX_DEVICE_ID_LEN];
+ WCHAR mfg_name[LINE_LEN], mfg_key[LINE_LEN], mfg_key_ext[LINE_LEN], id[MAX_DEVICE_ID_LEN], version[MAX_DEVICE_ID_LEN];
INFCONTEXT ctx;
DWORD i, j, k;
HINF hinf;
@@ -4130,6 +4157,21 @@ static void enum_compat_drivers_from_file(struct device *device, const WCHAR *pa
if (!SetupGetStringFieldW(&ctx, 1, mfg_key, ARRAY_SIZE(mfg_key), NULL))
strcpyW(mfg_key, mfg_name);
+ if (SetupGetFieldCount(&ctx) >= 2)
+ {
+ BOOL compatible = FALSE;
+ for (j = 2; SetupGetStringFieldW(&ctx, j, version, ARRAY_SIZE(version), NULL); ++j)
+ {
+ if (version_is_compatible(version))
+ {
+ compatible = TRUE;
+ break;
+ }
+ }
+ if (!compatible)
+ continue;
+ }
+
if (!SetupDiGetActualSectionToInstallW(hinf, mfg_key, mfg_key_ext, ARRAY_SIZE(mfg_key_ext), NULL, NULL))
{
WARN("Failed to find section for %s, skipping.\n", debugstr_w(mfg_key));
More information about the wine-cvs
mailing list