Commit d703b5e6 authored by ussrhero's avatar ussrhero
Browse files

Merge branch 'fix_windbg_preview_echo' into 'master'

fixed absent echo in windbg preview

See merge request !5
parents 53b68c33 0992faa1
......@@ -286,7 +286,6 @@ std::auto_ptr<PythonSingleton> PythonSingleton::m_singleton;
HMODULE LoadPythonForKey(HKEY installPathKey, int majorVersion, int minorVersion)
{
HMODULE hmodule = NULL;
char installPath[1000];
......@@ -300,14 +299,19 @@ HMODULE LoadPythonForKey(HKEY installPathKey, int majorVersion, int minorVersion
std::stringstream imagePath;
imagePath << installPath << dllName.str();
hmodule = LoadLibraryExA(imagePath.str().c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
//load by full string
hmodule = LoadLibraryA(imagePath.str().c_str());
if (hmodule)
return hmodule;
hmodule = LoadLibraryExA(imagePath.str().c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
if (hmodule)
return hmodule;
//search in common places as system32
hmodule = LoadLibraryA(dllName.str().c_str());
if (hmodule)
return hmodule;
}
return NULL;
......
......@@ -3,7 +3,7 @@
#define PYKDEXT_VERSION_MAJOR 2
#define PYKDEXT_VERSION_MINOR 0
#define PYKDEXT_VERSION_SUBVERSION 0
#define PYKDEXT_VERSION_BUILDNO 24
#define PYKDEXT_VERSION_BUILDNO 25
#define __VER_STR2__(x) #x
#define __VER_STR1__(x) __VER_STR2__(x)
......
......@@ -19,7 +19,7 @@
//////////////////////////////////////////////////////////////////////////////
static int defaultMajorVersion = 3;
static int defaultMinorVersion = 8;
static int defaultMinorVersion = 9;
//////////////////////////////////////////////////////////////////////////////
......@@ -301,6 +301,19 @@ help(
//////////////////////////////////////////////////////////////////////////////
bool isClassicWindbg()
{
std::vector<wchar_t> exebuffer(0x10000);
auto exePathLength = GetModuleFileName(NULL, exebuffer.data(), static_cast<DWORD>(exebuffer.size()));
std::wstring exepath{ exebuffer.data(), exePathLength };
const std::wstring windbgexe{ L"windbg.exe" };
return (exepath.size() >= windbgexe.size()) && (exepath.rfind(windbgexe) == exepath.size() - windbgexe.size());
}
//////////////////////////////////////////////////////////////////////////////
static const std::regex shebangRe("^#!\\s*python([2,3])(?:\\.(\\d))?$");
......@@ -320,7 +333,14 @@ py(
{
ULONG oldMask;
client->GetOutputMask(&oldMask);
client->SetOutputMask( (oldMask & ~DEBUG_OUTPUT_PROMPT) | DEBUG_OUTPUT_STATUS);
ULONG mask = oldMask | DEBUG_OUTPUT_STATUS;
if (isClassicWindbg())
{
mask = mask & ~DEBUG_OUTPUT_PROMPT;
}
client->SetOutputMask(mask);
try {
......@@ -681,7 +701,7 @@ std::string getScriptFileName(const std::string &scriptName)
NULL,
scriptName.c_str(),
ext,
pathBuffer.size(),
static_cast<DWORD>(pathBuffer.size()),
&pathBuffer.front(),
NULL );
......@@ -779,7 +799,7 @@ void printString(PDEBUG_CLIENT client, ULONG mask, const char* str)
std::string line;
std::getline(sstr, line);
if ( prefer_dml && mask == DEBUG_OUTPUT_ERROR )
if (isClassicWindbg() && prefer_dml && mask == DEBUG_OUTPUT_ERROR )
{
line = std::regex_replace(line, std::regex("&"), "&amp;");
line = std::regex_replace(line, std::regex("<"), "&lt;");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment