Update Win32 from CPAN (from 0.40 to 0.41)
[perl.git] / cpan / Win32 / Win32.xs
index 2799290..f6d96b4 100644 (file)
@@ -39,6 +39,7 @@ typedef BOOL (__stdcall *PFNEqualSid)(PSID, PSID);
 typedef void* (__stdcall *PFNFreeSid)(PSID);\r
 typedef BOOL (__stdcall *PFNIsUserAnAdmin)(void);\r
 typedef BOOL (WINAPI *PFNGetProductInfo)(DWORD, DWORD, DWORD, DWORD, DWORD*);\r
+typedef void (WINAPI *PFNGetNativeSystemInfo)(LPSYSTEM_INFO lpSystemInfo);\r
 \r
 #ifndef CSIDL_MYMUSIC\r
 #   define CSIDL_MYMUSIC              0x000D\r
@@ -792,9 +793,17 @@ XS(w32_GetChipName)
 {\r
     dXSARGS;\r
     SYSTEM_INFO sysinfo;\r
+    HMODULE module;\r
+    PFNGetNativeSystemInfo pfnGetNativeSystemInfo;\r
 \r
     Zero(&sysinfo,1,SYSTEM_INFO);\r
-    GetSystemInfo(&sysinfo);\r
+    module = GetModuleHandle("kernel32.dll");\r
+    GETPROC(GetNativeSystemInfo);\r
+    if (pfnGetNativeSystemInfo)\r
+        pfnGetNativeSystemInfo(&sysinfo);\r
+    else\r
+        GetSystemInfo(&sysinfo);\r
+\r
     /* XXX docs say dwProcessorType is deprecated on NT */\r
     XSRETURN_IV(sysinfo.dwProcessorType);\r
 }\r
@@ -1659,7 +1668,7 @@ XS(w32_GetSystemMetrics)
     if (items != 1)\r
        Perl_croak(aTHX_ "usage: Win32::GetSystemMetrics($index)");\r
 \r
-    XSRETURN_IV(GetSystemMetrics(SvIV(ST(0))));\r
+    XSRETURN_IV(GetSystemMetrics((int)SvIV(ST(0))));\r
 }\r
 \r
 XS(w32_GetProductInfo)\r