Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mainwindow.h"
- #include <QApplication>
- #include <QProcess>
- #include <QMessageBox>
- #include "TurboActivate.h"
- #ifdef _WIN32
- #pragma comment (lib, "TurboActivate.lib")
- #endif
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- MainWindow w;
- GENUINE_OPTIONS opts;
- opts.nLength = sizeof(GENUINE_OPTIONS);
- opts.nDaysBetweenChecks = 30;
- opts.nGraceDaysOnInetErr = 14;
- opts.flags = TA_SKIP_OFFLINE;
- HRESULT hr = IsGenuineEx(L"3f53034554c5873609e5d6.27574134", &opts);
- if (hr == TA_OK || hr == TA_E_FEATURES_CHANGED
- || hr == TA_E_INET || hr == TA_E_INET_DELAYED)
- {
- // your app is activated and genuine
- w.show();
- if( w.checkVersion() == false)
- return 1;
- else
- return a.exec();
- if (hr == TA_E_INET || hr == TA_E_INET_DELAYED)
- {
- // TODO: show a warning to your user that this time (or recently)
- // the IsGenuineEx() failed to connect to the LimeLM servers.
- w.graceDisplay();
- }
- }
- else
- {
- //check to see if the program was activated in the past
- if(IsActivated(L"3f53034554c5873609e5d6.27574134") == TA_OK)
- {
- //program was activated but couldnt contact servers in time.
- QMessageBox msgBox;
- msgBox.setText("MC360 NBT Editor was not able to contact the activation servers for license reverification.");
- msgBox.setInformativeText("Would you like to attempt to reverify automatcally now? (Internet connection required)");
- msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
- int ret = msgBox.exec();
- switch (ret) {
- case QMessageBox::Yes:
- {
- HRESULT hr2 = IsGenuine(L"3f53034554c5873609e5d6.27574134");
- if(hr2 == TA_OK || hr2 == TA_E_FEATURES_CHANGED)
- {
- QMessageBox msgBox2;
- msgBox2.setText("Reactivation successful!");
- msgBox2.exec();
- }
- else
- {
- QMessageBox msgBox2;
- msgBox2.setText("Reactivation failed!");
- msgBox2.exec();
- QFile aTest("a.exe");
- if(!aTest.exists())
- {
- return a.exit();
- }
- aTest.close();
- QProcess a2;
- a2.start("a.exe");
- a2.waitForFinished(-1);
- a2.close();
- return 0;
- }
- break;
- }
- case QMessageBox::No:
- {
- QFile aTest("a.exe");
- if(!aTest.exists())
- {
- return a.exit();
- }
- aTest.close();
- QProcess a2;
- a2.start("a.exe");
- a2.waitForFinished(-1);
- a2.close();
- return 0;
- break;
- }
- default:
- // should never be reached
- break;
- }
- }
- QFile aTest("a.exe");
- if(!aTest.exists())
- {
- return a.exit();
- }
- aTest.close();
- QProcess a2;
- a2.start("a.exe");
- a2.waitForFinished(-1);
- a2.close();
- // TODO: Not genuine or not activated. Either way you should either
- // restrict the user from using your app or give the user a trial
- // of your app.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment