]> git.cworth.org Git - apitrace/commitdiff
inject: Add define to use environment var instead of shared memory.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 22 Feb 2013 09:40:30 +0000 (09:40 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 22 Feb 2013 10:25:25 +0000 (10:25 +0000)
inject/inject.h
inject/injectee.cpp
inject/injector.cpp

index 058ada6d188554933b91283c5435c4087794336f..e915e4f4ab347c5db614a6b624c0afd480f7c84b 100644 (file)
@@ -91,6 +91,11 @@ getModuleName(char *szModuleName, size_t n, const char *szFilename) {
 }
 
 
+#define USE_SHARED_MEM 1
+
+
+#if USE_SHARED_MEM
+
 #define SHARED_MEM_SIZE 4096
 
 static LPVOID pSharedMem = NULL;
@@ -179,3 +184,5 @@ GetSharedMem(LPSTR lpszDst, size_t n) {
     *lpszDst = '\0';
 }
 
+
+#endif /* USE_SHARED_MEM */
index 86992b83e94e3923b324e42378d446fa5b2073ee..57c82db8404941cdc13793e8ef8f75b82be6c43b 100644 (file)
@@ -513,7 +513,7 @@ DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved)
          * - http://msdn.microsoft.com/en-us/library/ms682583
          */
 
-#if 0
+#if !USE_SHARED_MEM
         szNewDllName = getenv("INJECT_DLL");
         if (!szNewDllName) {
             debugPrintf("warning: INJECT_DLL not set\n");
index 04e09598f98fa5c0d132e98597c85061b6ca24b8..5c62a72b1c067fa1ddfad9e0b40c51ae806c5b9f 100644 (file)
@@ -116,7 +116,7 @@ main(int argc, char *argv[])
     }
 
     const char *szDll = argv[1];
-#if 0
+#if !USE_SHARED_MEM
     SetEnvironmentVariableA("INJECT_DLL", szDll);
 #else
     SetSharedMem(szDll);