summaryrefslogtreecommitdiff
path: root/src/VBox/Additions/WINNT/VBoxMMR/dllmain.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2012-10-26 16:25:44 +0000
committer <>2012-11-12 12:15:52 +0000
commit58ed4748338f9466599adfc8a9171280ed99e23f (patch)
tree02027d99ded4fb56a64aa9489ac2eb487e7858ab /src/VBox/Additions/WINNT/VBoxMMR/dllmain.cpp
downloadVirtualBox-58ed4748338f9466599adfc8a9171280ed99e23f.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.2.4.tar.bz2.VirtualBox-4.2.4
Diffstat (limited to 'src/VBox/Additions/WINNT/VBoxMMR/dllmain.cpp')
-rw-r--r--src/VBox/Additions/WINNT/VBoxMMR/dllmain.cpp66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/VBox/Additions/WINNT/VBoxMMR/dllmain.cpp b/src/VBox/Additions/WINNT/VBoxMMR/dllmain.cpp
new file mode 100644
index 00000000..590199d9
--- /dev/null
+++ b/src/VBox/Additions/WINNT/VBoxMMR/dllmain.cpp
@@ -0,0 +1,66 @@
+/* $Id: dllmain.cpp $ */
+/** @file
+ * VBoxMMR - Multimedia Redirection
+ */
+
+/*
+ * Copyright (C) 2012 Oracle Corporation
+ *
+ * This file is part of VirtualBox Open Source Edition (OSE), as
+ * available from http://www.virtualbox.org. This file is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) as published by the Free Software
+ * Foundation, in version 2 as it comes in the "COPYING" file of the
+ * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+ * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+ */
+
+#include "stdafx.h"
+#include "tsmfhook.h"
+#include "logging.h"
+
+#include <Winternl.h>
+#include <iprt/initterm.h>
+#include <VBox/VBoxGuestLib.h>
+
+bool isWMP = false;
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+
+ DisableThreadLibraryCalls(hModule);
+
+ {
+ CHAR buffer[MAX_PATH];
+ GetModuleFileNameA(NULL, buffer, sizeof(buffer));
+ const PCHAR pc = strrchr(buffer, '\\');
+ isWMP = (0 == strcmp(pc + 1, "wmplayer.exe"));
+
+ if (isWMP)
+ {
+ RTR3InitDll(0);
+ VbglR3Init();
+ VBoxMMRHookLog("VBoxMMR: Hooking wmplayer process\n");
+ }
+ }
+
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ break;
+ case DLL_PROCESS_DETACH:
+ Shutdown();
+ if (isWMP)
+ {
+ VBoxMMRHookLog("VBoxMMR: Unhooking wmplayer process\n");
+ VbglR3Term();
+ }
+ break;
+ }
+ return TRUE;
+}