Declaring an Array from a variable?
Posted: Mon Apr 21, 2008 8:21 am
I am trying to write a script to get a name from memory (attached process). The name isn't null terminating and it's a variable length so I can't seem to declare the CHAR array successfully. Since I'm using a pointer and not a static address, I have an extern structure already declared:
When I call poPBase->poPObj->poPObj->pNameLen it has the correct value. The name follows directly after the length so I thought of doing it like this. I already know the commented CHAR variable (pName) doesn't work as is. My question is, how can I declare it successfully from a variable?
I need something that will get the same results as
Please help. I'm too used to VB. Thanks in advance.
- Code: Select all
extern struct playerName {
BYTE bBuffer[0x894];
struct {
struct {
BYTE bBuffer[0x15];
BYTE pNameLen;
//CHAR pName[pNameLen];
} * poPObj;
} * poPObj;
} * poPBase = {"", 0x3404F1A4};
When I call poPBase->poPObj->poPObj->pNameLen it has the correct value. The name follows directly after the length so I thought of doing it like this. I already know the commented CHAR variable (pName) doesn't work as is. My question is, how can I declare it successfully from a variable?
I need something that will get the same results as
- Code: Select all
BYTE tLen;
tLen = poPBase->poPObj->poPObj->pNameLen;
CHAR pName[tLen]; // this doesn't work >.<
char * szName = pName;
PrintF("Name:%s", szName);
Please help. I'm too used to VB. Thanks in advance.