[0.2.x] fix: Hresult as ULong

git-svn-id: https://pykd.svn.codeplex.com/svn@85177 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\EreTIk_cp 2013-09-11 16:57:48 +00:00 committed by Mikhail I. Izmestev
parent 1f45804a5b
commit ab92133f28
5 changed files with 22 additions and 13 deletions

View File

@ -150,6 +150,9 @@ BaseTypeVariant BasicTypedVar::getValue()
if ( m_typeInfo->getName() == "Bool" )
return *(bool*)&val;
if ( m_typeInfo->getName() == "Hresult" )
return *(PULONG)&val;
throw DbgException( "failed get value " );
}

View File

@ -252,7 +252,7 @@ TypeInfoPtr TypeInfo::getTypeInfo( SymbolPtr &symScope, const std::string &symN
/////////////////////////////////////////////////////////////////////////////////////
static const boost::regex baseMatch("^(Char)|(WChar)|(Int1B)|(UInt1B)|(Int2B)|(UInt2B)|(Int4B)|(UInt4B)|(Int8B)|(UInt8B)|(Long)|(ULong)|(Float)|(Bool)|(Double)$" );
static const boost::regex baseMatch("^(Char)|(WChar)|(Int1B)|(UInt1B)|(Int2B)|(UInt2B)|(Int4B)|(UInt4B)|(Int8B)|(UInt8B)|(Long)|(ULong)|(Float)|(Bool)|(Double)|(Hresult)$" );
bool
TypeInfo::isBaseType( const std::string &symName )
@ -313,6 +313,9 @@ TypeInfo::getBaseTypeInfo( const std::string &symName, ULONG pointerSize )
if ( baseMatchResult[15].matched )
return TypeInfoPtr( new TypeInfoWrapper<double>("Double", pointerSize) );
if ( baseMatchResult[16].matched )
return TypeInfoPtr( new TypeInfoWrapper<unsigned long>("Hresult", pointerSize) );
}
return TypeInfoPtr();

View File

@ -323,3 +323,7 @@ class TypedVarTest( unittest.TestCase ):
self.assertRaises( pykd.BaseException, pykd.typedVarList, target.module.g_listHead1, None, "next" )
self.assertRaises( pykd.BaseException, pykd.typedVarArray, target.module.g_testArray, None, 2 )
self.assertRaises( pykd.BaseException, pykd.containingRecord, target.module.offset( "g_structTest" ), None, "m_field2" )
def testHresult(self):
tv = pykd.typedVar( "g_atlException" )
self.assertEqual( tv.m_hr, 0x8000FFFF )

View File

@ -230,4 +230,3 @@ class TypeInfoTest( unittest.TestCase ):
def testArrayOf(self):
ti = pykd.typeInfo("UInt8B").arrayOf(10)
self.assertTrue( "UInt8B[10]", ti.name() )

View File

@ -1,7 +1,7 @@
#include "stdafx.h"
#include <intrin.h>
#include <atlexcept.h>
#include <iostream>
#include <string>
@ -206,7 +206,7 @@ struct struct3 {
struct3 g_struct3 = { { 0, 2 }, 3 };
__int64 g_bigValue = 0x8080808080808080;
volatile ATL::CAtlException g_atlException(E_UNEXPECTED);
static LIST_ENTRY g_listHead;
@ -437,7 +437,7 @@ void FuncWithName0()
std::cout << g_charValue;
std::cout << g_shortValue;
std::cout << g_longValue;
std::cout << g_longlongValue;
std::cout << g_longlongValue << g_atlException.m_hr;
std::cout << g_structTest.m_field0;
std::cout << g_testArray[1].m_field3;