[0.2.x] added : sample um.critsec.py

git-svn-id: https://pykd.svn.codeplex.com/svn@80243 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
SND\kernelnet_cp 2012-10-16 08:15:20 +00:00 committed by Mikhail I. Izmestev
parent 6c582490ee
commit f0fc6f3f86
6 changed files with 26 additions and 10 deletions

View File

@ -2,7 +2,7 @@
#define PYKD_VERSION_MAJOR 0 #define PYKD_VERSION_MAJOR 0
#define PYKD_VERSION_MINOR 2 #define PYKD_VERSION_MINOR 2
#define PYKD_VERSION_SUBVERSION 0 #define PYKD_VERSION_SUBVERSION 0
#define PYKD_VERSION_BUILDNO 1 #define PYKD_VERSION_BUILDNO 2
#define __VER_STR2__(x) #x #define __VER_STR2__(x) #x

View File

@ -76,9 +76,19 @@ ULONG64 TypeInfo::getSymbolSize( const std::string &fullName )
std::string TypeInfo::findSymbol( ULONG64 offset ) std::string TypeInfo::findSymbol( ULONG64 offset )
{ {
ModulePtr module = Module::loadModuleByOffset( offset ); try {
return module->getName() + '!' + module->getSymbolNameByVa( offset ); ModulePtr module = Module::loadModuleByOffset( offset );
return module->getName() + '!' + module->getSymbolNameByVa( offset );
}
catch( DbgException& )
{
std::stringstream sstr;
sstr << std::hex << offset;
return sstr.str();
}
} }
///////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////

View File

@ -44,10 +44,6 @@ def checkSSDT():
dprintln( "[%u] " % i + findSymbol( serviceTable[i] ) ) dprintln( "[%u] " % i + findSymbol( serviceTable[i] ) )
def run(): def run():
checkSSDT()
if __name__ == "__main__":
while True: while True:
@ -60,6 +56,12 @@ if __name__ == "__main__":
dprintln( "not a kernel debugging" ) dprintln( "not a kernel debugging" )
break break
run() checkSSDT()
break break
if __name__ == "__main__":
run()

View File

@ -6,6 +6,8 @@ from pykd import dprintln
from pykd import dprint from pykd import dprint
def printAllSamples(): def printAllSamples():
dprintln( "<b>User mode</b>", True)
dprintln( "Get critical sections list <link cmd=\"!py samples run um.critlist\">Run</link> <link cmd=\"!py samples source um.critlist\">Source</link>", True)
dprintln( "<b>Kernel mode</b>", True ) dprintln( "<b>Kernel mode</b>", True )
dprintln( "Get process list <link cmd=\"!py samples run km.proclist\">Run</link> <link cmd=\"!py samples source km.proclist\">Source</link>", True) dprintln( "Get process list <link cmd=\"!py samples run km.proclist\">Run</link> <link cmd=\"!py samples source km.proclist\">Source</link>", True)
dprintln( "Get kernel service list <link cmd=\"!py samples run km.ssdt\">Run</link> <link cmd=\"!py samples source km.ssdt\">Source</link>", True) dprintln( "Get kernel service list <link cmd=\"!py samples run km.ssdt\">Run</link> <link cmd=\"!py samples source km.ssdt\">Source</link>", True)

View File

@ -66,6 +66,6 @@ class ModuleTest( unittest.TestCase ):
self.assertTrue( re.search('targetapp\\.cpp', fileName ) ) self.assertTrue( re.search('targetapp\\.cpp', fileName ) )
self.assertEqual( 2, displacement ) self.assertEqual( 2, displacement )
fileName, lineNo, displacement = pykd.getSourceLine() fileName, lineNo, displacement = pykd.getSourceLine()
self.assertEqual( 622, lineNo ) self.assertEqual( 624, lineNo )

View File

@ -459,6 +459,8 @@ void FuncWithName1(int a)
std::cout << g_arrOfPtrToFunc[1]; std::cout << g_arrOfPtrToFunc[1];
} }
#pragma optimize("g", off)
static static
void _FuncWithName2(int a) void _FuncWithName2(int a)
{ {
@ -466,7 +468,7 @@ void _FuncWithName2(int a)
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#pragma optimize("g", off)
VOID functionCalledFromEnumWindowsProc1(DWORD dwProcessId) VOID functionCalledFromEnumWindowsProc1(DWORD dwProcessId)
{ {
DWORD dwCurrentProcessId = GetCurrentProcessId(); DWORD dwCurrentProcessId = GetCurrentProcessId();