Beispiel #1
0
bool Authorization::CreateMachineCode()
{
	CPUID cpu;
	string myStr = cpu.GetModel();

	return CreateMyFile(b, myStr);

}
Beispiel #2
0
bool Authorization::CheckVerIdFile()
{
	stringstream ss;
	SYSTEMTIME sysTime;
	GetSystemTime(&sysTime);
	ss << sysTime.wYear << sysTime.wMonth << sysTime.wDay;
	string myTime = ss.str();
	ifstream inFile(c.c_str(), ofstream::in | ofstream::binary);
	string MyStr;
	inFile >> MyStr;
	if (MyStr.length()<13)
	{
		return false;
	}
	string enCodeStr;

	for (int i = 0; i < MyStr.length()-5;++i)
    {
		enCodeStr += MyStr[i];
    }
	string decodeStr = StringEncode().base64_decode(enCodeStr);
	string decodeTime,decodeMachineCode;
	for (int i = 0; i < decodeStr.length() - myTime.length();++i)
	{
		decodeMachineCode += decodeStr[i];
	}
	CPUID myCpu;
	if (myCpu.GetModel()!=decodeMachineCode)
	{
	
		return false;
	}
	for (int i = decodeStr.length() - myTime.length(); i<decodeStr.length(); ++i)
	{
		decodeTime += decodeStr[i];
	}
	
	if (myTime == decodeTime)
	{
		return true;
	}else
	{
		
		return false;
	}
}
Beispiel #3
0
int _tmain(int argc, _TCHAR* argv[])
{
	//CPUID cpuID(0); // Get CPU vendor

	//std::string vendor;
	//vendor += std::string((const char *)&cpuID.EBX(), 4);
	//vendor += std::string((const char *)&cpuID.EDX(), 4);
	//vendor += std::string((const char *)&cpuID.ECX(), 4);
	CPUID cpu;
	cout << "CPU 型 号: " << cpu.GetModel() << endl;
	//std::cout << "CPU vendor = " << vendor << std::endl;
	//system("wmic path win32_physicalmedia get SerialNumber");
	////cout << functionManage.IsFileExit("C:\\123\\123.txt");
	Authorization auth("c:\\1.txt", "c:\\2.txt", "c:\\3.txt");
	//auth.Authorized();
	//auth.CreateKeyFile("c:\\3.txt", "c:\\2.txt");
	auth.Authorized();
	return 0;
}