Click here to Skip to main content
15,923,789 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I stumbled on this function online while trying to find a means of getting mother serial number without using WMI : IWMDMDevice::GetSerialNumber method. Documentation does not tell what sort of devices it retrieve their serial number? Can anyone here kindly tell me? And, please, is the said serial number always available?

What I have tried:

I have googled but no useful search result.
Posted
Updated 31-May-24 11:38am
v2
Comments
Dave Kreskowiak 31-May-24 19:01pm    
Your first mistake is assuming every motherboard even has a serial number on it to retrieve. There is no standard requiring it.
Gbenbam 1-Jun-24 8:42am    
I know that. I like a switch statement I am giving them several options including HDD, motherboard, CPU, casing and finally the Mac address which is available. The mac address option will only be present if all other are not available. Its like a default in a switch statement. Believe me,I have things pretty well covered an I am using an innovative approach.
Dave Kreskowiak 1-Jun-24 11:42am    
What you're calling "innovative" is actually just combing all the same bad assumptions about hardware, just across more hardware, into a single app and calling it a security system. Making a lot of mistakes like this does not guarantee security.

Have you thought of what happens when you run your "security" on a virtual machine? Probably not.

Are you still faffing about with this "hardware locking" system of yours? As you have been told before, there isn't necessarily any hardware serial numbers that are guaranteed to exist in any system - and most definitely includes the motherboard serial number - heck, many manufacturers don't even have the model available, much less the serial number!

Think about it: you have already spent at least a month playing with this - how much is your time worth to you? How many copies of this do you expect to sell? How much profit (after development, marketing, distribution, and support costs are amortised across total sales) will you make per unit? What percentage of users is likely to pirate your software? What is the total cost of piracy? How many legitimate users will your anti-copy code annoy to the point where they demand their money back and your software gets a bad rep?

At some point, the cost of adding piracy exceeds the benefits you get from it - generally very quickly if the product is low priced, and even quicker is it's expensive! If your hourly rate is $20 per hour, and you spend ten hours on antipiracy but you only sell ten units and prevent one stolen copy at $20, then you just made a loss overall ...

Think about your projected numbers, and you'll almost certainly see that it's not worth your time brewing your own antipiracy - particularly when you have no idea what you are doing!
 
Share this answer
 
Comments
Gbenbam 1-Jun-24 4:20am    
Okay what is your pragmatic suggestion?
OriginalGriff 1-Jun-24 4:50am    
Think about your number projections, and work out "best case" and "worst case" values. Then look at the worst case - because if you get the the best case the likelihood of of cracking goes up, not down but you've probably got the revenue stream to support paying for "proper" protection. How much is your time worth to you? How much of it can you afford to expend before (in the worst case) you start to make a loss? How many hours is that? How many hours have you invested in "protection" so far? How much money is left in the budget for that?

Remember, if it gets to selling significantly above worse case you can add protection as part of a major "free upgrade" - but if you add poor protection it'll impact sales and drive your support costs up as well as damaging reputation.

I'm guessing here, but I'd say you have probably gone out of budget already!


Is it really that obvious that I used to run companies? :laugh:
Gbenbam 1-Jun-24 4:55am    
I apologize if I seem to be wasting your time, but , can you tell me in as few words as possible your pragmatic suggestion? I am so sorry , I did not get it your last reply.
Gbenbam 1-Jun-24 4:58am    
Please, by pragmatic, I mean an approach that will guarantee that I make money and also not loose customers.
OriginalGriff 1-Jun-24 5:18am    
There is no "one answer" that guarantees profits.
If you are selling 10 copies at $200,000 each, then buy damn good protection - the customer will understand and even expect it, but it's unlikely to be heavily pirated anyway.
If you are selling 10 copies at $20 each, then it's not worth protecting - it'll cost more to add and support it than you'll make.
And it'll depend on who your customers are: think about software that gets pirated and if your software fits into that group.

Somewhere in the middle is a "happy medium" where it's worth protecting, but where that is depends on your specific circumstances - and the heavier the protection you add, the more likely it gets to be cracked as a challenge, and the more your support costs grow when the protection gets too "heavy handed" with legitimate customers.

In my experience, it's almost never worth your time to add "home grown" protection to software!
The GetSerialNumber method retrieves the serial number string for the device object represented by the IWMDMDevice instance. You could probably guess that from the name.

The serial number is a unique identifier assigned to a particular hardware device by the manufacturer. This method gets you identifying information about a specific device installed on the Windows system. The device will not be the motherboard (it could be a hard drive for instance) and there's no guarantee that a device even has a serial number.
 
Share this answer
 
v2
Comments
Gbenbam 1-Jun-24 4:22am    
Okay, can you explain it's usage to me using hard disk and motherboard respectively?
Pete O'Hanlon 1-Jun-24 5:08am    
Looking at the documentation, this is for portable devices only. Everything you need is under here. https://learn.microsoft.com/en-us/windows/win32/api/mswmdm/nn-mswmdm-iwmdmdevice
Gbenbam 1-Jun-24 5:12am    
But, that's where I got this function from, there is absolutely no code example there and no specific, that i device was mentioned there that's why I came here. I need code example to help understanding.
 
Share this answer
 
Comments
Gbenbam 8-Jun-24 12:09pm    
Which device is its serial number being retrieved in the sample program?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900