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:
authorRobert Adam <krzmbrzl@gmail.com>2021-03-01 20:01:11 +0300
committerRobert Adam <krzmbrzl@gmail.com>2021-03-02 12:15:01 +0300
commit59ae429972c16c377135bcccfee646b7df446933 (patch)
treed4d82f96756f95255970f165195f3fde71273c40 /overlay
parent86710dab6202794bb14a26aff76e303c99c7dc43 (diff)
MAINT: Update copyright notice to 2021
This was done by running scripts/updateLicenseHeaders.py and then manually editing the LICENSE file.
Diffstat (limited to 'overlay')
-rw-r--r--overlay/D11StateBlock.cpp2
-rw-r--r--overlay/D11StateBlock.h2
-rw-r--r--overlay/HardHook.cpp20
-rw-r--r--overlay/HardHook.h30
-rw-r--r--overlay/HardHook_minhook.cpp2
-rw-r--r--overlay/HardHook_minhook.h2
-rw-r--r--overlay/HardHook_x86.cpp758
-rw-r--r--overlay/HardHook_x86.h120
-rw-r--r--overlay/ancestor.cpp2
-rw-r--r--overlay/ancestor.h2
-rw-r--r--overlay/d3d10.cpp2
-rw-r--r--overlay/d3d11.cpp2
-rw-r--r--overlay/d3d9.cpp2
-rw-r--r--overlay/dxgi.cpp2
-rw-r--r--overlay/excludecheck.cpp2
-rw-r--r--overlay/excludecheck.h2
-rw-r--r--overlay/lib.cpp2
-rw-r--r--overlay/lib.h2
-rw-r--r--overlay/ods.cpp2
-rw-r--r--overlay/ods.h2
-rw-r--r--overlay/olsettings.cpp2
-rw-r--r--overlay/olsettings.h2
-rw-r--r--overlay/opengl.cpp2
-rw-r--r--overlay/overlay.fx2
-rw-r--r--overlay/overlay.h2
-rw-r--r--overlay/overlay11-common.hlsl108
-rw-r--r--overlay/overlay11.ps80
-rw-r--r--overlay/overlay11.vs88
-rw-r--r--overlay/overlay_blacklist.h2
-rw-r--r--overlay/overlay_exe/overlay_exe.cpp2
-rw-r--r--overlay/overlay_exe/overlay_exe.h178
-rw-r--r--overlay/overlay_launchers.h2
-rw-r--r--overlay/overlay_whitelist.h2
-rw-r--r--overlay/scripts/build_overlay_xcompile.cmd5
-rw-r--r--overlay/util.h106
35 files changed, 774 insertions, 769 deletions
diff --git a/overlay/D11StateBlock.cpp b/overlay/D11StateBlock.cpp
index f1acb91e4..21355ba53 100644
--- a/overlay/D11StateBlock.cpp
+++ b/overlay/D11StateBlock.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2014-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/D11StateBlock.h b/overlay/D11StateBlock.h
index b1a59cf52..89c31956a 100644
--- a/overlay/D11StateBlock.h
+++ b/overlay/D11StateBlock.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/HardHook.cpp b/overlay/HardHook.cpp
index 6c14ae611..0c9c8ead5 100644
--- a/overlay/HardHook.cpp
+++ b/overlay/HardHook.cpp
@@ -1,10 +1,10 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-#ifdef USE_MINHOOK
-# include "HardHook_minhook.cpp"
-#else
-# include "HardHook_x86.cpp"
-#endif
+// Copyright 2010-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+#ifdef USE_MINHOOK
+# include "HardHook_minhook.cpp"
+#else
+# include "HardHook_x86.cpp"
+#endif
diff --git a/overlay/HardHook.h b/overlay/HardHook.h
index 9a18cb9ef..539c8e8cc 100644
--- a/overlay/HardHook.h
+++ b/overlay/HardHook.h
@@ -1,15 +1,15 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-#ifndef MUMBLE_HARDHOOK_H_
-#define MUMBLE_HARDHOOK_H_
-
-#ifdef USE_MINHOOK
-# include "HardHook_minhook.h"
-#else
-# include "HardHook_x86.h"
-#endif
-
-#endif
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+#ifndef MUMBLE_HARDHOOK_H_
+#define MUMBLE_HARDHOOK_H_
+
+#ifdef USE_MINHOOK
+# include "HardHook_minhook.h"
+#else
+# include "HardHook_x86.h"
+#endif
+
+#endif
diff --git a/overlay/HardHook_minhook.cpp b/overlay/HardHook_minhook.cpp
index 1b9b52d68..6c8405fd1 100644
--- a/overlay/HardHook_minhook.cpp
+++ b/overlay/HardHook_minhook.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2015-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/HardHook_minhook.h b/overlay/HardHook_minhook.h
index 105940976..2145293d2 100644
--- a/overlay/HardHook_minhook.h
+++ b/overlay/HardHook_minhook.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/HardHook_x86.cpp b/overlay/HardHook_x86.cpp
index 79cc469eb..2dee21a67 100644
--- a/overlay/HardHook_x86.cpp
+++ b/overlay/HardHook_x86.cpp
@@ -1,379 +1,379 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-#include "HardHook.h"
-#include "ods.h"
-
-void *HardHook::pCode = nullptr;
-unsigned int HardHook::uiCode = 0;
-
-const int HardHook::CODEREPLACESIZE = 6;
-const int HardHook::CODEPROTECTSIZE = 16;
-
-/**
- * @brief Constructs a new hook without actually injecting.
- */
-HardHook::HardHook() : bTrampoline(false), call(0), baseptr(nullptr) {
- for (int i = 0; i < CODEREPLACESIZE; ++i) {
- orig[i] = replace[i] = 0;
- }
-
- // assert(CODEREPLACESIZE == sizeof(orig) / sizeof(orig[0]));
- // assert(CODEREPLACESIZE == sizeof(replace) / sizeof(replace[0]));
-}
-
-/**
- * @brief Constructs a new hook by injecting given replacement function into func.
- * @see HardHook::setup
- * @param func Funktion to inject replacement into.
- * @param replacement Function to inject into func.
- */
-HardHook::HardHook(voidFunc func, voidFunc replacement) : bTrampoline(false), call(0), baseptr(nullptr) {
- for (int i = 0; i < CODEREPLACESIZE; ++i)
- orig[i] = replace[i] = 0;
- setup(func, replacement);
-}
-
-/**
- * @return Number of extra bytes.
- */
-static unsigned int modrmbytes(unsigned char a, unsigned char b) {
- unsigned char lower = (a & 0x0f);
- if (a >= 0xc0) {
- return 0;
- } else if (a >= 0x80) {
- if ((lower == 4) || (lower == 12))
- return 5;
- else
- return 4;
- } else if (a >= 0x40) {
- if ((lower == 4) || (lower == 12))
- return 2;
- else
- return 1;
-
- } else {
- if ((lower == 4) || (lower == 12)) {
- if ((b & 0x07) == 0x05)
- return 5;
- else
- return 1;
- } else if ((lower == 5) || (lower == 13))
- return 4;
- return 0;
- }
-}
-
-/**
- * @brief Tries to construct a trampoline from original code.
- *
- * A trampoline is the replacement code that features the original code plus
- * a jump back to the original instructions that follow.
- * It is called to execute the original behavior. As it is a replacement for
- * the original, the original can then be overwritten.
- * The size of the trampoline is at least CODEREPLACESIZE. Thus, CODEREPLACESIZE
- * bytes of the original code can afterwards be overwritten (and the trampoline
- * called after those instructions for the original logic).
- * CODEREPLACESIZE has to be smaller than CODEPROTECTSIZE.
- *
- * As commands must not be destroyed they have to be disassembled to get their length.
- * All encountered commands will be part of the trampoline and stored in pCode (shared
- * for all trampolines).
- *
- * If code is encountered that can not be moved into the trampoline (conditionals etc.)
- * construction fails and nullptr is returned. If enough commands can be saved the
- * trampoline is finalized by appending a jump back to the original code. The return value
- * in this case will be the address of the newly constructed trampoline.
- *
- * pCode + offset to trampoline:
- * [SAVED CODE FROM ORIGINAL which is >= CODEREPLACESIZE bytes][JUMP BACK TO ORIGINAL CODE]
- *
- * @param porig Original code
- * @return Pointer to trampoline on success. nullptr if trampoline construction failed.
- */
-void *HardHook::cloneCode(void **porig) {
- if (!pCode || uiCode > 4000) {
- pCode = VirtualAlloc(nullptr, 4096, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
- uiCode = 0;
- }
- // If we have no memory to clone to, return.
- if (!pCode) {
- return nullptr;
- }
-
- unsigned char *o = (unsigned char *) *porig;
-
- DWORD origProtect;
- if (!VirtualProtect(o, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) {
- fods("HardHook: CloneCode failed; failed to make original code read and executable");
- return nullptr;
- }
-
- // Follow relative jumps to next instruction. On execution it doesn't make
- // a difference if we actually perform all the jumps or directly jump to the
- // end of the chain. Hence these jumps need not be part of the trampoline.
- while (*o == 0xe9) { // JMP
- unsigned char *tmp = o;
- int *iptr = reinterpret_cast< int * >(o + 1);
- o += *iptr + 5;
-
- fods("HardHook: CloneCode: Skipping jump from %p to %p", *porig, o);
- *porig = o;
-
- // Assume jump took us out of our read enabled zone, get rights for the new one
- DWORD tempProtect;
- VirtualProtect(tmp, CODEPROTECTSIZE, origProtect, &tempProtect);
- if (!VirtualProtect(o, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) {
- fods("HardHook: CloneCode failed; failed to make jump target code read and executable");
- return nullptr;
- }
- }
-
- unsigned char *n = (unsigned char *) pCode;
- n += uiCode;
- unsigned int idx = 0;
-
- do {
- unsigned char opcode = o[idx];
- unsigned char a = o[idx + 1];
- unsigned char b = o[idx + 2];
- unsigned int extra = 0;
-
- switch (opcode) {
- case 0x50: // PUSH
- case 0x51:
- case 0x52:
- case 0x53:
- case 0x54:
- case 0x55:
- case 0x56:
- case 0x57:
- case 0x58: // POP
- case 0x59:
- case 0x5a:
- case 0x5b:
- case 0x5c:
- case 0x5d:
- case 0x5e:
- case 0x5f:
- break;
- case 0x6a: // PUSH immediate
- extra = 1;
- break;
- case 0x68: // PUSH immediate
- extra = 4;
- break;
- case 0x81: // CMP immediate
- extra = modrmbytes(a, b) + 5;
- break;
- case 0x83: // CMP
- extra = modrmbytes(a, b) + 2;
- break;
- case 0x8b: // MOV
- extra = modrmbytes(a, b) + 1;
- break;
- default: {
- int rmop = ((a >> 3) & 7);
- if (opcode == 0xff && rmop == 6) { // PUSH memory
- extra = modrmbytes(a, b) + 1;
- break;
- }
-
- fods("HardHook: CloneCode failed; Unknown opcode %02x at %d: %02x %02x %02x %02x %02x %02x %02x %02x "
- "%02x %02x %02x %02x",
- opcode, idx, o[0], o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9], o[10], o[11]);
- DWORD tempProtect;
- VirtualProtect(o, CODEPROTECTSIZE, origProtect, &tempProtect);
- return nullptr;
- break;
- }
- }
-
- n[idx] = opcode;
- ++idx;
-
- for (unsigned int i = 0; i < extra; ++i)
- n[idx + i] = o[idx + i];
- idx += extra;
-
- } while (idx < CODEREPLACESIZE);
-
- DWORD tempProtect;
- VirtualProtect(o, CODEPROTECTSIZE, origProtect, &tempProtect);
-
- // Add a relative jmp back to the original code, to after the copied code
- n[idx++] = 0xe9;
- int *iptr = reinterpret_cast< int * >(&n[idx]);
- const int JMP_OP_SIZE = 5;
- int offs = o - n - JMP_OP_SIZE;
- *iptr = offs;
- idx += 4;
-
- uiCode += idx;
-
- FlushInstructionCache(GetCurrentProcess(), n, idx);
-
- fods("HardHook: trampoline creation successful at %p", n);
-
- return n;
-}
-
-/**
- * @brief Makes sure the given replacement function is run once func is called.
- *
- * Tries to construct a trampoline for the given function (@see HardHook::cloneCode)
- * and then injects replacement function calling code into the first 6 bytes of the
- * original function (@see HardHook::inject).
- *
- * @param func Pointer to function to redirect.
- * @param replacement Pointer to code to redirect to.
- */
-void HardHook::setup(voidFunc func, voidFunc replacement) {
- if (baseptr)
- return;
-
- fods("HardHook: Setup: Asked to replace %p with %p", func, replacement);
-
- unsigned char *fptr = reinterpret_cast< unsigned char * >(func);
- unsigned char *nptr = reinterpret_cast< unsigned char * >(replacement);
-
- call = (voidFunc) cloneCode((void **) &fptr);
-
- if (call) {
- bTrampoline = true;
- } else {
- // Could not create a trampoline. Use alternative method instead.
- // This alternative method is dependant on the replacement code
- // restoring before calling the original. Otherwise we get a jump recursion
- bTrampoline = false;
- call = func;
- }
-
- DWORD origProtect;
- if (VirtualProtect(fptr, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) {
- replace[0] = 0x68; // PUSH immediate 1 Byte
- unsigned char **iptr = reinterpret_cast< unsigned char ** >(&replace[1]);
- *iptr = nptr; // (imm. value = nptr) 4 Byte
- replace[5] = 0xc3; // RETN 1 Byte
-
- // Save original 6 bytes at start of original function
- for (int i = 0; i < CODEREPLACESIZE; ++i)
- orig[i] = fptr[i];
-
- baseptr = fptr;
-
- inject(true);
-
- DWORD tempProtect;
- VirtualProtect(fptr, CODEPROTECTSIZE, origProtect, &tempProtect);
- } else {
- fods("HardHook: setup failed; failed to make original code read and executable");
- }
-}
-
-void HardHook::setupInterface(IUnknown *unkn, LONG funcoffset, voidFunc replacement) {
- fods("HardHook: setupInterface: Replacing %p function #%ld", unkn, funcoffset);
- void **ptr = reinterpret_cast< void ** >(unkn);
- ptr = reinterpret_cast< void ** >(ptr[0]);
- setup(reinterpret_cast< voidFunc >(ptr[funcoffset]), replacement);
-}
-
-void HardHook::reset() {
- baseptr = 0;
- bTrampoline = false;
- call = nullptr;
- for (int i = 0; i < CODEREPLACESIZE; ++i) {
- orig[i] = replace[i] = 0;
- }
-}
-
-/**
- * @brief Injects redirection code into the target function.
- *
- * Replaces the first 6 Bytes of the function indicated by baseptr
- * with the replacement code previously generated (usually a jump
- * to mumble code). If a trampoline is available this injection is not needed
- * as control flow was already permanently redirected by HardHook::setup .
- *
- * @param force Perform injection even when trampoline is available.
- */
-void HardHook::inject(bool force) {
- if (!baseptr)
- return;
- if (!force && bTrampoline)
- return;
-
- DWORD origProtect;
- if (VirtualProtect(baseptr, CODEREPLACESIZE, PAGE_EXECUTE_READWRITE, &origProtect)) {
- for (int i = 0; i < CODEREPLACESIZE; ++i) {
- baseptr[i] = replace[i]; // Replace with jump to new code
- }
-
- DWORD tempProtect;
- VirtualProtect(baseptr, CODEREPLACESIZE, origProtect, &tempProtect);
-
- FlushInstructionCache(GetCurrentProcess(), baseptr, CODEREPLACESIZE);
- }
-
- // Verify that the injection was successful
- for (int i = 0; i < CODEREPLACESIZE; ++i) {
- if (baseptr[i] != replace[i]) {
- fods("HardHook: Injection failure noticed at byte %d", i);
- }
- }
-}
-
-/**
- * @brief Restores the original code in a target function.
- *
- * Restores the first 6 Bytes of the function indicated by baseptr
- * from previously stored original code in orig. If a trampoline is available this
- * restoration is not needed as trampoline will correctly restore control
- * flow.
- *
- * @param force If true injection will be reverted even when trampoline is available.
- */
-void HardHook::restore(bool force) {
- if (!baseptr)
- return;
- if (!force && bTrampoline)
- return;
-
- DWORD origProtect;
- if (VirtualProtect(baseptr, CODEREPLACESIZE, PAGE_EXECUTE_READWRITE, &origProtect)) {
- for (int i = 0; i < CODEREPLACESIZE; ++i)
- baseptr[i] = orig[i];
- DWORD tempProtect;
- VirtualProtect(baseptr, CODEREPLACESIZE, origProtect, &tempProtect);
-
- FlushInstructionCache(GetCurrentProcess(), baseptr, CODEREPLACESIZE);
- }
-}
-
-void HardHook::print() {
- fods("HardHook: code replacement: %02x %02x %02x %02x %02x => %02x %02x %02x %02x %02x (currently effective: %02x "
- "%02x %02x %02x %02x)",
- orig[0], orig[1], orig[2], orig[3], orig[4], replace[0], replace[1], replace[2], replace[3], replace[4],
- baseptr[0], baseptr[1], baseptr[2], baseptr[3], baseptr[4]);
-}
-
-/**
- * @brief Checks whether injected code is in good shape and injects if not yet injected.
- *
- * If injected code is not found injection is attempted unless 3rd party overwrote
- * original code at injection location.
- */
-void HardHook::check() {
- if (memcmp(baseptr, replace, CODEREPLACESIZE) != 0) {
- // The instructions do not match our replacement instructions
- // If they match the original code, inject our hook.
- if (memcmp(baseptr, orig, CODEREPLACESIZE) == 0) {
- fods("HardHook: Reinjecting hook into function %p", baseptr);
- inject(true);
- } else {
- fods("HardHook: Function %p replaced by third party. Lost injected hook.");
- }
- }
-}
+// Copyright 2010-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+#include "HardHook.h"
+#include "ods.h"
+
+void *HardHook::pCode = nullptr;
+unsigned int HardHook::uiCode = 0;
+
+const int HardHook::CODEREPLACESIZE = 6;
+const int HardHook::CODEPROTECTSIZE = 16;
+
+/**
+ * @brief Constructs a new hook without actually injecting.
+ */
+HardHook::HardHook() : bTrampoline(false), call(0), baseptr(nullptr) {
+ for (int i = 0; i < CODEREPLACESIZE; ++i) {
+ orig[i] = replace[i] = 0;
+ }
+
+ // assert(CODEREPLACESIZE == sizeof(orig) / sizeof(orig[0]));
+ // assert(CODEREPLACESIZE == sizeof(replace) / sizeof(replace[0]));
+}
+
+/**
+ * @brief Constructs a new hook by injecting given replacement function into func.
+ * @see HardHook::setup
+ * @param func Funktion to inject replacement into.
+ * @param replacement Function to inject into func.
+ */
+HardHook::HardHook(voidFunc func, voidFunc replacement) : bTrampoline(false), call(0), baseptr(nullptr) {
+ for (int i = 0; i < CODEREPLACESIZE; ++i)
+ orig[i] = replace[i] = 0;
+ setup(func, replacement);
+}
+
+/**
+ * @return Number of extra bytes.
+ */
+static unsigned int modrmbytes(unsigned char a, unsigned char b) {
+ unsigned char lower = (a & 0x0f);
+ if (a >= 0xc0) {
+ return 0;
+ } else if (a >= 0x80) {
+ if ((lower == 4) || (lower == 12))
+ return 5;
+ else
+ return 4;
+ } else if (a >= 0x40) {
+ if ((lower == 4) || (lower == 12))
+ return 2;
+ else
+ return 1;
+
+ } else {
+ if ((lower == 4) || (lower == 12)) {
+ if ((b & 0x07) == 0x05)
+ return 5;
+ else
+ return 1;
+ } else if ((lower == 5) || (lower == 13))
+ return 4;
+ return 0;
+ }
+}
+
+/**
+ * @brief Tries to construct a trampoline from original code.
+ *
+ * A trampoline is the replacement code that features the original code plus
+ * a jump back to the original instructions that follow.
+ * It is called to execute the original behavior. As it is a replacement for
+ * the original, the original can then be overwritten.
+ * The size of the trampoline is at least CODEREPLACESIZE. Thus, CODEREPLACESIZE
+ * bytes of the original code can afterwards be overwritten (and the trampoline
+ * called after those instructions for the original logic).
+ * CODEREPLACESIZE has to be smaller than CODEPROTECTSIZE.
+ *
+ * As commands must not be destroyed they have to be disassembled to get their length.
+ * All encountered commands will be part of the trampoline and stored in pCode (shared
+ * for all trampolines).
+ *
+ * If code is encountered that can not be moved into the trampoline (conditionals etc.)
+ * construction fails and nullptr is returned. If enough commands can be saved the
+ * trampoline is finalized by appending a jump back to the original code. The return value
+ * in this case will be the address of the newly constructed trampoline.
+ *
+ * pCode + offset to trampoline:
+ * [SAVED CODE FROM ORIGINAL which is >= CODEREPLACESIZE bytes][JUMP BACK TO ORIGINAL CODE]
+ *
+ * @param porig Original code
+ * @return Pointer to trampoline on success. nullptr if trampoline construction failed.
+ */
+void *HardHook::cloneCode(void **porig) {
+ if (!pCode || uiCode > 4000) {
+ pCode = VirtualAlloc(nullptr, 4096, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
+ uiCode = 0;
+ }
+ // If we have no memory to clone to, return.
+ if (!pCode) {
+ return nullptr;
+ }
+
+ unsigned char *o = (unsigned char *) *porig;
+
+ DWORD origProtect;
+ if (!VirtualProtect(o, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) {
+ fods("HardHook: CloneCode failed; failed to make original code read and executable");
+ return nullptr;
+ }
+
+ // Follow relative jumps to next instruction. On execution it doesn't make
+ // a difference if we actually perform all the jumps or directly jump to the
+ // end of the chain. Hence these jumps need not be part of the trampoline.
+ while (*o == 0xe9) { // JMP
+ unsigned char *tmp = o;
+ int *iptr = reinterpret_cast< int * >(o + 1);
+ o += *iptr + 5;
+
+ fods("HardHook: CloneCode: Skipping jump from %p to %p", *porig, o);
+ *porig = o;
+
+ // Assume jump took us out of our read enabled zone, get rights for the new one
+ DWORD tempProtect;
+ VirtualProtect(tmp, CODEPROTECTSIZE, origProtect, &tempProtect);
+ if (!VirtualProtect(o, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) {
+ fods("HardHook: CloneCode failed; failed to make jump target code read and executable");
+ return nullptr;
+ }
+ }
+
+ unsigned char *n = (unsigned char *) pCode;
+ n += uiCode;
+ unsigned int idx = 0;
+
+ do {
+ unsigned char opcode = o[idx];
+ unsigned char a = o[idx + 1];
+ unsigned char b = o[idx + 2];
+ unsigned int extra = 0;
+
+ switch (opcode) {
+ case 0x50: // PUSH
+ case 0x51:
+ case 0x52:
+ case 0x53:
+ case 0x54:
+ case 0x55:
+ case 0x56:
+ case 0x57:
+ case 0x58: // POP
+ case 0x59:
+ case 0x5a:
+ case 0x5b:
+ case 0x5c:
+ case 0x5d:
+ case 0x5e:
+ case 0x5f:
+ break;
+ case 0x6a: // PUSH immediate
+ extra = 1;
+ break;
+ case 0x68: // PUSH immediate
+ extra = 4;
+ break;
+ case 0x81: // CMP immediate
+ extra = modrmbytes(a, b) + 5;
+ break;
+ case 0x83: // CMP
+ extra = modrmbytes(a, b) + 2;
+ break;
+ case 0x8b: // MOV
+ extra = modrmbytes(a, b) + 1;
+ break;
+ default: {
+ int rmop = ((a >> 3) & 7);
+ if (opcode == 0xff && rmop == 6) { // PUSH memory
+ extra = modrmbytes(a, b) + 1;
+ break;
+ }
+
+ fods("HardHook: CloneCode failed; Unknown opcode %02x at %d: %02x %02x %02x %02x %02x %02x %02x %02x "
+ "%02x %02x %02x %02x",
+ opcode, idx, o[0], o[1], o[2], o[3], o[4], o[5], o[6], o[7], o[8], o[9], o[10], o[11]);
+ DWORD tempProtect;
+ VirtualProtect(o, CODEPROTECTSIZE, origProtect, &tempProtect);
+ return nullptr;
+ break;
+ }
+ }
+
+ n[idx] = opcode;
+ ++idx;
+
+ for (unsigned int i = 0; i < extra; ++i)
+ n[idx + i] = o[idx + i];
+ idx += extra;
+
+ } while (idx < CODEREPLACESIZE);
+
+ DWORD tempProtect;
+ VirtualProtect(o, CODEPROTECTSIZE, origProtect, &tempProtect);
+
+ // Add a relative jmp back to the original code, to after the copied code
+ n[idx++] = 0xe9;
+ int *iptr = reinterpret_cast< int * >(&n[idx]);
+ const int JMP_OP_SIZE = 5;
+ int offs = o - n - JMP_OP_SIZE;
+ *iptr = offs;
+ idx += 4;
+
+ uiCode += idx;
+
+ FlushInstructionCache(GetCurrentProcess(), n, idx);
+
+ fods("HardHook: trampoline creation successful at %p", n);
+
+ return n;
+}
+
+/**
+ * @brief Makes sure the given replacement function is run once func is called.
+ *
+ * Tries to construct a trampoline for the given function (@see HardHook::cloneCode)
+ * and then injects replacement function calling code into the first 6 bytes of the
+ * original function (@see HardHook::inject).
+ *
+ * @param func Pointer to function to redirect.
+ * @param replacement Pointer to code to redirect to.
+ */
+void HardHook::setup(voidFunc func, voidFunc replacement) {
+ if (baseptr)
+ return;
+
+ fods("HardHook: Setup: Asked to replace %p with %p", func, replacement);
+
+ unsigned char *fptr = reinterpret_cast< unsigned char * >(func);
+ unsigned char *nptr = reinterpret_cast< unsigned char * >(replacement);
+
+ call = (voidFunc) cloneCode((void **) &fptr);
+
+ if (call) {
+ bTrampoline = true;
+ } else {
+ // Could not create a trampoline. Use alternative method instead.
+ // This alternative method is dependant on the replacement code
+ // restoring before calling the original. Otherwise we get a jump recursion
+ bTrampoline = false;
+ call = func;
+ }
+
+ DWORD origProtect;
+ if (VirtualProtect(fptr, CODEPROTECTSIZE, PAGE_EXECUTE_READ, &origProtect)) {
+ replace[0] = 0x68; // PUSH immediate 1 Byte
+ unsigned char **iptr = reinterpret_cast< unsigned char ** >(&replace[1]);
+ *iptr = nptr; // (imm. value = nptr) 4 Byte
+ replace[5] = 0xc3; // RETN 1 Byte
+
+ // Save original 6 bytes at start of original function
+ for (int i = 0; i < CODEREPLACESIZE; ++i)
+ orig[i] = fptr[i];
+
+ baseptr = fptr;
+
+ inject(true);
+
+ DWORD tempProtect;
+ VirtualProtect(fptr, CODEPROTECTSIZE, origProtect, &tempProtect);
+ } else {
+ fods("HardHook: setup failed; failed to make original code read and executable");
+ }
+}
+
+void HardHook::setupInterface(IUnknown *unkn, LONG funcoffset, voidFunc replacement) {
+ fods("HardHook: setupInterface: Replacing %p function #%ld", unkn, funcoffset);
+ void **ptr = reinterpret_cast< void ** >(unkn);
+ ptr = reinterpret_cast< void ** >(ptr[0]);
+ setup(reinterpret_cast< voidFunc >(ptr[funcoffset]), replacement);
+}
+
+void HardHook::reset() {
+ baseptr = 0;
+ bTrampoline = false;
+ call = nullptr;
+ for (int i = 0; i < CODEREPLACESIZE; ++i) {
+ orig[i] = replace[i] = 0;
+ }
+}
+
+/**
+ * @brief Injects redirection code into the target function.
+ *
+ * Replaces the first 6 Bytes of the function indicated by baseptr
+ * with the replacement code previously generated (usually a jump
+ * to mumble code). If a trampoline is available this injection is not needed
+ * as control flow was already permanently redirected by HardHook::setup .
+ *
+ * @param force Perform injection even when trampoline is available.
+ */
+void HardHook::inject(bool force) {
+ if (!baseptr)
+ return;
+ if (!force && bTrampoline)
+ return;
+
+ DWORD origProtect;
+ if (VirtualProtect(baseptr, CODEREPLACESIZE, PAGE_EXECUTE_READWRITE, &origProtect)) {
+ for (int i = 0; i < CODEREPLACESIZE; ++i) {
+ baseptr[i] = replace[i]; // Replace with jump to new code
+ }
+
+ DWORD tempProtect;
+ VirtualProtect(baseptr, CODEREPLACESIZE, origProtect, &tempProtect);
+
+ FlushInstructionCache(GetCurrentProcess(), baseptr, CODEREPLACESIZE);
+ }
+
+ // Verify that the injection was successful
+ for (int i = 0; i < CODEREPLACESIZE; ++i) {
+ if (baseptr[i] != replace[i]) {
+ fods("HardHook: Injection failure noticed at byte %d", i);
+ }
+ }
+}
+
+/**
+ * @brief Restores the original code in a target function.
+ *
+ * Restores the first 6 Bytes of the function indicated by baseptr
+ * from previously stored original code in orig. If a trampoline is available this
+ * restoration is not needed as trampoline will correctly restore control
+ * flow.
+ *
+ * @param force If true injection will be reverted even when trampoline is available.
+ */
+void HardHook::restore(bool force) {
+ if (!baseptr)
+ return;
+ if (!force && bTrampoline)
+ return;
+
+ DWORD origProtect;
+ if (VirtualProtect(baseptr, CODEREPLACESIZE, PAGE_EXECUTE_READWRITE, &origProtect)) {
+ for (int i = 0; i < CODEREPLACESIZE; ++i)
+ baseptr[i] = orig[i];
+ DWORD tempProtect;
+ VirtualProtect(baseptr, CODEREPLACESIZE, origProtect, &tempProtect);
+
+ FlushInstructionCache(GetCurrentProcess(), baseptr, CODEREPLACESIZE);
+ }
+}
+
+void HardHook::print() {
+ fods("HardHook: code replacement: %02x %02x %02x %02x %02x => %02x %02x %02x %02x %02x (currently effective: %02x "
+ "%02x %02x %02x %02x)",
+ orig[0], orig[1], orig[2], orig[3], orig[4], replace[0], replace[1], replace[2], replace[3], replace[4],
+ baseptr[0], baseptr[1], baseptr[2], baseptr[3], baseptr[4]);
+}
+
+/**
+ * @brief Checks whether injected code is in good shape and injects if not yet injected.
+ *
+ * If injected code is not found injection is attempted unless 3rd party overwrote
+ * original code at injection location.
+ */
+void HardHook::check() {
+ if (memcmp(baseptr, replace, CODEREPLACESIZE) != 0) {
+ // The instructions do not match our replacement instructions
+ // If they match the original code, inject our hook.
+ if (memcmp(baseptr, orig, CODEREPLACESIZE) == 0) {
+ fods("HardHook: Reinjecting hook into function %p", baseptr);
+ inject(true);
+ } else {
+ fods("HardHook: Function %p replaced by third party. Lost injected hook.");
+ }
+ }
+}
diff --git a/overlay/HardHook_x86.h b/overlay/HardHook_x86.h
index 356803e55..7a4c580fa 100644
--- a/overlay/HardHook_x86.h
+++ b/overlay/HardHook_x86.h
@@ -1,60 +1,60 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-#ifndef MUMBLE_HARDHOOK_X86_H_
-#define MUMBLE_HARDHOOK_X86_H_
-
-#define _UNICODE
-#ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0501
-#endif
-#include <windows.h>
-#include <cmath>
-#include <ctype.h>
-#include <map>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string>
-#include <unknwn.h>
-#include <vector>
-
-typedef void *(*voidFunc)();
-
-struct HardHook {
- // Pointer to executable code page that holds all trampoline codes
- static void *pCode;
- // Number of bytes used in pCode.
- static unsigned int uiCode;
-
- // Pointer to original code (which is hooked/replaced)
- unsigned char *baseptr;
- // The original instructions that are replaced by the hook
- unsigned char orig[6];
- // Hook-Code; Replacement instructions for function call jump
- unsigned char replace[6];
- // Remembers whether there is a trampoline in place in the target code or
- // whether restore -> call orig. -> replace has to be used for every intercepted call
- bool bTrampoline;
- // Points to the (rest of the) original function when used from the injected function
- voidFunc call;
-
- HardHook();
- HardHook(voidFunc func, voidFunc replacement);
- void setup(voidFunc func, voidFunc replacement);
- void setupInterface(IUnknown *intf, LONG funcoffset, voidFunc replacement);
- void reset();
- void inject(bool force = false);
- void restore(bool force = false);
- void print();
- void check();
-
-private:
- static const int CODEREPLACESIZE;
- static const int CODEPROTECTSIZE;
-
- void *cloneCode(void **orig);
-};
-
-#endif
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+#ifndef MUMBLE_HARDHOOK_X86_H_
+#define MUMBLE_HARDHOOK_X86_H_
+
+#define _UNICODE
+#ifndef _WIN32_WINNT
+# define _WIN32_WINNT 0x0501
+#endif
+#include <windows.h>
+#include <cmath>
+#include <ctype.h>
+#include <map>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string>
+#include <unknwn.h>
+#include <vector>
+
+typedef void *(*voidFunc)();
+
+struct HardHook {
+ // Pointer to executable code page that holds all trampoline codes
+ static void *pCode;
+ // Number of bytes used in pCode.
+ static unsigned int uiCode;
+
+ // Pointer to original code (which is hooked/replaced)
+ unsigned char *baseptr;
+ // The original instructions that are replaced by the hook
+ unsigned char orig[6];
+ // Hook-Code; Replacement instructions for function call jump
+ unsigned char replace[6];
+ // Remembers whether there is a trampoline in place in the target code or
+ // whether restore -> call orig. -> replace has to be used for every intercepted call
+ bool bTrampoline;
+ // Points to the (rest of the) original function when used from the injected function
+ voidFunc call;
+
+ HardHook();
+ HardHook(voidFunc func, voidFunc replacement);
+ void setup(voidFunc func, voidFunc replacement);
+ void setupInterface(IUnknown *intf, LONG funcoffset, voidFunc replacement);
+ void reset();
+ void inject(bool force = false);
+ void restore(bool force = false);
+ void print();
+ void check();
+
+private:
+ static const int CODEREPLACESIZE;
+ static const int CODEPROTECTSIZE;
+
+ void *cloneCode(void **orig);
+};
+
+#endif
diff --git a/overlay/ancestor.cpp b/overlay/ancestor.cpp
index a858224ab..083a793f2 100644
--- a/overlay/ancestor.cpp
+++ b/overlay/ancestor.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2017-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/ancestor.h b/overlay/ancestor.h
index a1a387f64..7f69e1919 100644
--- a/overlay/ancestor.h
+++ b/overlay/ancestor.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2017-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/d3d10.cpp b/overlay/d3d10.cpp
index 2c487ecbd..e84a21ad7 100644
--- a/overlay/d3d10.cpp
+++ b/overlay/d3d10.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2009-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/d3d11.cpp b/overlay/d3d11.cpp
index 67cf347b0..158d3e8ef 100644
--- a/overlay/d3d11.cpp
+++ b/overlay/d3d11.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2014-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/d3d9.cpp b/overlay/d3d9.cpp
index f954ef74d..bafc3ac4e 100644
--- a/overlay/d3d9.cpp
+++ b/overlay/d3d9.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/dxgi.cpp b/overlay/dxgi.cpp
index 3d732c231..3a0ddff21 100644
--- a/overlay/dxgi.cpp
+++ b/overlay/dxgi.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2013-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/excludecheck.cpp b/overlay/excludecheck.cpp
index 9821641e6..bdacd385d 100644
--- a/overlay/excludecheck.cpp
+++ b/overlay/excludecheck.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2017-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/excludecheck.h b/overlay/excludecheck.h
index 727158fef..8fb796931 100644
--- a/overlay/excludecheck.h
+++ b/overlay/excludecheck.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/lib.cpp b/overlay/lib.cpp
index 6be0b2fed..d2b8b9d62 100644
--- a/overlay/lib.cpp
+++ b/overlay/lib.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/lib.h b/overlay/lib.h
index 96ddee91b..0abeca492 100644
--- a/overlay/lib.h
+++ b/overlay/lib.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/ods.cpp b/overlay/ods.cpp
index 4c7693932..ec4356722 100644
--- a/overlay/ods.cpp
+++ b/overlay/ods.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/ods.h b/overlay/ods.h
index 8c6880b9c..2497424cf 100644
--- a/overlay/ods.h
+++ b/overlay/ods.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/olsettings.cpp b/overlay/olsettings.cpp
index 8daef0996..dc7da55b5 100644
--- a/overlay/olsettings.cpp
+++ b/overlay/olsettings.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2017-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/olsettings.h b/overlay/olsettings.h
index a251be8f4..1aeeacb2e 100644
--- a/overlay/olsettings.h
+++ b/overlay/olsettings.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2017-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/opengl.cpp b/overlay/opengl.cpp
index f8645c490..31ec24e54 100644
--- a/overlay/opengl.cpp
+++ b/overlay/opengl.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2007-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/overlay.fx b/overlay/overlay.fx
index d520bb64e..157695c68 100644
--- a/overlay/overlay.fx
+++ b/overlay/overlay.fx
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2009-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/overlay.h b/overlay/overlay.h
index 549619795..0b3676b1d 100644
--- a/overlay/overlay.h
+++ b/overlay/overlay.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/overlay11-common.hlsl b/overlay/overlay11-common.hlsl
index b9f61440d..723913e26 100644
--- a/overlay/overlay11-common.hlsl
+++ b/overlay/overlay11-common.hlsl
@@ -1,54 +1,54 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-/* Copyright (C) 2011-2013, Nye Liu <nyet@nyet.org>
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- - Neither the name of the Mumble Developers nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-Texture2D txDiffuse;
-SamplerState samLinear
-{
- Filter = MIN_MAG_MIP_LINEAR;
- AddressU = Wrap;
- AddressV = Wrap;
-};
-
-struct VS_INPUT
-{
- float4 Pos : POSITION;
- float2 Tex : TEXCOORD;
-};
-
-struct PS_INPUT
-{
- float4 Pos : SV_POSITION;
- float2 Tex : TEXCOORD0;
-};
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+/* Copyright (C) 2011-2013, Nye Liu <nyet@nyet.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ - Neither the name of the Mumble Developers nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+Texture2D txDiffuse;
+SamplerState samLinear
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = Wrap;
+ AddressV = Wrap;
+};
+
+struct VS_INPUT
+{
+ float4 Pos : POSITION;
+ float2 Tex : TEXCOORD;
+};
+
+struct PS_INPUT
+{
+ float4 Pos : SV_POSITION;
+ float2 Tex : TEXCOORD0;
+};
diff --git a/overlay/overlay11.ps b/overlay/overlay11.ps
index e758fa964..0c660fd47 100644
--- a/overlay/overlay11.ps
+++ b/overlay/overlay11.ps
@@ -1,41 +1,41 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-/* Copyright (C) 2011-2013, Nye Liu <nyet@nyet.org>
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- - Neither the name of the Mumble Developers nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "overlay11-common.hlsl"
-
-float4 main( PS_INPUT input ) : SV_Target
-{
- return txDiffuse.Sample(samLinear, input.Tex).bgra;
+// Copyright 2010-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+/* Copyright (C) 2011-2013, Nye Liu <nyet@nyet.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ - Neither the name of the Mumble Developers nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "overlay11-common.hlsl"
+
+float4 main( PS_INPUT input ) : SV_Target
+{
+ return txDiffuse.Sample(samLinear, input.Tex).bgra;
} \ No newline at end of file
diff --git a/overlay/overlay11.vs b/overlay/overlay11.vs
index 53de19ca3..b67e0365f 100644
--- a/overlay/overlay11.vs
+++ b/overlay/overlay11.vs
@@ -1,44 +1,44 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-/* Copyright (C) 2011-2013, Nye Liu <nyet@nyet.org>
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- - Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- - Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- - Neither the name of the Mumble Developers nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include "overlay11-common.hlsl"
-
-PS_INPUT main( VS_INPUT input )
-{
- PS_INPUT output = (PS_INPUT)0;
- output.Pos = input.Pos;
- output.Tex = input.Tex;
- return output;
-}
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+/* Copyright (C) 2011-2013, Nye Liu <nyet@nyet.org>
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ - Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ - Neither the name of the Mumble Developers nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "overlay11-common.hlsl"
+
+PS_INPUT main( VS_INPUT input )
+{
+ PS_INPUT output = (PS_INPUT)0;
+ output.Pos = input.Pos;
+ output.Tex = input.Tex;
+ return output;
+}
diff --git a/overlay/overlay_blacklist.h b/overlay/overlay_blacklist.h
index 32d26ff22..c03ab89f4 100644
--- a/overlay/overlay_blacklist.h
+++ b/overlay/overlay_blacklist.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/overlay_exe/overlay_exe.cpp b/overlay/overlay_exe/overlay_exe.cpp
index 7bca1c3de..3bbf4f40b 100644
--- a/overlay/overlay_exe/overlay_exe.cpp
+++ b/overlay/overlay_exe/overlay_exe.cpp
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2015-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/overlay_exe/overlay_exe.h b/overlay/overlay_exe/overlay_exe.h
index 9799e3149..82ec1b248 100644
--- a/overlay/overlay_exe/overlay_exe.h
+++ b/overlay/overlay_exe/overlay_exe.h
@@ -1,89 +1,89 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-#ifndef MUMBLE_OVERLAY_EXE_H_
-#define MUMBLE_OVERLAY_EXE_H_
-
-#if defined(_M_IX86)
-const wchar_t *MUMBLE_OVERLAY_DLL_NAME = L"mumble_ol.dll";
-#elif defined(_M_X64)
-const wchar_t *MUMBLE_OVERLAY_DLL_NAME = L"mumble_ol_x64.dll";
-#endif
-
-/// OverlayHelperError represents exit codes returned by the
-/// overlay helper process (mumble_ol_helper.exe) on Windows.
-enum OverlayHelperError {
- /// The overlay helper process was not passed any
- /// arguments.
- OVERLAY_HELPER_ERROR_EXE_NO_ARGUMENTS = 0x0F000001,
- /// The magic number on the command line of the overlay
- /// helper process could not be converted to an integer.
- OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT = 0x0F000002,
- /// The magic number on the command line of the overlay
- /// helper did not match the built-in magic number of
- /// the helper process.
- OVERLAY_HELPER_ERROR_EXE_MAGIC_MISMATCH = 0x0F000003,
- /// The overlay helper process was unable to configure
- /// its environment in preparation of loading the
- /// overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_CONFIGURE_ENVIRONMENT = 0x0F000004,
- /// The overlay helper process was unable to get the
- /// path to the overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_GET_DLL_PATH = 0x0F000005,
- /// The overlay helper process was unable to load the
- /// overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_LOAD_DLL = 0x0F000006,
- /// The overlay helper process was uanble to look up
- /// the 'OverlayHelperProcessMain' entry point in the
- /// overlay DLL.
- OVERLAY_HELPER_ERROR_EXE_LOOKUP_ENTRY_POINT = 0x0F000007,
- /// The overlay helper process was uanble to parse
- /// the commandline arguments it was passed.
- /// The helper process exepcts two arguments, and this
- /// error occurs if it only finds one.
- OVERLAY_HELPER_ERROR_TOO_FEW_ARGUMENTS = 0x0F000008,
- /// The magic number on the command line of the overlay
- /// helper process could not be converted to a HANDLE.
- OVERLAY_HELPER_ERROR_EXE_INVALID_HANDLE_ARGUMENT = 0x0F000009,
-
- /// The magic number passed to the overlay DLL's
- /// OverlayHelperProcessMain function did not match
- /// the overlay DLL's built-in magic number.
- OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH = 0x0FF00000,
- /// The overlay helper process exited due to an error
- /// in the Windows message loop.
- OVERLAY_HELPER_ERROR_DLL_MESSAGE_LOOP = 0x0FF00001,
- /// The parent death thread could not be created.
- OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR = 0x0FF00002,
- /// The helper's WaitForSingleObject call on its parent
- /// process failed unexpectedly.
- OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL = 0x0FF00003,
-};
-
-/// OverlayHelperErrorToString converts an OverlayHelperError value
-/// to a printable string representation.
-static inline const char *OverlayHelperErrorToString(OverlayHelperError err) {
-#define OHE(x) \
- case x: \
- return #x
- switch (err) {
- OHE(OVERLAY_HELPER_ERROR_EXE_NO_ARGUMENTS);
- OHE(OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT);
- OHE(OVERLAY_HELPER_ERROR_EXE_MAGIC_MISMATCH);
- OHE(OVERLAY_HELPER_ERROR_EXE_CONFIGURE_ENVIRONMENT);
- OHE(OVERLAY_HELPER_ERROR_EXE_GET_DLL_PATH);
- OHE(OVERLAY_HELPER_ERROR_EXE_LOAD_DLL);
- OHE(OVERLAY_HELPER_ERROR_EXE_LOOKUP_ENTRY_POINT);
- OHE(OVERLAY_HELPER_ERROR_TOO_FEW_ARGUMENTS);
- OHE(OVERLAY_HELPER_ERROR_EXE_INVALID_HANDLE_ARGUMENT);
- OHE(OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH);
- OHE(OVERLAY_HELPER_ERROR_DLL_MESSAGE_LOOP);
- OHE(OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR);
- OHE(OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL);
- }
- return nullptr;
-}
-
-#endif
+// Copyright 2015-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+#ifndef MUMBLE_OVERLAY_EXE_H_
+#define MUMBLE_OVERLAY_EXE_H_
+
+#if defined(_M_IX86)
+const wchar_t *MUMBLE_OVERLAY_DLL_NAME = L"mumble_ol.dll";
+#elif defined(_M_X64)
+const wchar_t *MUMBLE_OVERLAY_DLL_NAME = L"mumble_ol_x64.dll";
+#endif
+
+/// OverlayHelperError represents exit codes returned by the
+/// overlay helper process (mumble_ol_helper.exe) on Windows.
+enum OverlayHelperError {
+ /// The overlay helper process was not passed any
+ /// arguments.
+ OVERLAY_HELPER_ERROR_EXE_NO_ARGUMENTS = 0x0F000001,
+ /// The magic number on the command line of the overlay
+ /// helper process could not be converted to an integer.
+ OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT = 0x0F000002,
+ /// The magic number on the command line of the overlay
+ /// helper did not match the built-in magic number of
+ /// the helper process.
+ OVERLAY_HELPER_ERROR_EXE_MAGIC_MISMATCH = 0x0F000003,
+ /// The overlay helper process was unable to configure
+ /// its environment in preparation of loading the
+ /// overlay DLL.
+ OVERLAY_HELPER_ERROR_EXE_CONFIGURE_ENVIRONMENT = 0x0F000004,
+ /// The overlay helper process was unable to get the
+ /// path to the overlay DLL.
+ OVERLAY_HELPER_ERROR_EXE_GET_DLL_PATH = 0x0F000005,
+ /// The overlay helper process was unable to load the
+ /// overlay DLL.
+ OVERLAY_HELPER_ERROR_EXE_LOAD_DLL = 0x0F000006,
+ /// The overlay helper process was uanble to look up
+ /// the 'OverlayHelperProcessMain' entry point in the
+ /// overlay DLL.
+ OVERLAY_HELPER_ERROR_EXE_LOOKUP_ENTRY_POINT = 0x0F000007,
+ /// The overlay helper process was uanble to parse
+ /// the commandline arguments it was passed.
+ /// The helper process exepcts two arguments, and this
+ /// error occurs if it only finds one.
+ OVERLAY_HELPER_ERROR_TOO_FEW_ARGUMENTS = 0x0F000008,
+ /// The magic number on the command line of the overlay
+ /// helper process could not be converted to a HANDLE.
+ OVERLAY_HELPER_ERROR_EXE_INVALID_HANDLE_ARGUMENT = 0x0F000009,
+
+ /// The magic number passed to the overlay DLL's
+ /// OverlayHelperProcessMain function did not match
+ /// the overlay DLL's built-in magic number.
+ OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH = 0x0FF00000,
+ /// The overlay helper process exited due to an error
+ /// in the Windows message loop.
+ OVERLAY_HELPER_ERROR_DLL_MESSAGE_LOOP = 0x0FF00001,
+ /// The parent death thread could not be created.
+ OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR = 0x0FF00002,
+ /// The helper's WaitForSingleObject call on its parent
+ /// process failed unexpectedly.
+ OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL = 0x0FF00003,
+};
+
+/// OverlayHelperErrorToString converts an OverlayHelperError value
+/// to a printable string representation.
+static inline const char *OverlayHelperErrorToString(OverlayHelperError err) {
+#define OHE(x) \
+ case x: \
+ return #x
+ switch (err) {
+ OHE(OVERLAY_HELPER_ERROR_EXE_NO_ARGUMENTS);
+ OHE(OVERLAY_HELPER_ERROR_EXE_INVALID_MAGIC_ARGUMENT);
+ OHE(OVERLAY_HELPER_ERROR_EXE_MAGIC_MISMATCH);
+ OHE(OVERLAY_HELPER_ERROR_EXE_CONFIGURE_ENVIRONMENT);
+ OHE(OVERLAY_HELPER_ERROR_EXE_GET_DLL_PATH);
+ OHE(OVERLAY_HELPER_ERROR_EXE_LOAD_DLL);
+ OHE(OVERLAY_HELPER_ERROR_EXE_LOOKUP_ENTRY_POINT);
+ OHE(OVERLAY_HELPER_ERROR_TOO_FEW_ARGUMENTS);
+ OHE(OVERLAY_HELPER_ERROR_EXE_INVALID_HANDLE_ARGUMENT);
+ OHE(OVERLAY_HELPER_ERROR_DLL_MAGIC_MISMATCH);
+ OHE(OVERLAY_HELPER_ERROR_DLL_MESSAGE_LOOP);
+ OHE(OVERLAY_HELPER_ERROR_DLL_PDEATH_THREAD_ERROR);
+ OHE(OVERLAY_HELPER_ERROR_DLL_PDEATH_WAIT_FAIL);
+ }
+ return nullptr;
+}
+
+#endif
diff --git a/overlay/overlay_launchers.h b/overlay/overlay_launchers.h
index 02c0f5690..1918d8824 100644
--- a/overlay/overlay_launchers.h
+++ b/overlay/overlay_launchers.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2017-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/overlay_whitelist.h b/overlay/overlay_whitelist.h
index 24215c361..947c47a4a 100644
--- a/overlay/overlay_whitelist.h
+++ b/overlay/overlay_whitelist.h
@@ -1,4 +1,4 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
+// Copyright 2005-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
diff --git a/overlay/scripts/build_overlay_xcompile.cmd b/overlay/scripts/build_overlay_xcompile.cmd
index 622dacadd..ac4ef170a 100644
--- a/overlay/scripts/build_overlay_xcompile.cmd
+++ b/overlay/scripts/build_overlay_xcompile.cmd
@@ -1,3 +1,8 @@
+:: Copyright 2020-2021 The Mumble Developers. All rights reserved.
+:: Use of this source code is governed by a BSD-style license
+:: that can be found in the LICENSE file at the root of the
+:: Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
@echo off
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (
diff --git a/overlay/util.h b/overlay/util.h
index 29d29c651..35687968b 100644
--- a/overlay/util.h
+++ b/overlay/util.h
@@ -1,53 +1,53 @@
-// Copyright 2005-2020 The Mumble Developers. All rights reserved.
-// Use of this source code is governed by a BSD-style license
-// that can be found in the LICENSE file at the root of the
-// Mumble source tree or at <https://www.mumble.info/LICENSE>.
-
-#ifndef MUMBLE_UTIL_H_
-#define MUMBLE_UTIL_H_
-
-#include <algorithm>
-#include <string>
-#include <vector>
-
-/// Returns true if |path| is an absolute path.
-/// Returns false if |path| is not an absolute path.
-static inline bool isAbsPath(const std::string &path) {
- return path.find("\\") != std::string::npos;
-}
-
-/// Convert the string |s| to lowercase and return it.
-static inline std::string slowercase(std::string s) {
- std::transform(s.begin(), s.end(), s.begin(), tolower);
- return s;
-}
-
-/// Convert all entries of |vec| to lowercase and return the resulting vector.
-static inline std::vector< std::string > vlowercase(std::vector< std::string > vec) {
- std::transform(vec.begin(), vec.end(), vec.begin(), slowercase);
- return vec;
-}
-
-/// Merge |v1| and |v2| and return the result.
-template< typename T > static inline std::vector< T > vmerge(std::vector< T > v1, const std::vector< T > &v2) {
- v1.insert(v1.end(), v2.begin(), v2.end());
- return v1;
-}
-
-/// Filter out all entries of |vremove| from |v| and return the result.
-template< typename T >
-static inline std::vector< T > vexclude(const std::vector< T > &v, const std::vector< T > &vremove) {
- std::vector< T > out;
- std::set_difference(v.begin(), v.end(), vremove.begin(), vremove.end(), std::inserter(out, out.begin()));
- return out;
-}
-
-/// Find the intersection between |v1| and |v2| and return the result.
-template< typename T >
-static inline std::vector< T > vintersect(const std::vector< T > &v1, const std::vector< T > &v2) {
- std::vector< T > out;
- std::set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(), std::inserter(out, out.begin()));
- return out;
-}
-
-#endif
+// Copyright 2017-2021 The Mumble Developers. All rights reserved.
+// Use of this source code is governed by a BSD-style license
+// that can be found in the LICENSE file at the root of the
+// Mumble source tree or at <https://www.mumble.info/LICENSE>.
+
+#ifndef MUMBLE_UTIL_H_
+#define MUMBLE_UTIL_H_
+
+#include <algorithm>
+#include <string>
+#include <vector>
+
+/// Returns true if |path| is an absolute path.
+/// Returns false if |path| is not an absolute path.
+static inline bool isAbsPath(const std::string &path) {
+ return path.find("\\") != std::string::npos;
+}
+
+/// Convert the string |s| to lowercase and return it.
+static inline std::string slowercase(std::string s) {
+ std::transform(s.begin(), s.end(), s.begin(), tolower);
+ return s;
+}
+
+/// Convert all entries of |vec| to lowercase and return the resulting vector.
+static inline std::vector< std::string > vlowercase(std::vector< std::string > vec) {
+ std::transform(vec.begin(), vec.end(), vec.begin(), slowercase);
+ return vec;
+}
+
+/// Merge |v1| and |v2| and return the result.
+template< typename T > static inline std::vector< T > vmerge(std::vector< T > v1, const std::vector< T > &v2) {
+ v1.insert(v1.end(), v2.begin(), v2.end());
+ return v1;
+}
+
+/// Filter out all entries of |vremove| from |v| and return the result.
+template< typename T >
+static inline std::vector< T > vexclude(const std::vector< T > &v, const std::vector< T > &vremove) {
+ std::vector< T > out;
+ std::set_difference(v.begin(), v.end(), vremove.begin(), vremove.end(), std::inserter(out, out.begin()));
+ return out;
+}
+
+/// Find the intersection between |v1| and |v2| and return the result.
+template< typename T >
+static inline std::vector< T > vintersect(const std::vector< T > &v1, const std::vector< T > &v2) {
+ std::vector< T > out;
+ std::set_intersection(v1.begin(), v1.end(), v2.begin(), v2.end(), std::inserter(out, out.begin()));
+ return out;
+}
+
+#endif