Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5940111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:55:23+00:00 2026-05-22T15:55:23+00:00

I had a question regarding generating a specific computer ID for licensing purposes. Preferably

  • 0

I had a question regarding generating a specific computer ID for licensing purposes. Preferably this ID should be hardware based, and thus should not change if the user reformats for example. Also it should not be easy (or preferably even impossible) for the user to change the information that the ID is generated from. Currently I only have two components that I combine, the CPUID standard and feature flags and the geometry and total size of the first physical drive in the machine. While this seems to be good for most general PC’s, a lot of netbooks for example are made with the exact same hardware and so you would get the same ID for many machines in that case. Can any of you suggest some other hardware component I could use?

I have two requirements:

  1. It must not use WMI.

  2. It must work in a large number of situations (including for users with no or few privileges). I thought of using the serial of the physical drive, but that seems hard to retrieve if the user is not in administrator mode.

I am working in C++ on Windows.

Thanks in advance for any suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T15:55:24+00:00Added an answer on May 22, 2026 at 3:55 pm

    You can use the first MAC address, which is assigned by the manufacturer of the hardware and will never change.

    Something like this:

    /** 
    
      return string containing first MAC address on computer
    
     requires adding Iphlpapi.lib to project
    
    */
    string GetMac()
    {
        char data[4096];
        ZeroMemory( data, 4096 );
         unsigned long  len = 4000;
        PIP_ADAPTER_INFO pinfo = ( PIP_ADAPTER_INFO ) data;
        char sbuf[20];
        string sret;
    
        DWORD ret = GetAdaptersInfo( pinfo, &len );
        if( ret != ERROR_SUCCESS )
            return string("**ERROR**");
    
        for(int k = 0; k < 5; k++ ) {
            sprintf(sbuf,"%02X-",pinfo->Address[k]);
            sret += sbuf;
        }
        sprintf(sbuf,"%02X",pinfo->Address[5]);
        sret += sbuf;
    
        return( sret );
    }
    

    IMHO, this is sufficient for licensing software valued up to a thousand dollars, where all that is necessary is to prevent casual consumers from sharing your software with their neighbours. A motivated pirate can get around it, but pirates with sufficient knowledge and motivation are not frequent enough to make it worthwhile for you to spend any more effort trying to defeat them and, even more important, you do not want to inconvenience your honest clients.

    If your software is so valuable that motivated pirates are a real threat, then the cost and inconvenience of a hardware dongle becomes justified.

    Neither do I believe in piling on more hardware signatures, disk drive IDs, motherboard configurations and so on. The increase in security is minimal and the chance that something may go wrong increases greatly so that you will end up wasting hours supporting clients with unusual setups and pissing off unknown numbers who simply give up on you.

    Implement a simple system with the MAC address, which always seems to work. Accept that an occasional pirate may get their kicks from breaking your licence. Focus your efforts on improving your software so that you will gain more honest clients.

    A system may have more than one network card ( e.g. ethernet and wireless ) and it is possible for the user to change the presentation order ( why would a user do this? ). To handle this, a licence would need to match a network card present anywhere on the system, requiring code something like this:

    /**
    
      The MAC addresses of ethernet network cards present on computer
    
      @param[out] vMAC vector of strings containing MAC addresses in XX-XX-XX-XX-XX-XX format
    
      returns empty vector on error
    
      See discussion of this 
      http://stackoverflow.com/questions/6131123/generating-hardware-based-computerid/6131231#6131231
    
    */
    
    void cLicenser::GetMac( vector < string >& vMac )
    {
        vMac.clear();
        char data[4096];
        ZeroMemory( data, 4096 );
        unsigned long  len = 4000;
        PIP_ADAPTER_INFO pinfo = ( PIP_ADAPTER_INFO ) data;
    
        DWORD ret = GetAdaptersInfo( pinfo, &len );
        if( ret != ERROR_SUCCESS )
            return;
    
        while ( pinfo )
        {
            // ignore software loopbacks
            if( pinfo->Type != MIB_IF_TYPE_LOOPBACK )
            {
                char sbuf[20];
                string sret;
                for(int k = 0; k < 5; k++ )
                {
                    sprintf(sbuf,"%02X-",pinfo->Address[k]);
                    sret += sbuf;
                }
                sprintf(sbuf,"%02X",pinfo->Address[5]);
                sret += sbuf;
                vMac.push_back( sret );
            }
            pinfo = pinfo->Next;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had this question earlier and it was concluded it was a bug in
We've had this question already, but I want to narrow it down to already
I had the same question as was asked in this thread , i.e. I
This is a follow-up to a previous question I had about interfaces. I received
I am not familiar with PHP at all and had a quick question. I
I previously asked a question regarding pulling specific items out of a database if
So one of my previous exams had this question, and till now I've been
I had made some questions regarding PHP-GTK (there are only 4 php-gtk tagged questions
I'm playing around with RhinoCommons and NHibernate and I had a question about the
I had telephone interview question yesterday. The interviewer asked me if I had faced

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.