softwarekey_vendortool.cpp

来自「通过key保护程序以增强程序的安全程度」· C++ 代码 · 共 52 行

CPP
52
字号
#include "csoftwarekey.h" 

// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
int main(int argc, char* argv[])
{
	RETVALUE lResult = SUCCESS;

	printf("\nSoftware key - Vendor Tool - Software key generator\n\n");

	if (argc != 3)
	{		
		printf("Usage is:\n\n");
		printf("softwarekey_vendortool -v MachineCode\n\n");
	}
	else
	if (strcmp(argv[1],"-v")==0)
	{
		// Get the machine code from the command line
		BYTE*			lMachineCode = NULL;
		unsigned int	lMachineCodeSize = 0;
		lResult = CSoftwareKey::String2Buffer(
									argv[2], 
									&lMachineCode, 
									&lMachineCodeSize); 
		
		// Compute the software key
		BYTE lSoftwareKey[SOFTWAREKEY_DIM];
		lResult = CSoftwareKey::ComputeSoftwareKey(lMachineCode, lSoftwareKey); 

		// Print the software key
		char* lSoftwareKeyString = NULL;
		lResult = CSoftwareKey::Buffer2String(
						lSoftwareKey, 
						SOFTWAREKEY_DIM, 
						&lSoftwareKeyString);
		
		printf(
			"\nThe software key for the machine code [%s] is: %s\n\n", 
			argv[2], 
			lSoftwareKeyString);
	} 
	else
	{
		printf("Usage is:\n\n");
		printf("softwarekey_vendortool -v MachineCode\n\n");
	}

	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?