mirror of
https://github.com/ivellioscolin/pykd.git
synced 2025-04-21 04:13:22 +08:00
[+] loadUnicodeString routine added
git-svn-id: https://pykd.svn.codeplex.com/svn@53157 9b283d60-5439-405e-af05-b73fd8c4d996
This commit is contained in:
parent
1e8e382c4e
commit
2575bd6bfa
@ -53,6 +53,7 @@ BOOST_PYTHON_MODULE( pykd )
|
|||||||
boost::python::def( "loadSignDWords", &loadArray<long> );
|
boost::python::def( "loadSignDWords", &loadArray<long> );
|
||||||
boost::python::def( "loadSignQWords", &loadArray<__int64> );
|
boost::python::def( "loadSignQWords", &loadArray<__int64> );
|
||||||
boost::python::def( "loadPtrs", &loadPtrArray );
|
boost::python::def( "loadPtrs", &loadPtrArray );
|
||||||
|
boost::python::def( "loadUnicodeString", &loadUnicodeStr );
|
||||||
boost::python::def( "PtrByte", &loadByPtr<unsigned char> );
|
boost::python::def( "PtrByte", &loadByPtr<unsigned char> );
|
||||||
boost::python::def( "PtrSignByte", &loadByPtr<char> );
|
boost::python::def( "PtrSignByte", &loadByPtr<char> );
|
||||||
boost::python::def( "PtrWord", &loadByPtr<unsigned short> );
|
boost::python::def( "PtrWord", &loadByPtr<unsigned short> );
|
||||||
|
@ -160,4 +160,76 @@ loadPtrByPtr( ULONG64 address )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
boost::python::object
|
||||||
|
loadUnicodeStr( ULONG64 address )
|
||||||
|
{
|
||||||
|
USHORT length;
|
||||||
|
USHORT maximumLength;
|
||||||
|
ULONG64 buffer = 0;
|
||||||
|
|
||||||
|
wchar_t *str = NULL;
|
||||||
|
char *ansiStr = NULL;
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
if ( !loadMemory( address, &length, sizeof( length ) ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( length == 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
address += sizeof( length );
|
||||||
|
|
||||||
|
if ( !loadMemory( address, &maximumLength, sizeof( maximumLength ) ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
address += sizeof( maximumLength );
|
||||||
|
|
||||||
|
if ( is64bitSystem() )
|
||||||
|
{
|
||||||
|
if ( !loadMemory( address, &buffer, 8 ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
address += 8;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( !loadMemory( address, &buffer, 4 ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
buffer = addr64( buffer );
|
||||||
|
|
||||||
|
address += 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = new wchar_t[ length/2 ];
|
||||||
|
|
||||||
|
if ( !loadMemory( buffer, str, length ) )
|
||||||
|
break;
|
||||||
|
|
||||||
|
ansiStr = new char [ length/2 ];
|
||||||
|
|
||||||
|
WideCharToMultiByte( CP_ACP, 0, str, length/2, ansiStr, length/2, NULL, NULL );
|
||||||
|
|
||||||
|
std::string strVal ( ansiStr, length/2 );
|
||||||
|
|
||||||
|
delete[] str;
|
||||||
|
delete[] ansiStr;
|
||||||
|
|
||||||
|
return boost::python::object( strVal );
|
||||||
|
|
||||||
|
} while( FALSE );
|
||||||
|
|
||||||
|
if ( str )
|
||||||
|
delete[] str;
|
||||||
|
|
||||||
|
if ( ansiStr )
|
||||||
|
delete[] ansiStr;
|
||||||
|
|
||||||
|
return boost::python::object( "" );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
@ -49,10 +49,12 @@ loadByPtr( ULONG64 address )
|
|||||||
boost::python::object
|
boost::python::object
|
||||||
loadPtrByPtr( ULONG64 address );
|
loadPtrByPtr( ULONG64 address );
|
||||||
|
|
||||||
|
|
||||||
boost::python::object
|
boost::python::object
|
||||||
loadPtrArray( ULONG64 address, ULONG number );
|
loadPtrArray( ULONG64 address, ULONG number );
|
||||||
|
|
||||||
|
boost::python::object
|
||||||
|
loadUnicodeStr( ULONG64 address );
|
||||||
|
|
||||||
bool
|
bool
|
||||||
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length );
|
compareMemory( ULONG64 addr1, ULONG64 addr2, ULONG length );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user