Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbgValFromString&DbgEval #2223

Open
Paliha opened this issue Oct 9, 2019 · 6 comments

Comments

@Paliha
Copy link

commented Oct 9, 2019

Hi!
What method can I get data from a variable in a script?
Example from the script:
FindPointer mytable, pattern, 4
The method that I use:
bool cbFunctionFindPointer(int argc, char* argv[3])
{
char buffer[MAX_MNEMONIC_SIZE];
bool success;
duint index = DbgEval(argv[1], &success);
duint Size = Memory::GetSize(DbgValFromString(argv[1]), false, true);
.....
}
Unfortunately, there are no data in the variables. As a result, the functions (DbgValFromString&DbgEval) simply convert the variable name to unsigned __int64:
0x0000020db33b9720 {0x0000020db33b72f0 "FindPointer mytable, pattern, 4"}
index = 5557833728 //unsigned __int64
Size = 1077248 //unsigned __int64

@mrexodia

This comment has been minimized.

Copy link
Member

commented Oct 12, 2019

Hi, can't you just use findallmem from your script? findallmem 0, "{bswap@mytable}" should work. Otherwise could you paste the full code because right now it does not make any sense to me.

@mrexodia mrexodia added the question label Oct 12, 2019
@Paliha

This comment has been minimized.

Copy link
Author

commented Oct 13, 2019

if my memory serves me, this command displays the search result in the ref window. This is not convenient. To search for va / rva pointers, I wrote my command and everything was in order. With the transition to a fresh OS (vin10.1809) in place of the arguments, I get a line with the command and variables.

@mrexodia

This comment has been minimized.

Copy link
Member

commented Oct 13, 2019

@mrexodia

This comment has been minimized.

Copy link
Member

commented Oct 15, 2019

It might help to try

bool cbListArguments(int argc, char* argv[])
{
    for(int i = 0; i < argc; i++) dprintf("%d:%s\n", i, argv[i]);
    return true;
}

And see what is the output.

@Paliha

This comment has been minimized.

Copy link
Author

commented Oct 19, 2019

for(int i = 0; i < argc; i++) dprintf("%d:%s\n", i, argv[i]);
the output is the same variables.


updated sdk, added to method:
sprintf(buffer, "%p", DbgValFromString(argv[2]));
strncpy_s(buffer, buffer, len);
now everything is great..))

@mrexodia

This comment has been minimized.

Copy link
Member

commented Oct 19, 2019

I have no idea what the issue was. The code you sent earlier looked fine 🤷‍♂ but glad you fixed it :) Feel free to close the issue if it’s solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.