Updated to 1.65.4 (fixed issues concerning ASK and ASM commands in scripts).
Found bug here:
bool OllyLang:: DoASK(string args)
{
string ops[1];
string title;
if(!CreateOperands(args, ops, 1))
return false;
if(GetSTROpValue(ops[0], title))
{
if (wndProg.hw!=NULL)
InvalidateRect(wndProg.hw, NULL, FALSE);
HINSTANCE hi = (HINSTANCE)GetModuleHandle("ODbgScript.dll");
HWND hw = 0; //not modal but dialog need to be closed on plugin close.
char* returned_buffer = (char*)DialogBoxParam(hi, MAKEINTRESOURCE(IDD_INPUT), hw, (DLGPROC) InputDialogProc, (LPARAM)title.c_str());
if ((BYTE)returned_buffer != NULL)
{
string returned = returned_buffer;
delete[256] returned_buffer;
if(is_hex(returned))
{
variables["$RESULT"] = strtoul(returned.c_str(), 0, 16);
variables["$RESULT_1"] = (int) (returned.length() / 2); //size
}
else
{
UnquoteString(returned, '"', '"'); // To Accept input like "FFF" (forces string)
variables["$RESULT"] = returned.c_str();
variables["$RESULT_1"] = (int) returned.length();
}
}
else
{
variables["$RESULT"] = 0; //****added this!!****
Pause();
}
return true;
}
return false;
}
By doing that, if you leave the dialog box empty or press Cancel, it makes $RESULT 0 instead of empty as it used to..
Example:
ask "Enter text:" //here, when you press Cancel or don't type anything in, $RESULT = EMPTY..
cmp $RESULT,0
je #cancel
mov bla,$RESULT
Found another bug with ODbgScript.. When your variable holds addresses like B239E0, ODbgScript will fail to ASM them. Example:
eval "mov dword ptr [{GPA}],{cave}"
asm cave,$RESULT
For this case, with:
Command= eval "mov dword ptr [{GPA}],{cave}"
Result="mov dword ptr [A71074],B23A39"
Because of not putting a 0 in front of A71074, ODbgScript will error -> "unknown command".
Fixed here, in OllyLang.cpp:
[quote]else if(variables[op].vt == DW)
{
char buffer[12] = {0};
if (hex8forExec)
//For Assemble Command (EXEC/ENDE) ie "0DEADBEEF"
sprintf(buffer, "%09X", variables[op].dw);
else
sprintf(buffer, "%08X", variables[op].dw); //****changed from %X to %08X****
value = buffer;
goto values_ok;
}
Now it should work fine;)
Script Execution, item 66
Line=66
Command= asm cave,$RESULT
Result=A
EIP= i
Values <---="mov dword ptr [00A71074],00B23A39" B23A01