Manual
Function KG_VerifyRegistrationInfoFromProjectKG_VerifyRegistrationInfoFromProject is used for verifying the registration information and extracting registration key parameters from ANSI-based registration information. The function has two parameters, one of them is a pointer to the TKeyVerifyParams structure, the other one is ANSI - null terminated string - the path to the Enigma Protector project file. The function reads secure information from the project file, so it does not require secure parameters PublicKey, KeyMode, KeyBase and EncryptedConstant in the TKeyVerifyParams structure. Return Values
DefinitionShow/Hide Delphi function definition function KG_VerifyRegistrationInfoFromProject(ProjectFile : PAnsiChar; kv : PKeyVerifyParams) : dword; external 'keygen.dll' name 'KG_VerifyRegistrationInfoFromProject'; Show/Hide C++ function definition extern "C" __declspec( dllimport ) __stdcall int KG_VerifyRegistrationInfoFromProject(char* pfile, PKeyVerifyParams kv); Show/Hide C# (.NET) function definition public class Enigma_KeyGen_IDE { [DllImport("keygen.dll", CallingConvention = CallingConvention.StdCall)] public static extern uint KG_VerifyRegistrationInfoFromProject(string FileName, ref TKeyVerifyParams kv); } Show/Hide Visual Basic function definition Public Declare Function KG_VerifyRegistrationInfoFromProject Lib "keygen.dll" (ByVal ProjectName As String, ByRef kv As TKeyVerifyParams) As Long ExamplesShow/Hide Delphi function example procedure TfrmMain.btnVerifyPClick(Sender: TObject); var kv : TKeyVerifyParams; i : integer; dwResult : dword; stemp : string; sresult : string; begin if eUserInfo.Text = '' then begin ShowMessage('User info field is empty!'); Exit; end; if mKey.Text = '' then begin ShowMessage('Key field is empty!'); Exit; end; kv.RegInfo := PAnsiChar(AnsiString(eUserInfo.Text)); kv.RegInfoLen := strlen(PAnsiChar(kv.RegInfo)); kv.Key := PAnsiChar(AnsiString(mKey.Text)); kv.KeyLen := strlen(PAnsiChar(kv.Key)); // Hardware ID kv.UseHardwareLocking := cbHardwareID.Checked; if kv.UseHardwareLocking then begin kv.HardwareID := PAnsiChar(AnsiString(eHardware.Text)); end; dwResult := KG_VerifyRegistrationInfoFromProject('default.enigma', @kv); if dwResult = EP_NO_ERROR then begin sresult := 'Key is valid!'#13#10; sresult := format(sresult + 'Creation Date: %s'#13#10, [DateToStr(EncodeDate(kv.CreationYear, kv.CreationMonth, kv.CreationDay))]); if kv.UseKeyExpiration then begin sresult := format(sresult + 'Expiration Date: %s'#13#10, [DateToStr(EncodeDate(kv.ExpirationYear, kv.ExpirationMonth, kv.ExpirationDay))]); end; if kv.UseRegisterAfter then begin sresult := format(sresult + 'Register After Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterAfterYear, kv.RegisterAfterMonth, kv.RegisterAfterDay))]); end; if kv.UseRegisterBefore then begin sresult := format(sresult + 'Register Before Date: %s'#13#10, [DateToStr(EncodeDate(kv.RegisterBeforeYear, kv.RegisterBeforeMonth, kv.RegisterBeforeDay))]); end; if kv.UseCountyLimit then begin for i := 0 to length(KEY_COUNTRIES) - 1 do begin if kv.CountryCode = KEY_COUNTRIES[i].Code then begin stemp := KEY_COUNTRIES[i].Name; break; end; end; sresult := format(sresult + 'Locked to country: %s'#13#10, [stemp]); end; if kv.UseExecutionsLimit then begin sresult := format(sresult + 'Executions limit: %d executions'#13#10, [kv.ExecutionsCount]); end; if kv.UseDaysLimit then begin sresult := format(sresult + 'Days limit: %d days'#13#10, [kv.DaysCount]); end; if kv.UseRunTimeLimit then begin sresult := format(sresult + 'Run-time limit: %d minutes'#13#10, [kv.RunTimeMinutes]); end; if kv.UseGlobalTimeLimit then begin sresult := format(sresult + 'Global Time limit: %d minutes'#13#10, [kv.GlobalTimeMinutes]); end; for i := 1 to NUMBER_OF_CRYPTED_SECTIONS do begin if kv.EncryptedSections[i] then begin sresult := format(sresult + 'Unlocked section #%d'#13#10, [i]); end; end; end else begin case dwResult of EP_ERROR_UNKNOWN : sresult := 'EP_ERROR_UNKNOWN '; EP_ERROR_KEYBUFFEREMPTY : sresult := 'EP_ERROR_KEYBUFFEREMPTY '; EP_ERROR_KEYBUFFERISLESS : sresult := 'EP_ERROR_KEYBUFFERISLESS '; EP_ERROR_REGINFOEMPTY : sresult := 'EP_ERROR_REGINFOEMPTY '; EP_ERROR_REGINFOTOOLARGE : sresult := 'EP_ERROR_REGINFOTOOLARGE '; EP_ERROR_PRIVATEKEYISNOTSET : sresult := 'EP_ERROR_PRIVATEKEYISNOTSET '; EP_ERROR_PUBLICKEYISNOTSET : sresult := 'EP_ERROR_PUBLICKEYISNOTSET '; EP_ERROR_PRIVATEKEYISINVALID : sresult := 'EP_ERROR_PRIVATEKEYISINVALID '; EP_ERROR_PUBLICKEYISINVALID : sresult := 'EP_ERROR_PUBLICKEYISINVALID '; EP_ERROR_KEYMODEISINVALID : sresult := 'EP_ERROR_KEYMODEISINVALID '; EP_ERROR_KEYBASEISINVALID : sresult := 'EP_ERROR_KEYBASEISINVALID '; EP_ERROR_CURRENTDATEISINVALID : sresult := 'EP_ERROR_CURRENTDATEISINVALID '; EP_ERROR_EXPIRATIONDATEISINVALID : sresult := 'EP_ERROR_EXPIRATIONDATEISINVALID'; EP_ERROR_KEYISINVALID : sresult := 'EP_ERROR_KEYISINVALID '; EP_ERROR_HARDWAREID : sresult := 'EP_ERROR_HARDWAREID '; EP_ERROR_HARDWAREBUFFEREMPTY : sresult := 'EP_ERROR_HARDWAREBUFFEREMPTY '; EP_ERROR_HARDWAREIDINVALIDFORKEY : sresult := 'EP_ERROR_HARDWAREIDINVALIDFORKEY'; EP_ERROR_PROJECTFILENOTFOUND : sresult := 'EP_ERROR_PROJECTFILENOTFOUND '; EP_ERROR_INVALIDPROJECTFILE : sresult := 'EP_ERROR_INVALIDPROJECTFILE '; EP_ERROR_EXECUTIONSNUMBERINVALID : sresult := 'EP_ERROR_EXECUTIONSNUMBERINVALID'; EP_ERROR_DAYSNUMBERINVALID : sresult := 'EP_ERROR_DAYSNUMBERINVALID '; EP_ERROR_COUNTRYCODEINVALID : sresult := 'EP_ERROR_COUNTRYCODEINVALID '; EP_ERROR_RUNTIMEINVALID : sresult := 'EP_ERROR_RUNTIMEINVALID '; EP_ERROR_GLOBALTIMEINVALID : sresult := 'EP_ERROR_GLOBALTIMEINVALID '; EP_ERROR_INSTALLBEFOREINVALID : sresult := 'EP_ERROR_INSTALLBEFOREINVALID '; EP_ERROR_INSTALLAFTERINVALID : sresult := 'EP_ERROR_INSTALLAFTERINVALID '; else sresult := 'Unknown error'; end; end; ShowMessage(sresult); end; Show/Hide Borland C++ Builder function example void __fastcall TfrmMain::btnVerifyFPClick(TObject *Sender) { if (eUserInfo->Text == "") { ShowMessage("Registration info is empty!"); return; } if (mKey->Text == "") { ShowMessage("Registration key is empty!"); return; } TKeyVerifyParams kv; WORD wYear; WORD wDay; WORD wMonth; DWORD dwResult; // Clear params buffer memset(&kv, 0, sizeof(kv)); // Fill key buffer char keybuf[2048]; memset(&keybuf, 0, sizeof(keybuf)); memcpy(&keybuf, mKey->Text.c_str(), mKey->Text.Length()); kv.Key = keybuf; kv.KeyLen = mKey->Text.Length(); // Fill User Info char namebuf[255]; memset(&namebuf, 0, sizeof(namebuf)); memcpy(&namebuf, eUserInfo->Text.c_str(), eUserInfo->Text.Length()); kv.RegInfo = namebuf; kv.RegInfoLen = eUserInfo->Text.Length(); // Hardware ID kv.UseHardwareLocking = cbHardware->Checked; if (kv.UseHardwareLocking) { char hdbuf[255]; memset(&hdbuf, 0, sizeof(hdbuf)); memcpy(&hdbuf, eHardware->Text.c_str(), eHardware->Text.Length()); kv.HardwareID = hdbuf; } dwResult = KG_VerifyRegistrationInfoFromProject("default.enigma", &kv); AnsiString sresult; if (dwResult == EP_NO_ERROR) { sresult = "Valid registration key!\n"; sresult += Format("Creation date %d/%d/%d\n", ARRAYOFCONST(((int)kv.CreationYear, (int)kv.CreationMonth, (int)kv.CreationDay))); if (kv.UseKeyExpiration) { sresult += Format("Expiration date %d/%d/%d\n", ARRAYOFCONST(((int)kv.ExpirationYear, (int)kv.ExpirationMonth, (int)kv.ExpirationDay))); } if (kv.UseRegisterAfter) { sresult += Format("Register After date %d/%d/%d\n", ARRAYOFCONST(((int)kv.RegisterAfterYear, (int)kv.RegisterAfterMonth, (int)kv.RegisterAfterDay))); } if (kv.UseRegisterBefore) { sresult += Format("Register Before date %d/%d/%d\n", ARRAYOFCONST(((int)kv.RegisterBeforeYear, (int)kv.RegisterBeforeMonth, (int)kv.RegisterBeforeDay))); } if (kv.UseExecutionsLimit) { sresult += Format("Executions %d\n", ARRAYOFCONST(((int)kv.ExecutionsCount))); } if (kv.UseDaysLimit) { sresult += Format("Days %d\n", ARRAYOFCONST(((int)kv.DaysCount))); } if (kv.UseRunTimeLimit) { sresult += Format("Run-time minutes %d\n", ARRAYOFCONST(((int)kv.RunTimeMinutes))); } if (kv.UseGlobalTimeLimit) { sresult += Format("Global Time minutes %d\n", ARRAYOFCONST(((int)kv.GlobalTimeMinutes))); } if (kv.UseCountyLimit) { for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++) { if (kv.CountryCode == KEY_COUNTRIES[i].Code) { sresult += Format("Country Lock %s\n", ARRAYOFCONST((KEY_COUNTRIES[i].Name))); break; } } } for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++) { if (kv.EncryptedSections[i]) { sresult += Format("Unlocked section #%d\n", ARRAYOFCONST((i + 1))); } } } else { switch (dwResult) { case EP_ERROR_UNKNOWN: sresult = "EP_ERROR_UNKNOWN"; break; case EP_ERROR_KEYBUFFEREMPTY: sresult = "EP_ERROR_KEYBUFFEREMPTY"; break; case EP_ERROR_KEYBUFFERISLESS: sresult = "EP_ERROR_KEYBUFFERISLESS"; break; case EP_ERROR_REGINFOEMPTY: sresult = "EP_ERROR_REGINFOEMPTY"; break; case EP_ERROR_REGINFOTOOLARGE: sresult = "EP_ERROR_REGINFOTOOLARGE"; break; case EP_ERROR_PRIVATEKEYISNOTSET: sresult = "EP_ERROR_PRIVATEKEYISNOTSET"; break; case EP_ERROR_PUBLICKEYISNOTSET: sresult = "EP_ERROR_PUBLICKEYISNOTSET"; break; case EP_ERROR_PRIVATEKEYISINVALID: sresult = "EP_ERROR_PRIVATEKEYISINVALID"; break; case EP_ERROR_PUBLICKEYISINVALID: sresult = "EP_ERROR_PUBLICKEYISINVALID"; break; case EP_ERROR_KEYMODEISINVALID: sresult = "EP_ERROR_KEYMODEISINVALID"; break; case EP_ERROR_KEYBASEISINVALID: sresult = "EP_ERROR_KEYBASEISINVALID"; break; case EP_ERROR_CURRENTDATEISINVALID: sresult = "EP_ERROR_CURRENTDATEISINVALID"; break; case EP_ERROR_EXPIRATIONDATEISINVALID: sresult = "EP_ERROR_EXPIRATIONDATEISINVALID"; break; case EP_ERROR_KEYISINVALID: sresult = "EP_ERROR_KEYISINVALID"; break; case EP_ERROR_HARDWAREID: sresult = "EP_ERROR_HARDWAREID"; break; case EP_ERROR_HARDWAREBUFFEREMPTY: sresult = "EP_ERROR_HARDWAREBUFFEREMPTY"; break; case EP_ERROR_HARDWAREIDINVALIDFORKEY: sresult = "EP_ERROR_HARDWAREIDINVALIDFORKEY"; break; case EP_ERROR_PROJECTFILENOTFOUND: sresult = "EP_ERROR_PROJECTFILENOTFOUND"; break; case EP_ERROR_INVALIDPROJECTFILE: sresult = "EP_ERROR_INVALIDPROJECTFILE"; break; case EP_ERROR_EXECUTIONSNUMBERINVALID: mKey->Text = "EP_ERROR_EXECUTIONSNUMBERINVALID"; break; case EP_ERROR_DAYSNUMBERINVALID: mKey->Text = "EP_ERROR_DAYSNUMBERINVALID"; break; case EP_ERROR_COUNTRYCODEINVALID: mKey->Text = "EP_ERROR_COUNTRYCODEINVALID"; break; case EP_ERROR_RUNTIMEINVALID: mKey->Text = "EP_ERROR_RUNTIMEINVALID"; break; case EP_ERROR_GLOBALTIMEINVALID: mKey->Text = "EP_ERROR_GLOBALTIMEINVALID"; break; case EP_ERROR_INSTALLBEFOREINVALID: mKey->Text = "EP_ERROR_INSTALLBEFOREINVALID"; break; case EP_ERROR_INSTALLAFTERINVALID: mKey->Text = "EP_ERROR_INSTALLAFTERINVALID"; break; default: sresult = "Unknown error"; break; } } ShowMessage(sresult); } Show/Hide Visual C++ function example void CKeygenDlg::OnBnClickedButtonverfp() { // TODO: Add your control notification handler code here TKeyVerifyParams kv; char keybuffer[2048]; char username[255]; char hardwareid[255]; DWORD dwResult; // Clear params buffer memset(&kv, 0, sizeof(kv)); // Clear key buffer memset(&keybuffer, 0, sizeof(keybuffer)); GetDlgItemText(IDC_EDITKEY, (char*)&keybuffer, sizeof(keybuffer)); kv.Key = (char*) keybuffer; kv.KeyLen = strlen(kv.Key); // Fill User Info memset(&username, 0, sizeof(username)); GetDlgItemText(IDC_EDITNAME, (char*)&username, sizeof(username)); kv.RegInfo = (char*)&username; kv.RegInfoLen = strlen(kv.RegInfo); // Hardware ID if (IsDlgButtonChecked(IDC_CHECKHD) != 0) { kv.UseHardwareLocking = true; memset(&hardwareid, 0, sizeof(hardwareid)); GetDlgItemText(IDC_EDITHD, (char*)&hardwareid, sizeof(hardwareid)); kv.HardwareID = (char*)&hardwareid; } // Generate reg. key dwResult = KG_VerifyRegistrationInfoFromProject("default.enigma", &kv); if (dwResult == EP_NO_ERROR) { char tmp[255]; // Creation date char mes[2048] = "Valid Registration Key!\n"; sprintf(tmp, "Creation date: %d/%d/%d\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear); strcat(mes, tmp); // Expiration date if (kv.UseKeyExpiration) { sprintf(tmp, "Expiration date: %d/%d/%d\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear); strcat(mes, tmp); } // Register After date if (kv.UseRegisterAfter) { sprintf(tmp, "Register After date: %d/%d/%d\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear); strcat(mes, tmp); } // Register Before date if (kv.UseRegisterBefore) { sprintf(tmp, "Register Before date: %d/%d/%d\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear); strcat(mes, tmp); } // Executions if (kv.UseExecutionsLimit) { sprintf(tmp, "Executions: %d\n", kv.ExecutionsCount); strcat(mes, tmp); } // Days if (kv.UseDaysLimit) { sprintf(tmp, "Days: %d\n", kv.DaysCount); strcat(mes, tmp); } // Run-time if (kv.UseRunTimeLimit) { sprintf(tmp, "Run-time: %d minutes\n", kv.RunTimeMinutes); strcat(mes, tmp); } // Global Time if (kv.UseGlobalTimeLimit) { sprintf(tmp, "Global Time: %d minutes\n", kv.GlobalTimeMinutes); strcat(mes, tmp); } // Country if (kv.UseCountyLimit) { for (int i = 0; i < ARRAYSIZE(KEY_COUNTRIES); i++) { if (kv.CountryCode == KEY_COUNTRIES[i].Code) { sprintf(tmp, "Country Lock: %s\n", KEY_COUNTRIES[i].Name); strcat(mes, tmp); break; } } } for (int i = 0; i < NUMBER_OF_CRYPTED_SECTIONS; i++) { if (kv.EncryptedSections[i]) { sprintf(tmp, "Unlocked section: #%d\n", i + 1); strcat(mes, tmp); } } MessageBox(mes); } else { char* sError; switch (dwResult) { case EP_ERROR_UNKNOWN: sError = "EP_ERROR_UNKNOWN"; break; case EP_ERROR_KEYBUFFEREMPTY: sError = "EP_ERROR_KEYBUFFEREMPTY"; break; case EP_ERROR_KEYBUFFERISLESS: sError = "EP_ERROR_KEYBUFFERISLESS"; break; case EP_ERROR_REGINFOEMPTY: sError = "EP_ERROR_REGINFOEMPTY"; break; case EP_ERROR_REGINFOTOOLARGE: sError = "EP_ERROR_REGINFOTOOLARGE"; break; case EP_ERROR_PRIVATEKEYISNOTSET: sError = "EP_ERROR_PRIVATEKEYISNOTSET"; break; case EP_ERROR_PUBLICKEYISNOTSET: sError = "EP_ERROR_PUBLICKEYISNOTSET"; break; case EP_ERROR_PRIVATEKEYISINVALID: sError = "EP_ERROR_PRIVATEKEYISINVALID"; break; case EP_ERROR_PUBLICKEYISINVALID: sError = "EP_ERROR_PUBLICKEYISINVALID"; break; case EP_ERROR_KEYMODEISINVALID: sError = "EP_ERROR_KEYMODEISINVALID"; break; case EP_ERROR_KEYBASEISINVALID: sError = "EP_ERROR_KEYBASEISINVALID"; break; case EP_ERROR_CURRENTDATEISINVALID: sError = "EP_ERROR_CURRENTDATEISINVALID"; break; case EP_ERROR_EXPIRATIONDATEISINVALID: sError = "EP_ERROR_EXPIRATIONDATEISINVALID"; break; case EP_ERROR_KEYISINVALID: sError = "EP_ERROR_KEYISINVALID"; break; case EP_ERROR_HARDWAREID: sError = "EP_ERROR_HARDWAREID"; break; case EP_ERROR_HARDWAREBUFFEREMPTY: sError = "EP_ERROR_HARDWAREBUFFEREMPTY"; break; case EP_ERROR_HARDWAREIDINVALIDFORKEY: sError = "EP_ERROR_HARDWAREIDINVALIDFORKEY"; break; case EP_ERROR_PROJECTFILENOTFOUND: sError = "EP_ERROR_PROJECTFILENOTFOUND"; break; case EP_ERROR_INVALIDPROJECTFILE: sError = "EP_ERROR_INVALIDPROJECTFILE"; break; case EP_ERROR_EXECUTIONSNUMBERINVALID: sError = "EP_ERROR_EXECUTIONSNUMBERINVALID"; break; case EP_ERROR_DAYSNUMBERINVALID: sError = "EP_ERROR_DAYSNUMBERINVALID"; break; case EP_ERROR_COUNTRYCODEINVALID: sError = "EP_ERROR_COUNTRYCODEINVALID"; break; case EP_ERROR_RUNTIMEINVALID: sError = "EP_ERROR_RUNTIMEINVALID"; break; case EP_ERROR_GLOBALTIMEINVALID: sError = "EP_ERROR_GLOBALTIMEINVALID"; break; case EP_ERROR_INSTALLBEFOREINVALID: sError = "EP_ERROR_INSTALLBEFOREINVALID"; break; case EP_ERROR_INSTALLAFTERINVALID: sError = "EP_ERROR_INSTALLAFTERINVALID"; break; default: sError = "Unknown error"; break; } MessageBox(sError); } } Show/Hide C# (.NET) function example private void btnVerifyFP_Click(object sender, EventArgs e) { if (tbUserInfo.Text == string.Empty) { MessageBox.Show("User info field is empty!"); return; } if (tbUserInfo.Text == string.Empty) { MessageBox.Show("Registration key field is empty!"); return; } Enigma_KeyGen_IDE.TKeyVerifyParams kv = new Enigma_KeyGen_IDE.TKeyVerifyParams(); kv.Key = tbKey.Text; kv.KeyLen = tbKey.Text.Length; kv.RegInfo = tbUserInfo.Text; kv.RegInfoLen = tbUserInfo.Text.Length; // Hardware ID kv.UseHardwareLocking = cbHardware.Checked; if (kv.UseHardwareLocking) { kv.HardwareID = tbHardware.Text; } // Generate reg. key uint dwResult = Enigma_KeyGen_IDE.KG_VerifyRegistrationInfoFromProject("default.enigma", ref kv); string sout = string.Empty; if (dwResult == Enigma_KeyGen_IDE.EP_NO_ERROR) { // sout = "Valid key!\n"; sout = string.Format(sout + "Creation Date: {0}/{1}/{2}\n", kv.CreationDay, kv.CreationMonth, kv.CreationYear); if (kv.UseKeyExpiration) { sout = string.Format(sout + "Expiration Date: {0}/{1}/{2}\n", kv.ExpirationDay, kv.ExpirationMonth, kv.ExpirationYear); } if (kv.UseRegisterAfter) { sout += string.Format("Register After: {0}/{1}/{2}\n", kv.RegisterAfterDay, kv.RegisterAfterMonth, kv.RegisterAfterYear); } if (kv.UseRegisterBefore) { sout += string.Format("Register Before: {0}/{1}/{2}\n", kv.RegisterBeforeDay, kv.RegisterBeforeMonth, kv.RegisterBeforeYear); } if (kv.UseCountyLimit) { Enigma_KeyGen_IDE ide = new Enigma_KeyGen_IDE(); foreach (Enigma_KeyGen_IDE.TKeyCountries country in ide.KEY_COUNTRIES) { if (country.Code == kv.CountryCode) { sout += string.Format("Country Lock: {0}\n", country.Name); break; } } } if (kv.UseExecutionsLimit) { sout += string.Format("Executions: {0}\n", kv.ExecutionsCount); } if (kv.UseDaysLimit) { sout += string.Format("Days: {0}\n", kv.DaysCount); } if (kv.UseRunTimeLimit) { sout += string.Format("Runtime: {0}\n", kv.RunTimeMinutes); } if (kv.UseGlobalTimeLimit) { sout += string.Format("Global Time: {0}\n", kv.GlobalTimeMinutes); } for (int i = 0; i < Enigma_KeyGen_IDE.NUMBER_OF_CRYPTED_SECTIONS; i++) { if (Convert.ToBoolean(kv.EncryptedSections[i])) { sout = string.Format(sout + "Unlock section: #{0}\n", i + 1); } } } else { switch (dwResult) { case Enigma_KeyGen_IDE.EP_ERROR_UNKNOWN: sout = "EP_ERROR_UNKNOWN"; break; case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFEREMPTY: sout = "EP_ERROR_KEYBUFFEREMPTY"; break; case Enigma_KeyGen_IDE.EP_ERROR_KEYBUFFERISLESS: sout = "EP_ERROR_KEYBUFFERISLESS"; break; case Enigma_KeyGen_IDE.EP_ERROR_REGINFOEMPTY: sout = "EP_ERROR_REGINFOEMPTY"; break; case Enigma_KeyGen_IDE.EP_ERROR_REGINFOTOOLARGE: sout = "EP_ERROR_REGINFOTOOLARGE"; break; case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISNOTSET: sout = "EP_ERROR_PRIVATEKEYISNOTSET"; break; case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISNOTSET: sout = "EP_ERROR_PUBLICKEYISNOTSET"; break; case Enigma_KeyGen_IDE.EP_ERROR_PRIVATEKEYISINVALID: sout = "EP_ERROR_PRIVATEKEYISINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_PUBLICKEYISINVALID: sout = "EP_ERROR_PUBLICKEYISINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_KEYMODEISINVALID: sout = "EP_ERROR_KEYMODEISINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_KEYBASEISINVALID: sout = "EP_ERROR_KEYBASEISINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_CURRENTDATEISINVALID: sout = "EP_ERROR_CURRENTDATEISINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_EXPIRATIONDATEISINVALID: sout = "EP_ERROR_EXPIRATIONDATEISINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_KEYISINVALID: sout = "EP_ERROR_KEYISINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREID: sout = "EP_ERROR_HARDWAREID"; break; case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREBUFFEREMPTY: sout = "EP_ERROR_HARDWAREBUFFEREMPTY"; break; case Enigma_KeyGen_IDE.EP_ERROR_HARDWAREIDINVALIDFORKEY: sout = "EP_ERROR_HARDWAREIDINVALIDFORKEY"; break; case Enigma_KeyGen_IDE.EP_ERROR_PROJECTFILENOTFOUND: sout = "EP_ERROR_PROJECTFILENOTFOUND"; break; case Enigma_KeyGen_IDE.EP_ERROR_INVALIDPROJECTFILE: sout = "EP_ERROR_INVALIDPROJECTFILE"; break; case Enigma_KeyGen_IDE.EP_ERROR_EXECUTIONSNUMBERINVALID: tbKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_DAYSNUMBERINVALID: tbKey.Text = "EP_ERROR_DAYSNUMBERINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_COUNTRYCODEINVALID: tbKey.Text = "EP_ERROR_COUNTRYCODEINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_RUNTIMEINVALID: tbKey.Text = "EP_ERROR_RUNTIMEINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_GLOBALTIMEINVALID: tbKey.Text = "EP_ERROR_GLOBALTIMEINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_INSTALLBEFOREINVALID: tbKey.Text = "EP_ERROR_INSTALLBEFOREINVALID"; break; case Enigma_KeyGen_IDE.EP_ERROR_INSTALLAFTERINVALID: tbKey.Text = "EP_ERROR_INSTALLAFTERINVALID"; break; default: sout = "Unknown error"; break; } } MessageBox.Show(sout); } Show/Hide Visual Basic function example Private Sub btnVerifyFP_Click() Dim kv As TKeyVerifyParams Dim I As Integer Dim dwResult As Long Dim sresult As String If tbUserInfo.Text = vbNullString Then MsgBox "User info field is empty!" Exit Sub End If If tKey.Text = vbNullString Then MsgBox "Key field is empty!" Exit Sub End If ' Fill key buffer kv.Key = tKey.Text kv.KeyLen = Len(tKey.Text) ' Fill User Info buffer kv.RegInfo = tbUserInfo.Text kv.RegInfoLen = Len(tbUserInfo.Text) ' Hardware ID kv.UseHardwareLocking = cbHardware.Value If kv.UseHardwareLocking Then kv.HardwareID = tbHardware.Text End If ' Verify reg. key dwResult = KG_VerifyRegistrationInfoFromProject("default.enigma", kv) If dwResult = ERROR_OK Then sresult = "Key is valid!" & Chr$(13) sresult = sresult & "Key creation date: " & Str$(kv.CreationDay) & "/" & Str$(kv.CreationMonth) & "/" & Str$(kv.CreationYear) & Chr$(13) If kv.UseKeyExpiration Then sresult = sresult & "Key expiration date: " & Str$(kv.ExpirationDay) & "/" & Str$(kv.ExpirationMonth) & "/" & Str$(kv.ExpirationYear) & Chr$(13) End If If kv.UseRegisterAfter Then sresult = sresult & "Register After date: " & Str$(kv.RegisterAfterDay) & "/" & Str$(kv.RegisterAfterMonth) & "/" & Str$(kv.RegisterAfterYear) & Chr$(13) End If If kv.UseRegisterBefore Then sresult = sresult & "Register Before date: " & Str$(kv.RegisterBeforeDay) & "/" & Str$(kv.RegisterBeforeMonth) & "/" & Str$(kv.RegisterBeforeYear) & Chr$(13) End If If kv.UseExecutionsLimit Then sresult = sresult & "Executions: " & Str$(kv.ExecutionsCount) & Chr$(13) End If If kv.UseDaysLimit Then sresult = sresult & "Days: " & Str$(kv.DaysCount) & Chr$(13) End If If kv.UseRunTimeLimit Then sresult = sresult & "Runtime: " & Str$(kv.RunTimeMinutes) & Chr$(13) End If If kv.UseGlobalTimeLimit Then sresult = sresult & "Global Time: " & Str$(kv.GlobalTimeMinutes) & Chr$(13) End If If kv.UseCountyLimit Then For I = 0 To comCountries.ListCount - 1 If comCountries.ItemData(I) = kv.CountryCode Then sresult = sresult & "Country Lock: " & comCountries.List(I) & Chr$(13) End If Next I End If For I = 1 To NUMBER_OF_CRYPTED_SECTIONS If kv.EncryptedSections(I - 1) = 1 Then sresult = sresult & "Unlock section #" & Str$(I) & Chr$(13) End If Next I Else Select Case dwResult Case EP_ERROR_UNKNOWN sresult = "EP_ERROR_UNKNOWN" Case EP_ERROR_KEYBUFFEREMPTY sresult = "EP_ERROR_KEYBUFFEREMPTY" Case EP_ERROR_KEYBUFFERISLESS sresult = "EP_ERROR_KEYBUFFERISLESS" Case EP_ERROR_REGINFOEMPTY sresult = "EP_ERROR_REGINFOEMPTY" Case EP_ERROR_REGINFOTOOLARGE sresult = "EP_ERROR_REGINFOTOOLARGE" Case EP_ERROR_PRIVATEKEYISNOTSET sresult = "EP_ERROR_PRIVATEKEYISNOTSET" Case EP_ERROR_PUBLICKEYISNOTSET sresult = "EP_ERROR_PUBLICKEYISNOTSET" Case EP_ERROR_PRIVATEKEYISINVALID sresult = "EP_ERROR_PRIVATEKEYISINVALID" Case EP_ERROR_PUBLICKEYISINVALID sresult = "EP_ERROR_PUBLICKEYISINVALID" Case EP_ERROR_KEYMODEISINVALID sresult = "EP_ERROR_KEYMODEISINVALID" Case EP_ERROR_KEYBASEISINVALID sresult = "EP_ERROR_KEYBASEISINVALID" Case EP_ERROR_CURRENTDATEISINVALID sresult = "EP_ERROR_CURRENTDATEISINVALID" Case EP_ERROR_EXPIRATIONDATEISINVALID sresult = "EP_ERROR_EXPIRATIONDATEISINVALID" Case EP_ERROR_KEYISINVALID sresult = "EP_ERROR_KEYISINVALID" Case EP_ERROR_HARDWAREID sresult = "EP_ERROR_HARDWAREID" Case EP_ERROR_HARDWAREBUFFEREMPTY sresult = "EP_ERROR_HARDWAREBUFFEREMPTY" Case EP_ERROR_HARDWAREIDINVALIDFORKEY sresult = "EP_ERROR_HARDWAREIDINVALIDFORKEY" Case EP_ERROR_PROJECTFILENOTFOUND sresult = "EP_ERROR_PROJECTFILENOTFOUND" Case EP_ERROR_INVALIDPROJECTFILE sresult = "EP_ERROR_INVALIDPROJECTFILE" Case EP_ERROR_EXECUTIONSNUMBERINVALID tKey.Text = "EP_ERROR_EXECUTIONSNUMBERINVALID" Case EP_ERROR_DAYSNUMBERINVALID tKey.Text = "EP_ERROR_DAYSNUMBERINVALID" Case EP_ERROR_COUNTRYCODEINVALID tKey.Text = "EP_ERROR_COUNTRYCODEINVALID" Case EP_ERROR_RUNTIMEINVALID tKey.Text = "EP_ERROR_RUNTIMEINVALID" Case EP_ERROR_GLOBALTIMEINVALID tKey.Text = "EP_ERROR_GLOBALTIMEINVALID" Case EP_ERROR_INSTALLBEFOREINVALID tKey.Text = "EP_ERROR_INSTALLBEFOREINVALID" Case EP_ERROR_INSTALLAFTERINVALID tKey.Text = "EP_ERROR_INSTALLAFTERINVALID" Case Else sresult = "Unknown error" End Select End If MsgBox sresult End Sub See function examples in the installation folder, Examples\Keygen subfolder. |
The Enigma Protector in - China https://enigmaprotector.cn - India https://enigmaprotector.in
Copyright © 2004-2024, The Enigma Protector Developers Team. All rights reserved.