mirror of
https://github.com/greenshot/greenshot
synced 2025-07-13 08:33:53 -07:00
This commit fixes two bugs: BUG-1809 & BUG-1835 and adds somewhat better Windows 10 support.
This commit is contained in:
parent
4290333997
commit
a1769dbc66
7 changed files with 302 additions and 122 deletions
|
@ -270,6 +270,9 @@ namespace Greenshot {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BUG-1809: Add message filter, to filter out all the InputLangChanged messages which go to a target control with a handle > 32 bit.
|
||||||
|
Application.AddMessageFilter(new WmInputLangChangeRequestFilter());
|
||||||
|
|
||||||
// From here on we continue starting Greenshot
|
// From here on we continue starting Greenshot
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
|
@ -18,30 +18,33 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using GreenshotPlugin.UnmanagedHelpers;
|
|
||||||
using GreenshotPlugin.Core;
|
|
||||||
using Greenshot.IniFile;
|
using Greenshot.IniFile;
|
||||||
using Greenshot.Drawing;
|
using GreenshotPlugin.UnmanagedHelpers;
|
||||||
using log4net;
|
using log4net;
|
||||||
|
|
||||||
namespace Greenshot.Helpers {
|
namespace Greenshot.Helpers
|
||||||
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of EnvironmentInfo.
|
/// Description of EnvironmentInfo.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class EnvironmentInfo {
|
public static class EnvironmentInfo
|
||||||
|
{
|
||||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(EnvironmentInfo));
|
private static readonly ILog LOG = LogManager.GetLogger(typeof(EnvironmentInfo));
|
||||||
private static bool? isWindows = null;
|
private static bool? isWindows = null;
|
||||||
|
|
||||||
public static bool IsWindows {
|
public static bool IsWindows
|
||||||
get {
|
{
|
||||||
if (isWindows.HasValue) {
|
get
|
||||||
|
{
|
||||||
|
if (isWindows.HasValue)
|
||||||
|
{
|
||||||
return isWindows.Value;
|
return isWindows.Value;
|
||||||
}
|
}
|
||||||
isWindows = Environment.OSVersion.Platform.ToString().StartsWith("Win");
|
isWindows = Environment.OSVersion.Platform.ToString().StartsWith("Win");
|
||||||
|
@ -49,75 +52,104 @@ namespace Greenshot.Helpers {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsNet45OrNewer() {
|
public static bool IsNet45OrNewer()
|
||||||
|
{
|
||||||
// Class "ReflectionContext" exists from .NET 4.5 onwards.
|
// Class "ReflectionContext" exists from .NET 4.5 onwards.
|
||||||
return Type.GetType("System.Reflection.ReflectionContext", false) != null;
|
return Type.GetType("System.Reflection.ReflectionContext", false) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string EnvironmentToString(bool newline) {
|
public static string EnvironmentToString(bool newline)
|
||||||
|
{
|
||||||
StringBuilder environment = new StringBuilder();
|
StringBuilder environment = new StringBuilder();
|
||||||
environment.Append("Software version: " + Application.ProductVersion);
|
environment.Append("Software version: " + Application.ProductVersion);
|
||||||
if (IniConfig.IsPortable) {
|
if (IniConfig.IsPortable) {
|
||||||
environment.Append(" Portable");
|
environment.Append(" Portable");
|
||||||
}
|
}
|
||||||
environment.Append(" (" + OSInfo.Bits + " bit)");
|
environment.Append(" (" + OSInfo.Bits + " bit)");
|
||||||
|
|
||||||
if (newline) {
|
if (newline)
|
||||||
|
{
|
||||||
environment.AppendLine();
|
environment.AppendLine();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
environment.Append(", ");
|
environment.Append(", ");
|
||||||
}
|
}
|
||||||
environment.Append(".NET runtime version: " + Environment.Version);
|
environment.Append(".NET runtime version: " + Environment.Version);
|
||||||
if (IsNet45OrNewer()) {
|
if (IsNet45OrNewer())
|
||||||
|
{
|
||||||
environment.Append("+");
|
environment.Append("+");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (newline) {
|
if (newline)
|
||||||
|
{
|
||||||
environment.AppendLine();
|
environment.AppendLine();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
environment.Append(", ");
|
environment.Append(", ");
|
||||||
}
|
}
|
||||||
environment.Append("Time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss zzz"));
|
environment.Append("Time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss zzz"));
|
||||||
|
|
||||||
if (IsWindows) {
|
if (IsWindows)
|
||||||
if (newline) {
|
{
|
||||||
|
if (newline)
|
||||||
|
{
|
||||||
environment.AppendLine();
|
environment.AppendLine();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
environment.Append(", ");
|
environment.Append(", ");
|
||||||
}
|
}
|
||||||
environment.Append(String.Format("OS: {0} {1} {2} (x{3}) {4}", OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString));
|
environment.Append(String.Format("OS: {0} {1} {2} (x{3}) {4}", OSInfo.Name, OSInfo.Edition, OSInfo.ServicePack, OSInfo.Bits, OSInfo.VersionString));
|
||||||
if (newline) {
|
if (newline)
|
||||||
|
{
|
||||||
environment.AppendLine();
|
environment.AppendLine();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
environment.Append(", ");
|
environment.Append(", ");
|
||||||
}
|
}
|
||||||
// Get some important information for fixing GDI related Problems
|
// Get some important information for fixing GDI related Problems
|
||||||
environment.Append("GDI object count: " + User32.GetGuiResourcesGDICount());
|
environment.AppendFormat("GDI object count: {0}", User32.GetGuiResourcesGDICount());
|
||||||
if (newline) {
|
if (newline)
|
||||||
|
{
|
||||||
environment.AppendLine();
|
environment.AppendLine();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
environment.Append(", ");
|
environment.Append(", ");
|
||||||
}
|
}
|
||||||
environment.Append("User object count: " + User32.GetGuiResourcesUserCount());
|
environment.AppendFormat("User object count: {0}", User32.GetGuiResourcesUserCount());
|
||||||
} else {
|
|
||||||
if (newline) {
|
|
||||||
environment.AppendLine();
|
|
||||||
} else {
|
|
||||||
environment.Append(", ");
|
|
||||||
}
|
|
||||||
environment.Append("OS: " + Environment.OSVersion.Platform.ToString());
|
|
||||||
}
|
}
|
||||||
if (newline) {
|
else
|
||||||
|
{
|
||||||
|
if (newline)
|
||||||
|
{
|
||||||
|
environment.AppendLine();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
environment.Append(", ");
|
||||||
|
}
|
||||||
|
environment.AppendFormat("OS: {0}", Environment.OSVersion.Platform);
|
||||||
|
}
|
||||||
|
if (newline)
|
||||||
|
{
|
||||||
environment.AppendLine();
|
environment.AppendLine();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
environment.Append(", ");
|
environment.Append(", ");
|
||||||
}
|
}
|
||||||
environment.Append("Surface count: " + Surface.Count);
|
// TODO: Is this needed?
|
||||||
|
// environment.AppendFormat("Surface count: {0}", Surface.Count);
|
||||||
|
|
||||||
return environment.ToString();
|
return environment.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ExceptionToString(Exception ex) {
|
public static string ExceptionToString(Exception ex)
|
||||||
|
{
|
||||||
if (ex == null)
|
if (ex == null)
|
||||||
return "null\r\n";
|
return "null\r\n";
|
||||||
|
|
||||||
|
@ -125,44 +157,54 @@ namespace Greenshot.Helpers {
|
||||||
|
|
||||||
report.AppendLine("Exception: " + ex.GetType().ToString());
|
report.AppendLine("Exception: " + ex.GetType().ToString());
|
||||||
report.AppendLine("Message: " + ex.Message);
|
report.AppendLine("Message: " + ex.Message);
|
||||||
if (ex.Data != null && ex.Data.Count > 0) {
|
if (ex.Data != null && ex.Data.Count > 0)
|
||||||
|
{
|
||||||
report.AppendLine();
|
report.AppendLine();
|
||||||
report.AppendLine("Additional Information:");
|
report.AppendLine("Additional Information:");
|
||||||
foreach (object key in ex.Data.Keys) {
|
foreach (object key in ex.Data.Keys)
|
||||||
|
{
|
||||||
object data = ex.Data[key];
|
object data = ex.Data[key];
|
||||||
if (data != null) {
|
if (data != null)
|
||||||
|
{
|
||||||
report.AppendLine(key + " : " + data);
|
report.AppendLine(key + " : " + data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ex is ExternalException) {
|
if (ex is ExternalException)
|
||||||
|
{
|
||||||
// e.g. COMException
|
// e.g. COMException
|
||||||
report.AppendLine().AppendLine("ErrorCode: 0x" + (ex as ExternalException).ErrorCode.ToString("X"));
|
report.AppendLine().AppendLine("ErrorCode: 0x" + (ex as ExternalException).ErrorCode.ToString("X"));
|
||||||
}
|
}
|
||||||
|
|
||||||
report.AppendLine().AppendLine("Stack:").AppendLine(ex.StackTrace);
|
report.AppendLine().AppendLine("Stack:").AppendLine(ex.StackTrace);
|
||||||
|
|
||||||
if (ex is ReflectionTypeLoadException) {
|
if (ex is ReflectionTypeLoadException)
|
||||||
|
{
|
||||||
report.AppendLine().AppendLine("LoaderExceptions: ");
|
report.AppendLine().AppendLine("LoaderExceptions: ");
|
||||||
foreach (Exception cbE in (ex as ReflectionTypeLoadException).LoaderExceptions) {
|
foreach (Exception cbE in (ex as ReflectionTypeLoadException).LoaderExceptions)
|
||||||
|
{
|
||||||
report.AppendLine(cbE.Message);
|
report.AppendLine(cbE.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ex.InnerException != null) {
|
if (ex.InnerException != null)
|
||||||
|
{
|
||||||
report.AppendLine("--- InnerException: ---");
|
report.AppendLine("--- InnerException: ---");
|
||||||
report.AppendLine(ExceptionToString(ex.InnerException));
|
report.AppendLine(ExceptionToString(ex.InnerException));
|
||||||
}
|
}
|
||||||
return report.ToString();
|
return report.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string BuildReport(Exception exception) {
|
public static string BuildReport(Exception exception)
|
||||||
|
{
|
||||||
StringBuilder exceptionText = new StringBuilder();
|
StringBuilder exceptionText = new StringBuilder();
|
||||||
exceptionText.AppendLine(EnvironmentToString(true));
|
exceptionText.AppendLine(EnvironmentToString(true));
|
||||||
exceptionText.AppendLine(ExceptionToString(exception));
|
exceptionText.AppendLine(ExceptionToString(exception));
|
||||||
exceptionText.AppendLine("Configuration dump:");
|
exceptionText.AppendLine("Configuration dump:");
|
||||||
using (TextWriter writer = new StringWriter(exceptionText)) {
|
using (TextWriter writer = new StringWriter(exceptionText))
|
||||||
IniConfig.GetIniSection<CoreConfiguration>().Write(writer, true);
|
{
|
||||||
|
// TODO: Create summary of properties
|
||||||
|
//var iniConfig = IniConfig.Current.WriteToStreamAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
return exceptionText.ToString();
|
return exceptionText.ToString();
|
||||||
|
@ -173,13 +215,16 @@ namespace Greenshot.Helpers {
|
||||||
/// Provides detailed information about the host operating system.
|
/// Provides detailed information about the host operating system.
|
||||||
/// Code is available at: http://www.csharp411.com/determine-windows-version-and-edition-with-c/
|
/// Code is available at: http://www.csharp411.com/determine-windows-version-and-edition-with-c/
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public class OSInfo {
|
static public class OSInfo
|
||||||
|
{
|
||||||
#region BITS
|
#region BITS
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if the current application is 32 or 64-bit.
|
/// Determines if the current application is 32 or 64-bit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public int Bits {
|
static public int Bits
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return IntPtr.Size * 8;
|
return IntPtr.Size * 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,9 +235,12 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the edition of the operating system running on this computer.
|
/// Gets the edition of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public string Edition {
|
static public string Edition
|
||||||
get {
|
{
|
||||||
if (s_Edition != null) {
|
get
|
||||||
|
{
|
||||||
|
if (s_Edition != null)
|
||||||
|
{
|
||||||
return s_Edition; //***** RETURN *****//
|
return s_Edition; //***** RETURN *****//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,22 +250,30 @@ namespace Greenshot.Helpers {
|
||||||
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
||||||
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
||||||
|
|
||||||
if (GetVersionEx(ref osVersionInfo)) {
|
if (GetVersionEx(ref osVersionInfo))
|
||||||
|
{
|
||||||
int majorVersion = osVersion.Version.Major;
|
int majorVersion = osVersion.Version.Major;
|
||||||
int minorVersion = osVersion.Version.Minor;
|
int minorVersion = osVersion.Version.Minor;
|
||||||
byte productType = osVersionInfo.wProductType;
|
byte productType = osVersionInfo.wProductType;
|
||||||
short suiteMask = osVersionInfo.wSuiteMask;
|
short suiteMask = osVersionInfo.wSuiteMask;
|
||||||
|
|
||||||
#region VERSION 4
|
#region VERSION 4
|
||||||
if (majorVersion == 4) {
|
if (majorVersion == 4)
|
||||||
if (productType == VER_NT_WORKSTATION) {
|
{
|
||||||
|
if (productType == VER_NT_WORKSTATION)
|
||||||
|
{
|
||||||
// Windows NT 4.0 Workstation
|
// Windows NT 4.0 Workstation
|
||||||
edition = "Workstation";
|
edition = "Workstation";
|
||||||
} else if (productType == VER_NT_SERVER) {
|
}
|
||||||
if ((suiteMask & VER_SUITE_ENTERPRISE) != 0) {
|
else if (productType == VER_NT_SERVER)
|
||||||
|
{
|
||||||
|
if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
|
||||||
|
{
|
||||||
// Windows NT 4.0 Server Enterprise
|
// Windows NT 4.0 Server Enterprise
|
||||||
edition = "Enterprise Server";
|
edition = "Enterprise Server";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Windows NT 4.0 Server
|
// Windows NT 4.0 Server
|
||||||
edition = "Standard Server";
|
edition = "Standard Server";
|
||||||
}
|
}
|
||||||
|
@ -226,38 +282,60 @@ namespace Greenshot.Helpers {
|
||||||
#endregion VERSION 4
|
#endregion VERSION 4
|
||||||
|
|
||||||
#region VERSION 5
|
#region VERSION 5
|
||||||
else if (majorVersion == 5) {
|
else if (majorVersion == 5)
|
||||||
if (productType == VER_NT_WORKSTATION) {
|
{
|
||||||
if ((suiteMask & VER_SUITE_PERSONAL) != 0) {
|
if (productType == VER_NT_WORKSTATION)
|
||||||
|
{
|
||||||
|
if ((suiteMask & VER_SUITE_PERSONAL) != 0)
|
||||||
|
{
|
||||||
// Windows XP Home Edition
|
// Windows XP Home Edition
|
||||||
edition = "Home";
|
edition = "Home";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Windows XP / Windows 2000 Professional
|
// Windows XP / Windows 2000 Professional
|
||||||
edition = "Professional";
|
edition = "Professional";
|
||||||
}
|
}
|
||||||
} else if (productType == VER_NT_SERVER) {
|
}
|
||||||
if (minorVersion == 0) {
|
else if (productType == VER_NT_SERVER)
|
||||||
if ((suiteMask & VER_SUITE_DATACENTER) != 0) {
|
{
|
||||||
|
if (minorVersion == 0)
|
||||||
|
{
|
||||||
|
if ((suiteMask & VER_SUITE_DATACENTER) != 0)
|
||||||
|
{
|
||||||
// Windows 2000 Datacenter Server
|
// Windows 2000 Datacenter Server
|
||||||
edition = "Datacenter Server";
|
edition = "Datacenter Server";
|
||||||
} else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0) {
|
}
|
||||||
|
else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
|
||||||
|
{
|
||||||
// Windows 2000 Advanced Server
|
// Windows 2000 Advanced Server
|
||||||
edition = "Advanced Server";
|
edition = "Advanced Server";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Windows 2000 Server
|
// Windows 2000 Server
|
||||||
edition = "Server";
|
edition = "Server";
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if ((suiteMask & VER_SUITE_DATACENTER) != 0) {
|
else
|
||||||
|
{
|
||||||
|
if ((suiteMask & VER_SUITE_DATACENTER) != 0)
|
||||||
|
{
|
||||||
// Windows Server 2003 Datacenter Edition
|
// Windows Server 2003 Datacenter Edition
|
||||||
edition = "Datacenter";
|
edition = "Datacenter";
|
||||||
} else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0) {
|
}
|
||||||
|
else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
|
||||||
|
{
|
||||||
// Windows Server 2003 Enterprise Edition
|
// Windows Server 2003 Enterprise Edition
|
||||||
edition = "Enterprise";
|
edition = "Enterprise";
|
||||||
} else if ((suiteMask & VER_SUITE_BLADE) != 0) {
|
}
|
||||||
|
else if ((suiteMask & VER_SUITE_BLADE) != 0)
|
||||||
|
{
|
||||||
// Windows Server 2003 Web Edition
|
// Windows Server 2003 Web Edition
|
||||||
edition = "Web Edition";
|
edition = "Web Edition";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Windows Server 2003 Standard Edition
|
// Windows Server 2003 Standard Edition
|
||||||
edition = "Standard";
|
edition = "Standard";
|
||||||
}
|
}
|
||||||
|
@ -267,10 +345,13 @@ namespace Greenshot.Helpers {
|
||||||
#endregion VERSION 5
|
#endregion VERSION 5
|
||||||
|
|
||||||
#region VERSION 6
|
#region VERSION 6
|
||||||
else if (majorVersion == 6) {
|
else if (majorVersion == 6)
|
||||||
|
{
|
||||||
int ed;
|
int ed;
|
||||||
if (GetProductInfo(majorVersion, minorVersion, osVersionInfo.wServicePackMajor, osVersionInfo.wServicePackMinor, out ed)) {
|
if (GetProductInfo(majorVersion, minorVersion, osVersionInfo.wServicePackMajor, osVersionInfo.wServicePackMinor, out ed))
|
||||||
switch (ed) {
|
{
|
||||||
|
switch (ed)
|
||||||
|
{
|
||||||
case PRODUCT_BUSINESS:
|
case PRODUCT_BUSINESS:
|
||||||
edition = "Business";
|
edition = "Business";
|
||||||
break;
|
break;
|
||||||
|
@ -399,9 +480,12 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the operating system running on this computer.
|
/// Gets the name of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public string Name {
|
static public string Name
|
||||||
get {
|
{
|
||||||
if (s_Name != null) {
|
get
|
||||||
|
{
|
||||||
|
if (s_Name != null)
|
||||||
|
{
|
||||||
return s_Name; //***** RETURN *****//
|
return s_Name; //***** RETURN *****//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,27 +495,37 @@ namespace Greenshot.Helpers {
|
||||||
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
||||||
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
||||||
|
|
||||||
if (GetVersionEx(ref osVersionInfo)) {
|
if (GetVersionEx(ref osVersionInfo))
|
||||||
|
{
|
||||||
int majorVersion = osVersion.Version.Major;
|
int majorVersion = osVersion.Version.Major;
|
||||||
int minorVersion = osVersion.Version.Minor;
|
int minorVersion = osVersion.Version.Minor;
|
||||||
byte productType = osVersionInfo.wProductType;
|
byte productType = osVersionInfo.wProductType;
|
||||||
short suiteMask = osVersionInfo.wSuiteMask;
|
short suiteMask = osVersionInfo.wSuiteMask;
|
||||||
switch (osVersion.Platform) {
|
switch (osVersion.Platform)
|
||||||
|
{
|
||||||
case PlatformID.Win32Windows:
|
case PlatformID.Win32Windows:
|
||||||
if (majorVersion == 4) {
|
if (majorVersion == 4)
|
||||||
|
{
|
||||||
string csdVersion = osVersionInfo.szCSDVersion;
|
string csdVersion = osVersionInfo.szCSDVersion;
|
||||||
switch (minorVersion) {
|
switch (minorVersion)
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (csdVersion == "B" || csdVersion == "C") {
|
if (csdVersion == "B" || csdVersion == "C")
|
||||||
|
{
|
||||||
name = "Windows 95 OSR2";
|
name = "Windows 95 OSR2";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
name = "Windows 95";
|
name = "Windows 95";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
if (csdVersion == "A") {
|
if (csdVersion == "A")
|
||||||
|
{
|
||||||
name = "Windows 98 Second Edition";
|
name = "Windows 98 Second Edition";
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
name = "Windows 98";
|
name = "Windows 98";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -442,12 +536,14 @@ namespace Greenshot.Helpers {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PlatformID.Win32NT:
|
case PlatformID.Win32NT:
|
||||||
switch (majorVersion) {
|
switch (majorVersion)
|
||||||
|
{
|
||||||
case 3:
|
case 3:
|
||||||
name = "Windows NT 3.51";
|
name = "Windows NT 3.51";
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
switch (productType) {
|
switch (productType)
|
||||||
|
{
|
||||||
case 1:
|
case 1:
|
||||||
name = "Windows NT 4.0";
|
name = "Windows NT 4.0";
|
||||||
break;
|
break;
|
||||||
|
@ -457,12 +553,14 @@ namespace Greenshot.Helpers {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
switch (minorVersion) {
|
switch (minorVersion)
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
name = "Windows 2000";
|
name = "Windows 2000";
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
switch (suiteMask) {
|
switch (suiteMask)
|
||||||
|
{
|
||||||
case 0x0200:
|
case 0x0200:
|
||||||
name = "Windows XP Professional";
|
name = "Windows XP Professional";
|
||||||
break;
|
break;
|
||||||
|
@ -472,7 +570,8 @@ namespace Greenshot.Helpers {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
switch (suiteMask) {
|
switch (suiteMask)
|
||||||
|
{
|
||||||
case 0x0200:
|
case 0x0200:
|
||||||
name = "Windows XP Professional x64";
|
name = "Windows XP Professional x64";
|
||||||
break;
|
break;
|
||||||
|
@ -496,9 +595,11 @@ namespace Greenshot.Helpers {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
switch (minorVersion) {
|
switch (minorVersion)
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
switch (productType) {
|
switch (productType)
|
||||||
|
{
|
||||||
case 3:
|
case 3:
|
||||||
name = "Windows Server 2008";
|
name = "Windows Server 2008";
|
||||||
break;
|
break;
|
||||||
|
@ -508,7 +609,8 @@ namespace Greenshot.Helpers {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
switch (productType) {
|
switch (productType)
|
||||||
|
{
|
||||||
case 3:
|
case 3:
|
||||||
name = "Windows Server 2008 R2";
|
name = "Windows Server 2008 R2";
|
||||||
break;
|
break;
|
||||||
|
@ -520,8 +622,14 @@ namespace Greenshot.Helpers {
|
||||||
case 2:
|
case 2:
|
||||||
name = "Windows 8";
|
name = "Windows 8";
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
name = "Windows 8.1";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 10:
|
||||||
|
name = "Windows 10";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +661,8 @@ namespace Greenshot.Helpers {
|
||||||
|
|
||||||
#region OSVERSIONINFOEX
|
#region OSVERSIONINFOEX
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
private struct OSVERSIONINFOEX {
|
private struct OSVERSIONINFOEX
|
||||||
|
{
|
||||||
public int dwOSVersionInfoSize;
|
public int dwOSVersionInfoSize;
|
||||||
public int dwMajorVersion;
|
public int dwMajorVersion;
|
||||||
public int dwMinorVersion;
|
public int dwMinorVersion;
|
||||||
|
@ -629,14 +738,17 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the service pack information of the operating system running on this computer.
|
/// Gets the service pack information of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public string ServicePack {
|
static public string ServicePack
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
string servicePack = String.Empty;
|
string servicePack = String.Empty;
|
||||||
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
||||||
|
|
||||||
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
||||||
|
|
||||||
if (GetVersionEx(ref osVersionInfo)) {
|
if (GetVersionEx(ref osVersionInfo))
|
||||||
|
{
|
||||||
servicePack = osVersionInfo.szCSDVersion;
|
servicePack = osVersionInfo.szCSDVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,8 +762,10 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the build version number of the operating system running on this computer.
|
/// Gets the build version number of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int BuildVersion {
|
public static int BuildVersion
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return Environment.OSVersion.Version.Build;
|
return Environment.OSVersion.Version.Build;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -662,8 +776,10 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the full version string of the operating system running on this computer.
|
/// Gets the full version string of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public string VersionString {
|
static public string VersionString
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return string.Format("{0}.{1} build {3} revision {2:X}", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, Environment.OSVersion.Version.Revision, Environment.OSVersion.Version.Build);
|
return string.Format("{0}.{1} build {3} revision {2:X}", Environment.OSVersion.Version.Major, Environment.OSVersion.Version.Minor, Environment.OSVersion.Version.Revision, Environment.OSVersion.Version.Build);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -673,8 +789,10 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the full version of the operating system running on this computer.
|
/// Gets the full version of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public Version Version {
|
static public Version Version
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return Environment.OSVersion.Version;
|
return Environment.OSVersion.Version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,8 +803,10 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the major version number of the operating system running on this computer.
|
/// Gets the major version number of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public int MajorVersion {
|
static public int MajorVersion
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return Environment.OSVersion.Version.Major;
|
return Environment.OSVersion.Version.Major;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -696,8 +816,10 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the minor version number of the operating system running on this computer.
|
/// Gets the minor version number of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public int MinorVersion {
|
static public int MinorVersion
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return Environment.OSVersion.Version.Minor;
|
return Environment.OSVersion.Version.Minor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -707,8 +829,10 @@ namespace Greenshot.Helpers {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the revision version number of the operating system running on this computer.
|
/// Gets the revision version number of the operating system running on this computer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
static public int RevisionVersion {
|
static public int RevisionVersion
|
||||||
get {
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
return Environment.OSVersion.Version.Revision;
|
return Environment.OSVersion.Version.Revision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,16 @@
|
||||||
</asmv3:application>
|
</asmv3:application>
|
||||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
<application>
|
<application>
|
||||||
<!--The ID below indicates app support for Windows Vista -->
|
<!-- Windows 10 -->
|
||||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
<!--The ID below indicates app support for Windows 7 -->
|
<!-- Windows 8.1 -->
|
||||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
|
||||||
<!--The ID below indicates app support for Windows 8 -->
|
|
||||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
|
||||||
<!--The ID below indicates app support for Windows 8.1 -->
|
|
||||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
|
<!--Windows 8 -->
|
||||||
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||||
|
<!-- Windows 7 -->
|
||||||
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||||
|
<!-- Windows Vista -->
|
||||||
|
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||||
</application>
|
</application>
|
||||||
</compatibility>
|
</compatibility>
|
||||||
<!-- Set UAC level to "asInvoker" and disable registry virtualization -->
|
<!-- Set UAC level to "asInvoker" and disable registry virtualization -->
|
||||||
|
|
|
@ -9,6 +9,13 @@ All details to our tickets can be found here: https://greenshot.atlassian.net
|
||||||
|
|
||||||
@DETAILVERSION@
|
@DETAILVERSION@
|
||||||
|
|
||||||
|
Bugs Resolved:
|
||||||
|
* BUG-1809: OverflowException when changing the windows input language
|
||||||
|
* BUG-1835: Imgur uploads were cancelled due to a timeout which was set too small
|
||||||
|
|
||||||
|
|
||||||
|
1.2.6.7-359dcf3 RELEASE
|
||||||
|
|
||||||
Bugs Resolved:
|
Bugs Resolved:
|
||||||
* BUG-1769: Switched to OAuth 2 for Picasa Authentication, OAuth 1.x will be terminated as of 20th of April 2015.
|
* BUG-1769: Switched to OAuth 2 for Picasa Authentication, OAuth 1.x will be terminated as of 20th of April 2015.
|
||||||
* BUG-1770: Fix problems when a font doesn't want to draw itself.
|
* BUG-1770: Fix problems when a font doesn't want to draw itself.
|
||||||
|
|
|
@ -291,7 +291,7 @@ namespace GreenshotPlugin.Core {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[IniProperty("WebRequestTimeout", Description = "The connect timeout value for webrequets, these are seconds", DefaultValue = "10")]
|
[IniProperty("WebRequestTimeout", Description = "The connect timeout value for webrequets, these are seconds", DefaultValue = "100")]
|
||||||
public int WebRequestTimeout;
|
public int WebRequestTimeout;
|
||||||
[IniProperty("WebRequestReadWriteTimeout", Description = "The read/write timeout value for webrequets, these are seconds", DefaultValue = "100")]
|
[IniProperty("WebRequestReadWriteTimeout", Description = "The read/write timeout value for webrequets, these are seconds", DefaultValue = "100")]
|
||||||
public int WebRequestReadWriteTimeout;
|
public int WebRequestReadWriteTimeout;
|
||||||
|
@ -509,8 +509,8 @@ namespace GreenshotPlugin.Core {
|
||||||
OutputFileReduceColorsTo = 256;
|
OutputFileReduceColorsTo = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WebRequestTimeout < 1) {
|
if (WebRequestTimeout <= 10) {
|
||||||
WebRequestTimeout = 10;
|
WebRequestTimeout = 100;
|
||||||
}
|
}
|
||||||
if (WebRequestReadWriteTimeout < 1) {
|
if (WebRequestReadWriteTimeout < 1) {
|
||||||
WebRequestReadWriteTimeout = 100;
|
WebRequestReadWriteTimeout = 100;
|
||||||
|
|
43
GreenshotPlugin/Core/WmInputLangChangeRequestFilter.cs
Normal file
43
GreenshotPlugin/Core/WmInputLangChangeRequestFilter.cs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* Greenshot - a free and open source screenshot tool
|
||||||
|
* Copyright (C) 2007-2015 Thomas Braun, Jens Klingen, Robin Krom
|
||||||
|
*
|
||||||
|
* For more information see: http://getgreenshot.org/
|
||||||
|
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 1 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
using GreenshotPlugin.UnmanagedHelpers;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace GreenshotPlugin.Core
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// This IMessageFilter filters out all WM_INPUTLANGCHANGEREQUEST messages which go to a handle which is >32 bits.
|
||||||
|
/// The need for this is documented here: http://stackoverflow.com/a/32021586
|
||||||
|
/// Unfortunately there is an error in the code example, should use HWnd instead of LParam for the handle.
|
||||||
|
/// </summary>
|
||||||
|
public class WmInputLangChangeRequestFilter : IMessageFilter
|
||||||
|
{
|
||||||
|
public bool PreFilterMessage(ref Message m)
|
||||||
|
{
|
||||||
|
if (m.Msg == (int)WindowsMessages.WM_INPUTLANGCHANGEREQUEST || m.Msg == (int)WindowsMessages.WM_INPUTLANGCHANGE)
|
||||||
|
{
|
||||||
|
return m.HWnd.ToInt64() > 0x7FFFFFFF;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,6 +37,7 @@
|
||||||
<Compile Include="Core\CaptureHandler.cs" />
|
<Compile Include="Core\CaptureHandler.cs" />
|
||||||
<Compile Include="Core\EventDelay.cs" />
|
<Compile Include="Core\EventDelay.cs" />
|
||||||
<Compile Include="Core\FastBitmap.cs" />
|
<Compile Include="Core\FastBitmap.cs" />
|
||||||
|
<Compile Include="Core\WmInputLangChangeRequestFilter.cs" />
|
||||||
<Compile Include="GlobalSuppressions.cs" />
|
<Compile Include="GlobalSuppressions.cs" />
|
||||||
<Compile Include="IEInterop\IHTMLBodyElement.cs" />
|
<Compile Include="IEInterop\IHTMLBodyElement.cs" />
|
||||||
<Compile Include="IEInterop\IHTMLCurrentStyle.cs" />
|
<Compile Include="IEInterop\IHTMLCurrentStyle.cs" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue