From 8865f9d7bc6b88e6cde2e2ec53e2f7c0f41561a7 Mon Sep 17 00:00:00 2001 From: Tannin Date: Wed, 23 Sep 2015 21:47:56 +0200 Subject: added cmake build script and a few fixes for 64-bit compatibility --- src/shared/inject.cpp | 3 +++ src/shared/stackdata.cpp | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/shared') diff --git a/src/shared/inject.cpp b/src/shared/inject.cpp index 36db7840..fcd4cfab 100644 --- a/src/shared/inject.cpp +++ b/src/shared/inject.cpp @@ -113,6 +113,8 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll // dizzy yet? we still have to calculate the entry point as an address relative to our stub ULONG entryPoint = 0; + // not implemented on 64 bit systems +#ifdef _X86_ CONTEXT threadContext; threadContext.ContextFlags = CONTEXT_CONTROL; if (::GetThreadContext(threadHandle, &threadContext) == 0) { @@ -139,6 +141,7 @@ void injectDLL(HANDLE processHandle, HANDLE threadHandle, const std::string &dll if (::SetThreadContext(threadHandle, &threadContext) == 0) { throw windows_error("failed to overwrite thread context"); } +#endif } } // namespace MOShared diff --git a/src/shared/stackdata.cpp b/src/shared/stackdata.cpp index 4450756d..6c5a0968 100644 --- a/src/shared/stackdata.cpp +++ b/src/shared/stackdata.cpp @@ -11,7 +11,7 @@ using namespace MOShared; -#ifdef _MSC_VER +#if defined _MSC_VER static void initDbgIfNecess() { @@ -94,6 +94,7 @@ void StackData::load_modules(HANDLE process, DWORD processID) { #pragma warning( disable : 4748 ) void StackData::initTrace() { +#ifdef _X86_ load_modules(::GetCurrentProcess(), ::GetCurrentProcessId()); CONTEXT context; std::memset(&context, 0, sizeof(CONTEXT)); @@ -134,6 +135,7 @@ void StackData::initTrace() { m_Stack[m_Count++] = reinterpret_cast(stackFrame.AddrPC.Offset); } +#endif } -- cgit v1.3.1