Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Krautz <mikkel@krautz.dk>2017-03-19 23:35:29 +0300
committerMikkel Krautz <mikkel@krautz.dk>2017-03-19 23:35:29 +0300
commit151bc49132b1c1c130017fd185fe5b14306ef0ca (patch)
treeae8046e07371de45117e65e6fc116cc41a63aa3f /overlay
parentde6e9ec0cf02ea85d13d4403a169d27930c7af43 (diff)
overlay: re-introduce checks for 'debugoverlay' and 'nooverlay'.
These were removed when we removed all the legacy exclusion logic. This commit re-adds them in a more sensible way.
Diffstat (limited to 'overlay')
-rw-r--r--overlay/lib.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/overlay/lib.cpp b/overlay/lib.cpp
index 8080729b1..7454b2b85 100644
--- a/overlay/lib.cpp
+++ b/overlay/lib.cpp
@@ -474,6 +474,34 @@ extern "C" __declspec(dllexport) int __cdecl OverlayHelperProcessMain(unsigned i
static bool createSharedDataMap();
+// Check for the presence of a "nooverlay" file in the directory of the
+// program we're injected into. If such a file exists, it's a hint that
+// we shouldn't inject into it.
+static void checkNoOverlayFile(const std::string &dir) {
+ std::string nooverlay = dir + "\\nooverlay";
+ HANDLE h = CreateFile(nooverlay.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h != INVALID_HANDLE_VALUE) {
+ CloseHandle(h);
+ ods("Lib: Overlay disable %s found", dir.c_str());
+ bEnableOverlay = FALSE;
+ return;
+ }
+}
+
+// Check for the presence of a "debugoverlay" file in the directory of
+// the program we're injected into. If such a file exists, it's a hint
+// from the user that they want verbose debugging output from the overlay.
+static void checkDebugOverlayFile(const std::string &dir) {
+ // check for "debugoverlay" file, which would enable overlay debugging
+ std::string debugoverlay = dir + "\\debugoverlay";
+ HANDLE h = CreateFile(debugoverlay.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h != INVALID_HANDLE_VALUE) {
+ CloseHandle(h);
+ ods("Lib: Overlay debug %s found", debugoverlay.c_str());
+ bDebug = TRUE;
+ }
+}
+
// Given the absolute path to the current process's executable via |procname|,
// return the absolute path to the executable in |absExeName|, the directory
// that the executable lives in in |dir| and the basename of the executable in
@@ -512,9 +540,11 @@ static bool dllmainProcAttach(char *procname) {
ods("Lib: Attached to overlay helper or Mumble process. Blacklisted - no overlay injection.");
bEnableOverlay = FALSE;
bMumble = TRUE;
+ } else {
+ checkNoOverlayFile(dir);
+ checkDebugOverlayFile(dir);
}
-
OSVERSIONINFOEX ovi;
memset(&ovi, 0, sizeof(ovi));
ovi.dwOSVersionInfoSize = sizeof(ovi);