Skip to content

Commit a90ac8c

Browse files
authored
Update UACLibTest.cpp
1 parent fc0c31d commit a90ac8c

1 file changed

Lines changed: 29 additions & 25 deletions

File tree

LibTest/UACLibTest.cpp

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// UACLibTest.cpp : This file contains the 'main' function. Program execution begins and ends there.
2-
//
1+
// UACLibTest.cpp : Test program for checking .lib build of ultimateanticheat
32

43
#define _CRT_SECURE_NO_WARNINGS
54
#include "..\\Core\\AntiCheatLib.hpp"
@@ -8,20 +7,22 @@
87

98
int main()
109
{
10+
bool isCI = (std::getenv("GITHUB_ACTIONS") != nullptr);
11+
1112
std::list<std::wstring> validParents = { L"explorer.exe", L"powershell.exe", L"cmd.exe", L"pwsh.exe", L"VsDebugConsole.exe" };
1213

1314
std::unique_ptr<Settings> settings = nullptr;
1415
std::unique_ptr<AntiCheat> anticheat = nullptr;
1516

16-
const bool bNetworkingEnabled = false; //change this to false if you don't want to use the server
17-
const bool bEnforceSecureBoot = false; //secure boot is recommended in distribution builds
17+
const bool bNetworkingEnabled = false;
18+
const bool bEnforceSecureBoot = false;
1819
const bool bEnforceDSE = true;
1920
const bool bEnforceNoKDBG = true;
2021
const bool bUseAntiDebugging = true;
2122
const bool bUseIntegrityChecking = true;
2223
const bool bCheckThreadIntegrity = true;
2324
const bool bCheckHypervisor = false;
24-
const bool bRequireRunAsAdministrator = false; //no admin mode in Github Actions
25+
bool bRequireRunAsAdministrator = true;
2526
const bool bUsingDriver = false; //signed driver for hybrid KM + UM anticheat. the KM driver will not be public, so make one yourself if you want to use this option
2627
std::wstring DriverCertSubject = L"YourGameCompany";
2728

@@ -31,11 +32,30 @@ int main()
3132
const bool bEnableLogging = true;
3233
const std::string logFIleName = "UltimateAnticheatLib.log";
3334

35+
if (isCI)
36+
bRequireRunAsAdministrator = false; //don't require admin on CI, since it runs in a container
37+
3438
try
3539
{
36-
settings = std::make_unique<Settings>("127.0.0.1", 5445, bNetworkingEnabled,
37-
bEnforceSecureBoot, bEnforceDSE, bEnforceNoKDBG, bUseAntiDebugging, bUseIntegrityChecking, bCheckThreadIntegrity, bCheckHypervisor,
38-
bRequireRunAsAdministrator, bUsingDriver, DriverCertSubject, validParents, bEnableLogging, logFIleName);
40+
if (isCI) //github actions runner will hang/run forever, forced to turn off most features since it runs in a VM
41+
{
42+
std::cout << "[CI MODE] Disabling admin check, anti-debugging, hypervisor checks" << std::endl;
43+
44+
settings = std::make_unique<Settings>(
45+
"127.0.0.1", 5445, false, // no networking
46+
false, false, false, // disable secure boot, DSE, KDBG
47+
false, false, false, // disable anti-debugging/integrity checks
48+
false, // disable hypervisor
49+
false, false, L"", // no admin, no driver
50+
validParents,
51+
false, ""); // disable logging
52+
}
53+
else
54+
{
55+
settings = std::make_unique<Settings>("127.0.0.1", 5445, bNetworkingEnabled,
56+
bEnforceSecureBoot, bEnforceDSE, bEnforceNoKDBG, bUseAntiDebugging, bUseIntegrityChecking, bCheckThreadIntegrity, bCheckHypervisor,
57+
bRequireRunAsAdministrator, bUsingDriver, DriverCertSubject, validParents, bEnableLogging, logFIleName);
58+
}
3959

4060
anticheat = std::make_unique<AntiCheat>(settings.get());
4161
}
@@ -45,23 +65,7 @@ int main()
4565
return 1;
4666
}
4767

48-
//cout << "\n----------------------------------------------------------------------------------------------------------" << endl;
49-
//cout << "All protections have been deployed, the program will now loop using its detection methods" << endl;
50-
//cout << "Please enter 'q' if you'd like to end the program." << endl;
51-
52-
//std::string userKeyboardInput;
53-
54-
//while (true)
55-
//{
56-
// cin >> userKeyboardInput;
57-
58-
// if (userKeyboardInput == "q" || userKeyboardInput == "Q")
59-
// {
60-
// cout << "Exit key was pressed, shutting down program..." << endl;
61-
// break;
62-
// }
63-
//}
64-
68+
//Since this file is being used with Github actions, remove any infinite loops and explicitly destroy object
6569
anticheat->Destroy();
6670

6771
return 0;

0 commit comments

Comments
 (0)