#include "stdafx.h"

//////////////////////////////////////////////////////////////////////////
// !!! this block should be generated by VMProtect License Manager !!! ///
//////////////////////////////////////////////////////////////////////////
VMProtectAlgorithms g_Algorithm = ALGORITHM_RSA;
size_t g_nBits = 0;
byte g_vModulus[1];
byte g_vPrivate[1];
byte g_vProductCode[1];
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

int _tmain(int argc, _TCHAR* argv[])
{
	VMProtectProductInfo	pi;
	pi.algorithm = g_Algorithm;
	pi.nBits = g_nBits;
	pi.nModulusSize = sizeof(g_vModulus);
	pi.pModulus = g_vModulus;
	pi.nPrivateSize = sizeof(g_vPrivate);
	pi.pPrivate = g_vPrivate;
	pi.nProductCodeSize = sizeof(g_vProductCode);
	pi.pProductCode = g_vProductCode;

	VMProtectSerialNumberInfo si = {0};
	si.flags = HAS_USER_NAME | HAS_EMAIL;
	si.pUserName = L"John Doe";
	si.pEMail = L"john@doe.com";
	char *pBuf = NULL;
	VMProtectErrors res = VMProtectGenerateSerialNumber(&pi, &si, &pBuf);
	if (res == ALL_RIGHT)
	{
		printf("Serial number:\n%s\n", pBuf);
		VMProtectFreeSerialNumberMemory(pBuf);
	}
	else
	{
		printf("Error: %d\n", res);
	}

	return 0;
}

