kernel32: fix cpu detection on NetBSD
Austin English
austinenglish at gmail.com
Fri Jan 16 16:18:11 CST 2009
I submitted OpenBSD's patch for CPU detection a while back
(http://www.winehq.org/pipermail/wine-patches/2009-January/067002.html).
Francois sent a 'more correct' one
(http://www.winehq.org/pipermail/wine-patches/2009-January/067382.html),
but that one is broken on NetBSD/OpenBSD
(http://bugs.winehq.org/show_bug.cgi?id=16927). With the below
changes, it works again, but I'm not sure it's correct. Comments
appreciated:
diff --git a/dlls/kernel32/cpu.c b/dlls/kernel32/cpu.c
index 95ac469..5bd3a38 100644
--- a/dlls/kernel32/cpu.c
+++ b/dlls/kernel32/cpu.c
@@ -547,7 +547,7 @@ VOID WINAPI GetSystemInfo(
#elif defined (__NetBSD__)
{
int mib[2];
- int value;
+ int value[2];
size_t val_len;
char model[256];
char *cpuclass;
@@ -578,7 +579,7 @@ VOID WINAPI GetSystemInfo(
mib[1] = HW_NCPU;
val_len = sizeof(value);
if (sysctl(mib, 2, &value, &val_len, NULL, 0) >= 0)
- if (value > cachedsi.dwNumberOfProcessors)
+ if (value[0] > cachedsi.dwNumberOfProcessors)
cachedsi.dwNumberOfProcessors = value[0];
mib[1] = HW_MODEL;
val_len = sizeof(model)-1;
--
-Austin
More information about the wine-devel
mailing list