10年8个月前IP:澳大利亚
813966
9楼
using System;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
 
namespace WinUtils
{
    [StructLayout(LayoutKind.Sequential, Pack = 1)]
    public struct SYSTEM_INFO
    {
        public PROCESSOR_ARCHITECTURE wProcessorArchitecture;
        short wReserved;
 
        public int dwPageSize;
        public IntPtr lpMinimumApplicationAddress;
        public IntPtr lpMaximumApplicationAddress;
        public IntPtr dwActiveProcessorMask;
        public int dwNumberOfProcessors;
        public int dwProcessorType;
        public int dwAllocationGranularity;
        public short wProcessorLevel;
        public short wProcessorRevision;
    };
 
    public enum PROCESSOR_ARCHITECTURE : short
    {
        PROCESSOR_ARCHITECTURE_INTEL = 0,
        PROCESSOR_ARCHITECTURE_MIPS = 1,
        PROCESSOR_ARCHITECTURE_ALPHA = 2,
        PROCESSOR_ARCHITECTURE_PPC = 3,
        PROCESSOR_ARCHITECTURE_SHX = 4,
        PROCESSOR_ARCHITECTURE_ARM = 5,
        PROCESSOR_ARCHITECTURE_IA64 = 6,
        PROCESSOR_ARCHITECTURE_ALPHA64 = 7,
        PROCESSOR_ARCHITECTURE_MSIL = 8,
        PROCESSOR_ARCHITECTURE_AMD64 = 9,
        PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10,
        PROCESSOR_ARCHITECTURE_NEUTRAL = 11
    }
 
    public static class WinVer
    {
        public static Version SystemVersion = WinVer.GetSystemVersion();
 
        public static bool IsVistaOrGreater()
        {
            return SystemVersion.Major > 5;
        }
 
        public static bool IsWin10OrGreater()
        {
            return SystemVersion.Major > 9;
        }
 
        public static bool IsX64System()
        {
            SYSTEM_INFO systemInfo = new SYSTEM_INFO();
            int a = Marshal.SizeOf(systemInfo);
            WinAPI.GetNativeSystemInfo(ref systemInfo);
            return systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE.PROCESSOR_ARCHITECTURE_AMD64;
        }
 
        public static void ShowShellAboutBox(Form form, string appName, string comment, Icon icon = null)
        {
            WinAPI.ShellAbout(form.Handle, appName, comment, icon == null ? form.Icon.Handle : icon.Handle);
        }
 
        private static Delegate GetFunctionAddress(IntPtr dllModule, string functionName, Type t)
        {
 
            IntPtr address = WinAPI.GetProcAddress(dllModule, functionName);
            if (address == IntPtr.Zero)
                return null;
            else
                return Marshal.GetDelegateForFunctionPointer(address, t);
        }
 
        private delegate IntPtr RtlGetNtVersionNumbers(ref int dwMajor, ref int dwMinor, ref int dwBuildNumber);
 
        public static Version GetSystemVersion()
        {
            IntPtr hinst = WinAPI.LoadLibrary("ntdll.dll");
            RtlGetNtVersionNumbers func = (RtlGetNtVersionNumbers)GetFunctionAddress(hinst, "RtlGetNtVersionNumbers", typeof(RtlGetNtVersionNumbers));
            int dwMajor = 0, dwMinor = 0, dwBuildNumber = 0;
            func.Invoke(ref dwMajor, ref dwMinor, ref dwBuildNumber);
            dwBuildNumber &= 0xffff;
            return new Version(dwMajor, dwMinor, dwBuildNumber);
        }
    }
}
[DllImport("Kernel32")]
public static extern IntPtr LoadLibrary(string funcname);
 
[DllImport("Kernel32")]
public static extern IntPtr GetProcAddress(IntPtr handle, string funcname);
 
[DllImport("Kernel32")]
public static extern IntPtr GetNativeSystemInfo(ref SYSTEM_INFO systemInfo);
 
[DllImport("shell32.dll")]
public static extern int ShellAbout(IntPtr hWnd, string szApp, string szOtherStuff, IntPtr hIcon);
评论
文号 / 813966

万流景仰
名片发私信
学术分 11
总主题 171 帖总回复 1713 楼拥有证书:学者 机友 笔友
注册于 2011/09/23 14:21:19最后登录 2026/04/15 00:20:51
主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:0

个人简介

怪哉!灵异的三极管电流流向! 这素一个在仿真的RCC电路,示波器上绿色的是集电极电流红色的是发射极电流。窝萌都知道发射姬电流素集电极电流和基极电流之和,所以讲道理发射极电流一定比集电极略大。可仿真结果刷了三观,Q1集电极电流一部分流经基极,然后流经Q2的C->E。

笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的