#ifndef _SCRIPTAPI_MISC_H
#define _SCRIPTAPI_MISC_H
#include "_scriptapi.h"
namespace Script
{
namespace Misc
{
///
/// Evaluates an expression and returns the result. Analagous to using the Command field in x64dbg.
///
/// Expressions can consist of memory locations, registers, flags, API names, labels, symbols, variables etc.
///
/// Example: bool success = ParseExpression("[esp+8]", &val)
///
/// The expression to evaluate.
/// The result of the expression.
/// True on success, False on failure.
SCRIPT_EXPORT bool ParseExpression(const char* expression, duint* value);
///
/// Returns the address of a function in the debuggee's memory space.
///
/// Example: duint addr = RemoteGetProcAddress("kernel32.dll", "GetProcAddress")
///
/// The name of the module.
/// The name of the function.
/// The address of the function in the debuggee.
SCRIPT_EXPORT duint RemoteGetProcAddress(const char* module, const char* api);
///
/// Returns the address for a label created in the disassembly window.
///
/// Example: duint addr = ResolveLabel("sneaky_crypto")
///
/// The name of the label to resolve.
/// The memory address for the label.
SCRIPT_EXPORT duint ResolveLabel(const char* label);
///
/// Allocates the requested number of bytes from x64dbg's default process heap.
///
/// Note: this allocation is in the debugger, not the debuggee.
///
/// Memory allocated using this function should be Free'd after use.
///
/// Example: void* addr = Alloc(0x100000)
///
/// Number of bytes to allocate.
/// A pointer to the newly allocated memory.
SCRIPT_EXPORT void* Alloc(duint size);
///
/// Frees memory previously allocated by Alloc.
///
/// Example: Free(addr)
///
/// Pointer returned by Alloc.
/// Nothing.
SCRIPT_EXPORT void Free(void* ptr);
}; //Misc
}; //Script
#endif //_SCRIPTAPI_MISC_H