From cd3a99a49630c99d3f4ada115cc2005bd1f9093c Mon Sep 17 00:00:00 2001
From: "SND\\kernelnet_cp"
 <SND\kernelnet_cp@9b283d60-5439-405e-af05-b73fd8c4d996>
Date: Wed, 5 Dec 2012 06:47:19 +0000
Subject: [PATCH] [0.2.x] fixed : Abnormal process termination after
 setCurrentProcess, setImplicitThread

git-svn-id: https://pykd.svn.codeplex.com/svn@81650 9b283d60-5439-405e-af05-b73fd8c4d996
---
 pykd/dbgmem.h       | 1 +
 pykd/win/dbgeng.cpp | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/pykd/dbgmem.h b/pykd/dbgmem.h
index 9ac34a4..d798ad7 100644
--- a/pykd/dbgmem.h
+++ b/pykd/dbgmem.h
@@ -5,6 +5,7 @@ namespace pykd {
 ///////////////////////////////////////////////////////////////////////////////////
 
 ULONG64 addr64( ULONG64 offset );
+ULONG64 addr64NoSafe( ULONG64 addr );
 void readMemory( ULONG64 offset, PVOID buffer, ULONG length, bool phyAddr = FALSE, ULONG *readed = NULL );
 bool readMemoryUnsafe( ULONG64 offset, PVOID buffer, ULONG length, bool phyAddr = FALSE, ULONG *readed = NULL );
 bool isVaValid( ULONG64 addr );
diff --git a/pykd/win/dbgeng.cpp b/pykd/win/dbgeng.cpp
index 6b32982..3924b99 100644
--- a/pykd/win/dbgeng.cpp
+++ b/pykd/win/dbgeng.cpp
@@ -1172,7 +1172,7 @@ void setCurrentProcess( ULONG64 processAddr )
 
     HRESULT     hres;
 
-    processAddr = addr64(processAddr);
+    processAddr = addr64NoSafe(processAddr);
     hres = g_dbgEng->system->SetImplicitProcessDataOffset( processAddr );
     if ( FAILED( hres ) )
         throw DbgException( "IDebugSystemObjects2::SetImplicitProcessDataOffset  failed" );
@@ -1186,7 +1186,7 @@ void setImplicitThread( ULONG64 threadAddr )
 
     HRESULT  hres;
 
-    threadAddr = addr64(threadAddr);
+    threadAddr = addr64NoSafe(threadAddr);
     hres = g_dbgEng->system->SetImplicitThreadDataOffset( threadAddr );
     if ( FAILED( hres ) )
         throw DbgException( "IDebugSystemObjects2::SetImplicitThreadDataOffset  failed" );