diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-09 17:59:57 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-09 17:59:57 +0100 |
commit | 89f104782e673cfacec0eab016dc22a51533f113 (patch) | |
tree | 9fe9dfdbcf1051a49d749a5d77daa8260faa3948 /proto-ft/mutex.cpp | |
parent | 61bf0f0ec4b836981b39910f4719cc526da5c415 (diff) |
proto/freetrack: cleanup
- set zeros in shm, for NPClient.dll tracking detection
- remove tirviews support
- remove registry cleanup on exit support
Diffstat (limited to 'proto-ft/mutex.cpp')
-rw-r--r-- | proto-ft/mutex.cpp | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/proto-ft/mutex.cpp b/proto-ft/mutex.cpp deleted file mode 100644 index a012ba90..00000000 --- a/proto-ft/mutex.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "ftnoir_protocol_ft.h" -#include "mutex.hpp" -#include <windows.h> -#include <QDebug> - -check_for_first_run::check_for_first_run() : checked_for_first_run(false), is_first_instance(false), enabled(false) -{ -} - -bool check_for_first_run::is_first_run() -{ - return checked_for_first_run && is_first_instance; -} - -void check_for_first_run::set_enabled(bool flag) -{ - enabled = flag; -} - -void check_for_first_run::try_runonce() -{ - constexpr const char* name = "opentrack-freetrack-runonce"; - - if (checked_for_first_run) - return; - - // just leak it, no issue - HANDLE h = CreateMutexA(nullptr, false, name); - - switch (WaitForSingleObject(h, 0)) - { - case WAIT_OBJECT_0: - is_first_instance = true; - checked_for_first_run = true; - break; - case WAIT_TIMEOUT: - checked_for_first_run = true; - break; - default: - checked_for_first_run = false; - break; - } - - if (checked_for_first_run && !is_first_instance) - CloseHandle(h); -} - -check_for_first_run::~check_for_first_run() -{ - try_exit(); -} - -void check_for_first_run::try_exit() -{ - if (is_first_instance && enabled) - { - qDebug() << "ft runonce: removing registry keys"; - freetrack::set_protocols(false, false); - } -} |