CQuazaaSysInfo::CQuazaaSysInfo(QObject *parent) :
	QObject(parent)
{
#ifdef Q_OS_WIN
	bool canDetect = true;
	PGetNativeSystemInfo pGNSI = 0;

	m_bOsVersionInfoEx = false;
	m_nWindowsVersion = WindowsVersion::Windows;
	m_nWindowsEdition = WindowsEdition::EditionUnknown;
	memset(m_sServicePack, 0, sizeof(m_sServicePack));

	// Try calling GetVersionEx using the OSVERSIONINFOEX structure.
	ZeroMemory(&m_osvi, sizeof(OSVERSIONINFOEX));
	m_osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

	if( !(m_bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &m_osvi)) )
	{
		// If that fails, try using the OSVERSIONINFO structure.
		m_osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
		if (! GetVersionEx ( (OSVERSIONINFO *) &m_osvi) )
		canDetect = FALSE;
	}

	pGNSI = (PGetNativeSystemInfo) GetProcAddress(
		GetModuleHandle(L"kernel32.dll"),
		"GetNativeSystemInfo");

	if(0 != pGNSI) pGNSI(&m_SysInfo);
	else GetSystemInfo(&m_SysInfo);

	if(canDetect)
	{
		DetectWindowsVersion();
		DetectWindowsEdition();
		DetectWindowsServicePack();
	}
#endif
}
Esempio n. 2
0
SystemInfo::SystemInfo()
{
   BOOL canDetect = TRUE;
   PGetNativeSystemInfo pGNSI = NULL;

   m_bOsVersionInfoEx = FALSE;
   m_nWinVersion = Windows;
   m_nWinEdition = EditionUnknown;
   memset(m_szServicePack, 0, sizeof(m_szServicePack));

   // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
   ZeroMemory(&m_osvi, sizeof(OSVERSIONINFOEX));
   m_osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);

   if( !(m_bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &m_osvi)) )
   {
      // If that fails, try using the OSVERSIONINFO structure.
      m_osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
      if (! GetVersionEx ( (OSVERSIONINFO *) &m_osvi) ) 
         canDetect = FALSE;
   }

   pGNSI = (PGetNativeSystemInfo) GetProcAddress(
      GetModuleHandle(TEXT("kernel32.dll")),
      "GetNativeSystemInfo");

   if(NULL != pGNSI) pGNSI(&m_SysInfo);
   else GetSystemInfo(&m_SysInfo);

   if(canDetect)
   {
	   DetectWindowsVersion();
      DetectWindowsEdition();
      DetectWindowsServicePack();
   }
}