diff --git a/bazaar/SysInfo/OS.cpp b/bazaar/SysInfo/OS.cpp index 607502a74..18d4160b1 100644 --- a/bazaar/SysInfo/OS.cpp +++ b/bazaar/SysInfo/OS.cpp @@ -260,8 +260,8 @@ using namespace Upp; #define VER_SUITE_WH_SERVER 0x00008000 #endif -typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); -typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); +//typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); +//typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); bool GetOsInfo(String &kernel, String &kerVersion, String &kerArchitecture, String &distro, String &distVersion, String &desktop, String &deskVersion) @@ -273,7 +273,7 @@ bool GetOsInfo(String &kernel, String &kerVersion, String &kerArchitecture, Stri ZeroMemory(&si, sizeof(SYSTEM_INFO)); // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. - static PGNSI pGNSI = (PGNSI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); + PGNSI pGNSI = Get_GetNativeSystemInfo(); if(NULL != pGNSI) pGNSI(&si); else @@ -324,7 +324,7 @@ bool GetOsInfo(String &kernel, String &kerVersion, String &kerArchitecture, Stri else kernel.Cat(" Server 2008"); } - static PGPI pGPI = (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo"); + PGPI pGPI = Get_GetProductInfo(); DWORD dwType; if (pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType)) { switch(dwType) { diff --git a/bazaar/SysInfo/OSwin.c b/bazaar/SysInfo/OSwin.c new file mode 100644 index 000000000..9a315b5a0 --- /dev/null +++ b/bazaar/SysInfo/OSwin.c @@ -0,0 +1,16 @@ +#ifdef _WIN32 + + +#include +#include "OSwin.h" + +PGNSI Get_GetNativeSystemInfo() { + return (PGNSI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetNativeSystemInfo"); +} + +PGPI Get_GetProductInfo() { + return (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo"); +} + + +#endif \ No newline at end of file diff --git a/bazaar/SysInfo/OSwin.h b/bazaar/SysInfo/OSwin.h new file mode 100644 index 000000000..bcc7d24f0 --- /dev/null +++ b/bazaar/SysInfo/OSwin.h @@ -0,0 +1,18 @@ +#ifndef _SysInfo_OSwin_h_ +#define _SysInfo_OSwin_h_ + +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); +typedef BOOL (WINAPI *PGPI)(DWORD, DWORD, DWORD, DWORD, PDWORD); + +#ifdef __cplusplus +extern "C" { +#endif + +PGNSI Get_GetNativeSystemInfo(); +PGPI Get_GetProductInfo(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/bazaar/SysInfo/SysInfo.upp b/bazaar/SysInfo/SysInfo.upp index c04bd2161..1658a0e5a 100644 --- a/bazaar/SysInfo/SysInfo.upp +++ b/bazaar/SysInfo/SysInfo.upp @@ -19,6 +19,8 @@ file SysInfo.h, SysInfo_in.h, OS.cpp, + OSwin.c, + OSwin.h, srcdoc.tpp, ScreenGrab.cpp, MouseKey.cpp, diff --git a/bazaar/SysInfo/SysInfo_in.h b/bazaar/SysInfo/SysInfo_in.h index 43d6db826..a16283094 100644 --- a/bazaar/SysInfo/SysInfo_in.h +++ b/bazaar/SysInfo/SysInfo_in.h @@ -69,5 +69,7 @@ #define _Browser_Browser_h #include "SysInfo.h" - +#ifdef _WIN32 +#include "OSwin.h" +#endif #endif