Skip to content

Commit

Permalink
v1.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
aurolou committed Dec 21, 2021
1 parent 8b2446d commit 9316771
Show file tree
Hide file tree
Showing 115 changed files with 3,928 additions and 2,762 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,5 @@ paket-files/
*.wixobj

/OCAT-Installer/redist
/GameOverlay/vulkan/src/vk.xml
/GameOverlay/vulkan/src/vk_dispatch_defs.h
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variables:
PLATFORM_TOOLSET: v141
OCAT_VERSION: 1.6.1
OCAT_VERSION: 1.6.2

stages:
- build
Expand Down
1 change: 0 additions & 1 deletion .mailmap

This file was deleted.

1 change: 0 additions & 1 deletion COPYING

This file was deleted.

14 changes: 7 additions & 7 deletions Commons/Commons.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Config\BlackList.cpp" />
<ClCompile Include="Config\DenyList.cpp" />
<ClCompile Include="Config\Config.cpp" />
<ClCompile Include="Logging\MessageLog.cpp" />
<ClCompile Include="Overlay\DLLInjection.cpp" />
Expand All @@ -45,7 +45,7 @@
<ClCompile Include="Utility\StringUtils.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Config\BlackList.h" />
<ClInclude Include="Config\DenyList.h" />
<ClInclude Include="Config\Config.h" />
<ClInclude Include="Logging\MessageLog.h" />
<ClInclude Include="Overlay\DLLInjection.h" />
Expand Down Expand Up @@ -77,35 +77,35 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{62089454-A7BA-4416-9E4B-EB0085797582}</ProjectGuid>
<RootNamespace>Commons</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<CLRSupport>false</CLRSupport>
Expand Down
4 changes: 2 additions & 2 deletions Commons/Commons.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<ClCompile Include="Utility\ProcessTermination.cpp">
<Filter>Utility</Filter>
</ClCompile>
<ClCompile Include="Config\BlackList.cpp">
<ClCompile Include="Config\DenyList.cpp">
<Filter>Config</Filter>
</ClCompile>
<ClCompile Include="Config\Config.cpp">
Expand Down Expand Up @@ -140,7 +140,7 @@
<ClInclude Include="Utility\ProcessTermination.h">
<Filter>Utility</Filter>
</ClInclude>
<ClInclude Include="Config\BlackList.h">
<ClInclude Include="Config\DenyList.h">
<Filter>Config</Filter>
</ClInclude>
<ClInclude Include="Config\Config.h">
Expand Down
68 changes: 34 additions & 34 deletions Commons/Config/BlackList.cpp → Commons/Config/DenyList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,98 +20,98 @@
// SOFTWARE.
//

#include "BlackList.h"
#include "DenyList.h"
#include "../Utility/ProcessHelper.h"
#include "../Utility/FileDirectory.h"
#include "../Logging/MessageLog.h"
#include "../Utility/StringUtils.h"

#include <fstream>

void BlackList::Load()
void DenyList::Load()
{
if (loaded_) return;

const std::wstring defaultBlackList =
g_fileDirectory.GetDirectory(DirectoryType::Config) + L"defaultBlackList.txt";
const std::wstring defaultDenyList =
g_fileDirectory.GetDirectory(DirectoryType::Config) + L"defaultDenyList.txt";

std::wifstream file(defaultBlackList);
std::wifstream file(defaultDenyList);
if (file.is_open())
{
// check for version number
// if we know app version and it differs from default blacklist version -> update
// if we know app version and it differs from default denylist version -> update
std::wstring version;
std::getline(file, version);
if (version_.empty() || ConvertUTF16StringToUTF8String(version).compare(version_) == 0)
{
// at this point the correct version number should be the one parsed from the blackList file
// at this point the correct version number should be the one parsed from the denyList file
version_ = ConvertUTF16StringToUTF8String(version);
for (std::wstring line; std::getline(file, line);)
{
blackList_.push_back(line);
denyList_.push_back(line);
}
g_messageLog.LogInfo("BlackList", "Blacklist file loaded");
g_messageLog.LogInfo("DenyList", "Denylist file loaded");
}
else {
file.close();
CreateDefault(defaultBlackList);
CreateDefault(defaultDenyList);
}
}
else
{
CreateDefault(defaultBlackList);
CreateDefault(defaultDenyList);
}

const std::wstring userBlackList =
g_fileDirectory.GetDirectory(DirectoryType::Config) + L"userBlackList.txt";
std::wifstream userfile(userBlackList);
const std::wstring userDenyList =
g_fileDirectory.GetDirectory(DirectoryType::Config) + L"userDenyList.txt";
std::wifstream userfile(userDenyList);
if (userfile.is_open())
{
for (std::wstring line; std::getline(userfile, line);)
{
blackList_.push_back(line);
denyList_.push_back(line);
}
g_messageLog.LogInfo("BlackList", "Blacklist file loaded");
g_messageLog.LogInfo("DenyList", "Denylist file loaded");
}
else {
CreateUserBlackList(userBlackList);
CreateUserDenyList(userDenyList);
}

loaded_ = true;
}

bool BlackList::Contains(const std::wstring& value) const
bool DenyList::Contains(const std::wstring& value) const
{
// ignore system processes without names
if (value.empty()) {
return true;
}

for (auto& entry : blackList_) {
for (auto& entry : denyList_) {
if (_wcsicmp(entry.c_str(), value.c_str()) == 0) {
return true;
}
}
return false;
}

std::vector<std::string> BlackList::GetBlackList()
std::vector<std::string> DenyList::GetDenyList()
{
std::vector<std::string> blackList;
blackList.reserve(blackList_.size());
for (const auto& item : blackList_)
std::vector<std::string> denyList;
denyList.reserve(denyList_.size());
for (const auto& item : denyList_)
{
blackList.push_back(ConvertUTF16StringToUTF8String(item));
denyList.push_back(ConvertUTF16StringToUTF8String(item));
}
return blackList;
return denyList;
}

void BlackList::CreateDefault(const std::wstring& fileName)
void DenyList::CreateDefault(const std::wstring& fileName)
{
g_messageLog.LogInfo("BlackList", "Create default blackList file");
g_messageLog.LogInfo("DenyList", "Create default denyList file");

/* TODO: properly separate and document this list */
blackList_ = {ConvertUTF8StringToUTF16String(version_),
denyList_ = {ConvertUTF8StringToUTF16String(version_),
L"dwm.exe", L"explorer.exe", L"firefox.exe",
L"chrome.exe", L"taskhostw.exe", L"notepad.exe",
L"RadeonSettings.exe", L"Nvidia Share.exe", L"devenv.exe", L"Outlook.exe", L"Excel.exe",
Expand All @@ -123,33 +123,33 @@ void BlackList::CreateDefault(const std::wstring& fileName)
L"OculusClient.exe", L"IAStorIcon.exe", L"conhost.exe", L"Agent.exe", L"Slack.exe",
L"Code.exe", L"powershell.exe", L"python.exe", L"conda.exe", L"wmic.exe", L"onenote.exe",
L"SearchProtocolHost.exe", L"lync.exe", L"taskmgr.exe", L"teams.exe", L"SpeechRuntime.exe",
L"ApplicationFrameHost.exe", L"LogonUI.exe", L"winword.exe" , L"powerpnt.exe"
L"ApplicationFrameHost.exe", L"LogonUI.exe", L"winword.exe" , L"powerpnt.exe", L"Launcher.exe"
};

std::wofstream file(fileName);
if (file.is_open())
{
for (auto& value : blackList_)
for (auto& value : denyList_)
{
file << value << std::endl;
}
}
else
{
g_messageLog.LogError("BlackList", "Unable to create default blackList file");
g_messageLog.LogError("DenyList", "Unable to create default denyList file");
}
}

void BlackList::CreateUserBlackList(const std::wstring& fileName)
void DenyList::CreateUserDenyList(const std::wstring& fileName)
{
g_messageLog.LogInfo("BlackList", "Create user blackList file");
g_messageLog.LogInfo("DenyList", "Create user denyList file");
std::wofstream file(fileName);
if (file.is_open())
{
file << L"app_to_be_ignored.exe" << std::endl;
}
else
{
g_messageLog.LogError("BlackList", "Unable to create user blackList file");
g_messageLog.LogError("DenyList", "Unable to create user denyList file");
}
}
10 changes: 5 additions & 5 deletions Commons/Config/BlackList.h → Commons/Config/DenyList.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@
#include <vector>
#include <string>

class BlackList
class DenyList
{
public:
// Tries to load the black list, creates a default file if none is found
// Tries to load the deny list, creates a default file if none is found
void Load();
bool Contains(const std::wstring& value) const;
std::vector<std::string> GetBlackList();
std::vector<std::string> GetDenyList();
void SetVersion(std::string version) { version_ = version; }
std::string GetVersion() { return version_; }

private:
void CreateDefault(const std::wstring& fileName);
void CreateUserBlackList(const std::wstring& fileName);
void CreateUserDenyList(const std::wstring& fileName);
bool loaded_ = false;
std::vector<std::wstring> blackList_;
std::vector<std::wstring> denyList_;
std::string version_;
};
17 changes: 13 additions & 4 deletions Commons/Overlay/Overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ Overlay::Overlay()

typedef LONG(*PStartUWPProcessWithOverlay) (const wchar_t*);

bool Overlay::StartProcess(const std::wstring& path, std::wstring& cmdArgs, bool enableOverlay)
bool Overlay::StartProcess(const std::wstring& path, const std::wstring& workingDirectory, std::wstring& cmdArgs, bool enableOverlay)
{
const auto processStartedStatus = CreateDesktopProcess(path, cmdArgs, enableOverlay);
const auto processStartedStatus =
CreateDesktopProcess(path, workingDirectory, cmdArgs, enableOverlay);
// UWP app detected
if (processStartedStatus == ERROR_APPCONTAINER_REQUIRED)
{
Expand Down Expand Up @@ -107,11 +108,19 @@ const DWORD Overlay::GetProcessID() const
return processID_;
}

DWORD Overlay::CreateDesktopProcess(const std::wstring& path, std::wstring& cmdArgs, bool enableOverlay)
DWORD Overlay::CreateDesktopProcess(const std::wstring& path, const std::wstring& workingDirectory, std::wstring& cmdArgs, bool enableOverlay)
{
g_messageLog.LogInfo("Overlay",
L"Trying to start executable " + path + L" cmdArgs " + cmdArgs);
const auto directory = GetDirFromPathSlashes(path);
std::wstring directory;
if (workingDirectory.empty()) {
// if user did not set a working directory manual, try the one in which the executable lives
directory = GetDirFromPathSlashes(path);
}
else {
directory = workingDirectory;
}

if (directory.empty()) return ERROR_PATH_NOT_FOUND;

VK_Environment environment;
Expand Down
7 changes: 5 additions & 2 deletions Commons/Overlay/Overlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class Overlay {

// Starts the given executable and suspends the process to load the overlay dll
// if failed the process will be resumed without overlay
bool StartProcess(const std::wstring& path, std::wstring& cmdArgs, bool enableOverlay);
bool StartProcess(const std::wstring& path,
const std::wstring& workingDirectory, std::wstring& cmdArgs, bool enableOverlay);
void Stop();

// returns the process name, empty if no process is attached
Expand All @@ -43,7 +44,9 @@ class Overlay {
private:
// Returns ERROR_SUCCES if a normal process was started, ERROR_APPCONTAINER_REQUIRED if tried to
// start uwp app
DWORD CreateDesktopProcess(const std::wstring& path, std::wstring& cmdArgs, bool enableOverlay);
DWORD CreateDesktopProcess(const std::wstring& path,
const std::wstring& workingDirectory, std::wstring& cmdArgs,
bool enableOverlay);
void SetProcessInfo(DWORD id);

PROCESS_INFORMATION processInfo_{};
Expand Down
4 changes: 2 additions & 2 deletions Commons/Overlay/OverlayInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ bool OverlayInterface::Init(HWND hwnd)
return true;
}

void OverlayInterface::StartProcess(const std::wstring& executable, std::wstring& cmdArgs)
void OverlayInterface::StartProcess(const std::wstring& executable, const std::wstring& workingDirectory, std::wstring& cmdArgs)
{
g_messageLog.LogInfo("OverlayInterface", "Start single process");
g_ProcessFinished = false;
g_CaptureAll = false;
if (overlay_.StartProcess(executable, cmdArgs, true))
if (overlay_.StartProcess(executable, workingDirectory, cmdArgs, true))
{
processTermination_.Register(overlay_.GetProcessID());
}
Expand Down
2 changes: 1 addition & 1 deletion Commons/Overlay/OverlayInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class OverlayInterface

bool Init(HWND hwnd);

void StartProcess(const std::wstring& executable, std::wstring& cmdArgs);
void StartProcess(const std::wstring& executable, const std::wstring& workingDirectory, std::wstring& cmdArgs);
void StartGlobal();
void StopCapture(std::vector<int> overlayThreads);
void FreeInjectedDlls(std::vector<int> injectedProcesses);
Expand Down
Loading

0 comments on commit 9316771

Please sign in to comment.