diff --git a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj
index 8cdac4b..7a67a73 100644
--- a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj
+++ b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj
@@ -169,8 +169,10 @@
+
+
@@ -204,6 +206,9 @@
{3e9c538f-f060-4e86-ab7d-d44439615b63}
+
+
+
diff --git a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters
index 85fe9fa..d7e05bd 100644
--- a/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters
+++ b/pykd_bootstrapper/pykd_bootstrapper_vc120.vcxproj.filters
@@ -24,6 +24,12 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
@@ -126,4 +132,9 @@
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/pykd_bootstrapper/resource.h b/pykd_bootstrapper/resource.h
new file mode 100644
index 0000000..c3bc570
--- /dev/null
+++ b/pykd_bootstrapper/resource.h
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by version.rc
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/pykd_bootstrapper/version.h b/pykd_bootstrapper/version.h
new file mode 100644
index 0000000..20cf500
--- /dev/null
+++ b/pykd_bootstrapper/version.h
@@ -0,0 +1,15 @@
+#pragma once
+
+#define PYKDEXT_VERSION_MAJOR 1
+#define PYKDEXT_VERSION_MINOR 0
+#define PYKDEXT_VERSION_SUBVERSION 1
+#define PYKDEXT_VERSION_BUILDNO 2
+
+#define __VER_STR2__(x) #x
+#define __VER_STR1__(x) __VER_STR2__(x)
+
+#define PYKDEXT_VERSION_BUILD_COMMA PYKDEXT_VERSION_MAJOR, PYKDEXT_VERSION_MINOR, PYKDEXT_VERSION_SUBVERSION, PYKDEXT_VERSION_BUILDNO
+#define PYKDEXT_VERSION_BUILD PYKDEXT_VERSION_MAJOR.PYKDEXT_VERSION_MINOR.PYKDEXT_VERSION_SUBVERSION.PYKDEXT_VERSION_BUILDNO
+
+#define PYKDEXT_VERSION_BUILD_STR_COMMA __VER_STR1__(PYKDEXT_VERSION_BUILD_COMMA)
+#define PYKDEXT_VERSION_BUILD_STR __VER_STR1__(PYKDEXT_VERSION_BUILD)
diff --git a/pykd_bootstrapper/version.rc b/pykd_bootstrapper/version.rc
new file mode 100644
index 0000000..d21dc69
Binary files /dev/null and b/pykd_bootstrapper/version.rc differ
diff --git a/pykd_bootstrapper/windbgext.cpp b/pykd_bootstrapper/windbgext.cpp
index 98b7d15..db7bf28 100644
--- a/pykd_bootstrapper/windbgext.cpp
+++ b/pykd_bootstrapper/windbgext.cpp
@@ -172,6 +172,14 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, py)
PyEval_RestoreThread(m_pyState);
+ python::handle<> pykdHandle(python::allow_null(PyImport_ImportModule("pykd")));
+ if (!pykdHandle)
+ {
+ m_pyState = PyEval_SaveThread();
+ kdlib::eprintln(L"Pykd package is not installed. You can install it by command \"!pykd.install\"");
+ return;
+ }
+
std::string scriptFileName;
if (args.size() > 0)
{
@@ -179,6 +187,7 @@ KDLIB_EXT_COMMAND_METHOD_IMPL(PykdBootsTrapper, py)
if (scriptFileName.empty())
{
+ m_pyState = PyEval_SaveThread();
kdlib::eprintln(L"script file not found");
return;
}
@@ -351,12 +360,6 @@ void PykdBootsTrapper::setUp()
.def("readline", &::DbgIn::readline)
.add_property("encoding", &::DbgIn::encoding);
- python::object sys = python::import("sys");
-
- sys.attr("stdout") = python::object(::DbgOut());
- sys.attr("stderr") = python::object(::DbgOut());
- sys.attr("stdin") = python::object(::DbgIn());
-
m_pyState = PyEval_SaveThread();
}