DBG: added signed comparisons.

DBG: added many general purpose commands!
PROJECT: updated help
GUI: added msgyn messagebox
GUI: updated GuiScriptAdd behaviour (now it's 1000 times faster!)
BRIDGE: added GuiScriptMsgyn
DBG: changed '#' operator to '$' (for internal reasons)
DBG: threaded stepping (GUI could freeze otherwise)
DBG: added various script commands
This commit is contained in:
mr.exodia 2014-02-13 15:42:53 +01:00
parent 688cead535
commit e569ebab95
40 changed files with 1539 additions and 296 deletions

View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>AttachDebugger/attach</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>AttachDebugger[,attach]<BR></STRONG>Attach the
debugger to a running process.</P>
<P><U>arguments</U><BR>&nbsp; arg1: Process Identifier
(PID) of the running process.</P>
<P><U>result</U> <BR>This command will give control back to the user&nbsp;after
the&nbsp;system breakpoint&nbsp;is reached. It will
set&nbsp;<U>$pid</U>&nbsp;and&nbsp;<U>$hp/$hProcess</U>&nbsp;variables.
</P></body></HTML>

View File

@ -27,7 +27,7 @@ use one.</P>
<P><U>2:not</U>: '~' The not operator can be used before a
number of a variable, like in C.</P>
<P><U>3:muliplication/devision</U>: '*' = regular
multiplication (signed/unsigned), '#' = get the higher part of the
multiplication (signed/unsigned), '$' = get the higher part of the
multiplication, '/' = regular devision (signed/unsigned, devide by zero=error)
and '%' = get the modulo (remainder) of the devision.</P>
<P><U>4:addition/substraction</U>
@ -47,4 +47,4 @@ syntax:</P>
can be any register, flag, variable or memory location. 'b' can be anything that is recognized as a mathmatical
input.</P>
<P><U>a++/a--</U>: 'a' can be any register, flag, variable or memory
location.</P></head>
location.</P></BODY></HTML>

21
help/General_Purpose.htm Normal file
View File

@ -0,0 +1,21 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>General Purpose</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>General Purpose<BR></STRONG>This section contains various commands that are
used for calculations etc.</P>
<P>&nbsp;</P></body>
</html>

View File

@ -35,7 +35,7 @@ called to retrieve a full path. Use quotation marks to include spaces in your pa
</P>
<P><U>result<BR></U> This command will
give control back to the user&nbsp;after the&nbsp;system breakpoint&nbsp;is reached. It will set
<U>$pid</U> and&nbsp;<U>$hp/$hProcess</U>variables.
<U>$pid</U> and&nbsp;<U>$hp/$hProcess</U>&nbsp;variables.
</P></BODY></HTML>
</P></head>

33
help/add.htm Normal file
View File

@ -0,0 +1,33 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>add</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>add</STRONG><BR> Add two
values.</P><SPAN class=rvts11>
<P class=rvps3>
<SPAN class=rvts11 >
<U >
arguments</U>
<BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN>
</P><P class=rvps3>
<SPAN class=rvts11><U >result<BR>
</U>This command does not set
any result&nbsp;variables.</SPAN></P>
</SPAN></BODY></HTML>

34
help/and.htm Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>and</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>and</STRONG><BR>Binary AND
two values.</P>
<P class=rvps3>
<SPAN class=rvts11>
<U>
arguments
</U>
<BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3 >
<SPAN class=rvts11 >&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3>
<SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

View File

@ -0,0 +1,28 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>bookmark/bookmarkset</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>bookmark[,bookmarkset]<BR></STRONG>Set a
bookmark.</P>
<P><U>arguments </U><BR>&nbsp; arg1:&nbsp;Address to set the bookmark at (preferably
inside a module). </P>
<P>
<U>
result
</U>
<BR>This command does not set any result
variables.</P></body>

View File

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>bookmarkc/bookmarkdel</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>bookmarkc[,bookmarkdel]<BR></STRONG>Delete a
bookmark.</P>
<P><U>arguments </U><BR> &nbsp; arg1:&nbsp;Address of the
bookmark to delete. </P>
<P><U>result</U> <BR>This command does not set any result
variables.</P></body>

23
help/dec.htm Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dec</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>dec</STRONG><BR>Decrease a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result <BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

25
help/div.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>div</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>div</STRONG><BR>Devide&nbsp;two
values.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

35
help/gpa.htm Normal file
View File

@ -0,0 +1,35 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>gpa</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>gpa</STRONG><BR>Get the address of an export
inside a DLL.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1: Export
name.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>[arg2]: DLL name.</SPAN></P>
<P class=rvps3>
<SPAN class=rvts11>
<U >
result
<BR ></U></SPAN>
<SPAN class=rvts9>
The <U>$result</U> variable is set to the
export address. When the export is not found, <U>$result</U>
will be set to
0.</SPAN>
</P></body>

23
help/inc.htm Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>inc</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>inc<BR></STRONG>Increase a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

22
help/msg.htm Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>msg</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>msg</STRONG><BR>Display a message
box.</P>
<P><U>arguments<BR></U>&nbsp;arg1: Message box text.</P>
<P><U>result<BR></U>This command does not set any
variables.</P></body>

26
help/msgyn.htm Normal file
View File

@ -0,0 +1,26 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>msgyn</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>msgyn<BR></STRONG>Display a message box, asking the user to
answer yes or no.</P>
<P><U>arguments<BR></U>&nbsp;arg1: Message box text.</P>
<P>
<U>
result
<BR>
</U>The <U>$result</U> variable will be set to 1 when the
user answered yes. Otherwise it's set to 0.</P></body>

25
help/mul.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>mul</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>mul</STRONG><BR>Multiply two
values.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

23
help/neg.htm Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>neg</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>neg</STRONG><BR>Negate a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

23
help/not.htm Normal file
View File

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>not</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>not</STRONG><BR>Binary NOT a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

25
help/or.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>or</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>or<BR></STRONG>Binary OR&nbsp;two
values.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

25
help/rol.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>rol</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>rol</STRONG><BR>Binary ROL a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

25
help/ror.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ror</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>ror</STRONG><BR>Binary ROR a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

22
help/scriptload.htm Normal file
View File

@ -0,0 +1,22 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>scriptload</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>scriptload<BR></STRONG>Load a script
file.</P>
<P><U>arguments<BR></U>&nbsp;arg1: Script file to load.</P>
<P><U>result<BR></U>This command does not set any
variables.</P></body>

25
help/shl.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>shl</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>shl<BR></STRONG>Binary SHL a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

25
help/shr.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>shr</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>shr<BR></STRONG>Binary SHR a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

25
help/sub.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>sub</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>sub</STRONG><BR>Subtract two
values.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1:
Destination.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Source.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command does not set
any result&nbsp;variables.</SPAN></P></body>

28
help/test.htm Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>test</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>test</STRONG><BR>Binary TEST a
value.</P>
<P class=rvps3><SPAN class=rvts11><U>arguments </U><BR>&nbsp; arg1: Value to
test.</SPAN></P>
<P class=rvps3><SPAN class=rvts11>&nbsp;
arg2: Tester.</SPAN></P>
<P class=rvps3><SPAN class=rvts11><U>result<BR></U>This command&nbsp;sets
the internal variables $_EZ_FLAG and $_BS_FLAG. $_EZ_FLAG is set to 1 when
arg1&amp;arg2=
= 0. $_BS_FLAG is always set
to 0.</SPAN></P></head>

File diff suppressed because it is too large Load Diff

View File

@ -584,9 +584,9 @@ BRIDGE_IMPEXP void GuiDumpAt(duint va)
_gui_sendmessage(GUI_DUMP_AT, (void*)va, 0);
}
BRIDGE_IMPEXP void GuiScriptAddLine(const char* text)
BRIDGE_IMPEXP void GuiScriptAdd(int count, const char** lines)
{
_gui_sendmessage(GUI_SCRIPT_ADDLINE, (void*)text, 0);
_gui_sendmessage(GUI_SCRIPT_ADD, (void*)(duint)count, (void*)lines);
}
BRIDGE_IMPEXP void GuiScriptClear()
@ -619,6 +619,11 @@ BRIDGE_IMPEXP void GuiScriptMessage(const char* message)
_gui_sendmessage(GUI_SCRIPT_MESSAGE, (void*)message, 0);
}
BRIDGE_IMPEXP int GuiScriptMsgyn(const char* message)
{
return (int)(duint)_gui_sendmessage(GUI_SCRIPT_MSGYN, (void*)message, 0);
}
//Main
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{

View File

@ -276,13 +276,14 @@ enum GUIMSG
GUI_GET_WINDOW_HANDLE, // param1=unused, param2=unused
GUI_DUMP_AT, // param1=(duint)va param2=unused
GUI_SCRIPT_ADDLINE, // param1=const char* text, param2=unused
GUI_SCRIPT_ADD, // param1=int count, param2=const char** lines
GUI_SCRIPT_CLEAR, // param1=unused, param2=unused
GUI_SCRIPT_SETIP, // param1=int line, param2=unused
GUI_SCRIPT_ERROR, // param1=int line, param2=const char* message
GUI_SCRIPT_SETTITLE, // param1=const char* title, param2=unused
GUI_SCRIPT_SETINFOLINE, // param1=int line, param2=const char* info
GUI_SCRIPT_MESSAGE // param1=const char* message, param2=unused
GUI_SCRIPT_MESSAGE, // param1=const char* message, param2=unused
GUI_SCRIPT_MSGYN // param1=const char* message, param2=unused
};
//GUI functions
@ -299,13 +300,14 @@ BRIDGE_IMPEXP void GuiUpdateCPUTitle(const char* modname);
BRIDGE_IMPEXP HWND GuiGetWindowHandle();
BRIDGE_IMPEXP void GuiDumpAt(duint va);
BRIDGE_IMPEXP void GuiScriptAddLine(const char* text);
BRIDGE_IMPEXP void GuiScriptAdd(int count, const char** lines);
BRIDGE_IMPEXP void GuiScriptClear();
BRIDGE_IMPEXP void GuiScriptSetIp(int line);
BRIDGE_IMPEXP void GuiScriptError(int line, const char* message);
BRIDGE_IMPEXP void GuiScriptSetTitle(const char* title);
BRIDGE_IMPEXP void GuiScriptSetInfoLine(int line, const char* info);
BRIDGE_IMPEXP void GuiScriptMessage(const char* message);
BRIDGE_IMPEXP int GuiScriptMsgyn(const char* message);
#ifdef __cplusplus
}

View File

@ -8,6 +8,7 @@
#include "assemble.h"
#include "debugger.h"
#include "memory.h"
#include "x64_dbg.h"
CMDRESULT cbBadCmd(int argc, char* argv[])
{
@ -476,11 +477,264 @@ CMDRESULT cbInstrCmp(int argc, char* argv[])
ezflag=1;
else
ezflag=0;
if(arg1>arg2)
bsflag=1;
else
bsflag=0;
if(valuesignedcalc()) //signed comparision
{
if((sint)arg1<(sint)arg2)
bsflag=0;
else
bsflag=1;
}
else //unsigned comparision
{
if(arg1>arg2)
bsflag=1;
else
bsflag=0;
}
varset("$_EZ_FLAG", ezflag, true);
varset("$_BS_FLAG", bsflag, true);
//dprintf("$_EZ_FLAG=%d, $_BS_FLAG=%d\n", ezflag, bsflag);
return STATUS_CONTINUE;
}
CMDRESULT cbInstrGpa(int argc, char* argv[])
{
if(argc<2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
if(argc>=3)
sprintf(newcmd, "%s:%s", argv[2], argv[1]);
else
sprintf(newcmd, "%s", argv[1]);
uint result=0;
if(!valfromstring(newcmd, &result, 0, 0, false, 0))
return STATUS_ERROR;
varset("$RESULT", result, false);
return STATUS_CONTINUE;
}
CMDRESULT cbInstrAdd(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s+%s", argv[1], argv[1], argv[2]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrAnd(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s&%s", argv[1], argv[1], argv[2]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrDec(int argc, char* argv[])
{
if(argc<2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s-1", argv[1], argv[1]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrDiv(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s/%s", argv[1], argv[1], argv[2]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrInc(int argc, char* argv[])
{
if(argc<2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s+1", argv[1], argv[1]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrMul(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s*%s", argv[1], argv[1], argv[2]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrNeg(int argc, char* argv[])
{
if(argc<2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s*-1", argv[1], argv[1]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrNot(int argc, char* argv[])
{
if(argc<2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,~%s", argv[1], argv[1]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrOr(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s|%s", argv[1], argv[1], argv[2]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrRol(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s<%s", argv[1], argv[1], argv[2]);
bool signedcalc=valuesignedcalc();
valuesetsignedcalc(true); //rol = signed
CMDRESULT res=cmddirectexec(dbggetcommandlist(), newcmd);
valuesetsignedcalc(signedcalc);
return res;
}
CMDRESULT cbInstrRor(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s>%s", argv[1], argv[1], argv[2]);
bool signedcalc=valuesignedcalc();
valuesetsignedcalc(true); //ror = signed
CMDRESULT res=cmddirectexec(dbggetcommandlist(), newcmd);
valuesetsignedcalc(signedcalc);
return res;
}
CMDRESULT cbInstrShl(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s<%s", argv[1], argv[1], argv[2]);
bool signedcalc=valuesignedcalc();
valuesetsignedcalc(false); //shl = unsigned
CMDRESULT res=cmddirectexec(dbggetcommandlist(), newcmd);
valuesetsignedcalc(signedcalc);
return res;
}
CMDRESULT cbInstrShr(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s>%s", argv[1], argv[1], argv[2]);
bool signedcalc=valuesignedcalc();
valuesetsignedcalc(false); //shr = unsigned
CMDRESULT res=cmddirectexec(dbggetcommandlist(), newcmd);
valuesetsignedcalc(signedcalc);
return res;
}
CMDRESULT cbInstrSub(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s-%s", argv[1], argv[1], argv[2]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrTest(int argc, char* argv[])
{
//TODO: test
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
uint arg1=0;
if(!valfromstring(argv[1], &arg1, 0, 0, false, 0))
return STATUS_ERROR;
uint arg2=0;
if(!valfromstring(argv[2], &arg2, 0, 0, false, 0))
return STATUS_ERROR;
uint ezflag;
uint bsflag=0;
if(!(arg1&arg2))
ezflag=1;
else
ezflag=0;
varset("$_EZ_FLAG", ezflag, true);
varset("$_BS_FLAG", bsflag, true);
//dprintf("$_EZ_FLAG=%d, $_BS_FLAG=%d\n", ezflag, bsflag);
return STATUS_CONTINUE;
}
CMDRESULT cbInstrXor(int argc, char* argv[])
{
if(argc<3)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
char newcmd[deflen]="";
sprintf(newcmd, "mov %s,%s^%s", argv[1], argv[1], argv[2]);
return cmddirectexec(dbggetcommandlist(), newcmd);
}

View File

@ -22,6 +22,23 @@ CMDRESULT cbSavedb(int argc, char* argv[]);
CMDRESULT cbAssemble(int argc, char* argv[]);
CMDRESULT cbFunctionAdd(int argc, char* argv[]);
CMDRESULT cbFunctionDel(int argc, char* argv[]);
CMDRESULT cbInstrCmp(int argc, char* argv[]);
CMDRESULT cbInstrGpa(int argc, char* argv[]);
CMDRESULT cbInstrAdd(int argc, char* argv[]);
CMDRESULT cbInstrAnd(int argc, char* argv[]);
CMDRESULT cbInstrDec(int argc, char* argv[]);
CMDRESULT cbInstrDiv(int argc, char* argv[]);
CMDRESULT cbInstrInc(int argc, char* argv[]);
CMDRESULT cbInstrMul(int argc, char* argv[]);
CMDRESULT cbInstrNeg(int argc, char* argv[]);
CMDRESULT cbInstrNot(int argc, char* argv[]);
CMDRESULT cbInstrOr(int argc, char* argv[]);
CMDRESULT cbInstrRol(int argc, char* argv[]);
CMDRESULT cbInstrRor(int argc, char* argv[]);
CMDRESULT cbInstrShl(int argc, char* argv[]);
CMDRESULT cbInstrShr(int argc, char* argv[]);
CMDRESULT cbInstrSub(int argc, char* argv[]);
CMDRESULT cbInstrTest(int argc, char* argv[]);
#endif // _INSTRUCTIONS_H

View File

@ -34,7 +34,7 @@ int mathisoperator(char ch)
return 1;
else if(ch=='~')
return 2;
else if(ch=='*' or ch=='#' or ch=='/' or ch=='%')
else if(ch=='*' or ch=='$' or ch=='/' or ch=='%')
return 3;
else if(ch=='+' or ch=='-')
return 4;
@ -121,7 +121,7 @@ bool mathdounsignedoperation(char op, uint left, uint right, uint* result)
case '*':
*result=left*right;
return true;
case '#':
case '$':
*result=umulhi(left, right);
return true;
case '/':
@ -170,7 +170,7 @@ bool mathdosignedoperation(char op, sint left, sint right, sint* result)
case '*':
*result=left*right;
return true;
case '#':
case '$':
*result=mulhi(left, right);
return true;
case '/':

View File

@ -47,6 +47,7 @@ static int scriptlabelfind(const char* labelname)
static bool scriptcreatelinemap(const char* filename)
{
DWORD ticks=GetTickCount();
HANDLE hFile=CreateFileA(filename, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if(hFile==INVALID_HANDLE_VALUE)
{
@ -193,6 +194,7 @@ static bool scriptcreatelinemap(const char* filename)
strcpy(entry.u.command, "ret");
linemap.push_back(entry);
}
dprintf("%ums to parse the script\n", GetTickCount()-ticks);
return true;
}
@ -390,18 +392,29 @@ static DWORD WINAPI scriptRunThread(void* arg)
return 0;
}
void scriptload(const char* filename)
static DWORD WINAPI scriptLoadThread(void* filename)
{
GuiScriptClear();
scriptIp=0;
scriptbplist.clear(); //clear breakpoints
bAbort=false;
if(!scriptcreatelinemap(filename))
return;
for(unsigned int i=0; i<linemap.size(); i++) //add script lines
GuiScriptAddLine(linemap.at(i).raw);
if(!scriptcreatelinemap((const char*)filename))
return 0;
int lines=linemap.size();
const char** script=(const char**)BridgeAlloc(lines*sizeof(const char*));
for(int i=0; i<lines; i++) //add script lines
script[i]=linemap.at(i).raw;
GuiScriptAdd(lines, script);
scriptIp=scriptinternalstep(0);
GuiScriptSetIp(scriptIp);
return 0;
}
void scriptload(const char* filename)
{
static char filename_[MAX_PATH]="";
strcpy(filename_, filename);
CreateThread(0, 0, scriptLoadThread, filename_, 0, 0);
}
void scriptunload()
@ -420,17 +433,23 @@ void scriptrun(int destline)
CreateThread(0, 0, scriptRunThread, (void*)(uint)destline, 0, 0);
}
void scriptstep()
DWORD WINAPI scriptStepThread(void* param)
{
if(bIsRunning) //already running
return;
return 0;
scriptIp=scriptinternalstep(scriptIp-1); //probably useless
if(!scriptinternalcmd())
return;
return 0;
if(scriptIp==scriptinternalstep(scriptIp)) //end of script
scriptIp=0;
scriptIp=scriptinternalstep(scriptIp);
GuiScriptSetIp(scriptIp);
return 0;
}
void scriptstep()
{
CreateThread(0, 0, scriptStepThread, 0, 0, 0);
}
bool scriptbptoggle(int line)
@ -505,3 +524,33 @@ void scriptsetip(int line)
scriptIp=scriptinternalstep(line);
GuiScriptSetIp(scriptIp);
}
CMDRESULT cbScriptLoad(int argc, char* argv[])
{
if(argc<2)
return STATUS_ERROR;
scriptload(argv[1]);
return STATUS_CONTINUE;
}
CMDRESULT cbScriptMsg(int argc, char* argv[])
{
if(argc<2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
GuiScriptMessage(argv[1]);
return STATUS_CONTINUE;
}
CMDRESULT cbScriptMsgyn(int argc, char* argv[])
{
if(argc<2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
varset("$RESULT", GuiScriptMsgyn(argv[1]), false);
return STATUS_CONTINUE;
}

View File

@ -54,4 +54,9 @@ void scriptabort();
SCRIPTLINETYPE scriptgetlinetype(int line);
void scriptsetip(int line);
//script commands
CMDRESULT cbScriptLoad(int argc, char* argv[]);
CMDRESULT cbScriptMsg(int argc, char* argv[]);
CMDRESULT cbScriptMsgyn(int argc, char* argv[]);
#endif // _SIMPLESCRIPT_H

View File

@ -35,42 +35,50 @@ static CMDRESULT cbCls(int argc, char* argv[])
static void registercommands()
{
COMMAND* cmd=command_list=cmdinit();
cmdnew(cmd, "strlen\1charcount\1ccount", cbStrLen, false); //get strlen, arg1:string
cmdnew(cmd, "varnew\1var", cbInstrVar, false); //make a variable arg1:name,[arg2:value]
cmdnew(cmd, "vardel", cbInstrVarDel, false); //delete a variable, arg1:variable name
cmdnew(cmd, "mov\1set", cbInstrMov, false); //mov a variable, arg1:dest,arg2:src
cmdnew(cmd, "cls\1lc\1lclr", cbCls, false); //clear the log
cmdnew(cmd, "varlist", cbInstrVarList, false); //list variables[arg1:type filter]
//debug control
cmdnew(cmd, "InitDebug\1init\1initdbg", cbDebugInit, false); //init debugger arg1:exefile,[arg2:commandline]
cmdnew(cmd, "StopDebug\1stop\1dbgstop", cbStopDebug, true); //stop debugger
cmdnew(cmd, "AttachDebugger\1attach", cbDebugAttach, false); //attach
//cmdnew(cmd, "DetachDebugger\1detach", cbDebugDetach, true); //detach
cmdnew(cmd, "run\1go\1r\1g", cbDebugRun, true); //unlock WAITID_RUN
cmdnew(cmd, "erun\1egun\1er\1eg", cbDebugErun, true); //run + skip first chance exceptions
cmdnew(cmd, "SetBPXOptions\1bptype", cbDebugSetBPXOptions, false); //breakpoint type
cmdnew(cmd, "SetBPX\1bp\1bpx", cbDebugSetBPX, true); //breakpoint
cmdnew(cmd, "DeleteBPX\1bpc\1bc", cbDebugDeleteBPX, true); //breakpoint delete
cmdnew(cmd, "EnableBPX\1bpe\1be", cbDebugEnableBPX, true); //breakpoint enable
cmdnew(cmd, "DisableBPX\1bpd\1bd", cbDebugDisableBPX, true); //breakpoint disable
cmdnew(cmd, "bplist", cbDebugBplist, true); //breakpoint list
cmdnew(cmd, "pause", cbDebugPause, true); //pause debugger
cmdnew(cmd, "StepInto\1sti", cbDebugStepInto, true); //StepInto
cmdnew(cmd, "eStepInto\1esti", cbDebugeStepInto, true); //StepInto + skip first chance exceptions
cmdnew(cmd, "StepOver\1step\1sto\1st", cbDebugStepOver, true); //StepOver
cmdnew(cmd, "eStepOver\1estep\1esto\1est", cbDebugeStepOver, true); //StepOver + skip first chance exceptions
cmdnew(cmd, "SingleStep\1sstep\1sst", cbDebugSingleStep, true); //SingleStep arg1:count
cmdnew(cmd, "eSingleStep\1esstep\1esst", cbDebugeSingleStep, true); //SingleStep arg1:count + skip first chance exceptions
cmdnew(cmd, "HideDebugger\1dbh\1hide", cbDebugHide, true); //HideDebugger
cmdnew(cmd, "disasm\1dis\1d", cbDebugDisasm, true); //doDisasm
cmdnew(cmd, "SetMemoryBPX\1membp\1bpm", cbDebugSetMemoryBpx, true); //SetMemoryBPX
cmdnew(cmd, "chd", cbInstrChd, false); //Change directory
cmdnew(cmd, "StepOut\1rtr", cbDebugRtr, true); //rtr
cmdnew(cmd, "eStepOut\1ertr", cbDebugeRtr, true); //rtr + skip first chance exceptions
//breakpoints
cmdnew(cmd, "bplist", cbDebugBplist, true); //breakpoint list
cmdnew(cmd, "SetBPXOptions\1bptype", cbDebugSetBPXOptions, false); //breakpoint type
cmdnew(cmd, "SetBPX\1bp\1bpx", cbDebugSetBPX, true); //breakpoint
cmdnew(cmd, "DeleteBPX\1bpc\1bc", cbDebugDeleteBPX, true); //breakpoint delete
cmdnew(cmd, "EnableBPX\1bpe\1be", cbDebugEnableBPX, true); //breakpoint enable
cmdnew(cmd, "DisableBPX\1bpd\1bd", cbDebugDisableBPX, true); //breakpoint disable
cmdnew(cmd, "SetHardwareBreakpoint\1bph\1bphws", cbDebugSetHardwareBreakpoint, true); //hardware breakpoint
cmdnew(cmd, "alloc", cbDebugAlloc, true); //allocate memory
cmdnew(cmd, "free", cbDebugFree, true); //free memory
cmdnew(cmd, "Fill\1memset", cbDebugMemset, true); //memset
cmdnew(cmd, "bench", cbBenchmark, true); //benchmark test (readmem etc)
cmdnew(cmd, "pause", cbDebugPause, true); //pause debugger
cmdnew(cmd, "memwrite", cbMemWrite, true); //memwrite test
cmdnew(cmd, "StartScylla\1scylla\1imprec", cbStartScylla, false); //start scylla
cmdnew(cmd, "DeleteHardwareBreakpoint\1bphc\1bphwc", cbDebugDeleteHardwareBreakpoint, true); //delete hardware breakpoint
cmdnew(cmd, "SetMemoryBPX\1membp\1bpm", cbDebugSetMemoryBpx, true); //SetMemoryBPX
cmdnew(cmd, "DeleteMemoryBPX\1membpc\1bpmc", cbDebugDeleteMemoryBreakpoint, true); //delete memory breakpoint
//variables
cmdnew(cmd, "varnew\1var", cbInstrVar, false); //make a variable arg1:name,[arg2:value]
cmdnew(cmd, "vardel", cbInstrVarDel, false); //delete a variable, arg1:variable name
cmdnew(cmd, "varlist", cbInstrVarList, false); //list variables[arg1:type filter]
cmdnew(cmd, "mov\1set", cbInstrMov, false); //mov a variable, arg1:dest,arg2:src
//misc
cmdnew(cmd, "strlen\1charcount\1ccount", cbStrLen, false); //get strlen, arg1:string
cmdnew(cmd, "cls\1lc\1lclr", cbCls, false); //clear the log
cmdnew(cmd, "chd", cbInstrChd, false); //Change directory
cmdnew(cmd, "disasm\1dis\1d", cbDebugDisasm, true); //doDisasm
cmdnew(cmd, "HideDebugger\1dbh\1hide", cbDebugHide, true); //HideDebugger
//user database
cmdnew(cmd, "cmt\1cmtset\1commentset", cbInstrCmt, true); //set/edit comment
cmdnew(cmd, "cmtc\1cmtdel\1commentdel", cbInstrCmtdel, true); //delete comment
cmdnew(cmd, "lbl\1lblset\1labelset", cbInstrLbl, true); //set/edit label
@ -79,15 +87,48 @@ static void registercommands()
cmdnew(cmd, "bookmarkc\1bookmarkdel", cbInstrBookmarkDel, true); //delete bookmark
cmdnew(cmd, "savedb\1dbsave", cbSavedb, true); //save program database
cmdnew(cmd, "loaddb\1dbload", cbLoaddb, true); //load program database
cmdnew(cmd, "DeleteHardwareBreakpoint\1bphc\1bphwc", cbDebugDeleteHardwareBreakpoint, true); //delete hardware breakpoint
cmdnew(cmd, "DeleteMemoryBPX\1membpc\1bpmc", cbDebugDeleteMemoryBreakpoint, true); //delete memory breakpoint
cmdnew(cmd, "asm", cbAssemble, true); //assemble instruction
cmdnew(cmd, "AttachDebugger\1attach", cbDebugAttach, false); //attach
//cmdnew(cmd, "DetachDebugger\1detach", cbDebugDetach, true); //detach
cmdnew(cmd, "functionadd\1func", cbFunctionAdd, true); //function
cmdnew(cmd, "functiondel\1funcc", cbFunctionDel, true); //function
cmdnew(cmd, "dump", cbDebugDump, true); //dump at address
//memory operations
cmdnew(cmd, "alloc", cbDebugAlloc, true); //allocate memory
cmdnew(cmd, "free", cbDebugFree, true); //free memory
cmdnew(cmd, "Fill\1memset", cbDebugMemset, true); //memset
//plugins
cmdnew(cmd, "StartScylla\1scylla\1imprec", cbStartScylla, false); //start scylla
//general purpose
cmdnew(cmd, "cmp", cbInstrCmp, false); //compare
cmdnew(cmd, "gpa", cbInstrGpa, true);
cmdnew(cmd, "add", cbInstrAdd, false);
cmdnew(cmd, "and", cbInstrAnd, false);
cmdnew(cmd, "dec", cbInstrDec, false);
cmdnew(cmd, "div", cbInstrDiv, false);
cmdnew(cmd, "inc", cbInstrInc, false);
cmdnew(cmd, "mul", cbInstrMul, false);
cmdnew(cmd, "neg", cbInstrNeg, false);
cmdnew(cmd, "not", cbInstrNot, false);
cmdnew(cmd, "or", cbInstrOr, false);
cmdnew(cmd, "rol", cbInstrRol, false);
cmdnew(cmd, "ror", cbInstrRor, false);
cmdnew(cmd, "shl", cbInstrShl, false);
cmdnew(cmd, "shr", cbInstrShr, false);
cmdnew(cmd, "sub", cbInstrSub, false);
cmdnew(cmd, "test", cbInstrTest, false);
//script
cmdnew(cmd, "scriptload", cbScriptLoad, false);
cmdnew(cmd, "msg", cbScriptMsg, false);
cmdnew(cmd, "msgyn", cbScriptMsgyn, false);
//undocumented
cmdnew(cmd, "bench", cbBenchmark, true); //benchmark test (readmem etc)
cmdnew(cmd, "memwrite", cbMemWrite, true); //memwrite test
cmdnew(cmd, "asm", cbAssemble, true); //assemble instruction
cmdnew(cmd, "dump", cbDebugDump, true); //dump at address
}
static bool cbCommandProvider(char* cmd, int maxlen)

View File

@ -12,13 +12,14 @@ ScriptView::ScriptView(StdTable *parent) : StdTable(parent)
setIp(0); //no IP
connect(Bridge::getBridge(), SIGNAL(scriptAddLine(QString)), this, SLOT(addLine(QString)));
connect(Bridge::getBridge(), SIGNAL(scriptAdd(int,const char**)), this, SLOT(add(int,const char**)));
connect(Bridge::getBridge(), SIGNAL(scriptClear()), this, SLOT(clear()));
connect(Bridge::getBridge(), SIGNAL(scriptSetIp(int)), this, SLOT(setIp(int)));
connect(Bridge::getBridge(), SIGNAL(scriptError(int,QString)), this, SLOT(error(int,QString)));
connect(Bridge::getBridge(), SIGNAL(scriptSetTitle(QString)), this, SLOT(setTitle(QString)));
connect(Bridge::getBridge(), SIGNAL(scriptSetInfoLine(int,QString)), this, SLOT(setInfoLine(int,QString)));
connect(Bridge::getBridge(), SIGNAL(scriptMessage(QString)), this, SLOT(message(QString)));
connect(Bridge::getBridge(), SIGNAL(scriptQuestion(QString)), this, SLOT(question(QString)));
setupContextMenu();
}
@ -178,12 +179,14 @@ void ScriptView::setupContextMenu()
}
//slots
void ScriptView::addLine(QString text)
void ScriptView::add(int count, const char** lines)
{
int rows=getRowCount();
setRowCount(rows+1);
setCellContent(rows, 1, text);
setRowCount(count);
for(int i=0; i<count; i++)
setCellContent(i, 1, QString(lines[i]));
BridgeFree(lines);
reloadData(); //repaint
Bridge::getBridge()->scriptResult=1;
}
void ScriptView::clear()
@ -195,10 +198,20 @@ void ScriptView::clear()
void ScriptView::setIp(int line)
{
if(!isValidIndex(line-1, 0))
int offset=line-1;
if(!isValidIndex(offset, 0))
{
mIpLine=0;
else
mIpLine=line;
return;
}
mIpLine=line;
int rangefrom=getTableOffset();
int rangeto=rangefrom+getViewableRowsCount()-1;
if(offset<rangefrom) //ip lays before the current view
setTableOffset(offset);
else if(offset>(rangeto-1)) //ip lays after the current view
setTableOffset(offset-getViewableRowsCount()+2);
setSingleSelection(offset);
reloadData(); //repaint
}
@ -304,3 +317,13 @@ void ScriptView::newIp()
if(isValidIndex(selected-1, 0))
DbgScriptSetIp(selected);
}
void ScriptView::question(QString message)
{
QMessageBox msg(QMessageBox::Question, "Question", message, QMessageBox::Yes|QMessageBox::No);
msg.setWindowIcon(QIcon(":/icons/images/question.png"));
if(msg.exec()==QMessageBox::Yes)
Bridge::getBridge()->scriptResult=1;
else
Bridge::getBridge()->scriptResult=0;
}

View File

@ -18,7 +18,7 @@ public:
void mouseDoubleClickEvent(QMouseEvent* event);
public slots:
void addLine(QString text);
void add(int count, const char** lines);
void clear();
void setIp(int line);
void error(int line, QString message);
@ -34,6 +34,7 @@ public slots:
void cmdExec();
void message(QString message);
void newIp();
void question(QString message);
private:
//private functions

View File

@ -79,9 +79,14 @@ void Bridge::emitDumpAt(int_t va)
emit dumpAt(va);
}
void Bridge::emitScriptAddLine(QString text)
void Bridge::emitScriptAdd(int count, const char** lines)
{
emit scriptAddLine(text);
mBridgeMutex.lock();
scriptResult=-1;
emit scriptAdd(count, lines);
while(scriptResult==-1) //wait for thread completion
Sleep(100);
mBridgeMutex.unlock();
}
void Bridge::emitScriptClear()
@ -114,6 +119,17 @@ void Bridge::emitScriptMessage(QString message)
emit scriptMessage(message);
}
int Bridge::emitScriptQuestion(QString message)
{
mBridgeMutex.lock();
scriptResult=-1;
emit scriptQuestion(message);
while(scriptResult==-1) //wait for thread completion
Sleep(100);
mBridgeMutex.unlock();
return scriptResult;
}
/************************************************************************************
Static Functions
@ -213,9 +229,9 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
}
break;
case GUI_SCRIPT_ADDLINE:
case GUI_SCRIPT_ADD:
{
Bridge::getBridge()->emitScriptAddLine(QString(reinterpret_cast<const char*>(param1)));
Bridge::getBridge()->emitScriptAdd((int)(int_t)param1, reinterpret_cast<const char**>(param2));
}
break;
@ -234,8 +250,7 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
case GUI_SCRIPT_ERROR:
{
int_t arg=(int_t)param1;
Bridge::getBridge()->emitScriptError((int)arg, QString(reinterpret_cast<const char*>(param2)));
Bridge::getBridge()->emitScriptError((int)(int_t)param1, QString(reinterpret_cast<const char*>(param2)));
}
break;
@ -258,6 +273,12 @@ __declspec(dllexport) void* _gui_sendmessage(GUIMSG type, void* param1, void* pa
}
break;
case GUI_SCRIPT_MSGYN:
{
return (void*)Bridge::getBridge()->emitScriptQuestion(QString(reinterpret_cast<const char*>(param1)));
}
break;
default:
{
}

View File

@ -34,15 +34,18 @@ public:
void emitSetInfoLine(int line, QString text);
void emitClearInfoBox();
void emitDumpAt(int_t va);
void emitScriptAddLine(QString text);
void emitScriptAdd(int count, const char** lines);
void emitScriptClear();
void emitScriptSetIp(int line);
void emitScriptError(int line, QString message);
void emitScriptSetTitle(QString title);
void emitScriptSetInfoLine(int line, QString info);
void emitScriptMessage(QString message);
int emitScriptQuestion(QString message);
void* winId;
QWidget* scriptView;
int scriptResult;
signals:
void disassembleAt(int_t va, int_t eip);
@ -57,17 +60,19 @@ signals:
void setInfoLine(int line, QString text);
void dumpAt(int_t va);
void scriptAddLine(QString text);
void scriptAdd(int count, const char** lines);
void scriptClear();
void scriptSetIp(int line);
void scriptError(int line, QString message);
void scriptSetTitle(QString title);
void scriptSetInfoLine(int line, QString info);
void scriptMessage(QString message);
void scriptQuestion(QString message);
public slots:
private:
QMutex mBridgeMutex;
public:

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 B

View File

@ -24,5 +24,6 @@
<file>images/script-code.png</file>
<file>images/script-error.png</file>
<file>images/information.png</file>
<file>images/question.png</file>
</qresource>
</RCC>