Ejemplo n.º 1
0
eWinPlatform Getplatform(void)
{
	OSVERSIONINFOA Osv;

	memset(&Osv, 0, sizeof(Osv));
	Osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
	if (!GetVersionExA(&Osv))
	{
		memset(&Osv, 0, sizeof(Osv));
		Osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
		if (!GetVersionExA(&Osv))
			return WIN_UNKNOWN;
	}

	switch(Osv.dwPlatformId)
	{
	case VER_PLATFORM_WIN32s:
		return WIN_3X;

	case VER_PLATFORM_WIN32_WINDOWS:
		return WIN_9X;

	case VER_PLATFORM_WIN32_NT:
		return WIN_NT;

	default:
		return WIN_UNKNOWN;
	}
}
Ejemplo n.º 2
0
bool CheckFor98Mill()
{
	static bool needOsCheck = true;
	static bool is98Mill = false;

	if (needOsCheck)
	{
		bool invalid = false;
		OSVERSIONINFOEXA osvi;
		ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));

		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
		if( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
		{
			osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOA);
			if ( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
				return false;
		}

		needOsCheck = false;
		is98Mill = osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS; // let's check Win95, 98, *AND* ME.
	}

	return is98Mill;
}
Ejemplo n.º 3
0
bool CheckForVista()
{
	static bool needOsCheck = true;
	static bool isVista = false;

	if (needOsCheck)
	{
		bool invalid = false;
		OSVERSIONINFOEXA osvi;
		ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));

		osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
		if( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
		{
			osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOA);
			if ( GetVersionExA((LPOSVERSIONINFOA)&osvi) == 0)
				return false;
		}

		needOsCheck = false;
		isVista = osvi.dwMajorVersion >= 6;
	}

	return isVista;
}
Ejemplo n.º 4
0
static BOOL iResolveAPI2(tVerifyTrustData* d)
{
	d->m_hWintrustDll = LoadLibraryA("WINTRUST");
	if (!d->m_hWintrustDll)
		return FALSE;
	d->m_hCrypt32Dll = LoadLibraryA("CRYPT32");
	if (!d->m_hCrypt32Dll)
		return FALSE;
	
	memset(&d->vi, 0, sizeof(OSVERSIONINFOA));
	d->vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
	if ( !GetVersionExA(&d->vi) )
		return FALSE;

	_RESOLVE_API(d->m_hWintrustDll, WinVerifyTrust);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminAcquireContext);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminCalcHashFromFileHandle);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminEnumCatalogFromHash);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATCatalogInfoFromContext);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminReleaseCatalogContext);
	_RESOLVE_API(d->m_hWintrustDll, CryptCATAdminReleaseContext);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertOpenStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertEnumCertificatesInStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertGetCertificateChain);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFindChainInStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertVerifyCertificateChainPolicy);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFreeCertificateChainEngine);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFreeCertificateChain);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertFreeCertificateContext);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertCloseStore);
	_RESOLVE_API(d->m_hCrypt32Dll,  CertGetNameStringA);
	return TRUE;
}
Ejemplo n.º 5
0
BOOL DXUTGetMonitorInfo(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
{
    static bool s_bInited = false;
    static LPGETMONITORINFO s_pFnGetMonitorInfo = NULL;
    if(!s_bInited)        
    {
        s_bInited = true;
        HMODULE hUser32 = GetModuleHandle(L"USER32");
        if (hUser32) 
        {
            OSVERSIONINFOA osvi = {0}; osvi.dwOSVersionInfoSize = sizeof(osvi); GetVersionExA((OSVERSIONINFOA*)&osvi);
            bool bNT = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId);    
            s_pFnGetMonitorInfo = (LPGETMONITORINFO) (bNT ? GetProcAddress(hUser32,"GetMonitorInfoW") : GetProcAddress(hUser32,"GetMonitorInfoA"));
        }
    }

    if(s_pFnGetMonitorInfo) 
        return s_pFnGetMonitorInfo(hMonitor, lpMonitorInfo);

    RECT rcWork;
    if ((hMonitor == DXUT_PRIMARY_MONITOR) && lpMonitorInfo && (lpMonitorInfo->cbSize >= sizeof(MONITORINFO)) && SystemParametersInfoA(SPI_GETWORKAREA, 0, &rcWork, 0))
    {
        lpMonitorInfo->rcMonitor.left = 0;
        lpMonitorInfo->rcMonitor.top  = 0;
        lpMonitorInfo->rcMonitor.right  = GetSystemMetrics(SM_CXSCREEN);
        lpMonitorInfo->rcMonitor.bottom = GetSystemMetrics(SM_CYSCREEN);
        lpMonitorInfo->rcWork = rcWork;
        lpMonitorInfo->dwFlags = MONITORINFOF_PRIMARY;
        return TRUE;
    }
    return FALSE;
}
Ejemplo n.º 6
0
void do_date(void)
{
    OSVERSIONINFOA verinfo;
    CHAR buf[128];
    time_t t = time(NULL);
    DWORD dwSize;
    CHAR szComp[MAX_PATH], szUser[MAX_PATH];

    // OS info
    verinfo.dwOSVersionInfoSize = sizeof(verinfo);
    GetVersionExA(&verinfo);
    sprintf(buf, "Microsoft Windows [Version %u.%u.%u]",
        verinfo.dwMajorVersion, verinfo.dwMinorVersion, verinfo.dwBuildNumber);
    if (nyarlathotep_p)
        do_nyarlathotep_buffer(buf);
    puts(buf);

    // computer_name - user_name
    dwSize = MAX_PATH;
    GetComputerNameA(szComp, &dwSize);
    dwSize = MAX_PATH;
    GetUserNameA(szUser, &dwSize);
    sprintf(buf, "%s - %s", szComp, szUser);
    if (nyarlathotep_p)
        do_nyarlathotep_buffer(buf);
    puts(buf);

    // Thu Nov 28 14:52:58     2013
    strftime(buf, 64, "%a %b %d %H:%M:%S     %Y", localtime(&t));
    if (nyarlathotep_p)
        do_nyarlathotep_buffer(buf);
    puts(buf);
}
Ejemplo n.º 7
0
 osplatform_getter() : m_osplatform( 0 )
 {
     OSVERSIONINFOA osvi;
     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
     if( GetVersionExA( & osvi ) )
         m_osplatform = osvi.dwPlatformId;
 }
Ejemplo n.º 8
0
bool CNtDriverControl::IsWindowsNt()
{
	OSVERSIONINFOEX  OSVer;

	OSVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
	OSVer.dwOSVersionInfoSize = sizeof(OSVer);

	if (!GetVersionExA((OSVERSIONINFOA *)&OSVer))
		return false;

	switch(OSVer.dwPlatformId << 16 | OSVer.dwMajorVersion << 8 | OSVer.dwMinorVersion)
	{

	  case VER_PLATFORM_WIN32_NT     <<16|0x0500| 1:
		  if(!GetSystemMetrics(87))
			return TRUE;
		  
	  default:
		  MessageBox (0
			  , _T("DeepMonitor designed only for Windows XP !")
			  , _T("Information")
			  , MB_OK);
		  return false;
	
	}
	
	return false;
	
}
Ejemplo n.º 9
0
char *iupdrvGetSystemVersion(void)
{
  char *str = iupStrGetMemory(256);
  OSVERSIONINFOEXA osvi;
  SYSTEM_INFO si;

  ZeroMemory(&si, sizeof(SYSTEM_INFO));
  GetSystemInfo(&si);

  ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));
  osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
  GetVersionExA((OSVERSIONINFOA*)&osvi);

  sprintf(str, "%d.%d.%d", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion, (int)osvi.dwBuildNumber);

  /* Display service pack (if any). */
  if (osvi.szCSDVersion && osvi.szCSDVersion[0]!=0)
  {
    strcat(str, " ");
    strcat(str, osvi.szCSDVersion);
  }

  if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
    strcat(str, " (IA64)");
  else if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
    strcat(str, " (x64)");
  else
    strcat(str, " (x86)");

  return str;
}
Ejemplo n.º 10
0
HANDLE my_CreateRemoteThread(HANDLE hRemoteProc, LPTHREAD_START_ROUTINE pThreadFun, LPVOID pThreadData) {

	/*
	win vista/7 NtCreateThreadEx
	win xp/8 CreateRemoteThread
	*/

	BOOL bCrossSession = FALSE;

	OSVERSIONINFOA sysVersion;
	sysVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);

	if (GetVersionExA(&sysVersion)) {
		if ((sysVersion.dwMajorVersion >= 6) && (sysVersion.dwMinorVersion != 2)) {
			bCrossSession = TRUE;
		}
	}

	HANDLE hThread = NULL;

	if (bCrossSession) {
		hThread = NtCreateThreadEx_1(hRemoteProc, pThreadFun, pThreadData);
	} else {
		DWORD dwThreadId = 0;
		hThread = CreateRemoteThread(hRemoteProc, NULL, 0, pThreadFun, pThreadData, 0, &dwThreadId);
	}

	return hThread;
}
Ejemplo n.º 11
0
tBOOL __stdcall DllMain( tPTR hInstance, tDWORD dwReason, tERROR* pError ) {
	// tDWORD count;
	static OSVERSIONINFOA osvi;

	switch( dwReason ) {
		case DLL_PROCESS_ATTACH:
			{
				memset(&osvi, 0, sizeof(OSVERSIONINFOA));
				osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
				if( !GetVersionExA(&osvi) || osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS )
				{
					// iCheckerSA doesn't support Windows 9x
					return FALSE;
				}
			}
			break;			
		case DLL_PROCESS_DETACH:
		case DLL_THREAD_ATTACH :
		case DLL_THREAD_DETACH :
			break;

		case PRAGUE_PLUGIN_LOAD :
			g_root = (hROOT)hInstance;
			*pError = errOK;

			//resolve  my imports
			//if ( PR_FAIL(*pError=CALL_Root_ResolveImportTable(g_root,&count,import_table_variable...,PID_ICHECKERSA)) ) {
			//   PR_TRACE(( g_root, prtERROR, "cannot resolve import table for ..." ));
			//   return cFALSE;
			//}

			//register my exports
			//CALL_Root_RegisterExportTable( g_root, &count, export_table_..., PID_ICHECKERSA );

			//register my custom property ids
			//if ( PR_FAIL(*pError=CALL_Root_RegisterCustomPropId(g_root,&some_propid_variable,"some_property_name",pTYPE_DWORD)) ) {
			//  PR_TRACE(( g_root, prtERROR, "cannot register custom property ..." ));
			//  return cFALSE;
			//}

			// register my interfaces
			if ( PR_FAIL(*pError=IChecker_Register(g_root)) ) {
				PR_TRACE(( g_root, prtERROR, "cannot register \"IChecker\" interface"));
				return cFALSE;
			}
			break;

		case PRAGUE_PLUGIN_UNLOAD :
			// free system resources
			// unregister my custom property ids -- you can drop it, kernel do it by itself
			// release    my imports		         -- you can drop it, kernel do it by itself
			// unregister my exports		         -- you can drop it, kernel do it by itself
			// unregister my interfaces          -- you can drop it, kernel do it by itself
			g_root = NULL;
			break;
	}
	return cTRUE;
}
Ejemplo n.º 12
0
void ntlm_get_version_info(NTLM_VERSION_INFO* versionInfo)
{
	OSVERSIONINFOA osVersionInfo;
	osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
	GetVersionExA(&osVersionInfo);
	versionInfo->ProductMajorVersion = (UINT8) osVersionInfo.dwMajorVersion;
	versionInfo->ProductMinorVersion = (UINT8) osVersionInfo.dwMinorVersion;
	versionInfo->ProductBuild = (UINT16) osVersionInfo.dwBuildNumber;
	ZeroMemory(versionInfo->Reserved, sizeof(versionInfo->Reserved));
	versionInfo->NTLMRevisionCurrent = NTLMSSP_REVISION_W2K3;
}
Ejemplo n.º 13
0
//--------------------------------------------------------------
BOOL WINAPI W_IsUnicodeSystem()
{
    static BOOL g_fWAPI = -2;
    if (-2 == g_fWAPI)
    {
        OSVERSIONINFOA osvi;
        osvi.dwOSVersionInfoSize = sizeof(osvi);
        GetVersionExA(&osvi);
        g_fWAPI = (VER_PLATFORM_WIN32_NT == osvi.dwPlatformId);
    }
    return g_fWAPI;
}
Ejemplo n.º 14
0
void getOSInfo( char *os_info )
{
	OSVERSIONINFOEXA os;
	memset( &os, 0, sizeof(os) );
	os.dwOSVersionInfoSize = sizeof(os);
	if( GetVersionExA( (OSVERSIONINFOA *)&os ) )
	{
		sprintf( os_info, "%d.%d.%d sp %d.%d",
			os.dwMajorVersion, os.dwMinorVersion, os.dwBuildNumber,
			(int)os.wServicePackMajor, (int)os.wServicePackMinor );
	}
	else log_error( LOG_ERROR, "GetVersionExA(): error!\n" );
}
Ejemplo n.º 15
0
void mork_fileflush(FILE * file)
{
  fflush(file);
#ifndef WINCE
  OSVERSIONINFOA vi = { sizeof(OSVERSIONINFOA) };
  if ((GetVersionExA(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS))
  {
    // Win9x/ME
    int fd = fileno(file);
    HANDLE fh = (HANDLE)_get_osfhandle(fd);
    FlushFileBuffers(fh);
  }
#endif
}
    void Platform_Windows::PlatformVersion(string& aVersion)
    {
        //Setup and initialize version struct
        OSVERSIONINFOA osVersion;
        ZeroMemory(&osVersion, sizeof(OSVERSIONINFOA));
        osVersion.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);

#pragma warning(push)
#pragma warning(disable : 4996)

        //Get the OS version
        GetVersionExA(&osVersion);

#pragma warning(pop)

        //String stream used to convert the numeric version
        stringstream version;

        //Convert the version to a string
        if(osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion == 3)
        {
            version << "8.1";
        }
        else if(osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion == 2)
        {
            version << "8";
        }
        else if(osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion == 1)
        {
            version << "7";
        }
        else if(osVersion.dwMajorVersion == 6 && osVersion.dwMinorVersion == 0)
        {
            version << "Vista";
        }
        else if(osVersion.dwMajorVersion == 5 && (osVersion.dwMinorVersion == 1 || osVersion.dwMinorVersion == 2))
        {
            version << "XP";
        }
        else if(osVersion.dwMajorVersion == 5 && osVersion.dwMinorVersion == 0)
        {
            version << "2000";
        }

        //Set the return version
        version << " (Build " << osVersion.dwBuildNumber << ": " << osVersion.szCSDVersion << ")";
        aVersion = string(version.str());
    }
Ejemplo n.º 17
0
void CrashLog_LogOSVersion(char *buffer)
{
	OSVERSIONINFOA os;
	os.dwOSVersionInfoSize = sizeof(os);
	GetVersionExA(&os);

	sprintf(buffer + strlen(buffer),
			"Operating system:\n"
			" Name:     Windows\n"
			" Release:  %d.%d.%d (%s)\n",
			(int)os.dwMajorVersion,
			(int)os.dwMinorVersion,
			(int)os.dwBuildNumber,
			os.szCSDVersion
	);
}
Ejemplo n.º 18
0
/* virtual */ char *CrashLogWindows::LogOSVersion(char *buffer, const char *last) const
{
	_OSVERSIONINFOA os;
	os.dwOSVersionInfoSize = sizeof(os);
	GetVersionExA(&os);

	return buffer + seprintf(buffer, last,
			"Operating system:\n"
			" Name:     Windows\n"
			" Release:  %d.%d.%d (%s)\n",
			(int)os.dwMajorVersion,
			(int)os.dwMinorVersion,
			(int)os.dwBuildNumber,
			os.szCSDVersion
	);

}
Ejemplo n.º 19
0
static void test_GetVersionEx(void)
{
    OSVERSIONINFOA infoA;
    OSVERSIONINFOEXA infoExA;
    BOOL ret;

    if (0)
    {
        /* Silently crashes on XP */
        GetVersionExA(NULL);
    }

    SetLastError(0xdeadbeef);
    memset(&infoA,0,sizeof infoA);
    ret = GetVersionExA(&infoA);
    ok(!ret, "Expected GetVersionExA to fail\n");
    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
        GetLastError() == 0xdeadbeef /* Win9x */,
        "Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
        GetLastError());

    SetLastError(0xdeadbeef);
    infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA) / 2;
    ret = GetVersionExA(&infoA);
    ok(!ret, "Expected GetVersionExA to fail\n");
    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
        GetLastError() == 0xdeadbeef /* Win9x */,
        "Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
        GetLastError());

    SetLastError(0xdeadbeef);
    infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA) * 2;
    ret = GetVersionExA(&infoA);
    ok(!ret, "Expected GetVersionExA to fail\n");
    ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER ||
        GetLastError() == 0xdeadbeef /* Win9x */,
        "Expected ERROR_INSUFFICIENT_BUFFER or 0xdeadbeef (Win9x), got %d\n",
        GetLastError());

    SetLastError(0xdeadbeef);
    infoA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
    ret = GetVersionExA(&infoA);
    ok(ret, "Expected GetVersionExA to succeed\n");
    ok(GetLastError() == 0xdeadbeef,
        "Expected 0xdeadbeef, got %d\n", GetLastError());

    SetLastError(0xdeadbeef);
    infoExA.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
    ret = GetVersionExA((OSVERSIONINFOA *)&infoExA);
    ok(ret ||
       broken(ret == 0), /* win95 */
       "Expected GetVersionExA to succeed\n");
}
Ejemplo n.º 20
0
/***********************************************************************
 *          GetWinFlags   (KERNEL.132)
 */
DWORD WINAPI GetWinFlags16(void)
{
    static const long cpuflags[5] = { WF_CPU086, WF_CPU186, WF_CPU286, WF_CPU386, WF_CPU486 };
    SYSTEM_INFO si;
    OSVERSIONINFOA ovi;
    DWORD result;

    GetSystemInfo(&si);

    /* There doesn't seem to be any Pentium flag.  */
    result = cpuflags[min(si.wProcessorLevel, 4)] | WF_ENHANCED | WF_PMODE | WF_80x87 | WF_PAGING;
    if (si.wProcessorLevel >= 4) result |= WF_HASCPUID;
    ovi.dwOSVersionInfoSize = sizeof(ovi);
    GetVersionExA(&ovi);
    if (ovi.dwPlatformId == VER_PLATFORM_WIN32_NT)
        result |= WF_WIN32WOW; /* undocumented WF_WINNT */
    return result;
}
Ejemplo n.º 21
0
/***********************************************************************
 *           acmGetVersion (MSACM32.@)
 */
DWORD WINAPI acmGetVersion(void)
{
    OSVERSIONINFOA version;

    version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
    if (!GetVersionExA( &version ))
	return 0x04030000;

    switch (version.dwPlatformId) {
    case VER_PLATFORM_WIN32_NT:
	return 0x04000565; /* 4.0.1381 */
    case VER_PLATFORM_WIN32s:
	return 0x02010000; /* 2.1 */
    default:
        FIXME("%x not supported\n", version.dwPlatformId);
        /* fall through */
    case VER_PLATFORM_WIN32_WINDOWS:
	return 0x04030000; /* 4.3.0 */
    }
}
Ejemplo n.º 22
0
DWORD WINAPI GetOsVersion(void)
{
    OSVERSIONINFOEXA	osvi;
    BOOL				bOs = FALSE;
    DWORD				ver = 0L;
    fzero(&osvi, sizeof(OSVERSIONINFOEXA));

    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
    if( GetVersionExA((OSVERSIONINFOA*)&osvi) )
    {
        if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId &&
                osvi.dwMajorVersion > 4 )
        {
            char pszOS[4] = {0};
            _snprintf(pszOS, 3, "%lu%d%lu", osvi.dwMajorVersion,0,osvi.dwMinorVersion);
            ver = strtol(pszOS, NULL, 10);
        }
    }
    return ver;
}
Ejemplo n.º 23
0
/***********************************************************************
 *         GetVersionEx   (KERNEL.149)
 */
BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16 *v)
{
    OSVERSIONINFOA info;

    if (v->dwOSVersionInfoSize < sizeof(OSVERSIONINFO16))
    {
        WARN("wrong OSVERSIONINFO size from app\n");
        return FALSE;
    }

    info.dwOSVersionInfoSize = sizeof(info);
    if (!GetVersionExA( &info )) return FALSE;

    v->dwMajorVersion = info.dwMajorVersion;
    v->dwMinorVersion = info.dwMinorVersion;
    v->dwBuildNumber  = info.dwBuildNumber;
    v->dwPlatformId   = info.dwPlatformId;
    strcpy( v->szCSDVersion, info.szCSDVersion );
    return TRUE;
}
Ejemplo n.º 24
0
char *iupdrvGetSystemName(void)
{
  OSVERSIONINFOA osvi;
  osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  GetVersionExA(&osvi);

  if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
  {
    if (osvi.dwMajorVersion <= 4)
      return "WinNT";

    if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
      return "Win2K";

    if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion > 0)
      return "WinXP";

    if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
      return "Vista";

    if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
      return "Win7";

    if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2)
      return "Win8";

    /* IMPORTANT: starting here will work only if the Manifest has been changed 
       to include Windows 8+ support. Otherwise GetVersionEx will report 6.2 */

    if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3)
      return "Win81";

    if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0)
      return "Win10";
  }

  return "Windows";
}
Ejemplo n.º 25
0
SYNFO_ERROR Synfo_Get_Os_String(char outbuf[SYNFO_OS_STRING_LENGTH])
{
	uint32_t Maj, Min;
	OSVERSIONINFOEXA osinfo;

	memset(outbuf, 0, SYNFO_OS_STRING_LENGTH);

	osinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
	GetVersionExA((OSVERSIONINFOA*)&osinfo);
	Maj = osinfo.dwMajorVersion;
	Min = osinfo.dwMinorVersion;

	if (Maj == 5 && Min == 0)
		strcat(outbuf, "Windows 2000");
	else if (Maj == 5 && Min == 1)
		strcat(outbuf, "Windows XP");
	else if (Maj == 5 && Min == 2)
		strcat(outbuf, "Windows Server 2003");
	else if (Maj == 6 && Min == 0)
		if (osinfo.wProductType == VER_NT_WORKSTATION)
			strcat(outbuf, "Windows Vista");
		else
			strcat(outbuf, "Windows Server 2008");
	else if (Maj == 6 && Min == 1)
		if (osinfo.wProductType == VER_NT_WORKSTATION)
			strcat(outbuf, "Windows 7");
		else
			strcat(outbuf, "Windows Server 2008 R2");
	else
		sprintf(outbuf, "Unknwon Windows %d.%d", Maj, Min);
	sprintf(outbuf + strlen(outbuf), " (%d)", osinfo.dwBuildNumber);
	if (osinfo.szCSDVersion[0])
	{
		strcat(outbuf, " ");
		strcat(outbuf, osinfo.szCSDVersion);
	}
	return SYNFO_SUCESS;
}
Ejemplo n.º 26
0
NOXREF void Sys_CheckOSVersion(void)
{
	struct _OSVERSIONINFOA verInfo;

	Q_memset(&verInfo, 0, sizeof(verInfo));
	verInfo.dwOSVersionInfoSize = sizeof(verInfo);
	if (!GetVersionExA(&verInfo))
		Sys_Error("Couldn't get OS info");

	g_WinNTOrHigher = verInfo.dwMajorVersion >= 4;
	if (verInfo.dwPlatformId == 1 && verInfo.dwMajorVersion == 4)
	{
		if (verInfo.dwMinorVersion)
		{
			if (verInfo.dwMinorVersion < 90)
				g_bIsWin98 = 1;
		}
		else
		{
			g_bIsWin95 = 1;
		}
	}
}
Ejemplo n.º 27
0
BOOL APIENTRY 
DllMain( 
	HINSTANCE	hModule, 
    DWORD		ul_reason_for_call, 
    LPVOID		lpReserved )
{
    switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
		{
			hInstance	= hModule;

			OSVERSIONINFOA	osvi;

			application_module = (HMODULE)hModule;

			osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);

			GetVersionExA(&osvi);

			non_unicode = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS );

			if ( non_unicode ){
				RegisterWindowClassA();
			}else{
				RegisterWindowClassW();
			}

			break;
		}
		case DLL_THREAD_ATTACH:
		case DLL_THREAD_DETACH:
		case DLL_PROCESS_DETACH:
			break;
    }
    return TRUE;
}
Ejemplo n.º 28
0
int
win_hasunicode(void)
{
	OSVERSIONINFOA osinfo;
	int r;

	osinfo.dwOSVersionInfoSize = sizeof(osinfo);
	if(!GetVersionExA(&osinfo))
		panic("GetVersionEx failed");
	switch(osinfo.dwPlatformId) {
	default:
		panic("unknown PlatformId");
	case VER_PLATFORM_WIN32s:
		panic("Win32s not supported");
	case VER_PLATFORM_WIN32_WINDOWS:
		r = 0;
		break;
	case VER_PLATFORM_WIN32_NT:
		r = 1;
		break;
	}

	return r;
}
Ejemplo n.º 29
0
// Check whether the OS is supported
bool IsSupportedOs()
{
	OSVERSIONINFO ver;

	Zero(&ver, sizeof(ver));

	ver.dwOSVersionInfoSize = sizeof(ver);
	if (GetVersionExA(&ver) == false)
	{
		return false;
	}

	if (ver.dwMajorVersion <= 4)
	{
		return false;
	}

	if (ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS || ver.dwPlatformId == VER_PLATFORM_WIN32s)
	{
		return false;
	}

	return true;
}
Ejemplo n.º 30
0
RFX_CONTEXT* rfx_context_new(void)
{
	HKEY hKey;
	LONG status;
	DWORD dwType;
	DWORD dwSize;
	DWORD dwValue;
	SYSTEM_INFO sysinfo;
	RFX_CONTEXT* context;

	context = (RFX_CONTEXT*) malloc(sizeof(RFX_CONTEXT));
	ZeroMemory(context, sizeof(RFX_CONTEXT));

	context->priv = (RFX_CONTEXT_PRIV*) malloc(sizeof(RFX_CONTEXT_PRIV));
	ZeroMemory(context->priv, sizeof(RFX_CONTEXT_PRIV));

	context->priv->TilePool = Queue_New(TRUE, -1, -1);
	context->priv->TileQueue = Queue_New(TRUE, -1, -1);

	/*
	 * align buffers to 16 byte boundary (needed for SSE/NEON instructions)
	 *
	 * y_r_buffer, cb_g_buffer, cr_b_buffer: 64 * 64 * 4 = 16384 (0x4000)
	 * dwt_buffer: 32 * 32 * 2 * 2 * 4 = 16384, maximum sub-band width is 32
	 */

	context->priv->BufferPool = BufferPool_New(TRUE, 16384, 16);

#ifdef _WIN32
	{
		BOOL isVistaOrLater;
		OSVERSIONINFOA verinfo;

		ZeroMemory(&verinfo, sizeof(OSVERSIONINFOA));
		verinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);

		GetVersionExA(&verinfo);
		isVistaOrLater = ((verinfo.dwMajorVersion >= 6) && (verinfo.dwMinorVersion >= 0)) ? TRUE : FALSE;

		context->priv->UseThreads = isVistaOrLater;
	}
#else
	context->priv->UseThreads = TRUE;
#endif

	GetNativeSystemInfo(&sysinfo);

	context->priv->MinThreadCount = sysinfo.dwNumberOfProcessors;
	context->priv->MaxThreadCount = 0;

	status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\RemoteFX"), 0, KEY_READ | KEY_WOW64_64KEY, &hKey);

	if (status == ERROR_SUCCESS)
	{
		if (RegQueryValueEx(hKey, _T("UseThreads"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
			context->priv->UseThreads = dwValue ? 1 : 0;

		if (RegQueryValueEx(hKey, _T("MinThreadCount"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
			context->priv->MinThreadCount = dwValue;

		if (RegQueryValueEx(hKey, _T("MaxThreadCount"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
			context->priv->MaxThreadCount = dwValue;

		RegCloseKey(hKey);
	}

	if (context->priv->UseThreads)
	{
		/* Call primitives_get here in order to avoid race conditions when using primitives_get */
		/* from multiple threads. This call will initialize all function pointers correctly     */
		/* before any decoding threads are started */
		primitives_get();

		context->priv->ThreadPool = CreateThreadpool(NULL);
		InitializeThreadpoolEnvironment(&context->priv->ThreadPoolEnv);
		SetThreadpoolCallbackPool(&context->priv->ThreadPoolEnv, context->priv->ThreadPool);

		if (context->priv->MinThreadCount)
			SetThreadpoolThreadMinimum(context->priv->ThreadPool, context->priv->MinThreadCount);

		if (context->priv->MaxThreadCount)
			SetThreadpoolThreadMaximum(context->priv->ThreadPool, context->priv->MaxThreadCount);
	}

	/* initialize the default pixel format */
	rfx_context_set_pixel_format(context, RDP_PIXEL_FORMAT_B8G8R8A8);

	/* create profilers for default decoding routines */
	rfx_profiler_create(context);
	
	/* set up default routines */
	context->quantization_decode = rfx_quantization_decode;	
	context->quantization_encode = rfx_quantization_encode;	
	context->dwt_2d_decode = rfx_dwt_2d_decode;
	context->dwt_2d_encode = rfx_dwt_2d_encode;

	RFX_INIT_SIMD(context);
	
	return context;
}