1
0
Fork 0

DBG: initial script api work (can now do simple debugging scripts with AngelScript)

pull/328/head
Mr. eXoDia 2015-06-22 03:09:18 +02:00
parent 6b6bc88347
commit 9542a55843
7 changed files with 1111 additions and 1 deletions

View File

@ -81,6 +81,7 @@ xcopy x64_dbg_dbg\XEDParse %RELEASEDIR%\pluginsdk\XEDParse /S /Y
xcopy x64_dbg_dbg\yara %RELEASEDIR%\pluginsdk\yara /S /Y
copy x64_dbg_dbg\_plugin_types.h %RELEASEDIR%\pluginsdk\_plugin_types.h
copy x64_dbg_dbg\_plugins.h %RELEASEDIR%\pluginsdk\_plugins.h
copy x64_dbg_dbg\_scriptapi.h %RELEASEDIR%\pluginsdk\_scriptapi.h
copy x64_dbg_dbg\_dbgfunctions.h %RELEASEDIR%\pluginsdk\_dbgfunctions.h
copy x64_dbg_bridge\bridgemain.h %RELEASEDIR%\pluginsdk\bridgemain.h

View File

@ -0,0 +1,813 @@
#include "_scriptapi.h"
#include "memory.h"
#include "value.h"
using namespace Script;
SCRIPT_EXPORT void Script::Debug::Wait()
{
_plugin_waituntilpaused();
}
SCRIPT_EXPORT void Script::Debug::Run()
{
DbgCmdExecDirect("run");
Wait();
}
SCRIPT_EXPORT void Script::Debug::Pause()
{
DbgCmdExecDirect("pause");
Wait();
}
SCRIPT_EXPORT void Script::Debug::Stop()
{
DbgCmdExecDirect("StopDebug");
Wait();
}
SCRIPT_EXPORT void Script::Debug::StepIn()
{
DbgCmdExecDirect("StepInto");
Wait();
}
SCRIPT_EXPORT void Script::Debug::StepOver()
{
DbgCmdExecDirect("StepOver");
Wait();
}
SCRIPT_EXPORT void Script::Debug::StepOut()
{
DbgCmdExecDirect("StepOut");
Wait();
}
SCRIPT_EXPORT bool Script::Memory::Read(duint addr, void* data, duint size, duint* sizeRead)
{
return MemRead((void*)addr, data, size, sizeRead);
}
SCRIPT_EXPORT bool Script::Memory::Write(duint addr, const void* data, duint size, duint* sizeWritten)
{
return MemWrite((void*)addr, (void*)data, size, sizeWritten);
}
SCRIPT_EXPORT unsigned char Script::Memory::ReadByte(duint addr)
{
unsigned char data;
Read(addr, &data, sizeof(data), nullptr);
return data;
}
SCRIPT_EXPORT bool Script::Memory::WriteByte(duint addr, unsigned char data)
{
return Write(addr, &data, sizeof(data), nullptr);
}
SCRIPT_EXPORT unsigned short Script::Memory::ReadWord(duint addr)
{
unsigned short data;
Read(addr, &data, sizeof(data), nullptr);
return data;
}
SCRIPT_EXPORT bool Script::Memory::WriteWord(duint addr, unsigned short data)
{
return Write(addr, &data, sizeof(data), nullptr);
}
SCRIPT_EXPORT unsigned int Script::Memory::ReadDword(duint addr)
{
unsigned int data;
Read(addr, &data, sizeof(data), nullptr);
return data;
}
SCRIPT_EXPORT bool Script::Memory::WriteDword(duint addr, unsigned int data)
{
return Write(addr, &data, sizeof(data), nullptr);
}
#ifdef _WIN64
SCRIPT_EXPORT unsigned long long Script::Memory::ReadQword(duint addr)
{
unsigned long long data;
Read(addr, &data, sizeof(data), nullptr);
return data;
}
SCRIPT_EXPORT bool Script::Memory::WriteQword(duint addr, unsigned long long data)
{
return Write(addr, &data, sizeof(data), nullptr);
}
#endif //_WIN64
SCRIPT_EXPORT duint Script::Memory::ReadPtr(duint addr)
{
duint data;
Read(addr, &data, sizeof(data), nullptr);
return data;
}
SCRIPT_EXPORT bool Script::Memory::WritePtr(duint addr, duint data)
{
return Write(addr, &data, sizeof(data), nullptr);
}
static const char* regTable[] =
{
"DR0",
"DR1",
"DR2",
"DR3",
"DR6",
"DR7",
"EAX",
"AX",
"AH",
"AL",
"EBX",
"BX",
"BH",
"BL",
"ECX",
"CX",
"CH",
"CL",
"EDX",
"DX",
"DH",
"DL",
"EDI",
"DI",
"ESI",
"SI",
"EBP",
"BP",
"ESP",
"SP",
"EIP",
"CIP",
#ifdef _WIN64
"RAX",
"RBX",
"RCX",
"RDX",
"RSI",
"SIL",
"RDI",
"DIL",
"RBP",
"BPL",
"RSP",
"SPL",
"RIP",
"R8",
"R8D",
"R8W",
"R8B",
"R9",
"R9D",
"R9W",
"R9B",
"R10",
"R10D",
"R10W",
"R10B",
"R11",
"R11D",
"R11W",
"R11B",
"R12",
"R12D",
"R12W",
"R12B",
"R13",
"R13D",
"R13W",
"R13B",
"R14",
"R14D",
"R14W",
"R14B",
"R15",
"R15D",
"R15W",
"R15"
#endif //_WIN64
};
SCRIPT_EXPORT duint Script::Register::Get(Script::Register::RegisterEnum reg)
{
duint value;
valfromstring(regTable[reg], &value);
return value;
}
SCRIPT_EXPORT bool Script::Register::Set(Script::Register::RegisterEnum reg, duint value)
{
return setregister(regTable[reg], value);
}
SCRIPT_EXPORT duint Script::Register::GetDR0()
{
return Get(DR0);
}
SCRIPT_EXPORT bool Script::Register::SetDR0(duint value)
{
return Set(DR0, value);
}
SCRIPT_EXPORT duint Script::Register::GetDR1()
{
return Get(DR1);
}
SCRIPT_EXPORT bool Script::Register::SetDR1(duint value)
{
return Set(DR1, value);
}
SCRIPT_EXPORT duint Script::Register::GetDR2()
{
return Get(DR2);
}
SCRIPT_EXPORT bool Script::Register::SetDR2(duint value)
{
return Set(DR2, value);
}
SCRIPT_EXPORT duint Script::Register::GetDR3()
{
return Get(DR3);
}
SCRIPT_EXPORT bool Script::Register::SetDR3(duint value)
{
return Set(DR3, value);
}
SCRIPT_EXPORT duint Script::Register::GetDR6()
{
return Get(DR6);
}
SCRIPT_EXPORT bool Script::Register::SetDR6(duint value)
{
return Set(DR6, value);
}
SCRIPT_EXPORT duint Script::Register::GetDR7()
{
return Get(DR7);
}
SCRIPT_EXPORT bool Script::Register::SetDR7(duint value)
{
return Set(DR7, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetEAX()
{
return (unsigned int)Get(EAX);
}
SCRIPT_EXPORT bool Script::Register::SetEAX(unsigned int value)
{
return Set(EAX, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetAX()
{
return (unsigned short)Get(AX);
}
SCRIPT_EXPORT bool Script::Register::SetAX(unsigned short value)
{
return Set(AX, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetAH()
{
return (unsigned char)Get(AH);
}
SCRIPT_EXPORT bool Script::Register::SetAH(unsigned char value)
{
return Set(AH, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetAL()
{
return (unsigned char)Get(AL);
}
SCRIPT_EXPORT bool Script::Register::SetAL(unsigned char value)
{
return Set(AL, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetEBX()
{
return (unsigned int)Get(EBX);
}
SCRIPT_EXPORT bool Script::Register::SetEBX(unsigned int value)
{
return Set(EBX, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetBX()
{
return (unsigned short)Get(BX);
}
SCRIPT_EXPORT bool Script::Register::SetBX(unsigned short value)
{
return Set(BX, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetBH()
{
return (unsigned char)Get(BH);
}
SCRIPT_EXPORT bool Script::Register::SetBH(unsigned char value)
{
return Set(BH, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetBL()
{
return (unsigned char)Get(BL);
}
SCRIPT_EXPORT bool Script::Register::SetBL(unsigned char value)
{
return Set(BL, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetECX()
{
return (unsigned int)Get(ECX);
}
SCRIPT_EXPORT bool Script::Register::SetECX(unsigned int value)
{
return Set(ECX, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetCX()
{
return (unsigned short)Get(CX);
}
SCRIPT_EXPORT bool Script::Register::SetCX(unsigned short value)
{
return Set(CX, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetCH()
{
return (unsigned char)Get(CH);
}
SCRIPT_EXPORT bool Script::Register::SetCH(unsigned char value)
{
return Set(CH, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetCL()
{
return (unsigned char)Get(CL);
}
SCRIPT_EXPORT bool Script::Register::SetCL(unsigned char value)
{
return Set(CL, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetEDX()
{
return (unsigned int)Get(EDX);
}
SCRIPT_EXPORT bool Script::Register::SetEDX(unsigned int value)
{
return Set(EDX, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetDX()
{
return (unsigned short)Get(DX);
}
SCRIPT_EXPORT bool Script::Register::SetDX(unsigned short value)
{
return Set(DX, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetDH()
{
return (unsigned char)Get(DH);
}
SCRIPT_EXPORT bool Script::Register::SetDH(unsigned char value)
{
return Set(DH, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetDL()
{
return (unsigned char)Get(DL);
}
SCRIPT_EXPORT bool Script::Register::SetDL(unsigned char value)
{
return Set(DL, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetEDI()
{
return (unsigned int)Get(EDI);
}
SCRIPT_EXPORT bool Script::Register::SetEDI(unsigned int value)
{
return Set(EDI, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetDI()
{
return (unsigned short)Get(DI);
}
SCRIPT_EXPORT bool Script::Register::SetDI(unsigned short value)
{
return Set(DI, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetESI()
{
return (unsigned int)Get(ESI);
}
SCRIPT_EXPORT bool Script::Register::SetESI(unsigned int value)
{
return Set(ESI, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetSI()
{
return (unsigned short)Get(SI);
}
SCRIPT_EXPORT bool Script::Register::SetSI(unsigned short value)
{
return Set(SI, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetEBP()
{
return (unsigned int)Get(EBP);
}
SCRIPT_EXPORT bool Script::Register::SetEBP(unsigned int value)
{
return Set(EBP, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetBP()
{
return (unsigned short)Get(BP);
}
SCRIPT_EXPORT bool Script::Register::SetBP(unsigned short value)
{
return Set(BP, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetESP()
{
return (unsigned int)Get(ESP);
}
SCRIPT_EXPORT bool Script::Register::SetESP(unsigned int value)
{
return Set(ESP, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetSP()
{
return (unsigned short)Get(SP);
}
SCRIPT_EXPORT bool Script::Register::SetSP(unsigned short value)
{
return Set(SP, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetEIP()
{
return (unsigned int)Get(EIP);
}
SCRIPT_EXPORT bool Script::Register::SetEIP(unsigned int value)
{
return Set(EIP, value);
}
SCRIPT_EXPORT duint Script::Register::GetCIP()
{
return Get(CIP);
}
SCRIPT_EXPORT bool Script::Register::SetCIP(duint value)
{
return Set(CIP, value);
}
#ifdef _WIN64
SCRIPT_EXPORT unsigned long long Script::Register::GetRAX()
{
return (unsigned long long)Get(RAX);
}
SCRIPT_EXPORT bool Script::Register::SetRAX(unsigned long long value)
{
return Set(RAX, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRBX()
{
return (unsigned long long)Get(RBX);
}
SCRIPT_EXPORT bool Script::Register::SetRBX(unsigned long long value)
{
return Set(RBX, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRCX()
{
return (unsigned long long)Get(RCX);
}
SCRIPT_EXPORT bool Script::Register::SetRCX(unsigned long long value)
{
return Set(RCX, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRDX()
{
return (unsigned long long)Get(RDX);
}
SCRIPT_EXPORT bool Script::Register::SetRDX(unsigned long long value)
{
return Set(RDX, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRSI()
{
return (unsigned long long)Get(RSI);
}
SCRIPT_EXPORT bool Script::Register::SetRSI(unsigned long long value)
{
return Set(RSI, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetSIL()
{
return (unsigned char)Get(SIL);
}
SCRIPT_EXPORT bool Script::Register::SetSIL(unsigned char value)
{
return Set(SIL, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRDI()
{
return (unsigned long long)Get(RDI);
}
SCRIPT_EXPORT bool Script::Register::SetRDI(unsigned long long value)
{
return Set(RDI, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetDIL()
{
return (unsigned char)Get(DIL);
}
SCRIPT_EXPORT bool Script::Register::SetDIL(unsigned char value)
{
return Set(DIL, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRBP()
{
return (unsigned long long)Get(RBP);
}
SCRIPT_EXPORT bool Script::Register::SetRBP(unsigned long long value)
{
return Set(RBP, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetBPL()
{
return (unsigned char)Get(BPL);
}
SCRIPT_EXPORT bool Script::Register::SetBPL(unsigned char value)
{
return Set(BPL, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRSP()
{
return (unsigned long long)Get(RSP);
}
SCRIPT_EXPORT bool Script::Register::SetRSP(unsigned long long value)
{
return Set(RSP, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetSPL()
{
return (unsigned char)Get(SPL);
}
SCRIPT_EXPORT bool Script::Register::SetSPL(unsigned char value)
{
return Set(SPL, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetRIP()
{
return (unsigned long long)Get(RIP);
}
SCRIPT_EXPORT bool Script::Register::SetRIP(unsigned long long value)
{
return Set(RIP, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR8()
{
return (unsigned long long)Get(R8);
}
SCRIPT_EXPORT bool Script::Register::SetR8(unsigned long long value)
{
return Set(R8, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR8D()
{
return (unsigned int)Get(R8D);
}
SCRIPT_EXPORT bool Script::Register::SetR8D(unsigned int value)
{
return Set(R8D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR8W()
{
return (unsigned short)Get(R8W);
}
SCRIPT_EXPORT bool Script::Register::SetR8W(unsigned short value)
{
return Set(R8W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR8B()
{
return (unsigned char)Get(R8B);
}
SCRIPT_EXPORT bool Script::Register::SetR8B(unsigned char value)
{
return Set(R8B, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR9()
{
return (unsigned long long)Get(R9);
}
SCRIPT_EXPORT bool Script::Register::SetR9(unsigned long long value)
{
return Set(R9, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR9D()
{
return (unsigned int)Get(R9D);
}
SCRIPT_EXPORT bool Script::Register::SetR9D(unsigned int value)
{
return Set(R9D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR9W()
{
return (unsigned short)Get(R9W);
}
SCRIPT_EXPORT bool Script::Register::SetR9W(unsigned short value)
{
return Set(R9W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR9B()
{
return (unsigned char)Get(R9B);
}
SCRIPT_EXPORT bool Script::Register::SetR9B(unsigned char value)
{
return Set(R9B, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR10()
{
return (unsigned long long)Get(R10);
}
SCRIPT_EXPORT bool Script::Register::SetR10(unsigned long long value)
{
return Set(R10, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR10D()
{
return (unsigned int)Get(R10D);
}
SCRIPT_EXPORT bool Script::Register::SetR10D(unsigned int value)
{
return Set(R10D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR10W()
{
return (unsigned short)Get(R10W);
}
SCRIPT_EXPORT bool Script::Register::SetR10W(unsigned short value)
{
return Set(R10W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR10B()
{
return (unsigned char)Get(R10B);
}
SCRIPT_EXPORT bool Script::Register::SetR10B(unsigned char value)
{
return Set(R10B, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR11()
{
return (unsigned long long)Get(R11);
}
SCRIPT_EXPORT bool Script::Register::SetR11(unsigned long long value)
{
return Set(R11, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR11D()
{
return (unsigned int)Get(R11D);
}
SCRIPT_EXPORT bool Script::Register::SetR11D(unsigned int value)
{
return Set(R11D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR11W()
{
return (unsigned short)Get(R11W);
}
SCRIPT_EXPORT bool Script::Register::SetR11W(unsigned short value)
{
return Set(R11W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR11B()
{
return (unsigned char)Get(R11B);
}
SCRIPT_EXPORT bool Script::Register::SetR11B(unsigned char value)
{
return Set(R11B, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR12()
{
return (unsigned long long)Get(R12);
}
SCRIPT_EXPORT bool Script::Register::SetR12(unsigned long long value)
{
return Set(R12, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR12D()
{
return (unsigned int)Get(R12D);
}
SCRIPT_EXPORT bool Script::Register::SetR12D(unsigned int value)
{
return Set(R12D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR12W()
{
return (unsigned short)Get(R12W);
}
SCRIPT_EXPORT bool Script::Register::SetR12W(unsigned short value)
{
return Set(R12W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR12B()
{
return (unsigned char)Get(R12B);
}
SCRIPT_EXPORT bool Script::Register::SetR12B(unsigned char value)
{
return Set(R12B, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR13()
{
return (unsigned long long)Get(R13);
}
SCRIPT_EXPORT bool Script::Register::SetR13(unsigned long long value)
{
return Set(R13, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR13D()
{
return (unsigned int)Get(R13D);
}
SCRIPT_EXPORT bool Script::Register::SetR13D(unsigned int value)
{
return Set(R13D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR13W()
{
return (unsigned short)Get(R13W);
}
SCRIPT_EXPORT bool Script::Register::SetR13W(unsigned short value)
{
return Set(R13W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR13B()
{
return (unsigned char)Get(R13B);
}
SCRIPT_EXPORT bool Script::Register::SetR13B(unsigned char value)
{
return Set(R13B, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR14()
{
return (unsigned long long)Get(R14);
}
SCRIPT_EXPORT bool Script::Register::SetR14(unsigned long long value)
{
return Set(R14, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR14D()
{
return (unsigned int)Get(R14D);
}
SCRIPT_EXPORT bool Script::Register::SetR14D(unsigned int value)
{
return Set(R14D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR14W()
{
return (unsigned short)Get(R14W);
}
SCRIPT_EXPORT bool Script::Register::SetR14W(unsigned short value)
{
return Set(R14W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR14B()
{
return (unsigned char)Get(R14B);
}
SCRIPT_EXPORT bool Script::Register::SetR14B(unsigned char value)
{
return Set(R14B, value);
}
SCRIPT_EXPORT unsigned long long Script::Register::GetR15()
{
return (unsigned long long)Get(R15);
}
SCRIPT_EXPORT bool Script::Register::SetR15(unsigned long long value)
{
return Set(R15, value);
}
SCRIPT_EXPORT unsigned int Script::Register::GetR15D()
{
return (unsigned int)Get(R15D);
}
SCRIPT_EXPORT bool Script::Register::SetR15D(unsigned int value)
{
return Set(R15D, value);
}
SCRIPT_EXPORT unsigned short Script::Register::GetR15W()
{
return (unsigned short)Get(R15W);
}
SCRIPT_EXPORT bool Script::Register::SetR15W(unsigned short value)
{
return Set(R15W, value);
}
SCRIPT_EXPORT unsigned char Script::Register::GetR15B()
{
return (unsigned char)Get(R15B);
}
SCRIPT_EXPORT bool Script::Register::SetR15B(unsigned char value)
{
return Set(R15B, value);
}
#endif //_WIN64

View File

@ -0,0 +1,287 @@
#ifndef _SCRIPT_API_H
#define _SCRIPT_API_H
#include "_plugins.h"
#define SCRIPT_EXPORT PLUG_IMPEXP
namespace Script
{
namespace Debug
{
SCRIPT_EXPORT void Wait();
SCRIPT_EXPORT void Run();
SCRIPT_EXPORT void Pause();
SCRIPT_EXPORT void Stop();
SCRIPT_EXPORT void StepIn();
SCRIPT_EXPORT void StepOver();
SCRIPT_EXPORT void StepOut();
};
namespace Memory
{
SCRIPT_EXPORT bool Read(duint addr, void* data, duint size, duint* sizeRead);
SCRIPT_EXPORT bool Write(duint addr, const void* data, duint size, duint* sizeWritten);
SCRIPT_EXPORT unsigned char ReadByte(duint addr);
SCRIPT_EXPORT bool WriteByte(duint addr, unsigned char data);
SCRIPT_EXPORT unsigned short ReadWord(duint addr);
SCRIPT_EXPORT bool WriteWord(duint addr, unsigned short data);
SCRIPT_EXPORT unsigned int ReadDword(duint addr);
SCRIPT_EXPORT bool WriteDword(duint addr, unsigned int data);
#ifdef _WIN64
SCRIPT_EXPORT unsigned long long ReadQword(duint addr);
SCRIPT_EXPORT bool WriteQword(duint addr, unsigned long long data);
#endif //_WIN64
SCRIPT_EXPORT duint ReadPtr(duint addr);
SCRIPT_EXPORT bool WritePtr(duint addr, duint data);
};
namespace Register
{
enum RegisterEnum
{
DR0,
DR1,
DR2,
DR3,
DR6,
DR7,
EAX,
AX,
AH,
AL,
EBX,
BX,
BH,
BL,
ECX,
CX,
CH,
CL,
EDX,
DX,
DH,
DL,
EDI,
DI,
ESI,
SI,
EBP,
BP,
ESP,
SP,
EIP,
CIP,
#ifdef _WIN64
RAX,
RBX,
RCX,
RDX,
RSI,
SIL,
RDI,
DIL,
RBP,
BPL,
RSP,
SPL,
RIP,
R8,
R8D,
R8W,
R8B,
R9,
R9D,
R9W,
R9B,
R10,
R10D,
R10W,
R10B,
R11,
R11D,
R11W,
R11B,
R12,
R12D,
R12W,
R12B,
R13,
R13D,
R13W,
R13B,
R14,
R14D,
R14W,
R14B,
R15,
R15D,
R15W,
R15B
#endif //_WIN64
};
SCRIPT_EXPORT duint Get(RegisterEnum reg);
SCRIPT_EXPORT bool Set(RegisterEnum reg, duint value);
SCRIPT_EXPORT duint GetDR0();
SCRIPT_EXPORT bool SetDR0(duint value);
SCRIPT_EXPORT duint GetDR1();
SCRIPT_EXPORT bool SetDR1(duint value);
SCRIPT_EXPORT duint GetDR2();
SCRIPT_EXPORT bool SetDR2(duint value);
SCRIPT_EXPORT duint GetDR3();
SCRIPT_EXPORT bool SetDR3(duint value);
SCRIPT_EXPORT duint GetDR6();
SCRIPT_EXPORT bool SetDR6(duint value);
SCRIPT_EXPORT duint GetDR7();
SCRIPT_EXPORT bool SetDR7(duint value);
SCRIPT_EXPORT unsigned int GetEAX();
SCRIPT_EXPORT bool SetEAX(unsigned int value);
SCRIPT_EXPORT unsigned short GetAX();
SCRIPT_EXPORT bool SetAX(unsigned short value);
SCRIPT_EXPORT unsigned char GetAH();
SCRIPT_EXPORT bool SetAH(unsigned char value);
SCRIPT_EXPORT unsigned char GetAL();
SCRIPT_EXPORT bool SetAL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEBX();
SCRIPT_EXPORT bool SetEBX(unsigned int value);
SCRIPT_EXPORT unsigned short GetBX();
SCRIPT_EXPORT bool SetBX(unsigned short value);
SCRIPT_EXPORT unsigned char GetBH();
SCRIPT_EXPORT bool SetBH(unsigned char value);
SCRIPT_EXPORT unsigned char GetBL();
SCRIPT_EXPORT bool SetBL(unsigned char value);
SCRIPT_EXPORT unsigned int GetECX();
SCRIPT_EXPORT bool SetECX(unsigned int value);
SCRIPT_EXPORT unsigned short GetCX();
SCRIPT_EXPORT bool SetCX(unsigned short value);
SCRIPT_EXPORT unsigned char GetCH();
SCRIPT_EXPORT bool SetCH(unsigned char value);
SCRIPT_EXPORT unsigned char GetCL();
SCRIPT_EXPORT bool SetCL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEDX();
SCRIPT_EXPORT bool SetEDX(unsigned int value);
SCRIPT_EXPORT unsigned short GetDX();
SCRIPT_EXPORT bool SetDX(unsigned short value);
SCRIPT_EXPORT unsigned char GetDH();
SCRIPT_EXPORT bool SetDH(unsigned char value);
SCRIPT_EXPORT unsigned char GetDL();
SCRIPT_EXPORT bool SetDL(unsigned char value);
SCRIPT_EXPORT unsigned int GetEDI();
SCRIPT_EXPORT bool SetEDI(unsigned int value);
SCRIPT_EXPORT unsigned short GetDI();
SCRIPT_EXPORT bool SetDI(unsigned short value);
SCRIPT_EXPORT unsigned int GetESI();
SCRIPT_EXPORT bool SetESI(unsigned int value);
SCRIPT_EXPORT unsigned short GetSI();
SCRIPT_EXPORT bool SetSI(unsigned short value);
SCRIPT_EXPORT unsigned int GetEBP();
SCRIPT_EXPORT bool SetEBP(unsigned int value);
SCRIPT_EXPORT unsigned short GetBP();
SCRIPT_EXPORT bool SetBP(unsigned short value);
SCRIPT_EXPORT unsigned int GetESP();
SCRIPT_EXPORT bool SetESP(unsigned int value);
SCRIPT_EXPORT unsigned short GetSP();
SCRIPT_EXPORT bool SetSP(unsigned short value);
SCRIPT_EXPORT unsigned int GetEIP();
SCRIPT_EXPORT bool SetEIP(unsigned int value);
SCRIPT_EXPORT duint GetCIP();
SCRIPT_EXPORT bool SetCIP(duint value);
#ifdef _WIN64
SCRIPT_EXPORT unsigned long long GetRAX();
SCRIPT_EXPORT bool SetRAX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRBX();
SCRIPT_EXPORT bool SetRBX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRCX();
SCRIPT_EXPORT bool SetRCX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRDX();
SCRIPT_EXPORT bool SetRDX(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetRSI();
SCRIPT_EXPORT bool SetRSI(unsigned long long value);
SCRIPT_EXPORT unsigned char GetSIL();
SCRIPT_EXPORT bool SetSIL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRDI();
SCRIPT_EXPORT bool SetRDI(unsigned long long value);
SCRIPT_EXPORT unsigned char GetDIL();
SCRIPT_EXPORT bool SetDIL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRBP();
SCRIPT_EXPORT bool SetRBP(unsigned long long value);
SCRIPT_EXPORT unsigned char GetBPL();
SCRIPT_EXPORT bool SetBPL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRSP();
SCRIPT_EXPORT bool SetRSP(unsigned long long value);
SCRIPT_EXPORT unsigned char GetSPL();
SCRIPT_EXPORT bool SetSPL(unsigned char value);
SCRIPT_EXPORT unsigned long long GetRIP();
SCRIPT_EXPORT bool SetRIP(unsigned long long value);
SCRIPT_EXPORT unsigned long long GetR8();
SCRIPT_EXPORT bool SetR8(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR8D();
SCRIPT_EXPORT bool SetR8D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR8W();
SCRIPT_EXPORT bool SetR8W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR8B();
SCRIPT_EXPORT bool SetR8B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR9();
SCRIPT_EXPORT bool SetR9(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR9D();
SCRIPT_EXPORT bool SetR9D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR9W();
SCRIPT_EXPORT bool SetR9W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR9B();
SCRIPT_EXPORT bool SetR9B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR10();
SCRIPT_EXPORT bool SetR10(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR10D();
SCRIPT_EXPORT bool SetR10D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR10W();
SCRIPT_EXPORT bool SetR10W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR10B();
SCRIPT_EXPORT bool SetR10B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR11();
SCRIPT_EXPORT bool SetR11(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR11D();
SCRIPT_EXPORT bool SetR11D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR11W();
SCRIPT_EXPORT bool SetR11W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR11B();
SCRIPT_EXPORT bool SetR11B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR12();
SCRIPT_EXPORT bool SetR12(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR12D();
SCRIPT_EXPORT bool SetR12D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR12W();
SCRIPT_EXPORT bool SetR12W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR12B();
SCRIPT_EXPORT bool SetR12B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR13();
SCRIPT_EXPORT bool SetR13(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR13D();
SCRIPT_EXPORT bool SetR13D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR13W();
SCRIPT_EXPORT bool SetR13W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR13B();
SCRIPT_EXPORT bool SetR13B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR14();
SCRIPT_EXPORT bool SetR14(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR14D();
SCRIPT_EXPORT bool SetR14D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR14W();
SCRIPT_EXPORT bool SetR14W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR14B();
SCRIPT_EXPORT bool SetR14B(unsigned char value);
SCRIPT_EXPORT unsigned long long GetR15();
SCRIPT_EXPORT bool SetR15(unsigned long long value);
SCRIPT_EXPORT unsigned int GetR15D();
SCRIPT_EXPORT bool SetR15D(unsigned int value);
SCRIPT_EXPORT unsigned short GetR15W();
SCRIPT_EXPORT bool SetR15W(unsigned short value);
SCRIPT_EXPORT unsigned char GetR15B();
SCRIPT_EXPORT bool SetR15B(unsigned char value);
#endif //_WIN64
};
};
#endif //_SCRIPT_API_H

View File

@ -1058,7 +1058,7 @@ static uint getregister(int* size, const char* string)
\param value The new register value.
\return true if the register was set, false otherwise.
*/
static bool setregister(const char* string, uint value)
bool setregister(const char* string, uint value)
{
if(scmp(string, "eax"))
return SetContextDataEx(hActiveThread, UE_EAX, value & 0xFFFFFFFF);

View File

@ -19,5 +19,6 @@ unsigned short valx87statuswordfieldfromstring(uint statusword, const char* stri
unsigned short valx87controlwordfieldfromstring(uint controlword, const char* string);
uint valfileoffsettova(const char* modname, uint offset);
uint valvatofileoffset(uint va);
bool setregister(const char* string, uint value);
#endif // _VALUE_H

View File

@ -51,6 +51,7 @@
<ClCompile Include="patternfind.cpp" />
<ClCompile Include="plugin_loader.cpp" />
<ClCompile Include="reference.cpp" />
<ClCompile Include="_scriptapi.cpp" />
<ClCompile Include="simplescript.cpp" />
<ClCompile Include="stackinfo.cpp" />
<ClCompile Include="stringformat.cpp" />
@ -118,6 +119,7 @@
<ClInclude Include="patternfind.h" />
<ClInclude Include="plugin_loader.h" />
<ClInclude Include="reference.h" />
<ClInclude Include="_scriptapi.h" />
<ClInclude Include="simplescript.h" />
<ClInclude Include="stackinfo.h" />
<ClInclude Include="stringformat.h" />

View File

@ -219,6 +219,9 @@
<ClCompile Include="expressionparser.cpp">
<Filter>Source Files\Core</Filter>
</ClCompile>
<ClCompile Include="_scriptapi.cpp">
<Filter>Source Files\Interfaces/Exports</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="x64_dbg.h">
@ -518,5 +521,8 @@
<ClInclude Include="expressionparser.h">
<Filter>Header Files\Core</Filter>
</ClInclude>
<ClInclude Include="_scriptapi.h">
<Filter>Header Files\Interfaces/Exports</Filter>
</ClInclude>
</ItemGroup>
</Project>