[!] bug fixed: issue #8103 ( !py windbg extension imports modules into the global space )

git-svn-id: https://pykd.svn.codeplex.com/svn@59901 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2011-01-08 13:27:38 +00:00
parent 44aeda68fb
commit af3e45bae6

View File

@ -96,7 +96,7 @@ BOOST_PYTHON_MODULE( pykd )
boost::python::def( "dprintln", &DbgPrint::dprintln ); boost::python::def( "dprintln", &DbgPrint::dprintln );
boost::python::def( "loadDump", &dbgLoadDump ); boost::python::def( "loadDump", &dbgLoadDump );
boost::python::def( "dbgCommand", &dbgCommand ); boost::python::def( "dbgCommand", &dbgCommand );
boost::python::def( "is64bitSystem", is64bitSystem ); boost::python::def( "is64bitSystem", &is64bitSystem );
boost::python::def( "isKernelDebugging", &isKernelDebugging ); boost::python::def( "isKernelDebugging", &isKernelDebugging );
boost::python::def( "ptrSize", ptrSize ); boost::python::def( "ptrSize", ptrSize );
boost::python::def( "reg", &loadRegister ); boost::python::def( "reg", &loadRegister );
@ -241,6 +241,8 @@ HRESULT
CALLBACK CALLBACK
py( PDEBUG_CLIENT4 client, PCSTR args) py( PDEBUG_CLIENT4 client, PCSTR args)
{ {
PyThreadState *interpreter = Py_NewInterpreter();
try { try {
DbgExt ext = { 0 }; DbgExt ext = { 0 };
@ -255,7 +257,7 @@ py( PDEBUG_CLIENT4 client, PCSTR args)
boost::python::object global(main.attr("__dict__")); boost::python::object global(main.attr("__dict__"));
// ïåðåíàïðàâëåíèå ñòàíäàðòíûõ ïîòîêîâ ÂÂ // ïåðåíàïðàâëåíèå ñòàíäàðòíûõ ïîòîêîâ ÂÂ
boost::python::object sys = boost::python::import( "sys"); boost::python::object sys = boost::python::import("sys");
dbgOut dout; dbgOut dout;
sys.attr("stdout") = boost::python::object( dout ); sys.attr("stdout") = boost::python::object( dout );
@ -349,6 +351,8 @@ py( PDEBUG_CLIENT4 client, PCSTR args)
{ {
} }
Py_EndInterpreter( interpreter );
return S_OK; return S_OK;
} }