Using NIC and hard disk serial number to realize the network registration mechanism of software

Source: Internet
Author: User
Tags bool command line comments

Brief introduction:

Pjsecure is a C-style Win32 dynamic link library, which can be used to realize the network Copy registration function of software products.

Quickly obtain the network card address of the remote machine by calling the RCP function uuidcreate or uuidcreatesequential.

The export function in Pjsecure uniquely identifies a computer based on two information. The first function gets the NIC address of the installed NIC, which is a 12-digit number that is guaranteed to be unique by the manufacturer of the NIC. The second function returns the serial number of the machine C disk. With two of information, you can successfully create your own software registration mechanism.

The source code contains the definition and implementation of the Pjsecure and a console program that tests the DLL.

Supports Unicode and provides build configuration options along with the source code.

API Reference:

Getnicaddress

BOOL getnicaddress (LPTSTR psznicaddress, UINT nbufsize);

Parameters

Psznicaddress if the function call succeeds, save the NIC address with this parameter.

The length of the nbufsize psznicaddress parameter should be at least 13 or greater.

Comments

This function gets the NIC address of the NIC on the client machine. The calling program is responsible for allocating buffers to receive the address. All NIC addresses are 12 bytes long, so you should allocate at least 13 bytes of space to hold the address before calling the function. The function calls the RCP function UuidCreate or uuidcreatesequential internally. This means that the code does not rely on any specialized network protocols that are installed. Returns FALSE if the function call successfully returns TRUE.

Getcdriveserialnumber

BOOL Getcdriveserialnumber (Lpdword pdwserialnumber);

Parameters

Pdwserialnumber DWORD Pointer that receives the serial number of the "C" disk based on the return value of the function.

Comments

Returns FALSE if the function call successfully returns TRUE. The return value in Pdwserialnumber can be displayed with the "VOL" command line command. For security-sensitive programs, calling this function can be used as a secondary means to obtain confirmation information about the customer.

Copyright Notice:

You can include this source code in any product that is published in binary form (including commercial, shared, free, or otherwise)

You can modify the source code in any way without modifying the top copyright rules for each module (*.h, *.cpp)

If you want to split the source code with your application, only allow the author's latest release to be distributed, to ensure that sources are unique.

Precautions:

If you run the program on Windows 2000, replace the UuidCreate call with a uuidcreatesequential call.

This article supporting source code

Related Article

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.