Program Listing for File anti-cheat-detector.h
↰ Return to documentation for file (include\anti-cheat-detector\anti-cheat-detector.h
)
/******************************************************************************
© Intel Corporation.
This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.
This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.
******************************************************************************/
#pragma once
#include <string>
#include <thread>
#include <atomic>
namespace gpa {
namespace anti_cheat_handling {
class AntiCheatDetector
{
public:
enum class DetectorType {
ON_DEMAND,
CONTINUAL
};
AntiCheatDetector(DetectorType type);
virtual ~AntiCheatDetector();
AntiCheatDetector(const AntiCheatDetector&) = delete;
AntiCheatDetector(AntiCheatDetector&&) noexcept = delete;
AntiCheatDetector& operator=(const AntiCheatDetector&) = delete;
AntiCheatDetector& operator=(const AntiCheatDetector&&) noexcept = delete;
void DetectAndNotify();
void ResetNotificationFlag();
size_t GetDetectedServiceID() const;
std::string ConvertIDToServiceName(const size_t serviceID) const;
private:
void StartDetection();
void StopDetection();
bool IsServiceStarted(const std::string& serviceName) const;
void ServiceDetectedNotification();
virtual void SendNotification() = 0;
DetectorType mDetectorType;
struct ServiceState
{
ServiceState(std::string name, bool status = false)
{
ServiceName = name;
Status = status;
}
std::string ServiceName;
std::atomic<bool> Status = false; // 0 - stopped , 1 - runnning
};
//ServiceState mServiceStates[2] = {{std::string("BEService"), std::atomic<bool>(false)}, {std::string("EasyAntiCheat"), false}};
std::unique_ptr<ServiceState> mServiceStates[2];
size_t mDetectedServiceID = 0;
std::atomic_bool mNotificationDone = false;
std::thread mThread;
std::atomic_bool mStopDetectorThread = false;
const uint32_t mDetectionPeriodMilliseconds = 1000; //1 second
};
} // namespace anti_cheat_handling
} // namespace gpa