mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-20 03:23:23 +08:00
[0.2.x]
~ getName fixed ~ MsPdbTest expanded git-svn-id: https://pykd.svn.codeplex.com/svn@83547 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
aee8b2b1b8
commit
d0234bcb4f
@ -367,7 +367,7 @@ std::string DiaSymbol::getName()
|
|||||||
if ( boost::regex_match( undecoratedName.c_str(), matchResult, fastcallMatch ) )
|
if ( boost::regex_match( undecoratedName.c_str(), matchResult, fastcallMatch ) )
|
||||||
return std::string( matchResult[1].first, matchResult[1].second );
|
return std::string( matchResult[1].first, matchResult[1].second );
|
||||||
|
|
||||||
return name;
|
return undecoratedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -8,22 +8,38 @@ class PeFileAsDumpLoader:
|
|||||||
"""Load/unload PE-file from System as crash dump file"""
|
"""Load/unload PE-file from System as crash dump file"""
|
||||||
def __init__(self, fileName):
|
def __init__(self, fileName):
|
||||||
self._fileName = fileName
|
self._fileName = fileName
|
||||||
self._loaded = False
|
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
pykd.loadDump(self._fileName)
|
pykd.loadDump(self._fileName)
|
||||||
self._loaded = True
|
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, exc_tb):
|
def __exit__(self, exc_type, exc_value, exc_tb):
|
||||||
if self._loaded:
|
pykd.detachProcess()
|
||||||
pykd.detachProcess()
|
|
||||||
self._loaded = False
|
|
||||||
|
|
||||||
class MsPdbTest(unittest.TestCase):
|
class MsPdbTest(unittest.TestCase):
|
||||||
"""Public Microsoft symbols tests"""
|
"""Public Microsoft symbols tests"""
|
||||||
|
|
||||||
def testFindMethodOffset(self):
|
def testSymbolNameAddress(self):
|
||||||
"""Lookup method offset by name"""
|
"""Lookup symbol by name/address"""
|
||||||
with PeFileAsDumpLoader( os.environ["WINDIR"] + r"\System32\ole32.dll" ) as loadedDump:
|
with PeFileAsDumpLoader( os.path.join(os.environ["WINDIR"], r"System32\ole32.dll") ):
|
||||||
print "\n" + str( pykd.module("ole32") )
|
mod = pykd.module("ole32")
|
||||||
self.assertNotEqual( 0, pykd.getOffset("ole32!CPackagerMoniker::AddRef") )
|
print "\n" + str( mod )
|
||||||
|
|
||||||
|
targetSymAddr = mod.offset("CPackagerMoniker::Create")
|
||||||
|
self.assertNotEqual( 0, targetSymAddr )
|
||||||
|
self.assertEqual( "CPackagerMoniker::Create", mod.findSymbol(targetSymAddr) )
|
||||||
|
|
||||||
|
targetSymAddr = mod.offset("CoInitialize")
|
||||||
|
self.assertNotEqual( 0, targetSymAddr )
|
||||||
|
self.assertEqual( "CoInitialize", mod.findSymbol(targetSymAddr) )
|
||||||
|
|
||||||
|
with PeFileAsDumpLoader( os.path.join(os.environ["WINDIR"], r"System32\authz.dll") ):
|
||||||
|
mod = pykd.module("authz")
|
||||||
|
print "\n" + str( mod )
|
||||||
|
|
||||||
|
targetSymAddr = mod.offset("AuthzpDefaultAccessCheck")
|
||||||
|
self.assertNotEqual( 0, targetSymAddr )
|
||||||
|
self.assertEqual( "AuthzpDefaultAccessCheck", mod.findSymbol(targetSymAddr) )
|
||||||
|
|
||||||
|
targetSymAddr = mod.offset("AuthzAccessCheck")
|
||||||
|
self.assertNotEqual( 0, targetSymAddr )
|
||||||
|
self.assertEqual( "AuthzAccessCheck", mod.findSymbol(targetSymAddr) )
|
||||||
|
Loading…
Reference in New Issue
Block a user