Guest User

Untitled

a guest
Apr 17th, 2015
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. #include "mainwindow.h"
  2.  
  3. #include <QApplication>
  4. #include <QProcess>
  5. #include <QMessageBox>
  6. #include "TurboActivate.h"
  7. #ifdef _WIN32
  8. #pragma comment (lib, "TurboActivate.lib")
  9. #endif
  10.  
  11. int main(int argc, char *argv[])
  12. {
  13. QApplication a(argc, argv);
  14. MainWindow w;
  15.  
  16. GENUINE_OPTIONS opts;
  17. opts.nLength = sizeof(GENUINE_OPTIONS);
  18. opts.nDaysBetweenChecks = 30;
  19. opts.nGraceDaysOnInetErr = 14;
  20.  
  21. opts.flags = TA_SKIP_OFFLINE;
  22.  
  23. HRESULT hr = IsGenuineEx(L"3f53034554c5873609e5d6.27574134", &opts);
  24.  
  25. if (hr == TA_OK || hr == TA_E_FEATURES_CHANGED
  26. || hr == TA_E_INET || hr == TA_E_INET_DELAYED)
  27. {
  28. // your app is activated and genuine
  29.  
  30. w.show();
  31. if( w.checkVersion() == false)
  32. return 1;
  33. else
  34. return a.exec();
  35.  
  36. if (hr == TA_E_INET || hr == TA_E_INET_DELAYED)
  37. {
  38.  
  39. // TODO: show a warning to your user that this time (or recently)
  40. // the IsGenuineEx() failed to connect to the LimeLM servers.
  41. w.graceDisplay();
  42. }
  43. }
  44. else
  45. {
  46. //check to see if the program was activated in the past
  47. if(IsActivated(L"3f53034554c5873609e5d6.27574134") == TA_OK)
  48. {
  49. //program was activated but couldnt contact servers in time.
  50. QMessageBox msgBox;
  51. msgBox.setText("MC360 NBT Editor was not able to contact the activation servers for license reverification.");
  52. msgBox.setInformativeText("Would you like to attempt to reverify automatcally now? (Internet connection required)");
  53. msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
  54. int ret = msgBox.exec();
  55.  
  56. switch (ret) {
  57. case QMessageBox::Yes:
  58. {
  59. HRESULT hr2 = IsGenuine(L"3f53034554c5873609e5d6.27574134");
  60. if(hr2 == TA_OK || hr2 == TA_E_FEATURES_CHANGED)
  61. {
  62. QMessageBox msgBox2;
  63. msgBox2.setText("Reactivation successful!");
  64. msgBox2.exec();
  65. }
  66. else
  67. {
  68. QMessageBox msgBox2;
  69. msgBox2.setText("Reactivation failed!");
  70. msgBox2.exec();
  71.  
  72. QFile aTest("a.exe");
  73. if(!aTest.exists())
  74. {
  75. return a.exit();
  76. }
  77. aTest.close();
  78.  
  79. QProcess a2;
  80. a2.start("a.exe");
  81. a2.waitForFinished(-1);
  82. a2.close();
  83.  
  84. return 0;
  85. }
  86. break;
  87. }
  88. case QMessageBox::No:
  89. {
  90. QFile aTest("a.exe");
  91. if(!aTest.exists())
  92. {
  93. return a.exit();
  94. }
  95. aTest.close();
  96.  
  97. QProcess a2;
  98. a2.start("a.exe");
  99. a2.waitForFinished(-1);
  100. a2.close();
  101.  
  102. return 0;
  103. break;
  104. }
  105. default:
  106. // should never be reached
  107. break;
  108. }
  109. }
  110.  
  111. QFile aTest("a.exe");
  112. if(!aTest.exists())
  113. {
  114. return a.exit();
  115. }
  116. aTest.close();
  117.  
  118. QProcess a2;
  119. a2.start("a.exe");
  120. a2.waitForFinished(-1);
  121. a2.close();
  122. // TODO: Not genuine or not activated. Either way you should either
  123. // restrict the user from using your app or give the user a trial
  124. // of your app.
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment