From a5fd4481fe7c6344a7a1554513c4e3aff9652a1b Mon Sep 17 00:00:00 2001
From: "SND\\kernelnet_cp"
 <SND\kernelnet_cp@9b283d60-5439-405e-af05-b73fd8c4d996>
Date: Fri, 26 Nov 2010 14:03:25 +0000
Subject: [PATCH] [!] fixed: loadModule return None for non existin module with
 out outputing error message

git-svn-id: https://pykd.svn.codeplex.com/svn@58077 9b283d60-5439-405e-af05-b73fd8c4d996
---
 pykd/dbgmodule.cpp | 2 +-
 samples/stacks.py  | 8 +++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/pykd/dbgmodule.cpp b/pykd/dbgmodule.cpp
index 5508fa2..4ff09f8 100644
--- a/pykd/dbgmodule.cpp
+++ b/pykd/dbgmodule.cpp
@@ -16,7 +16,7 @@ loadModule( const std::string &moduleName )
         ULONG64    moduleBase;
         hres = dbgExt->symbols->GetModuleByModuleName( moduleName.c_str(), 0, NULL, &moduleBase );
         if ( FAILED( hres ) )
-             throw DbgException( "IDebugSymbol::GetModuleByModuleName  failed" );
+             return boost::python::object();
         
         DEBUG_MODULE_PARAMETERS     moduleParam = { 0 };
         hres = dbgExt->symbols->GetModuleParameters( 1, &moduleBase, 0, &moduleParam );
diff --git a/samples/stacks.py b/samples/stacks.py
index 95baa72..348b869 100644
--- a/samples/stacks.py
+++ b/samples/stacks.py
@@ -6,13 +6,19 @@ def printStack():
 
     threadList = getThreadList()
 
+    oldMode = getProcessorMode()
+
+    if oldMode == "X64" and loadModule( "wow64" ) != None:
+        setProcessorMode("X86")
+
     for threadPtr in threadList:
-        oldThread = 0
         setImplicitThread( threadPtr )
         stackFrames = getCurrentStack()
         for frame in stackFrames: dprintln( findSymbol( frame.instructionOffset ) + "  (%x)" % frame.instructionOffset )
         dprintln("")
 
+    setProcessorMode(oldMode)
+
 
 if __name__ == "__main__":