精华内容
下载资源
问答
  • 2019-10-06 22:33:49

    通过 SELECT * FROM Win32_PhysicalMedia 可以返回硬盘序列号,但是在实际使用中某些情况下(原因未知)返回的 SerialNumber 是实际硬盘序列号的字符串按字符UrlEncode得到的纯数字字符串,如硬盘序列号为 1551F01361BF,可能某一次返回给你的会变成 3531313530463331313646422020202020202020,因此需要简单处理一下

            If str.Length > 12 AndAlso str.Length Mod 4 = 0 Then
                Dim sb As New StringBuilder
                For i As Int32 = 0 To str.Length - 1 Step 4
                    sb.Append(HttpUtility.UrlDecode("%" & str.Substring(i + 2, 2)))
                    sb.Append(HttpUtility.UrlDecode("%" & str.Substring(i, 2)))
                Next
                str = sb.ToString.Trim
            End If
            Return str    
    

     至于出现这个问题的原因,我还在没找到答案,如果有哪位大侠遇到过,还望不吝赐教

    转载于:https://www.cnblogs.com/towerbit/p/9992866.html

    更多相关内容
  • WMI 获取硬盘序列号

    2021-04-12 22:54:34
    //查询系统所在硬盘的索引ManagementObjectSearcher mo = new ManagementObjectSearcher("SELECT DiskIndex FROM Win32_DiskPartition WHERE Bootable = TRUE");foreach (var item in mo.Get()){string diskindex = ...

    //查询系统所在硬盘的索引

    ManagementObjectSearcher mo = new ManagementObjectSearcher("SELECT DiskIndex FROM Win32_DiskPartition WHERE Bootable = TRUE");

    foreach (var item in mo.Get())

    {

    string diskindex = item["DiskIndex"].ToString();

    MessageBox.Show(item["DiskIndex"].ToString());

    try

    {

    //根据硬盘索引查询硬盘序列号,XP查询“Win32_PhysicalMedia”,vista以后查询“Win32_DiskDrive”

    ManagementObjectSearcher ms = new ManagementObjectSearcher("SELECT SerialNumber FROM Win32_DiskDrive WHERE Index ="+"'"+diskindex+"'");

    foreach (var m in ms.Get())

    {

    MessageBox.Show(m["SerialNumber"].ToString());

    }

    }

    catch (Exception ex)

    {

    MessageBox.Show(ex.Message);

    }

    }

    //查询D盘卷标号

    ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");

    ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"d:\"");

    disk.Get();

    MessageBox.Show(disk.GetPropertyValue("VolumeSerialNumber").ToString());

    展开全文
  • 主要用于wmi方式获取c盘序列号,多用于生成硬件识别码,wmi可以获取很多设备信息,可以扩展到其他设备。但是wmi速度慢,而且有一定的局限性,有些环境获取不了,比如虚拟机。另一种更底层的方式是使用...
  • 于是想到利用硬盘序列号来生成license。而一台电脑往往有多块硬盘,并且根据用户需求可能会增加硬盘,用哪一块硬盘的序列号呢?很自然想到了系统所在的硬盘,因为系统所在的盘一般不会动,除非重装系统到另一块硬盘...

            本人最近在研究license设计,很多商业软件的license通常利用网卡MAC地址来生成,而电脑的MAC地址容易更改,难以保证license的控制。于是想到利用硬盘序列号来生成license。而一台电脑往往有多块硬盘,并且根据用户需求可能会增加硬盘,用哪一块硬盘的序列号呢?很自然想到了系统所在的硬盘,因为系统所在的盘一般不会动,除非重装系统到另一块硬盘。

           在windows系统中很容易直接查到系统盘在哪块硬盘上:右键我的电脑——管理——磁盘管理,在下方图示区域很容易看到系统在哪块硬盘上。

            如何通过代码获取系统在哪块硬盘上呢?在网上搜了很久,发现基本是用Windows API 函数CreateFile加DeviceIoControl函数实现的,由于在VB.NET中使用API需要写大量的常量定义和函数声明,非常之不方便。

            幸好之前研究获取硬盘序列号的时候,看过一篇文章是通过WMI的查询获取的,原文链接:VB.NET 获取电脑属性(硬盘ID、硬盘容量、Cpu序列号、MAC地址、系统类型),该链接中通过WMI查询“Win32_DiskDrive”的可以找到所有硬盘对应的序列号及其他信息。于是猜想是不是也能通过WMI来获取系统所在硬盘编号呢?接着找到一篇文章WMI使用的WIN32_类库名,在公开的众类名中找到了“Win32_DiskPartition”类(即Win32_磁盘分区类),感觉就是我需要的,接着在MSDN搜了一下这个类的成员Win32 _ DiskPartition 类,最终找到了我需要的属性。附上全套代码如下,注意需要在解决方案资源管理器里添加System.Management引用,否则无法识别ManagementObjectSearcher函数(即便代码开始Import了也不行,一定要添加到引用列表中)。

    Imports System.Management
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            
    
            '获取系统所在硬盘编号
            Dim rootDiskNo As Integer
            Dim cmicWmi2 As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_DiskPartition")
    
            For Each cmicWmiObj As ManagementObject In cmicWmi2.Get
                If cmicWmiObj("BootPartition") = True Then '判断当前分区是否为系统盘所在
                    rootDiskNo = cmicWmiObj("DiskIndex") '获得电脑中硬盘序号(形如0,1,2)
                End If
    
            Next
    
            Dim rootDiskSerialNO As String
            Dim cmicWmi As New System.Management.ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive")
            For Each cmicWmiObj As ManagementObject In cmicWmi.Get           
                If cmicWmiObj("Index") = rootDiskNo Then
                    rootDiskSerialNO = cmicWmiObj("serialnumber")
                End If
            Next
            Msgbox(rootDiskSerialNO)
      
    
        End Sub

    展开全文
  • 使用python wmi采集的硬盘序列号 ``` import wmi c = wmi.WMI() for physical_disk in c.Win32_DiskDrive(): print('Disk SN: %s' % physical_disk.SerialNumber.strip()) ``` 得到: Disk SN: ...
  • 在资源已在项目使用,所以分享给需要的小伙伴。代码清晰,可以直接移植到其它项目中。
  • WMI方式获取硬盘序列号VBS脚本

    热门讨论 2010-06-30 11:38:19
    通过调用WMI对象,查询并获取硬盘序列号,签名及标签
  • GetSysTemHardWareID(wchar_t* WMI_Namespace = L"ROOT\\CIMV2"); public: void Get_CpuId(CString& dest); void Get_DiskDriveId(CString& dest); void Get_MacAddress(CString& dest); void Get_OsName(CString& ...

     经行了简单的封装,江功能全部封装到了类文件。

     封装类文件H头文件

    #ifndef _H_GETSYSTEMHARDWAREID
    #define _H_GETSYSTEMHARDWAREID
    #include"targetver.h"
    #include<wbemcli.h>
    #include<string.h>
    #include <iostream>
    #include <Windows.h>
    #include <comdef.h>
    #include <Wbemidl.h>
    #include "wincred.h"
    #pragma comment(lib, "credui.lib")
    #pragma comment(lib,"wbemuuid.lib")
    using namespace std;
    #pragma once
    class GetSysTemHardWareID
    {
    public:
    	virtual ~GetSysTemHardWareID();
    	GetSysTemHardWareID(wchar_t* WMI_Namespace = L"ROOT\\CIMV2");
    public:
    	void Get_CpuId(CString& dest);
    	void Get_DiskDriveId(CString& dest);
    	void Get_MacAddress(CString& dest);
    	void Get_OsName(CString& dest);
    	void Get_BaseBoardId(CString &dest);
    	void Get_BiosSerialId(CString &dest);
    	HRESULT hres;
    private:
    	IWbemServices* pSvc;
    	IWbemLocator*  pLoc; 
    	bool ExecQueryValue(char* strQueryLanguage, char* strQuery, IEnumWbemClassObject** pEnumerator);
    private:
    protected:
    };
    #endif // !_H_GETSYSTEMHARDWAREID
    

    封装类CPP实现文件

    #include "pch.h"
    #include "GetSysTemHardWareID.h"
    #include <vector>
    #include <iostream> 
    #include <list>
    using namespace std;
    GetSysTemHardWareID::GetSysTemHardWareID(wchar_t* WMI_Namespace)
    {
         pSvc = NULL;
         pLoc = NULL;
         hres = NULL;
    
        hres =  CoInitializeEx(0, COINIT_MULTITHREADED); 
        if (FAILED(hres))
        {
            printf("Failed to initialize COM library. Error code = 0x");
        }
        hres =  CoInitializeSecurity(
            NULL, 
            -1,                         
            NULL,                       
            NULL,                       
            RPC_C_AUTHN_LEVEL_DEFAULT,   
            RPC_C_IMP_LEVEL_IMPERSONATE, 
            NULL,                        
            EOAC_NONE,                  
            NULL                        
            );
                          
        if (FAILED(hres))
        {
            printf("Failed to initialize security. Error code = 0x");
            CoUninitialize();
        }
        hres = CoCreateInstance(
            CLSID_WbemLocator,             
            0, 
            CLSCTX_INPROC_SERVER, 
            IID_IWbemLocator, (LPVOID *) &pLoc);
     
        if (FAILED(hres))
        {
            printf("Failed to create IWbemLocator object.");        
            CoUninitialize();
              
        }
        hres = pLoc->ConnectServer(
             _bstr_t(WMI_Namespace), 
             NULL,                   
             NULL,                   
             0,                      
             NULL,                 
             0,                       
             0,                      
             &pSvc                  
             );
        
        if (FAILED(hres))
        {
            printf("Could not connect. Error code = 0x");
            pLoc->Release();     
            CoUninitialize();        
        }
        printf ("Connected to ROOT\\CIMV2 WMI namespace") ;
    
        hres = CoSetProxyBlanket(
           pSvc,                        
           RPC_C_AUTHN_WINNT,           
           RPC_C_AUTHZ_NONE,            
           NULL,                        
           RPC_C_AUTHN_LEVEL_CALL,      
           RPC_C_IMP_LEVEL_IMPERSONATE, 
           NULL,                        
           EOAC_NONE                 
        );
    
        if (FAILED(hres))
        {
            printf("Could not set proxy blanket. Error code = 0x");
            pSvc->Release();
            pLoc->Release();     
            CoUninitialize();              
        }
    }
    GetSysTemHardWareID::~GetSysTemHardWareID()
    {
    	pSvc->Release();
    	pLoc->Release();
        CoUninitialize();
        hres = NULL;
    }
    
    void GetSysTemHardWareID::Get_CpuId(CString& dest)
    {
    	IEnumWbemClassObject* pEnumerator = NULL;
    	ExecQueryValue("WQL", "SELECT * FROM Win32_Processor", &pEnumerator);
    	IWbemClassObject* pclsObj = NULL;
    	ULONG uReturn = 0;
    	while (pEnumerator)
    	{
    		HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
    		&pclsObj, &uReturn);
    		if (0 == uReturn)
    		{
    			break;
    		}
    		VARIANT vtProp;
            vtProp.vt = VT_BSTR;
    		hr = pclsObj->Get(L"ProcessorId", 0, &vtProp, 0, 0);
            printf("ProcessorId:\n%ws", vtProp.bstrVal);
            printf("\n");
    		dest = vtProp.bstrVal;
    		VariantClear(&vtProp);
    		pclsObj->Release();
    	}
    	pEnumerator->Release();
    }
    
    void GetSysTemHardWareID::Get_DiskDriveId(CString& dest)
    {
    	IEnumWbemClassObject* pEnumerator = NULL;
    	ExecQueryValue("WQL", "SELECT * FROM Win32_DiskDrive WHERE (SerialNumber IS NOT NULL) AND (MediaType LIKE 'Fixed hard disk%')", &pEnumerator);
    	IWbemClassObject* pclsObj = NULL;
    	ULONG uReturn = 0;
        int i = 0;
        CString strN;
    	while (pEnumerator)
    	{
            i++;
    		HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
    			&pclsObj, &uReturn);
    		if (0 == uReturn)
    		{
    			break;
    		}
    		VARIANT vtProp;
            vtProp.vt = VT_BSTR;
    		hr = pclsObj->Get(L"SerialNumber", 0, &vtProp, 0,0);  
            strN = strN + vtProp.bstrVal+_T(";");
            dest = vtProp.bstrVal;
            dest.Replace(_T(" "), _T(""));
            strN.Replace(_T(" "),_T(""));
            printf("SerialNumber[%d]:\n%ws", i, dest.GetString());
            printf("\n");
    		VariantClear(&vtProp);
    		pclsObj->Release();
    	}
    	pEnumerator->Release();
        i = 0;
        dest = strN;
    }
    
    void GetSysTemHardWareID::Get_MacAddress(CString& dest)
    {
            IEnumWbemClassObject* pEnumerator = NULL;
            ExecQueryValue("WQL", "SELECT * FROM Win32_NetworkAdapter WHERE (MACAddress IS NOT NULL) AND (NOT (PNPDeviceID LIKE 'ROOT%'))", &pEnumerator);
            IWbemClassObject* pclsObj = NULL;
            ULONG uReturn = 0;
            vector<CString> MACAddress;
            while (pEnumerator)
            {
                HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
                &pclsObj, &uReturn);
                if (0 == uReturn)
                {
                    break;
                }
                VARIANT vtProp;
                VARIANT vtProp2;
                vtProp.vt = VT_BSTR;
                vtProp2.vt = VT_BSTR;
                hr = pclsObj->Get(L"Description", 0, &vtProp2, 0, 0);
                printf("Description:\n%ws", vtProp2.bstrVal);
                printf("\n");
                dest = vtProp2.bstrVal;
                dest += _T(" ; ");  
                pclsObj->Get(L"MACAddress", 0, &vtProp, 0, 0);
                MACAddress.push_back((CString)(vtProp.bstrVal));
                printf("MACAddress:\n%ws", vtProp.bstrVal);
                printf("\n");
                VariantClear(&vtProp);
                pclsObj->Release();
                break;
            }
            if (MACAddress.size() >= 1)
            {
                dest= dest+MACAddress[0];
            }
          /*  else if (MACAddress.size()>1)
            {
                for (size_t i = 0; i < MACAddress.size(); i++)
                {
                    dest = dest + MACAddress[i];
                }
            }*/
            MACAddress.clear();
            pEnumerator->Release();
    }
    
    void GetSysTemHardWareID::Get_OsName(CString& dest)
    {
    	IEnumWbemClassObject* pEnumerator=NULL ;
    	ExecQueryValue("WQL", "SELECT * FROM Win32_OperatingSystem", &pEnumerator);
    	IWbemClassObject* pclsObj = NULL;
    	ULONG uReturn = 0;
    	while (pEnumerator)
    	{
            HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
    		&pclsObj, &uReturn);
    		if (0 == uReturn)
    		{
    			break;
    		}
    		VARIANT vtProp;
            vtProp.vt = VT_BSTR;
            hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0);
            printf("OS NAME:\n%ws", vtProp.bstrVal);
            printf("\n");
    		dest = vtProp.bstrVal;
    		VariantClear(&vtProp);
    		pclsObj->Release();
    		break;
    	}
        pEnumerator->Release();
    }
    
    void GetSysTemHardWareID::Get_BaseBoardId(CString &dest)
    {
        IEnumWbemClassObject* pEnumerator = NULL;
        ExecQueryValue("WQL", "SELECT * FROM Win32_BaseBoard WHERE (SerialNumber IS NOT NULL)", &pEnumerator);
        IWbemClassObject* pclsObj = NULL;
        ULONG uReturn = 0;
        while (pEnumerator)
        {
            HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
                &pclsObj, &uReturn);
            if (0 == uReturn)
            {
                break;
            }
            VARIANT vtProp;
            vtProp.vt = VT_BSTR;
            hr = pclsObj->Get(L"SerialNumber", 0, &vtProp, 0, 0);
            printf("Board SerialNumber:\n%ws", vtProp.bstrVal);
            printf("\n");
            dest += _T("BaseBoardId:");
            dest += vtProp.bstrVal;
            VariantClear(&vtProp);
            pclsObj->Release();
            break;
        }
        pEnumerator->Release();
    }
    
    void GetSysTemHardWareID::Get_BiosSerialId(CString& dest)
    {
        IEnumWbemClassObject* pEnumerator = NULL;
        ExecQueryValue("WQL", "SELECT * FROM Win32_BIOS WHERE SerialNumber IS NOT NULL", &pEnumerator);
        IWbemClassObject* pclsObj = NULL;
        ULONG uReturn = 0;
        while (pEnumerator)
        {
            HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1,
                &pclsObj, &uReturn);
            if (0 == uReturn)
            {
                break;
            }
            VARIANT vtProp;
            vtProp.vt = VT_BSTR;
            hr = pclsObj->Get(L"SerialNumber", 0, &vtProp, 0, 0);
            printf("BIOS SerialNumber:\n%ws", vtProp.bstrVal);
            printf("\n");
            dest += _T("BIOSSerialId:");
            dest += vtProp.bstrVal;
            VariantClear(&vtProp);
            pclsObj->Release();
        }
        pEnumerator->Release();
    }
    
    bool GetSysTemHardWareID::ExecQueryValue(char* strQueryLanguage, char* strQuery, IEnumWbemClassObject** pEnumerator)
    {
        HRESULT hre = pSvc->ExecQuery(
    		bstr_t(strQueryLanguage),
    		bstr_t(strQuery),
    		WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
    		NULL,
    		pEnumerator);
    	if (FAILED(hres))
    	{
    		printf("Query for operating system name failed.");
    		pSvc->Release();
    		pLoc->Release();
    		CoUninitialize();
    		return FALSE; 
    	}
    	return true;
    }
    

    重要说明:本例程参考《MSDN Library for Visual Studio 2008 SP1 简体中文》类库文件说明,如下为《MSDN Library for Visual Studio 2008 SP1 简体中文》中对WMI技术的说明,在如下说明的第6步和第7步为读取PC机系统名称例程。

    #define _WIN32_DCOM
    #include <iostream>
    using namespace std;
    #include <comdef.h>
    #include <Wbemidl.h>
    
    # pragma comment(lib, "wbemuuid.lib")
    
    int main(int argc, char **argv)
    {
        HRESULT hres;
    
        // Step 1: --------------------------------------------------
        // Initialize COM. ------------------------------------------
    
        hres =  CoInitializeEx(0, COINIT_MULTITHREADED); 
        if (FAILED(hres))
        {
            cout << "Failed to initialize COM library. Error code = 0x" 
                << hex << hres << endl;
            return 1;                  // Program has failed.
        }
    
        // Step 2: --------------------------------------------------
        // Set general COM security levels --------------------------
        // Note: If you are using Windows 2000, you need to specify -
        // the default authentication credentials for a user by using
        // a SOLE_AUTHENTICATION_LIST structure in the pAuthList ----
        // parameter of CoInitializeSecurity ------------------------
    
        hres =  CoInitializeSecurity(
            NULL, 
            -1,                          // COM authentication
            NULL,                        // Authentication services
            NULL,                        // Reserved
            RPC_C_AUTHN_LEVEL_DEFAULT,   // Default authentication 
            RPC_C_IMP_LEVEL_IMPERSONATE, // Default Impersonation  
            NULL,                        // Authentication info
            EOAC_NONE,                   // Additional capabilities 
            NULL                         // Reserved
            );
    
                          
        if (FAILED(hres))
        {
            cout << "Failed to initialize security. Error code = 0x" 
                << hex << hres << endl;
            CoUninitialize();
            return 1;                    // Program has failed.
        }
        
        // Step 3: ---------------------------------------------------
        // Obtain the initial locator to WMI -------------------------
    
        IWbemLocator *pLoc = NULL;
    
        hres = CoCreateInstance(
            CLSID_WbemLocator,             
            0, 
            CLSCTX_INPROC_SERVER, 
            IID_IWbemLocator, (LPVOID *) &pLoc);
     
        if (FAILED(hres))
        {
            cout << "Failed to create IWbemLocator object."
                << " Err code = 0x"
                << hex << hres << endl;
            CoUninitialize();
            return 1;                 // Program has failed.
        }
    
        // Step 4: -----------------------------------------------------
        // Connect to WMI through the IWbemLocator::ConnectServer method
    
        IWbemServices *pSvc = NULL;
    	
        // Connect to the root\cimv2 namespace with
        // the current user and obtain pointer pSvc
        // to make IWbemServices calls.
        hres = pLoc->ConnectServer(
             _bstr_t(L"ROOT\\CIMV2"), // Object path of WMI namespace
             NULL,                    // User name. NULL = current user
             NULL,                    // User password. NULL = current
             0,                       // Locale. NULL indicates current
             NULL,                    // Security flags.
             0,                       // Authority (e.g. Kerberos)
             0,                       // Context object 
             &pSvc                    // pointer to IWbemServices proxy
             );
        
        if (FAILED(hres))
        {
            cout << "Could not connect. Error code = 0x" 
                 << hex << hres << endl;
            pLoc->Release();     
            CoUninitialize();
            return 1;                // Program has failed.
        }
    
        cout << "Connected to ROOT\\CIMV2 WMI namespace" << endl;
    
    
        // Step 5: --------------------------------------------------
        // Set security levels on the proxy -------------------------
    
        hres = CoSetProxyBlanket(
           pSvc,                        // Indicates the proxy to set
           RPC_C_AUTHN_WINNT,           // RPC_C_AUTHN_xxx
           RPC_C_AUTHZ_NONE,            // RPC_C_AUTHZ_xxx
           NULL,                        // Server principal name 
           RPC_C_AUTHN_LEVEL_CALL,      // RPC_C_AUTHN_LEVEL_xxx 
           RPC_C_IMP_LEVEL_IMPERSONATE, // RPC_C_IMP_LEVEL_xxx
           NULL,                        // client identity
           EOAC_NONE                    // proxy capabilities 
        );
    
        if (FAILED(hres))
        {
            cout << "Could not set proxy blanket. Error code = 0x" 
                << hex << hres << endl;
            pSvc->Release();
            pLoc->Release();     
            CoUninitialize();
            return 1;               // Program has failed.
        }
    
        // Step 6: --------------------------------------------------
        // Use the IWbemServices pointer to make requests of WMI ----
    
        // For example, get the name of the operating system
        IEnumWbemClassObject* pEnumerator = NULL;
        hres = pSvc->ExecQuery(
            bstr_t("WQL"), 
            bstr_t("SELECT * FROM Win32_OperatingSystem"),
            WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, 
            NULL,
            &pEnumerator);
        
        if (FAILED(hres))
        {
            cout << "Query for operating system name failed."
                << " Error code = 0x" 
                << hex << hres << endl;
            pSvc->Release();
            pLoc->Release();
            CoUninitialize();
            return 1;               // Program has failed.
        }
    
        // Step 7: -------------------------------------------------
        // Get the data from the query in step 6 -------------------
     
        IWbemClassObject *pclsObj;
        ULONG uReturn = 0;
       
        while (pEnumerator)
        {
            HRESULT hr = pEnumerator->Next(WBEM_INFINITE, 1, 
                &pclsObj, &uReturn);
    
            if(0 == uReturn)
            {
                break;
            }
    
            VARIANT vtProp;
    
            // Get the value of the Name property
            hr = pclsObj->Get(L"Name", 0, &vtProp, 0, 0);
            wcout << " OS Name : " << vtProp.bstrVal << endl;
            VariantClear(&vtProp);
        }
    
        // Cleanup
        // ========
        
        pSvc->Release();
        pLoc->Release();
        pEnumerator->Release();
        pclsObj->Release();
        CoUninitialize();
    
        return 0;   // Program successfully completed.
    	
    }
    

    展开全文
  • wmi应用(用于获取CPUID和硬盘ID)

    热门讨论 2012-05-08 23:07:52
    wmi应用(用于获取CPUID和硬盘ID)
  • 序列号相当于电脑的身份证号,是硬件出厂时,厂商写在硬件里的唯一识别码,具有唯一性和不可修改性。很多正版软件以此来识别用户电脑,限制安装。
  • VC++2010编译,可以通过WMI获取设备相关信息网卡原生MAC地址、硬盘序列号、主板序列号、处理器ID 等。
  • 该文件为微软提供的MicrosoftFixit50688.msi文件,可以用来解决事务日志中出现的windows事件ID10,WMI错误
  • 通过WMI获得硬盘序列号或其他信息

    千次阅读 2009-01-02 14:23:00
    工程人员今天反馈,我们的程序在vista下不能获得机器码(硬盘序列号)。经过Google查找资料和MSDN的帮助终于搞定。 网上很多VB.NET的代码示例这里就不说了。 C# string info=""; ManagementClass mc = new ...
  • 2.使用说明:打开程序后,点按钮后,三个TEXTBOX分别显示全球唯一标识的硬盘物理序列号、WMI方法获取的硬盘序列号WMI方法获取的CPU序列号 3.WMI方法被很多人诟病,有说读不出来什么的,我测试了几台机器确实有读不...
  • 最近要做个简单的网络验证, 需要取硬件的一些信息, 例如CPU序列号, 硬盘序列号, MAC地址, OS名称等等, 折腾了一天终于搞定了并且做了些简单封装, 先放个截图stdafx.h// stdafx.h : 标准系统包含文件的包含文件,// ...
  • //这个函数使用了WMI,而且只获取第一个硬件/软件设置的信息。//用户可以根据需要自行修改。function GetWMIProperty(WMIType, WMIProperty:String):String;varWmi, Objs, Obj:OleVariant;Enum:IEnumVariant;C:...
  • 开发语言:C/C++ 支持平台:Windows 实现功能: ...通过WMI获取网卡MAC地址、硬盘序列号、主板序列号、CPU ID、BIOS序列号 版本历史: V1.4 2010年05月17日  修正了硬盘序列号处理中的错
  • 获取硬件信息,通过WMI获取网卡MAC地址、硬盘序列号、主板序列号、CPU ID、BIOS序列号
  • VB6下如何获得硬盘序列号

    千次阅读 2019-06-22 08:37:50
    硬盘序列号获得可以通过WMI获取,但是实际上在win7以上没问题,在winxp下就没法使用。因此可以通过API编程 来实现读取硬盘序列号,以下程序来源于网络,在winxp下可以正确获得,但在win7和win10下均无法获取: '=...
  • 原文衔接 ...pip install wmi pip install pywin32 ...# # 硬盘序列号 for physical_disk in c.Win32_DiskDrive(): print(physical_disk.SerialNumber) # CPU序列号 for cpu in c.Win32_Processor(): p
  • 硬盘序列号会/为什么会改变

    千次阅读 2021-07-16 02:44:45
    我们的反盗版软件根据人们的硬盘序列号来识别他们。我相信这是一个不变的功能,不会改变,除非用户改变他们的主要物理驱动器-纠正我,如果我错了?我们使用WMIpython模块来获取用户硬盘驱动器序列号。对于我们的两台...
  • 使用c# 获取硬盘序列号,用于软件定向使用,防止被传播使用。
  • C++读取硬盘序列号

    2021-05-24 05:33:37
    c++读取硬盘序列号:有时在将程序或者打包库提供给第三方时,为了防止传播泛滥,或者有一定的版权问题,需要绑定特定的计算机设备。此时就需要读取计算机的一些硬件资源(硬盘、cpu、bios等),来计算一个验证码,达到...
  • 目前VB6.0读硬盘序列号最完美的代码 里面包括一个模块和一个VB6.0工程示例。
  • 主要介绍了WMI获取硬件信息的方法,硬件信息有:联想台式机出厂编号 CPUID BIOS序列号 硬盘信息 显卡信息 MAC地址
  • GoLang获取硬盘序列号

    2021-10-13 17:30:23
    package main import ( ... // 全部字段请看文档,这里我只取了硬盘名字,大小,序列号 // https://docs.microsoft.com/zh-cn/windows/win32/cimwin32prov/win32-diskdrive#syntax Name string Size
  • 通过wmic 命令获取CPU序列号、硬盘序列号、主板序列号、CPU名称等信息。 做软件加密、数据加密、软件1机1码绑定的场合比较实用。 WMIC扩展WMI(Windows Management Instrumentation,Windows管理工具) ,提供了从...
  • } // Step 3: --------------------------------------------------- // Obtain the initial locator to WMI ------------------------- IWbemLocator* pLoc = NULL; hres = CoCreateInstance( CLSID_WbemLocator, ...
  • Qt获取CPU编号和硬盘序列号

    千次阅读 2019-02-27 13:27:38
    windows下执行命令除了用cmd之外,还有个东西叫WMIC,非常强大,可以通过他获取很多信息,包括硬件信息。 QString frmMain::getWMIC(const QString &amp;cmd) { //获取cpu名称:wmic ... //获取cpu线程数:wmi...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,379
精华内容 551
关键字:

wmi硬盘序列号