mirror of
https://github.com/Crypto-Notepad/Crypto-Notepad.git
synced 2026-03-11 08:55:25 +00:00
Debug info was edited, now contains only app version/OS Information/.Net Framework version
This commit is contained in:
parent
2947d2b4a4
commit
e547eab329
2 changed files with 1 additions and 496 deletions
|
|
@ -76,19 +76,8 @@ private async void GetDebugInfo()
|
|||
sb.AppendLine();
|
||||
sb.AppendLine("Operation System Information");
|
||||
sb.AppendLine("----------------------------");
|
||||
sb.AppendLine(string.Format("Name = {0}", OSVersionInfo.Name));
|
||||
if (!string.IsNullOrEmpty(OSVersionInfo.Edition))
|
||||
sb.AppendLine(string.Format("Edition = {0}", OSVersionInfo.Edition));
|
||||
else
|
||||
sb.AppendLine(string.Format("Edition = None"));
|
||||
if (!string.IsNullOrEmpty(OSVersionInfo.ServicePack))
|
||||
sb.AppendLine(string.Format("Service Pack = {0}", OSVersionInfo.ServicePack));
|
||||
else
|
||||
sb.AppendLine("Service Pack = None");
|
||||
sb.AppendLine(string.Format("Name = {0}", OSVersionInfo.Name + " " + OSVersionInfo.ServicePack));
|
||||
sb.AppendLine(string.Format("Version = {0}", OSVersionInfo.VersionString));
|
||||
sb.AppendLine(string.Format("OSBits = {0}", OSVersionInfo.OSBits));
|
||||
sb.AppendLine(string.Format("ProcessorBits = {0}", OSVersionInfo.ProcessorBits));
|
||||
sb.AppendLine(string.Format("ProgramBits = {0}", OSVersionInfo.ProgramBits));
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine(".Net Framework Information");
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// http://www.codeproject.com/Articles/73000/Getting-Operating-System-Version-Info-Even-for-Win
|
||||
|
|
@ -39,450 +38,6 @@ public enum ProcessorArchitecture
|
|||
private delegate bool IsWow64ProcessDelegate([In] IntPtr handle, [Out] out bool isWow64Process);
|
||||
#endregion DELEGATE DECLARATION
|
||||
|
||||
#region BITS
|
||||
/// <summary>
|
||||
/// Determines if the current application is 32 or 64-bit.
|
||||
/// </summary>
|
||||
static public SoftwareArchitecture ProgramBits
|
||||
{
|
||||
get
|
||||
{
|
||||
SoftwareArchitecture pbits = SoftwareArchitecture.Unknown;
|
||||
|
||||
System.Collections.IDictionary test = Environment.GetEnvironmentVariables();
|
||||
|
||||
switch (IntPtr.Size * 8)
|
||||
{
|
||||
case 64:
|
||||
pbits = SoftwareArchitecture.Bit64;
|
||||
break;
|
||||
|
||||
case 32:
|
||||
pbits = SoftwareArchitecture.Bit32;
|
||||
break;
|
||||
|
||||
default:
|
||||
pbits = SoftwareArchitecture.Unknown;
|
||||
break;
|
||||
}
|
||||
|
||||
return pbits;
|
||||
}
|
||||
}
|
||||
|
||||
static public SoftwareArchitecture OSBits
|
||||
{
|
||||
get
|
||||
{
|
||||
SoftwareArchitecture osbits = SoftwareArchitecture.Unknown;
|
||||
|
||||
switch (IntPtr.Size * 8)
|
||||
{
|
||||
case 64:
|
||||
osbits = SoftwareArchitecture.Bit64;
|
||||
break;
|
||||
|
||||
case 32:
|
||||
if (Is32BitProcessOn64BitProcessor())
|
||||
osbits = SoftwareArchitecture.Bit64;
|
||||
else
|
||||
osbits = SoftwareArchitecture.Bit32;
|
||||
break;
|
||||
|
||||
default:
|
||||
osbits = SoftwareArchitecture.Unknown;
|
||||
break;
|
||||
}
|
||||
|
||||
return osbits;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the current processor is 32 or 64-bit.
|
||||
/// </summary>
|
||||
static public ProcessorArchitecture ProcessorBits
|
||||
{
|
||||
get
|
||||
{
|
||||
ProcessorArchitecture pbits = ProcessorArchitecture.Unknown;
|
||||
|
||||
try
|
||||
{
|
||||
SYSTEM_INFO l_System_Info = new SYSTEM_INFO();
|
||||
GetNativeSystemInfo(ref l_System_Info);
|
||||
|
||||
switch (l_System_Info.uProcessorInfo.wProcessorArchitecture)
|
||||
{
|
||||
case 9: // PROCESSOR_ARCHITECTURE_AMD64
|
||||
pbits = ProcessorArchitecture.Bit64;
|
||||
break;
|
||||
case 6: // PROCESSOR_ARCHITECTURE_IA64
|
||||
pbits = ProcessorArchitecture.Itanium64;
|
||||
break;
|
||||
case 0: // PROCESSOR_ARCHITECTURE_INTEL
|
||||
pbits = ProcessorArchitecture.Bit32;
|
||||
break;
|
||||
default: // PROCESSOR_ARCHITECTURE_UNKNOWN
|
||||
pbits = ProcessorArchitecture.Unknown;
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
|
||||
return pbits;
|
||||
}
|
||||
}
|
||||
#endregion BITS
|
||||
|
||||
#region EDITION
|
||||
static private string s_Edition;
|
||||
/// <summary>
|
||||
/// Gets the edition of the operating system running on this computer.
|
||||
/// </summary>
|
||||
static public string Edition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (s_Edition != null)
|
||||
return s_Edition; //***** RETURN *****//
|
||||
|
||||
string edition = String.Empty;
|
||||
|
||||
OperatingSystem osVersion = Environment.OSVersion;
|
||||
OSVERSIONINFOEX osVersionInfo = new OSVERSIONINFOEX();
|
||||
osVersionInfo.dwOSVersionInfoSize = Marshal.SizeOf(typeof(OSVERSIONINFOEX));
|
||||
|
||||
if (GetVersionEx(ref osVersionInfo))
|
||||
{
|
||||
int majorVersion = osVersion.Version.Major;
|
||||
int minorVersion = osVersion.Version.Minor;
|
||||
byte productType = osVersionInfo.wProductType;
|
||||
short suiteMask = osVersionInfo.wSuiteMask;
|
||||
|
||||
#region VERSION 4
|
||||
if (majorVersion == 4)
|
||||
{
|
||||
if (productType == VER_NT_WORKSTATION)
|
||||
{
|
||||
// Windows NT 4.0 Workstation
|
||||
edition = "Workstation";
|
||||
}
|
||||
else if (productType == VER_NT_SERVER)
|
||||
{
|
||||
if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
|
||||
{
|
||||
// Windows NT 4.0 Server Enterprise
|
||||
edition = "Enterprise Server";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows NT 4.0 Server
|
||||
edition = "Standard Server";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion VERSION 4
|
||||
|
||||
#region VERSION 5
|
||||
else if (majorVersion >= 5)
|
||||
{
|
||||
if (productType == VER_NT_WORKSTATION)
|
||||
{
|
||||
if ((suiteMask & VER_SUITE_PERSONAL) != 0)
|
||||
{
|
||||
edition = "Home";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetSystemMetrics(86) == 0) // 86 == SM_TABLETPC
|
||||
edition = "Professional";
|
||||
else
|
||||
edition = "Tablet Edition";
|
||||
}
|
||||
}
|
||||
else if (productType == VER_NT_SERVER)
|
||||
{
|
||||
if (minorVersion == 0)
|
||||
{
|
||||
if ((suiteMask & VER_SUITE_DATACENTER) != 0)
|
||||
{
|
||||
// Windows 2000 Datacenter Server
|
||||
edition = "Datacenter Server";
|
||||
}
|
||||
else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
|
||||
{
|
||||
// Windows 2000 Advanced Server
|
||||
edition = "Advanced Server";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows 2000 Server
|
||||
edition = "Server";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((suiteMask & VER_SUITE_DATACENTER) != 0)
|
||||
{
|
||||
// Windows Server 2003 Datacenter Edition
|
||||
edition = "Datacenter";
|
||||
}
|
||||
else if ((suiteMask & VER_SUITE_ENTERPRISE) != 0)
|
||||
{
|
||||
// Windows Server 2003 Enterprise Edition
|
||||
edition = "Enterprise";
|
||||
}
|
||||
else if ((suiteMask & VER_SUITE_BLADE) != 0)
|
||||
{
|
||||
// Windows Server 2003 Web Edition
|
||||
edition = "Web Edition";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Windows Server 2003 Standard Edition
|
||||
edition = "Standard";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion VERSION 5
|
||||
|
||||
#region VERSION 6
|
||||
else if (majorVersion == 6)
|
||||
{
|
||||
int ed;
|
||||
if (GetProductInfo(majorVersion, minorVersion,
|
||||
osVersionInfo.wServicePackMajor, osVersionInfo.wServicePackMinor,
|
||||
out ed))
|
||||
{
|
||||
switch (ed)
|
||||
{
|
||||
case PRODUCT_BUSINESS:
|
||||
edition = "Business";
|
||||
break;
|
||||
case PRODUCT_BUSINESS_N:
|
||||
edition = "Business N";
|
||||
break;
|
||||
case PRODUCT_CLUSTER_SERVER:
|
||||
edition = "HPC Edition";
|
||||
break;
|
||||
case PRODUCT_CLUSTER_SERVER_V:
|
||||
edition = "HPC Edition without Hyper-V";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER:
|
||||
edition = "Datacenter Server";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER_CORE:
|
||||
edition = "Datacenter Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER_V:
|
||||
edition = "Datacenter Server without Hyper-V";
|
||||
break;
|
||||
case PRODUCT_DATACENTER_SERVER_CORE_V:
|
||||
edition = "Datacenter Server without Hyper-V (core installation)";
|
||||
break;
|
||||
case PRODUCT_EMBEDDED:
|
||||
edition = "Embedded";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE:
|
||||
edition = "Enterprise";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_N:
|
||||
edition = "Enterprise N";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_E:
|
||||
edition = "Enterprise E";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER:
|
||||
edition = "Enterprise Server";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_CORE:
|
||||
edition = "Enterprise Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_CORE_V:
|
||||
edition = "Enterprise Server without Hyper-V (core installation)";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_IA64:
|
||||
edition = "Enterprise Server for Itanium-based Systems";
|
||||
break;
|
||||
case PRODUCT_ENTERPRISE_SERVER_V:
|
||||
edition = "Enterprise Server without Hyper-V";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT:
|
||||
edition = "Essential Business Server MGMT";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL:
|
||||
edition = "Essential Business Server ADDL";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC:
|
||||
edition = "Essential Business Server MGMTSVC";
|
||||
break;
|
||||
case PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC:
|
||||
edition = "Essential Business Server ADDLSVC";
|
||||
break;
|
||||
case PRODUCT_HOME_BASIC:
|
||||
edition = "Home Basic";
|
||||
break;
|
||||
case PRODUCT_HOME_BASIC_N:
|
||||
edition = "Home Basic N";
|
||||
break;
|
||||
case PRODUCT_HOME_BASIC_E:
|
||||
edition = "Home Basic E";
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM:
|
||||
edition = "Home Premium";
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM_N:
|
||||
edition = "Home Premium N";
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM_E:
|
||||
edition = "Home Premium E";
|
||||
break;
|
||||
case PRODUCT_HOME_PREMIUM_SERVER:
|
||||
edition = "Home Premium Server";
|
||||
break;
|
||||
case PRODUCT_HYPERV:
|
||||
edition = "Microsoft Hyper-V Server";
|
||||
break;
|
||||
case PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT:
|
||||
edition = "Windows Essential Business Management Server";
|
||||
break;
|
||||
case PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING:
|
||||
edition = "Windows Essential Business Messaging Server";
|
||||
break;
|
||||
case PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY:
|
||||
edition = "Windows Essential Business Security Server";
|
||||
break;
|
||||
case PRODUCT_PROFESSIONAL:
|
||||
edition = "Professional";
|
||||
break;
|
||||
case PRODUCT_PROFESSIONAL_N:
|
||||
edition = "Professional N";
|
||||
break;
|
||||
case PRODUCT_PROFESSIONAL_E:
|
||||
edition = "Professional E";
|
||||
break;
|
||||
case PRODUCT_SB_SOLUTION_SERVER:
|
||||
edition = "SB Solution Server";
|
||||
break;
|
||||
case PRODUCT_SB_SOLUTION_SERVER_EM:
|
||||
edition = "SB Solution Server EM";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SB_SOLUTIONS:
|
||||
edition = "Server for SB Solutions";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM:
|
||||
edition = "Server for SB Solutions EM";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SMALLBUSINESS:
|
||||
edition = "Windows Essential Server Solutions";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOR_SMALLBUSINESS_V:
|
||||
edition = "Windows Essential Server Solutions without Hyper-V";
|
||||
break;
|
||||
case PRODUCT_SERVER_FOUNDATION:
|
||||
edition = "Server Foundation";
|
||||
break;
|
||||
case PRODUCT_SMALLBUSINESS_SERVER:
|
||||
edition = "Windows Small Business Server";
|
||||
break;
|
||||
case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM:
|
||||
edition = "Windows Small Business Server Premium";
|
||||
break;
|
||||
case PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE:
|
||||
edition = "Windows Small Business Server Premium (core installation)";
|
||||
break;
|
||||
case PRODUCT_SOLUTION_EMBEDDEDSERVER:
|
||||
edition = "Solution Embedded Server";
|
||||
break;
|
||||
case PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE:
|
||||
edition = "Solution Embedded Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER:
|
||||
edition = "Standard Server";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_CORE:
|
||||
edition = "Standard Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_SOLUTIONS:
|
||||
edition = "Standard Server Solutions";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE:
|
||||
edition = "Standard Server Solutions (core installation)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_CORE_V:
|
||||
edition = "Standard Server without Hyper-V (core installation)";
|
||||
break;
|
||||
case PRODUCT_STANDARD_SERVER_V:
|
||||
edition = "Standard Server without Hyper-V";
|
||||
break;
|
||||
case PRODUCT_STARTER:
|
||||
edition = "Starter";
|
||||
break;
|
||||
case PRODUCT_STARTER_N:
|
||||
edition = "Starter N";
|
||||
break;
|
||||
case PRODUCT_STARTER_E:
|
||||
edition = "Starter E";
|
||||
break;
|
||||
case PRODUCT_STORAGE_ENTERPRISE_SERVER:
|
||||
edition = "Enterprise Storage Server";
|
||||
break;
|
||||
case PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE:
|
||||
edition = "Enterprise Storage Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_EXPRESS_SERVER:
|
||||
edition = "Express Storage Server";
|
||||
break;
|
||||
case PRODUCT_STORAGE_EXPRESS_SERVER_CORE:
|
||||
edition = "Express Storage Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_STANDARD_SERVER:
|
||||
edition = "Standard Storage Server";
|
||||
break;
|
||||
case PRODUCT_STORAGE_STANDARD_SERVER_CORE:
|
||||
edition = "Standard Storage Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_STORAGE_WORKGROUP_SERVER:
|
||||
edition = "Workgroup Storage Server";
|
||||
break;
|
||||
case PRODUCT_STORAGE_WORKGROUP_SERVER_CORE:
|
||||
edition = "Workgroup Storage Server (core installation)";
|
||||
break;
|
||||
case PRODUCT_UNDEFINED:
|
||||
edition = "Unknown product";
|
||||
break;
|
||||
case PRODUCT_ULTIMATE:
|
||||
edition = "Ultimate";
|
||||
break;
|
||||
case PRODUCT_ULTIMATE_N:
|
||||
edition = "Ultimate N";
|
||||
break;
|
||||
case PRODUCT_ULTIMATE_E:
|
||||
edition = "Ultimate E";
|
||||
break;
|
||||
case PRODUCT_WEB_SERVER:
|
||||
edition = "Web Server";
|
||||
break;
|
||||
case PRODUCT_WEB_SERVER_CORE:
|
||||
edition = "Web Server (core installation)";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion VERSION 6
|
||||
}
|
||||
|
||||
s_Edition = edition;
|
||||
return edition;
|
||||
}
|
||||
}
|
||||
#endregion EDITION
|
||||
|
||||
#region NAME
|
||||
static private string s_Name;
|
||||
/// <summary>
|
||||
|
|
@ -984,45 +539,6 @@ static public int RevisionVersion
|
|||
#endregion REVISION
|
||||
#endregion VERSION
|
||||
|
||||
#region 64 BIT OS DETECTION
|
||||
private static IsWow64ProcessDelegate GetIsWow64ProcessDelegate()
|
||||
{
|
||||
IntPtr handle = LoadLibrary("kernel32");
|
||||
|
||||
if (handle != IntPtr.Zero)
|
||||
{
|
||||
IntPtr fnPtr = GetProcAddress(handle, "IsWow64Process");
|
||||
|
||||
if (fnPtr != IntPtr.Zero)
|
||||
{
|
||||
return (IsWow64ProcessDelegate)Marshal.GetDelegateForFunctionPointer((IntPtr)fnPtr, typeof(IsWow64ProcessDelegate));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool Is32BitProcessOn64BitProcessor()
|
||||
{
|
||||
IsWow64ProcessDelegate fnDelegate = GetIsWow64ProcessDelegate();
|
||||
|
||||
if (fnDelegate == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isWow64;
|
||||
bool retVal = fnDelegate.Invoke(Process.GetCurrentProcess().Handle, out isWow64);
|
||||
|
||||
if (retVal == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return isWow64;
|
||||
}
|
||||
#endregion 64 BIT OS DETECTION
|
||||
|
||||
#region Windows 10 Detection
|
||||
|
||||
private static bool IsWindows10()
|
||||
|
|
|
|||
Loading…
Reference in a new issue