DotNet.Authorize/Hardware.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Management;
using System.Runtime.InteropServices;

namespace DotNet.Authorize
{
    /// <summary>
    /// 计算机硬件信息操作类
    /// </summary>
    public class Hardware
    {
        [DllImport("Kernel32.dll", CharSet = CharSet.Auto)]
        private static extern bool GetVolumeInformation(
            string lpRootPathName,
            //欲获取信息的那个卷的根路径
            string lpVolumeNameBuffer,
            //用于装载卷名(卷标)的一个字串
            int nVolumeNameSize,
            //lpVolumeNameBuffer字串的长度   
            ref int lpVolumeSerialNumber,
            //用于装载磁盘卷序列号的变量   
            int lpMaximumComponentLength,
            // 指定一个变量,用于装载文件名每一部分的长度。例如,在“c:\component1\component2.ext”的情况下,它就代表component1或component2名称的长度 .
            int lpFileSystemFlags,
            //用于装载一个或多个二进制位标志的变量。对这些标志位的解释如下:
            //FS_CASE_IS_PRESERVED 文件名的大小写记录于文件系统
            //FS_CASE_SENSITIVE 文件名要区分大小写
            //FS_UNICODE_STORED_ON_DISK 文件名保存为Unicode格式
            //FS_PERSISTANT_ACLS 文件系统支持文件的访问控制列表(ACL)安全机制
            //FS_FILE_COMPRESSION 文件系统支持逐文件的进行文件压缩
            //FS_VOL_IS_COMPRESSED 整个磁盘卷都是压缩的
            string lpFileSystemNameBuffer,
            //指定一个缓冲区,用于装载文件系统的名称(如FAT,NTFS以及其他)        
            int nFileSystemNameSize
            //lpFileSystemNameBuffer字串的长度
        );

        /// <summary>
        /// 获取分区号
        /// </summary>
        /// <returns></returns>
        private static string GetPartitionNumber()
        {
            string cdisk = Environment.GetFolderPath(Environment.SpecialFolder.System);
            cdisk = cdisk.Substring(0, cdisk.IndexOf("\\") + 1);
            const int MAX_FILENAME_LEN = 256;
            int retVal = 0;
            int a = 0;
            int b = 0;
            string str1 = null;
            string str2 = null;


            GetVolumeInformation(
                cdisk,
                str1,
                MAX_FILENAME_LEN,
                ref retVal,
                a,
                b,
后面还有 94 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。