Skip to content

Commit ced5818

Browse files
committed
Disabled hooks for discord.exe and slack.exe processes.
1 parent f2d2b2d commit ced5818

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

SmartSystemMenuHook/dllmain.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
// dllmain.cpp : Defines the entry point for the DLL application.
22
#include "stdafx.h"
3+
#include <string>
4+
#include <vector>
5+
#include <algorithm>
36

47
extern HINSTANCE g_appInstance;
58

9+
bool array_contains(const std::string &value, const std::vector<std::string> &array)
10+
{
11+
return std::find(array.begin(), array.end(), value) != array.end();
12+
}
13+
614
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
715
{
816
switch (ul_reason_for_call)
@@ -12,6 +20,20 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
1220
{
1321
g_appInstance = hModule;
1422
}
23+
WCHAR path[MAX_PATH];
24+
if (GetModuleFileName(NULL, path, sizeof(path)) != 0)
25+
{
26+
std::vector<std::string> excludedProcessNames{ "discord.exe", "slack.exe" };
27+
std::wstring tempPath(&path[0]);
28+
std::string processPath(tempPath.begin(), tempPath.end());
29+
std::size_t index = processPath.find_last_of("/\\");
30+
std::string processName = processPath.substr(index + 1);
31+
std::transform(processName.begin(), processName.end(), processName.begin(), ::tolower);
32+
if (array_contains(processName, excludedProcessNames))
33+
{
34+
return FALSE;
35+
}
36+
}
1537
break;
1638

1739
case DLL_THREAD_ATTACH:

0 commit comments

Comments
 (0)