Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'new_inject'

  • Loading branch information...
commit 8c9a174283a1a1c1c5acf41db7a26018ce0b1854 2 parents a45d0c1 + af0fa4d
@bozho bozho authored
View
264 Console/ConsoleHandler.cpp
@@ -200,7 +200,7 @@ bool ConsoleHandler::StartShellProcess(const wstring& strCustomShell, const wstr
m_hConsoleProcess = shared_ptr<void>(pi.hProcess, ::CloseHandle);
// inject our hook DLL into console process
- if (!InjectHookDLL()) return false;
+ if (!InjectHookDLL(pi)) return false;
// resume the console process
::ResumeThread(pi.hThread);
@@ -370,57 +370,233 @@ bool ConsoleHandler::CreateSharedObjects(DWORD dwConsoleProcessId)
//////////////////////////////////////////////////////////////////////////////
-bool ConsoleHandler::InjectHookDLL()
+bool ConsoleHandler::InjectHookDLL(PROCESS_INFORMATION& pi)
{
+
// allocate memory for parameter in the remote process
- wstring strHookDllPath(GetModulePath(NULL) + wstring(L"\\ConsoleHook.dll"));
+ wstring strHookDllPath(GetModulePath(NULL));
if (::GetFileAttributes(strHookDllPath.c_str()) == INVALID_FILE_ATTRIBUTES) return false;
- shared_ptr<void> hRemoteThread;
- shared_ptr<wchar_t> pszHookDllPathRemote(
- static_cast<wchar_t*>(::VirtualAllocEx(
- m_hConsoleProcess.get(),
- NULL,
- strHookDllPath.length()*sizeof(wchar_t),
- MEM_COMMIT,
- PAGE_READWRITE)),
- bind<BOOL>(::VirtualFreeEx, m_hConsoleProcess.get(), _1, NULL, MEM_RELEASE));
-
- if (!pszHookDllPathRemote) return false;
-
- // write the memory
- if (!::WriteProcessMemory(
- m_hConsoleProcess.get(),
- (PVOID)pszHookDllPathRemote.get(),
- (PVOID)strHookDllPath.c_str(),
- strHookDllPath.length()*sizeof(wchar_t),
- NULL))
+ CONTEXT context;
+
+ void* mem = NULL;
+ size_t memLen = 0;
+ UINT_PTR fnLoadLibrary = NULL;
+
+ size_t codeSize;
+ BOOL isWow64Process = FALSE;
+
+#ifdef _WIN64
+ WOW64_CONTEXT wow64Context;
+ DWORD fnWow64LoadLibrary = 0;
+
+ ::ZeroMemory(&wow64Context, sizeof(WOW64_CONTEXT));
+ ::IsWow64Process(pi.hProcess, &isWow64Process);
+ codeSize = isWow64Process ? 20 : 91;
+#else
+ codeSize = 20;
+#endif
+
+ if (isWow64Process)
{
- return false;
+ // starting a 32-bit process from a 64-bit console
+ strHookDllPath += wstring(L"\\ConsoleHook32.dll");
+ }
+ else
+ {
+ // same bitness :-)
+ strHookDllPath += wstring(L"\\ConsoleHook.dll");
+ }
+
+ ::ZeroMemory(&context, sizeof(CONTEXT));
+
+ shared_array<BYTE> code(new BYTE[codeSize + (MAX_PATH*sizeof(wchar_t))]);
+
+ memLen = (strHookDllPath.length()+1)*sizeof(wchar_t);
+ if (memLen > MAX_PATH*sizeof(wchar_t)) return false;
+
+ ::CopyMemory(code.get() + codeSize, strHookDllPath.c_str(), memLen);
+ memLen += codeSize;
+
+#ifdef _WIN64
+
+ if (isWow64Process)
+ {
+ wow64Context.ContextFlags = CONTEXT_FULL;
+ ::Wow64GetThreadContext(pi.hThread, &wow64Context);
+
+ mem = ::VirtualAllocEx(pi.hProcess, NULL, memLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+
+ // get 32-bit kernel32
+ wstring strConsoleWowPath(GetModulePath(NULL) + wstring(L"\\ConsoleWow.exe"));
+
+ STARTUPINFO siWow;
+ ::ZeroMemory(&siWow, sizeof(STARTUPINFO));
+
+ siWow.cb = sizeof(STARTUPINFO);
+ siWow.dwFlags = STARTF_USESHOWWINDOW;
+ siWow.wShowWindow = SW_HIDE;
+
+ PROCESS_INFORMATION piWow;
+
+ if (!::CreateProcess(
+ NULL,
+ const_cast<wchar_t*>(strConsoleWowPath.c_str()),
+ NULL,
+ NULL,
+ FALSE,
+ 0,
+ NULL,
+ NULL,
+ &siWow,
+ &piWow))
+ {
+ return false;
+ }
+
+ shared_ptr<void> wowProcess(piWow.hProcess, ::CloseHandle);
+ shared_ptr<void> wowThread(piWow.hThread, ::CloseHandle);
+
+ if (::WaitForSingleObject(wowProcess.get(), 5000) == WAIT_TIMEOUT)
+ {
+ return false;
+ }
+
+ ::GetExitCodeProcess(wowProcess.get(), reinterpret_cast<DWORD*>(&fnWow64LoadLibrary));
+ }
+ else
+ {
+ context.ContextFlags = CONTEXT_FULL;
+ ::GetThreadContext(pi.hThread, &context);
+
+ mem = ::VirtualAllocEx(pi.hProcess, NULL, memLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ fnLoadLibrary = (UINT_PTR)::GetProcAddress(::GetModuleHandle(L"kernel32.dll"), "LoadLibraryW");
}
- // get address to LoadLibraryW function
- PTHREAD_START_ROUTINE pfnThreadRoutine = (PTHREAD_START_ROUTINE)::GetProcAddress(::GetModuleHandle(L"Kernel32.dll"), "LoadLibraryW");
- if (pfnThreadRoutine == NULL) return false;
-
- // start the remote thread
- hRemoteThread = shared_ptr<void>(
- ::CreateRemoteThread(
- m_hConsoleProcess.get(),
- NULL,
- 0,
- pfnThreadRoutine,
- (PVOID)pszHookDllPathRemote.get(),
- 0,
- NULL),
- ::CloseHandle);
-
- if (!hRemoteThread) return false;
-
- // wait for the thread to finish
-// ::WaitForSingleObject(hRemoteThread.get(), INFINITE);
- if (::WaitForSingleObject(hRemoteThread.get(), 10000) == WAIT_TIMEOUT) return false;
+
+#else
+ context.ContextFlags = CONTEXT_FULL;
+ ::GetThreadContext(pi.hThread, &context);
+
+ mem = ::VirtualAllocEx(pi.hProcess, NULL, memLen, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
+ fnLoadLibrary = (UINT_PTR)::GetProcAddress(::GetModuleHandle(L"kernel32.dll"), "LoadLibraryW");
+#endif
+
+ union
+ {
+ PBYTE pB;
+ PINT pI;
+ PULONGLONG pL;
+ } ip;
+
+ ip.pB = code.get();
+
+#ifdef _WIN64
+
+ if (isWow64Process)
+ {
+ *ip.pB++ = 0x68; // push eip
+ *ip.pI++ = wow64Context.Eip;
+ *ip.pB++ = 0x9c; // pushf
+ *ip.pB++ = 0x60; // pusha
+ *ip.pB++ = 0x68; // push "path\to\our.dll"
+ *ip.pI++ = (DWORD)mem + codeSize;
+ *ip.pB++ = 0xe8; // call LoadLibraryW
+ *ip.pI++ = (DWORD)fnWow64LoadLibrary - ((DWORD)mem + (ip.pB+4 - code.get()));
+ *ip.pB++ = 0x61; // popa
+ *ip.pB++ = 0x9d; // popf
+ *ip.pB++ = 0xc3; // ret
+
+ ::WriteProcessMemory(pi.hProcess, mem, code.get(), memLen, NULL);
+ ::FlushInstructionCache(pi.hProcess, mem, memLen);
+ wow64Context.Eip = (DWORD)mem;
+ ::Wow64SetThreadContext(pi.hThread, &wow64Context);
+ }
+ else
+ {
+ *ip.pL++ = context.Rip;
+ *ip.pL++ = fnLoadLibrary;
+ *ip.pB++ = 0x9C; // pushfq
+ *ip.pB++ = 0x50; // push rax
+ *ip.pB++ = 0x51; // push rcx
+ *ip.pB++ = 0x52; // push rdx
+ *ip.pB++ = 0x53; // push rbx
+ *ip.pB++ = 0x55; // push rbp
+ *ip.pB++ = 0x56; // push rsi
+ *ip.pB++ = 0x57; // push rdi
+ *ip.pB++ = 0x41; *ip.pB++ = 0x50; // push r8
+ *ip.pB++ = 0x41; *ip.pB++ = 0x51; // push r9
+ *ip.pB++ = 0x41; *ip.pB++ = 0x52; // push r10
+ *ip.pB++ = 0x41; *ip.pB++ = 0x53; // push r11
+ *ip.pB++ = 0x41; *ip.pB++ = 0x54; // push r12
+ *ip.pB++ = 0x41; *ip.pB++ = 0x55; // push r13
+ *ip.pB++ = 0x41; *ip.pB++ = 0x56; // push r14
+ *ip.pB++ = 0x41; *ip.pB++ = 0x57; // push r15
+ *ip.pB++ = 0x48; // sub rsp, 40
+ *ip.pB++ = 0x83;
+ *ip.pB++ = 0xEC;
+ *ip.pB++ = 0x28;
+
+ *ip.pB++ = 0x48; // lea ecx, "path\to\our.dll"
+ *ip.pB++ = 0x8D;
+ *ip.pB++ = 0x0D;
+ *ip.pI++ = 40;
+
+ *ip.pB++ = 0xFF; // call LoadLibraryW
+ *ip.pB++ = 0x15;
+ *ip.pI++ = -49;
+
+ *ip.pB++ = 0x48; // add rsp, 40
+ *ip.pB++ = 0x83;
+ *ip.pB++ = 0xC4;
+ *ip.pB++ = 0x28;
+
+ *ip.pB++ = 0x41; *ip.pB++ = 0x5F; // pop r15
+ *ip.pB++ = 0x41; *ip.pB++ = 0x5E; // pop r14
+ *ip.pB++ = 0x41; *ip.pB++ = 0x5D; // pop r13
+ *ip.pB++ = 0x41; *ip.pB++ = 0x5C; // pop r12
+ *ip.pB++ = 0x41; *ip.pB++ = 0x5B; // pop r11
+ *ip.pB++ = 0x41; *ip.pB++ = 0x5A; // pop r10
+ *ip.pB++ = 0x41; *ip.pB++ = 0x59; // pop r9
+ *ip.pB++ = 0x41; *ip.pB++ = 0x58; // pop r8
+ *ip.pB++ = 0x5F; // pop rdi
+ *ip.pB++ = 0x5E; // pop rsi
+ *ip.pB++ = 0x5D; // pop rbp
+ *ip.pB++ = 0x5B; // pop rbx
+ *ip.pB++ = 0x5A; // pop rdx
+ *ip.pB++ = 0x59; // pop rcx
+ *ip.pB++ = 0x58; // pop rax
+ *ip.pB++ = 0x9D; // popfq
+ *ip.pB++ = 0xff; // jmp Rip
+ *ip.pB++ = 0x25;
+ *ip.pI++ = -91;
+
+ ::WriteProcessMemory(pi.hProcess, mem, code.get(), memLen, NULL);
+ ::FlushInstructionCache(pi.hProcess, mem, memLen);
+ context.Rip = (UINT_PTR)mem + 16;
+ ::SetThreadContext(pi.hThread, &context);
+ }
+
+#else
+
+ *ip.pB++ = 0x68; // push eip
+ *ip.pI++ = context.Eip;
+ *ip.pB++ = 0x9c; // pushf
+ *ip.pB++ = 0x60; // pusha
+ *ip.pB++ = 0x68; // push "path\to\our.dll"
+ *ip.pI++ = (UINT_PTR)mem + codeSize;
+ *ip.pB++ = 0xe8; // call LoadLibraryW
+ *ip.pI++ = (UINT_PTR)fnLoadLibrary - ((UINT_PTR)mem + (ip.pB+4 - code.get()));
+ *ip.pB++ = 0x61; // popa
+ *ip.pB++ = 0x9d; // popf
+ *ip.pB++ = 0xc3; // ret
+
+ ::WriteProcessMemory(pi.hProcess, mem, code.get(), memLen, NULL);
+ ::FlushInstructionCache(pi.hProcess, mem, memLen);
+ context.Eip = (UINT_PTR)mem;
+ ::SetThreadContext(pi.hThread, &context);
+#endif
return true;
}
View
6 Console/ConsoleHandler.h
@@ -34,7 +34,7 @@ class ConsoleHandler
SharedMemory<CONSOLE_CURSOR_INFO>& GetCursorInfo() { return m_cursorInfo; }
SharedMemory<CHAR_INFO>& GetConsoleBuffer() { return m_consoleBuffer; }
SharedMemory<ConsoleCopy>& GetCopyInfo() { return m_consoleCopyInfo; }
- SharedMemory<UINT_PTR>& GetTextInfo() { return m_consoleTextInfo; }
+ SharedMemory<TextInfo>& GetTextInfo() { return m_consoleTextInfo; }
SharedMemory<ConsoleSize>& GetNewConsoleSize() { return m_newConsoleSize; }
SharedMemory<SIZE>& GetNewScrollPos() { return m_newScrollPos; }
@@ -49,7 +49,7 @@ class ConsoleHandler
bool CreateSharedObjects(DWORD dwConsoleProcessId);
- bool InjectHookDLL();
+ bool InjectHookDLL(PROCESS_INFORMATION& pi);
private:
@@ -74,7 +74,7 @@ class ConsoleHandler
SharedMemory<CONSOLE_CURSOR_INFO> m_cursorInfo;
SharedMemory<CHAR_INFO> m_consoleBuffer;
SharedMemory<ConsoleCopy> m_consoleCopyInfo;
- SharedMemory<UINT_PTR> m_consoleTextInfo;
+ SharedMemory<TextInfo> m_consoleTextInfo;
SharedMemory<MOUSE_EVENT_RECORD> m_consoleMouseEvent;
SharedMemory<ConsoleSize> m_newConsoleSize;
View
4 Console/ConsoleView.cpp
@@ -2051,7 +2051,7 @@ void ConsoleView::SendTextToConsole(const wchar_t* pszText)
if (textLen == 0) return;
- SharedMemory<UINT_PTR>& textInfo = m_consoleHandler.GetTextInfo();
+ SharedMemory<TextInfo>& textInfo = m_consoleHandler.GetTextInfo();
{
SharedMemoryLock memLock(textInfo);
@@ -2076,7 +2076,7 @@ void ConsoleView::SendTextToConsole(const wchar_t* pszText)
return;
}
- textInfo = reinterpret_cast<UINT_PTR>(pRemoteMemory);
+ textInfo->mem = reinterpret_cast<UINT_PTR>(pRemoteMemory);
textInfo.SetReqEvent();
}
View
9 Console2.sln
@@ -7,9 +7,10 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DA1A8A1D-90C0-49B9-A9B2-DF2C574F19E6}"
ProjectSection(SolutionItems) = preProject
setup\console.iss = setup\console.iss
- devel_changes.txt = devel_changes.txt
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleWow", "ConsoleWow\ConsoleWow.vcproj", "{8A25E8AF-CC4A-4145-B878-3D99271562D4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -34,6 +35,12 @@ Global
{6EA5C354-A242-49F3-88D1-559EACA7FB8A}.Release|Win32.Build.0 = Release|Win32
{6EA5C354-A242-49F3-88D1-559EACA7FB8A}.Release|x64.ActiveCfg = Release|x64
{6EA5C354-A242-49F3-88D1-559EACA7FB8A}.Release|x64.Build.0 = Release|x64
+ {8A25E8AF-CC4A-4145-B878-3D99271562D4}.Debug|Win32.ActiveCfg = Debug|Win32
+ {8A25E8AF-CC4A-4145-B878-3D99271562D4}.Debug|Win32.Build.0 = Debug|Win32
+ {8A25E8AF-CC4A-4145-B878-3D99271562D4}.Debug|x64.ActiveCfg = Debug|Win32
+ {8A25E8AF-CC4A-4145-B878-3D99271562D4}.Release|Win32.ActiveCfg = Release|Win32
+ {8A25E8AF-CC4A-4145-B878-3D99271562D4}.Release|Win32.Build.0 = Release|Win32
+ {8A25E8AF-CC4A-4145-B878-3D99271562D4}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
View
4 ConsoleHook/ConsoleHandler.cpp
@@ -851,10 +851,10 @@ DWORD ConsoleHandler::MonitorThread()
shared_ptr<wchar_t> textBuffer;
- if (*m_consoleTextInfo.Get() != NULL)
+ if (m_consoleTextInfo->mem != NULL)
{
textBuffer.reset(
- reinterpret_cast<wchar_t*>(*m_consoleTextInfo.Get()),
+ reinterpret_cast<wchar_t*>(m_consoleTextInfo->mem),
bind<BOOL>(::VirtualFreeEx, ::GetCurrentProcess(), _1, NULL, MEM_RELEASE));
}
View
2  ConsoleHook/ConsoleHandler.h
@@ -55,7 +55,7 @@ class ConsoleHandler
SharedMemory<CONSOLE_CURSOR_INFO> m_cursorInfo;
SharedMemory<CHAR_INFO> m_consoleBuffer;
SharedMemory<ConsoleCopy> m_consoleCopyInfo;
- SharedMemory<UINT_PTR> m_consoleTextInfo;
+ SharedMemory<TextInfo> m_consoleTextInfo;
SharedMemory<MOUSE_EVENT_RECORD> m_consoleMouseEvent;
SharedMemory<ConsoleSize> m_newConsoleSize;
View
2  ConsoleHook/ConsoleHook.vcproj
@@ -96,6 +96,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="copy ..\bin\$(PlatformName)\$(ConfigurationName)\$(ProjectName).dll ..\bin\x64\$(ConfigurationName)\$(ProjectName)32.dll"
/>
</Configuration>
<Configuration
@@ -253,6 +254,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
+ CommandLine="copy ..\bin\$(PlatformName)\$(ConfigurationName)\$(ProjectName).dll ..\bin\x64\$(ConfigurationName)\$(ProjectName)32.dll"
/>
</Configuration>
<Configuration
View
12 ConsoleWow/ConsoleWow.cpp
@@ -0,0 +1,12 @@
+// ConsoleWow.cpp : Defines the entry point for the console application.
+//
+
+#include "stdafx.h"
+
+
+int wmain(int argc, wchar_t* argv[])
+{
+ UINT_PTR fnLoadLibrary = (UINT_PTR)::GetProcAddress(::GetModuleHandle(L"kernel32.dll"), "LoadLibraryW");
+ return (int)fnLoadLibrary;
+}
+
View
227 ConsoleWow/ConsoleWow.vcproj
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="windows-1250"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="ConsoleWow"
+ ProjectGUID="{8A25E8AF-CC4A-4145-B878-3D99271562D4}"
+ RootNamespace="ConsoleWow"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="..\bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="..\obj\$(PlatformName)\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="copy ..\bin\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe ..\bin\x64\$(ConfigurationName)\"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="..\bin\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="..\obj\$(PlatformName)\$(ProjectName)\$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="1"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="copy ..\bin\$(PlatformName)\$(ConfigurationName)\$(ProjectName).exe ..\bin\x64\$(ConfigurationName)\"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\ConsoleWow.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\stdafx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\stdafx.h"
+ >
+ </File>
+ <File
+ RelativePath=".\targetver.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <File
+ RelativePath=".\ReadMe.txt"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
View
33 ConsoleWow/ReadMe.txt
@@ -0,0 +1,33 @@
+========================================================================
+ CONSOLE APPLICATION : ConsoleWow Project Overview
+========================================================================
+
+AppWizard has created this ConsoleWow application for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your ConsoleWow application.
+
+
+ConsoleWow.vcproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+ConsoleWow.cpp
+ This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named ConsoleWow.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
View
8 ConsoleWow/stdafx.cpp
@@ -0,0 +1,8 @@
+// stdafx.cpp : source file that includes just the standard includes
+// ConsoleWow.pch will be the pre-compiled header
+// stdafx.obj will contain the pre-compiled type information
+
+#include "stdafx.h"
+
+// TODO: reference any additional headers you need in STDAFX.H
+// and not in this file
View
12 ConsoleWow/stdafx.h
@@ -0,0 +1,12 @@
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently, but
+// are changed infrequently
+//
+
+#pragma once
+
+#include "targetver.h"
+
+#include <windows.h>
+
+#include <stdio.h>
View
13 ConsoleWow/targetver.h
@@ -0,0 +1,13 @@
+#pragma once
+
+// The following macros define the minimum required platform. The minimum required platform
+// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
+// your application. The macros work by enabling all features available on platform versions up to and
+// including the version specified.
+
+// Modify the following defines if you have to target a platform prior to the ones specified below.
+// Refer to MSDN for the latest info on corresponding values for different platforms.
+#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
+#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
+#endif
+
View
10 devel_changes.txt
@@ -16,9 +16,13 @@ Build 147
- fixed exit codes
-- fixed a problem with console applications that create new screen buffers
- (GNUWin less, coLinux console, etc)
-
+- new inject code (many thanks to Jason Hood, creator of AnsiCon http://adoxa.110mb.com/ansicon
+ for the code) The new injection code enables running 32-bit shells from 64-bit Console,
+ starting .NET console applications (e.g. powershell) directly, it doesn't use CreateRemoteThread,
+ so Windows patches and antivirus software that disables the call should not cause problems. The
+ code still hasn't been tested with Vista/Win7 UAC, but it does work for shell processes started
+ as another user, so we'll have that feature in Console soon as well.
+
Build 146
=========
View
37 shared/Structures.h
@@ -49,7 +49,13 @@ struct ConsoleParams
// stuff set by console hook
DWORD dwMaxRows;
DWORD dwMaxColumns;
- HWND hwndConsoleWindow;
+ union
+ {
+ HWND hwndConsoleWindow;
+ // padding for 32-bit processes started from 64-bit Console
+ __int64 padding;
+ };
+
DWORD dwHookThreadId;
};
@@ -146,6 +152,11 @@ struct ConsoleInfo
//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
struct CharInfo
{
@@ -165,3 +176,27 @@ struct CharInfo
//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+
+//////////////////////////////////////////////////////////////////////////////
+
+struct TextInfo
+{
+ TextInfo()
+ : padding(0)
+ {
+ }
+
+ union
+ {
+ UINT_PTR mem;
+ // padding for 32-bit processes started from 64-bit Console
+ __int64 padding;
+ };
+};
+
+//////////////////////////////////////////////////////////////////////////////
Please sign in to comment.
Something went wrong with that request. Please try again.