*SysInfo: Solved problem in Linux

git-svn-id: svn://ultimatepp.org/upp/trunk@13646 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2019-10-16 05:56:53 +00:00
parent 85e9dbd1a9
commit c3c9e0727f
5 changed files with 43 additions and 5 deletions

View file

@ -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) {

16
bazaar/SysInfo/OSwin.c Normal file
View file

@ -0,0 +1,16 @@
#ifdef _WIN32
#include <windows.h>
#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

18
bazaar/SysInfo/OSwin.h Normal file
View file

@ -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

View file

@ -19,6 +19,8 @@ file
SysInfo.h,
SysInfo_in.h,
OS.cpp,
OSwin.c,
OSwin.h,
srcdoc.tpp,
ScreenGrab.cpp,
MouseKey.cpp,

View file

@ -69,5 +69,7 @@
#define _Browser_Browser_h
#include "SysInfo.h"
#ifdef _WIN32
#include "OSwin.h"
#endif
#endif