added readClassName

develop
doomchild 2011-04-01 14:41:47 -05:00
parent 3ef6893bc7
commit 84494e873c
2 changed files with 30 additions and 0 deletions

@ -190,6 +190,35 @@ char* Process_getPath(DFHackObject* p_Ptr)
return ""; return "";
} }
char* Process_readClassName(DFHackObject* p_Ptr, uint32_t vptr)
{
if(p_Ptr == NULL || alloc_char_buffer_callback == NULL)
return NULL;
std::string cString = ((DFHack::Process*)p_Ptr)->readClassName(vptr);
if(cString.length() > 0)
{
size_t length = cString.length();
char* buf;
//add 1 for the null terminator
((*alloc_char_buffer_callback)(&buf, length + 1));
if(buf == NULL)
return NULL;
memset(buf, '\0', length + 1);
cString.copy(buf, length);
return buf;
}
else
return "";
}
uint32_t* Process_getThreadIDs(DFHackObject* p_Ptr) uint32_t* Process_getThreadIDs(DFHackObject* p_Ptr)
{ {
if(p_Ptr == NULL || alloc_uint_buffer_callback == NULL) if(p_Ptr == NULL || alloc_uint_buffer_callback == NULL)

@ -74,6 +74,7 @@ DFHACK_EXPORT int Process_readSTLVector(DFHackObject* p_Ptr, uint32_t address, t
DFHACK_EXPORT char* Process_readString(DFHackObject* p_Ptr, uint32_t offset); DFHACK_EXPORT char* Process_readString(DFHackObject* p_Ptr, uint32_t offset);
DFHACK_EXPORT char* Process_getPath(DFHackObject* p_Ptr); DFHACK_EXPORT char* Process_getPath(DFHackObject* p_Ptr);
DFHACK_EXPORT char* Process_readClassName(DFHackObject* p_Ptr, uint32_t vptr);
DFHACK_EXPORT int Process_isSuspended(DFHackObject* p_Ptr); DFHACK_EXPORT int Process_isSuspended(DFHackObject* p_Ptr);
DFHACK_EXPORT int Process_isAttached(DFHackObject* p_Ptr); DFHACK_EXPORT int Process_isAttached(DFHackObject* p_Ptr);