Ejemplo n.º 1
0
bool wxPlatformInfo::CheckOSVersion(int major, int minor) const
{
    // If this instance of wxPlatformInfo has been initialized by InitForCurrentPlatform()
    // this check gets forwarded to the wxCheckOsVersion which might do more than a simple
    // number check if supported by the platform
    if (m_initializedForCurrentPlatform)
        return wxCheckOsVersion(major, minor);
    else
        return DoCheckVersion(GetOSMajorVersion(),
                            GetOSMinorVersion(),
                            major,
                            minor);
}
Ejemplo n.º 2
0
BOOL FireWallAddApplication(LPCWSTR lpszProcessImageFileName, LPCWSTR lpszRegisterName)
{
	try
	{
		COM _Com;

		if (GetOSMajorVersion() >= 6)
		{
			// see http://msdn.microsoft.com/en-us/library/windows/desktop/aa366418(v=vs.85).aspx
			Win7FireWall fireWall;

			return fireWall.AddApplication(
					lpszProcessImageFileName, 
					lpszRegisterName);
		}
		else
		{
			WinXPSP2FireWall fireWall;
			if (FW_NOERROR == fireWall.Initialize())
			{
				if (FW_NOERROR == fireWall.AddApplication(
					lpszProcessImageFileName, 
					lpszRegisterName))
				{
					return TRUE;
				}
			}

			return FALSE;
		}
	}
	catch (...) 
	{
		return FALSE;
	}
}