Problem getting hard drive serial number under. Net

Source: Internet
Author: User
Tags asymmetric encryption
Problem | The registration mechanism of the hard disk general software can be obtained by acquiring the hardware serial number and then using the asymmetric encryption algorithm to generate the corresponding public and private key. But using managed code to get the hard drive serial number can not solve all the problems, such as not under the authority of the administrator to use, a few days ago Sunmast in his blog published on the "How to get the hard disk serial number?" NET version [C #] is not a solution to this problem, there are many problems with WMI.

To get a successful serial number on your hard drive, you can only rely on unmanaged code now. DISKID32 is an open source of C + + program, can solve the above problems. Because the code is relatively low-level, I am not familiar with VC and DDK, do not have the ability to encapsulate it as a DLL, I hope you help!

Also, even if the native DLL is encapsulated and ready to use, there is still a problem. If encapsulated into the native DLL, the DLL is easily replaced by someone else, after all, in the managed code can be seen to invoke the native DLL function declaration, others just imitate these functional interface to write a new one is easy to achieve the purpose of cracking. But I did not test the specific, do not know can not.

Then I think of another way, is to get the hard disk serial number of the native DLL as a resource file into the managed code, and then each time you want to transfer the DLL, write the DLL to disk, and then dynamically bind. Since managed code can be protected by obfuscation so that it cannot be modified, how do I protect our. NET assembly? has already given the answer. Dynamic binding native DLL is another technical problem, I have found some information to share with you.
Late binding on native DLLs with C #
Late-binding DLLs in C #
Using legacy Plug-ins with. Net-part 1
Using legacy Plug-ins with. Net-part 2
C-function pointer for. NET
Dynamic PInvoke Method calls

But the most bull is the following this trick! Native code is stored directly in the managed code, and then the call, is really cow B, but I have not fully understood, I hope we can practice.
Execute Native Code from. NET

Another article about encrypting strings is worth studying!
Poly-engine Crypt String

I hope you will exchange a lot. NET program protection problem, find out the best solution!



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.