language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
C++
x64dbg-development/src/dbg/main.cpp
/** @file main.cpp @brief Implements the main class. */ #include "debugger.h" extern "C" DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { if(fdwReason == DLL_PROCESS_ATTACH) { hInst = hinstDLL; // Get program directory strcpy_s(szUserDir,...
C++
x64dbg-development/src/dbg/memory.cpp
/** @file memory.cpp @brief Implements the memory class. */ #include "memory.h" #include "debugger.h" #include "patches.h" #include "threading.h" #include "thread.h" #include "module.h" #include "taskthread.h" #include "value.h" #define PAGE_SHIFT (12) //#define PAGE_SIZE (4096) #define...
C/C++
x64dbg-development/src/dbg/memory.h
#ifndef _MEMORY_H #define _MEMORY_H #include "_global.h" #include "patternfind.h" struct SimplePage; void MemUpdateMap(); void MemUpdateMapAsync(); duint MemFindBaseAddr(duint Address, duint* Size = nullptr, bool Refresh = false, bool FindReserved = false); bool MemoryReadSafePage(HANDLE hProcess, LPVOID lpBaseAddres...
C++
x64dbg-development/src/dbg/mnemonichelp.cpp
#include "mnemonichelp.h" #include "threading.h" #include <atomic> #include "jansson/jansson_x64dbg.h" #include "debugger.h" #include "filehelper.h" static std::unordered_map<String, String> MnemonicMap; static std::unordered_map<String, String> MnemonicBriefMap; static std::atomic<bool> isMnemonicLoaded(false); stati...
C/C++
x64dbg-development/src/dbg/mnemonichelp.h
#pragma once #include "_global.h" class MnemonicHelp { public: static String getUniversalMnemonic(const String & mnem); static String getDescription(const char* mnem, int depth = 0); static String getBriefDescription(const char* mnem); };
C++
x64dbg-development/src/dbg/module.cpp
#include "module.h" #include "TitanEngine/TitanEngine.h" #include "ntdll/ntdll.h" #include "threading.h" #include "symbolinfo.h" #include "murmurhash.h" #include "symbolsourcedia.h" #include "memory.h" #include "label.h" #include <algorithm> #include <shlwapi.h> #include "console.h" #include "debugger.h" #include "valu...
C/C++
x64dbg-development/src/dbg/module.h
#ifndef _MODULE_H #define _MODULE_H #include "_global.h" #include <functional> #include "symbolsourcebase.h" // Macros to safely access IMAGE_NT_HEADERS fields since the compile-time typedef of this struct may not match the actual file bitness. // Never access OptionalHeader.xx values directly unless they have the s...
C++
x64dbg-development/src/dbg/msgqueue.cpp
#include "msgqueue.h" // Allocate a message stack MESSAGE_STACK* MsgAllocStack() { return new MESSAGE_STACK(); } // Free a message stack void MsgFreeStack(MESSAGE_STACK* Stack) { ASSERT_NONNULL(Stack); // Update termination variable Stack->Destroy = true; // Notify each thread for(int i = 0;...
C/C++
x64dbg-development/src/dbg/msgqueue.h
#ifndef _MSGQUEUE_H #define _MSGQUEUE_H #include "_global.h" #include <agents.h> #define MAX_MESSAGES 256 // Message structure struct MESSAGE { int msg = -1; duint param1 = 0; duint param2 = 0; }; // Message stack structure class MESSAGE_STACK { public: Concurrency::unbounded_buffer<MESSAGE> msgs; ...
C++
x64dbg-development/src/dbg/murmurhash.cpp
//----------------------------------------------------------------------------- // MurmurHash3 was written by Austin Appleby, and is placed in the public // domain. The author hereby disclaims copyright to this source code. // Note - The x86 and x64 versions do _not_ produce the same results, as the // algorithms are ...
C/C++
x64dbg-development/src/dbg/murmurhash.h
//----------------------------------------------------------------------------- // MurmurHash3 was written by Austin Appleby, and is placed in the public // domain. The author hereby disclaims copyright to this source code. #ifndef _MURMURHASH3_H_ #define _MURMURHASH3_H_ //--------------------------------------------...
C++
x64dbg-development/src/dbg/patches.cpp
/** @file patches.cpp @brief Implements the patches class. */ #include "patches.h" #include "memory.h" #include "debugger.h" #include "threading.h" #include "module.h" static std::unordered_map<duint, PATCHINFO> patches; static std::unordered_map<DWORD, size_t> lastEnumSize; bool PatchSet(duint Address, unsigned...
C/C++
x64dbg-development/src/dbg/patches.h
#ifndef _PATCHES_H #define _PATCHES_H #include "_global.h" //casted to bridgemain.h:DBGPATCHINFO in _dbgfunctions.cpp struct PATCHINFO { char mod[MAX_MODULE_SIZE]; duint addr; unsigned char oldbyte; unsigned char newbyte; }; bool PatchSet(duint Address, unsigned char OldByte, unsigned char NewByte); ...
C++
x64dbg-development/src/dbg/patternfind.cpp
#include "patternfind.h" #include <vector> #include <algorithm> using namespace std; static inline bool isHex(char ch) { return (ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f'); } static inline string formathexpattern(const string & patterntext) { string result; int len = ...
C/C++
x64dbg-development/src/dbg/patternfind.h
#ifndef _PATTERNFIND_H #define _PATTERNFIND_H #include <vector> #include <string> struct PatternByte { struct PatternNibble { unsigned char data; bool wildcard; } nibble[2]; }; //returns: offset to data when found, -1 when not found size_t patternfind( const unsigned char* data, //dat...
C++
x64dbg-development/src/dbg/pdbdiafile.cpp
#include "_global.h" #include <comutil.h> #include <windows.h> #include <thread> #include <atomic> #include <mutex> #include <algorithm> #include "msdia/dia2.h" #include "msdia/cvConst.h" #include "msdia/diacreate.h" #include "pdbdiafile.h" #include "stringutils.h" #include "console.h" #include "LLVMDemangle/LLVMDema...
C/C++
x64dbg-development/src/dbg/pdbdiafile.h
#pragma once #include "PDBDiaTypes.h" #include <vector> #include <map> #include <string> #include <set> #include <unordered_set> #include <unordered_map> #include <atomic> struct IDiaDataSource; struct IDiaSession; struct IDiaSymbol; class PDBDiaFile { public: struct Query_t { std::function<bool(Dia...
C/C++
x64dbg-development/src/dbg/pdbdiatypes.h
#ifndef PDBDIATYPES_H_ #define PDBDIATYPES_H_ #pragma once #include <string> #include <stdint.h> #include <set> #include <vector> #include <deque> #include <map> #include <windows.h> #include <functional> #include <string> enum class DiaSymbolType { ANY = -1, FUNCTION = 0, CODE, DATA, LABEL, T...
C++
x64dbg-development/src/dbg/plugin_loader.cpp
/** @file plugin_loader.cpp @brief Implements the plugin loader. */ #include "plugin_loader.h" #include "console.h" #include "debugger.h" #include "threading.h" #include "expressionfunctions.h" #include "formatfunctions.h" #include <algorithm> #include <shlwapi.h> /** \brief List of plugins. */ static std::vector...
C/C++
x64dbg-development/src/dbg/plugin_loader.h
#ifndef _PLUGIN_LOADER_H #define _PLUGIN_LOADER_H #include "_global.h" #include "_plugins.h" //typedefs typedef bool (*PLUGINIT)(PLUG_INITSTRUCT* initStruct); typedef bool (*PLUGSTOP)(); typedef void (*PLUGSETUP)(PLUG_SETUPSTRUCT* setupStruct); //structures struct PLUG_MENU { int pluginHandle; //plugin handle ...
C++
x64dbg-development/src/dbg/reference.cpp
/** @file reference.cpp @brief Implements the reference class. */ #include "reference.h" #include "memory.h" #include "console.h" #include "module.h" #include "threading.h" /** @brief RefFind Find reference to the buffer by a given criterion. @param Address The base address of the buffer @param Size The size of t...
C/C++
x64dbg-development/src/dbg/reference.h
#ifndef _REFERENCE_H #define _REFERENCE_H #include "_global.h" #include "disasm_fast.h" #include <functional> struct REFINFO { int refcount; void* userinfo; const char* name; }; typedef enum { CURRENT_REGION, CURRENT_MODULE, ALL_MODULES, USER_MODULES, SYSTEM_MODULES } REFFINDTYPE; //...
Text
x64dbg-development/src/dbg/script_commands.txt
odbgscript commands: general purpose: $result $result_1 $result_2 $result_3 $result_4 $version **eval refresh *var *varlist *help assembly: *asm *asmtxt **exec ende *opcode preop automation: an **cmt *dbh *dbs key ***lbl **lc **lclr opendump opentrace tc breakpoints: *bc *bd *bp bpcnd *bpd ***bpgoto *bphwc *bphws b...
C/C++
x64dbg-development/src/dbg/serializablemap.h
#ifndef _SERIALIZABLEMAP_H #define _SERIALIZABLEMAP_H #include "_global.h" #include "threading.h" #include "module.h" #include "memory.h" #include "jansson/jansson_x64dbg.h" template<class TValue> class JSONWrapper { public: virtual ~JSONWrapper() { } void SetJson(JSON json) { mJson = jso...
C++
x64dbg-development/src/dbg/simplescript.cpp
/** @file simplescript.cpp @brief Implements the simplescript class. */ #include "simplescript.h" #include "console.h" #include "variable.h" #include "debugger.h" #include "filehelper.h" #include <thread> enum CMDRESULT { STATUS_ERROR = false, STATUS_CONTINUE = true, STATUS_EXIT = 2, STATUS_PAUSE ...
C/C++
x64dbg-development/src/dbg/simplescript.h
#ifndef _SIMPLESCRIPT_H #define _SIMPLESCRIPT_H #include "command.h" //structures struct SCRIPTBP { int line; bool silent; //do not show in GUI }; struct LINEMAPENTRY { SCRIPTLINETYPE type; char raw[256]; union { char command[256]; SCRIPTBRANCH branch; char label[256];...
C++
x64dbg-development/src/dbg/stackinfo.cpp
/** @file stackinfo.cpp @brief Implements the stackinfo class. */ #include "stackinfo.h" #include "memory.h" #include "disasm_helper.h" #include "disasm_fast.h" #include "_exports.h" #include "module.h" #include "thread.h" #include "threading.h" #include "exhandlerinfo.h" #include "symbolinfo.h" #include "debugger...
C/C++
x64dbg-development/src/dbg/stackinfo.h
#ifndef _STACKINFO_H #define _STACKINFO_H #include "_global.h" struct CALLSTACKENTRY { duint addr; duint from; duint to; char comment[MAX_COMMENT_SIZE]; }; struct CALLSTACK { int total; CALLSTACKENTRY* entries; }; void stackupdateseh(); bool stackcommentget(duint addr, STACK_COMMENT* comment...
C++
x64dbg-development/src/dbg/stringformat.cpp
#include "stringformat.h" #include "value.h" #include "symbolinfo.h" #include "module.h" #include "disasm_fast.h" #include "disasm_helper.h" #include "formatfunctions.h" #include "expressionparser.h" enum class StringValueType { Unknown, Default, // hex or string SignedDecimal, UnsignedDecimal, Hex...
C/C++
x64dbg-development/src/dbg/stringformat.h
#ifndef _STRINGFORMAT_H #define _STRINGFORMAT_H #include "_global.h" typedef const char* FormatValueType; typedef std::vector<FormatValueType> FormatValueVector; String stringformat(String format, const FormatValueVector & values); String stringformatinline(String format); #endif //_STRINGFORMAT_H
C++
x64dbg-development/src/dbg/stringutils.cpp
#include "stringutils.h" #include <windows.h> #include <cstdint> static inline bool convertLongLongNumber(const char* str, unsigned long long & result, int radix) { errno = 0; char* end; result = strtoull(str, &end, radix); if(!result && end == str) return false; if(result == ULLONG_MAX && ...
C/C++
x64dbg-development/src/dbg/stringutils.h
#ifndef _STRINGUTILS_H #define _STRINGUTILS_H #include <string> #include <vector> #include <sstream> #include <iomanip> typedef std::string String; typedef std::wstring WString; typedef std::vector<String> StringList; typedef std::vector<WString> WStringList; class StringUtils { public: static void Split(const S...
C++
x64dbg-development/src/dbg/symbolinfo.cpp
/** @file symbolinfo.cpp @brief Implements the symbolinfo class. */ #include "symbolinfo.h" #include "debugger.h" #include "console.h" #include "module.h" #include "addrinfo.h" #include "dbghelp_safe.h" #include "exception.h" #include "ntdll/ntdll.h" #include "WinInet-Downloader/downslib.h" #include <shlwapi.h> duin...
C/C++
x64dbg-development/src/dbg/symbolinfo.h
#pragma once #include "_global.h" extern duint symbolDownloadingBase; bool SymEnum(duint Base, CBSYMBOLENUM EnumCallback, void* UserData, duint BeginRva, duint EndRva, unsigned int SymbolMask); bool SymGetModuleList(std::vector<SYMBOLMODULEINFO>* List); void SymUpdateModuleList(); bool SymDownloadSymbol(duint Base, ...
C++
x64dbg-development/src/dbg/symbolsourcebase.cpp
#include "symbolsourcebase.h" #include <algorithm> bool NameIndex::findByPrefix(const std::vector<NameIndex> & byName, const std::string & prefix, const std::function<bool(const NameIndex &)> & cbFound, bool caseSensitive) { struct PrefixCmp { PrefixCmp(size_t n) : n(n) { } bool operator()(con...
C/C++
x64dbg-development/src/dbg/symbolsourcebase.h
#ifndef _SYMBOLSOURCEBASE_H_ #define _SYMBOLSOURCEBASE_H_ #include "_global.h" #include <stdint.h> #include <vector> #include <functional> #include <map> #include <algorithm> //http://en.cppreference.com/w/cpp/algorithm/lower_bound template<class ForwardIt, class T, class Compare = std::less<>> static ForwardIt bina...
C++
x64dbg-development/src/dbg/symbolsourcedia.cpp
#include "symbolsourcedia.h" #include "console.h" #include "debugger.h" #include <algorithm> SymbolSourceDIA::SymbolSourceDIA() : _isOpen(false), _requiresShutdown(false), _loadCounter(0), _imageBase(0), _imageSize(0) { } SymbolSourceDIA::~SymbolSourceDIA() { SymbolSourceDIA::cancelLoa...
C/C++
x64dbg-development/src/dbg/symbolsourcedia.h
#ifndef _SYMBOLSOURCEDIA_H_ #define _SYMBOLSOURCEDIA_H_ #include "_global.h" #include "pdbdiafile.h" #include "symbolsourcebase.h" #include <thread> #include <atomic> #include <mutex> class SymbolSourceDIA : public SymbolSourceBase { struct CachedLineInfo { uint32 rva; uint32 lineNumber; ...
C/C++
x64dbg-development/src/dbg/symbolundecorator.h
#pragma once /* MIT License Copyright (c) 2018 Duncan Ogilvie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, m...
C/C++
x64dbg-development/src/dbg/syscalls.h
#pragma once #include <ntdll/ntdll.h> // https://github.com/x64dbg/ScyllaHide/blob/6817d32581b7a420322f34e36b1a1c8c3e4b434c/Scylla/Win32kSyscalls.h /* * The tables below were generated for each OS version using a modified version of wscg64 (https://github.com/hfiref0x/SyscallTables). * They were then converted to ...
C/C++
x64dbg-development/src/dbg/taskthread.h
#ifndef _TASKTHREAD_H #define _TASKTHREAD_H #include "_global.h" #include <thread> #include <tuple> #include <type_traits> #include <utility> const size_t TASK_THREAD_DEFAULT_SLEEP_TIME = 100; template <typename F, typename... Args> class TaskThread_ { protected: F fn; std::tuple<Args...> args; bool acti...
C++
x64dbg-development/src/dbg/tcpconnections.cpp
#include <WS2tcpip.h> #undef _WIN32_WINNT #undef WINVER #undef _WIN32_IE #include "tcpconnections.h" #include "IPHlpApi.h" static const char* TcpStateToString(DWORD State) { switch(State) { case MIB_TCP_STATE_CLOSED: return "CLOSED"; case MIB_TCP_STATE_LISTEN: return "LISTEN"; case ...
C/C++
x64dbg-development/src/dbg/tcpconnections.h
#pragma once #include "_global.h" #include "_dbgfunctions.h" bool TcpEnumConnections(duint pid, std::vector<TCPCONNECTIONINFO> & connections);
C++
x64dbg-development/src/dbg/thread.cpp
/** @file thread.cpp @brief Implements the thread class. */ #include "thread.h" #include "memory.h" #include "threading.h" #include "ntdll/ntdll.h" #include "debugger.h" static std::unordered_map<DWORD, THREADINFO> threadList; static std::unordered_map<DWORD, THREADWAITREASON> threadWaitReasons; // Function poin...
C/C++
x64dbg-development/src/dbg/thread.h
#ifndef _THREAD_H #define _THREAD_H #include "_global.h" #include "ntdll/ntdll.h" void ThreadCreate(CREATE_THREAD_DEBUG_INFO* CreateThread); void ThreadExit(DWORD ThreadId); void ThreadClear(); int ThreadGetCount(); void ThreadGetList(THREADLIST* list); void ThreadGetList(std::vector<THREADINFO> & list); bool ThreadG...
C++
x64dbg-development/src/dbg/threading.cpp
#include <ntstatus.h> #include "threading.h" static HANDLE waitArray[WAITID_LAST]; void waitclear() { for(int i = 0; i < WAITID_LAST; i++) unlock((WAIT_ID)i); } void wait(WAIT_ID id) { WaitForSingleObject(waitArray[id], INFINITE); } bool waitfor(WAIT_ID id, unsigned int Milliseconds) { return Wa...
C/C++
x64dbg-development/src/dbg/threading.h
#ifndef _THREADING_H #define _THREADING_H #include "_global.h" enum WAIT_ID { WAITID_RUN, WAITID_LAST }; //functions void waitclear(); void wait(WAIT_ID id); bool waitfor(WAIT_ID id, unsigned int Milliseconds); void lock(WAIT_ID id); void unlock(WAIT_ID id); bool waitislocked(WAIT_ID id); void waitinitialize...
C++
x64dbg-development/src/dbg/TraceRecord.cpp
#include "TraceRecord.h" #include "module.h" #include "memory.h" #include "threading.h" #include "thread.h" #include "disasm_helper.h" #include "disasm_fast.h" #include "plugin_loader.h" #include "stringformat.h" #include "value.h" #define MAX_INSTRUCTIONS_TRACED_FULL_REG_DUMP 512 TraceRecordManager TraceRecord; Tra...
C/C++
x64dbg-development/src/dbg/TraceRecord.h
#ifndef TRACERECORD_H #define TRACERECORD_H #include "_global.h" #include "_dbgfunctions.h" #include "debugger.h" #include "jansson/jansson_x64dbg.h" #include <zydis_wrapper.h> class TraceRecordManager { public: enum TraceRecordByteType { InstructionBody = 0, InstructionHeading = 1, Ins...
C++
x64dbg-development/src/dbg/types.cpp
#include "types.h" #include "stringutils.h" #include "threading.h" #include "filehelper.h" #include "console.h" #include "jansson/jansson_x64dbg.h" #include <algorithm> using namespace Types; static TypeManager typeManager; TypeManager::TypeManager() { auto p = [this](const std::string & n, Primitive p, int size...
C/C++
x64dbg-development/src/dbg/types.h
#pragma once #include <string> #include <vector> #include <unordered_map> namespace Types { enum Primitive { Void, Int8, Uint8, Int16, Uint16, Int32, Uint32, Int64, Uint64, Dsint, Duint, Float, Double, ...
C++
x64dbg-development/src/dbg/typesparser.cpp
#include "types.h" #include "console.h" using namespace Types; #include "btparser/btparser/lexer.h" void LoadModel(const std::string & owner, Model & model); bool ParseTypes(const std::string & parse, const std::string & owner) { Lexer lexer; lexer.SetInputData(parse); std::vector<Lexer::TokenState> tok...
C++
x64dbg-development/src/dbg/value.cpp
/** @file value.cpp @brief Implements the value class. */ #include "value.h" #include "variable.h" #include "debugger.h" #include "console.h" #include "memory.h" #include "symbolinfo.h" #include "module.h" #include "label.h" #include "expressionparser.h" #include "function.h" #include "threading.h" #include "Trace...
C/C++
x64dbg-development/src/dbg/value.h
#ifndef _VALUE_H #define _VALUE_H #include "_global.h" //functions bool valuesignedcalc(); void valuesetsignedcalc(bool a); bool valapifromstring(const char* name, duint* value, bool silent); bool convertNumber(const char* str, duint & result, int radix); bool convertLongLongNumber(const char* str, unsigned long long...
C++
x64dbg-development/src/dbg/variable.cpp
/** @file variable.cpp @brief Implements the variable class. */ #include "variable.h" #include "threading.h" #include <map> /** \brief The container that stores all variables. */ std::map<String, VAR, CaseInsensitiveCompare> variables; /** \brief Sets a variable with a value. \param [in,out] Var The variable to ...
C/C++
x64dbg-development/src/dbg/variable.h
#ifndef _VARIABLE_H #define _VARIABLE_H #include "_global.h" //enums enum VAR_TYPE { VAR_SYSTEM = 1, VAR_USER = 2, VAR_READONLY = 3, VAR_HIDDEN = 4 }; enum VAR_VALUE_TYPE { VAR_UINT, VAR_STRING, }; //structures struct VAR_VALUE { union { duint value = 0; std::vector<u...
C++
x64dbg-development/src/dbg/watch.cpp
#include "watch.h" #include "console.h" #include "threading.h" #include "debugger.h" #include "taskthread.h" #include <Windows.h> std::map<unsigned int, WatchExpr*> watchexpr; unsigned int idCounter = 1; WatchExpr::WatchExpr(const char* name, const char* expression, WATCHVARTYPE type) : expr(expression), have...
C/C++
x64dbg-development/src/dbg/watch.h
#pragma once #include "_global.h" #include "jansson/jansson_x64dbg.h" #include "expressionparser.h" #include <map> class WatchExpr { protected: char WatchName[MAX_WATCH_NAME_SIZE]; ExpressionParser expr; WATCHDOGMODE watchdogMode; bool haveCurrValue; WATCHVARTYPE varType; duint currValue; // l...
C++
x64dbg-development/src/dbg/x64dbg.cpp
/** @file x64dbg.cpp @brief Implements the 64 debug class. */ #include "_global.h" #include "command.h" #include "variable.h" #include "debugger.h" #include "simplescript.h" #include "console.h" #include "x64dbg.h" #include "msgqueue.h" #include "threading.h" #include "watch.h" #include "plugin_loader.h" #include ...
C/C++
x64dbg-development/src/dbg/x64dbg.h
#pragma once #include "_global.h" #ifdef __cplusplus extern "C" { #endif DLL_EXPORT const char* _dbg_dbginit(); DLL_EXPORT bool _dbg_dbgcmdexec(const char* cmd); DLL_EXPORT bool _dbg_dbgcmddirectexec(const char* cmd); DLL_EXPORT void _dbg_dbgexitsignal(); #ifdef __cplusplus } #endif bool dbgisstopped();
Visual C++ Project
x64dbg-development/src/dbg/x64dbg_dbg.vcxproj
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> ...
x64dbg-development/src/dbg/x64dbg_dbg.vcxproj.filters
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Source Files"> <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx<...
C++
x64dbg-development/src/dbg/xrefs.cpp
#include "xrefs.h" #include "addrinfo.h" struct XREFSINFO : AddrInfo { XREFTYPE type = XREF_NONE; std::unordered_map<duint, XREF_RECORD> references; }; struct XrefSerializer : AddrInfoSerializer<XREFSINFO> { bool Save(const XREFSINFO & value) override { AddrInfoSerializer::Save(value); ...
C/C++
x64dbg-development/src/dbg/xrefs.h
#ifndef _XREFS_H #define _XREFS_H #include "_global.h" #include "jansson/jansson_x64dbg.h" bool XrefAdd(duint Address, duint From); duint XrefAddMulti(const XREF_EDGE* Edges, duint Count); bool XrefGet(duint Address, XREF_INFO* List); duint XrefGetCount(duint Address); XREFTYPE XrefGetType(duint Address); bool XrefDe...
C++
x64dbg-development/src/dbg/_dbgfunctions.cpp
/** @file _dbgfunctions.cpp @brief Implements the dbgfunctions class. */ #include "_global.h" #include "_dbgfunctions.h" #include "assemble.h" #include "debugger.h" #include "jit.h" #include "patches.h" #include "memory.h" #include "disasm_fast.h" #include "stackinfo.h" #include "symbolinfo.h" #include "module.h" ...
C/C++
x64dbg-development/src/dbg/_dbgfunctions.h
#ifndef _DBGFUNCTIONS_H #define _DBGFUNCTIONS_H #ifndef __cplusplus #include <stdbool.h> #endif typedef struct { char mod[MAX_MODULE_SIZE]; duint addr; unsigned char oldbyte; unsigned char newbyte; } DBGPATCHINFO; typedef struct { duint addr; duint from; duint to; char comment[MAX_COM...
C++
x64dbg-development/src/dbg/_exports.cpp
/** @file _exports.cpp @brief Implements the exports class. */ #include "_exports.h" #include "memory.h" #include "debugger.h" #include "value.h" #include "threading.h" #include "breakpoint.h" #include "disasm_helper.h" #include "simplescript.h" #include "symbolinfo.h" #include "assemble.h" #include "stackinfo.h" ...
C/C++
x64dbg-development/src/dbg/_exports.h
#ifndef _EXPORTS_H #define _EXPORTS_H #include "_global.h" #ifdef __cplusplus extern "C" { #endif DLL_EXPORT duint _dbg_memfindbaseaddr(duint addr, duint* size); DLL_EXPORT bool _dbg_memread(duint addr, unsigned char* dest, duint size, duint* read); DLL_EXPORT bool _dbg_memwrite(duint addr, const unsigned char* src,...
C++
x64dbg-development/src/dbg/_global.cpp
/** \file _global.cpp \brief Implements the global class. */ #include "_global.h" #include <objbase.h> #include <shlobj.h> #include <psapi.h> #include "DeviceNameResolver/DeviceNameResolver.h" /** \brief x64dbg library instance. */ HINSTANCE hInst; /** \brief Number of allocated buffers by emalloc(). This should be ...
C/C++
x64dbg-development/src/dbg/_global.h
#pragma once #ifdef _WIN64 #define _WIN32_WINNT 0x0502 // XP x64 is version 5.2 #else #define _WIN32_WINNT 0x0501 #endif #ifdef WINVER // Overwrite WINVER if given on command line #undef WINVER #endif #define WINVER _WIN32_WINNT #define _WIN32_IE 0x0500 // Allow including Windows.h without bringing in a redefined a...
C++
x64dbg-development/src/dbg/_plugins.cpp
/** @file _plugins.cpp @brief Implements the plugins class. */ #include "_plugins.h" #include "plugin_loader.h" #include "console.h" #include "debugger.h" #include "threading.h" #include "murmurhash.h" ///debugger plugin exports (wrappers) PLUG_IMPEXP void _plugin_registercallback(int pluginHandle, CBTYPE cbType,...
C/C++
x64dbg-development/src/dbg/_plugins.h
#ifndef _PLUGINS_H #define _PLUGINS_H #ifndef __cplusplus #include <stdbool.h> #endif #ifndef PLUG_IMPEXP #ifdef BUILD_DBG #define PLUG_IMPEXP __declspec(dllexport) #else #define PLUG_IMPEXP __declspec(dllimport) #endif //BUILD_DBG #endif //PLUG_IMPEXP #include "_plugin_types.h" //default structure alignments force...
C/C++
x64dbg-development/src/dbg/_plugin_types.h
#ifndef _PLUGIN_DATA_H #define _PLUGIN_DATA_H #ifdef BUILD_DBG #include "_global.h" #include "jansson/jansson.h" #pragma warning(push) #pragma warning(disable:4091) #include <dbghelp.h> #pragma warning(pop) #else #ifdef __GNUC__ #include "dbghelp/dbghelp.h" #else #pragma warning(push) #pragma warning(disable:4091) ...
C/C++
x64dbg-development/src/dbg/_scriptapi.h
#ifndef _SCRIPT_API_H #define _SCRIPT_API_H #include "_plugins.h" #define SCRIPT_EXPORT PLUG_IMPEXP #endif //_SCRIPT_API_H
C++
x64dbg-development/src/dbg/_scriptapi_argument.cpp
#include "_scriptapi_argument.h" #include "_scriptapi_module.h" #include "argument.h" SCRIPT_EXPORT bool Script::Argument::Add(duint start, duint end, bool manual, duint instructionCount) { return ArgumentAdd(start, end, manual, instructionCount); } SCRIPT_EXPORT bool Script::Argument::Add(const ArgumentInfo* inf...
C/C++
x64dbg-development/src/dbg/_scriptapi_argument.h
#ifndef _SCRIPTAPI_ARGUMENT_H #define _SCRIPTAPI_ARGUMENT_H #include "_scriptapi.h" namespace Script { namespace Argument { struct ArgumentInfo { char mod[MAX_MODULE_SIZE]; duint rvaStart; duint rvaEnd; bool manual; duint instructionc...
C++
x64dbg-development/src/dbg/_scriptapi_assembler.cpp
#include "_scriptapi_assembler.h" #include "assemble.h" SCRIPT_EXPORT bool Script::Assembler::Assemble(duint addr, unsigned char* dest, int* size, const char* instruction) { return assemble(addr, dest, size, instruction, nullptr); } SCRIPT_EXPORT bool Script::Assembler::AssembleEx(duint addr, unsigned char* dest,...
C/C++
x64dbg-development/src/dbg/_scriptapi_assembler.h
#ifndef _SCRIPTAPI_ASSEMBLER_H #define _SCRIPTAPI_ASSEMBLER_H #include "_scriptapi.h" namespace Script { namespace Assembler { SCRIPT_EXPORT bool Assemble(duint addr, unsigned char* dest, int* size, const char* instruction); //dest[16] SCRIPT_EXPORT bool AssembleEx(duint addr, unsigned char* d...
C++
x64dbg-development/src/dbg/_scriptapi_bookmark.cpp
#include "_scriptapi_bookmark.h" #include "_scriptapi_module.h" #include "bookmark.h" SCRIPT_EXPORT bool Script::Bookmark::Set(duint addr, bool manual) { return BookmarkSet(addr, manual); } SCRIPT_EXPORT bool Script::Bookmark::Set(const BookmarkInfo* info) { if(!info) return false; auto base = Mod...
C/C++
x64dbg-development/src/dbg/_scriptapi_bookmark.h
#ifndef _SCRIPTAPI_BOOKMARK_H #define _SCRIPTAPI_BOOKMARK_H #include "_scriptapi.h" namespace Script { namespace Bookmark { struct BookmarkInfo { char mod[MAX_MODULE_SIZE]; duint rva; bool manual; }; SCRIPT_EXPORT bool Set(duint addr, bool m...
C++
x64dbg-development/src/dbg/_scriptapi_comment.cpp
#include "_scriptapi_comment.h" #include "_scriptapi_module.h" #include "comment.h" SCRIPT_EXPORT bool Script::Comment::Set(duint addr, const char* text, bool manual) { return CommentSet(addr, text, manual); } SCRIPT_EXPORT bool Script::Comment::Set(const CommentInfo* info) { if(!info) return false; ...
C/C++
x64dbg-development/src/dbg/_scriptapi_comment.h
#ifndef _SCRIPTAPI_COMMENT_H #define _SCRIPTAPI_COMMENT_H #include "_scriptapi.h" namespace Script { namespace Comment { struct CommentInfo { char mod[MAX_MODULE_SIZE]; duint rva; char text[MAX_LABEL_SIZE]; bool manual; }; SCRIPT...
C++
x64dbg-development/src/dbg/_scriptapi_debug.cpp
#include "_scriptapi_debug.h" SCRIPT_EXPORT void Script::Debug::Wait() { _plugin_waituntilpaused(); } SCRIPT_EXPORT void Script::Debug::Run() { if(DbgCmdExecDirect("run")) Wait(); } SCRIPT_EXPORT void Script::Debug::Pause() { if(DbgCmdExecDirect("pause")) Wait(); } SCRIPT_EXPORT void Scr...
C/C++
x64dbg-development/src/dbg/_scriptapi_debug.h
#ifndef _SCRIPTAPI_DEBUG_H #define _SCRIPTAPI_DEBUG_H #include "_scriptapi.h" namespace Script { namespace Debug { enum HardwareType { HardwareAccess, HardwareWrite, HardwareExecute }; SCRIPT_EXPORT void Wait(); SCRIPT_EXPORT void Ru...
C++
x64dbg-development/src/dbg/_scriptapi_flag.cpp
#include "_scriptapi_flag.h" #include "value.h" static const char* flagTable[] = { "_ZF", "_OF", "_CF", "_PF", "_SF", "_TF", "_AF", "_DF", "_IF" }; SCRIPT_EXPORT bool Script::Flag::Get(FlagEnum flag) { duint value; return valfromstring(flagTable[flag], &value) ? !!value : f...
C/C++
x64dbg-development/src/dbg/_scriptapi_flag.h
#ifndef _SCRIPTAPI_FLAG_H #define _SCRIPTAPI_FLAG_H #include "_scriptapi.h" namespace Script { namespace Flag { enum FlagEnum { ZF, OF, CF, PF, SF, TF, AF, DF, IF }; SCR...
C++
x64dbg-development/src/dbg/_scriptapi_function.cpp
#include "_scriptapi_function.h" #include "_scriptapi_module.h" #include "function.h" SCRIPT_EXPORT bool Script::Function::Add(duint start, duint end, bool manual, duint instructionCount) { return FunctionAdd(start, end, manual, instructionCount); } SCRIPT_EXPORT bool Script::Function::Add(const FunctionInfo* inf...
C/C++
x64dbg-development/src/dbg/_scriptapi_function.h
#ifndef _SCRIPTAPI_FUNCTION_H #define _SCRIPTAPI_FUNCTION_H #include "_scriptapi.h" namespace Script { namespace Function { struct FunctionInfo { char mod[MAX_MODULE_SIZE]; duint rvaStart; duint rvaEnd; bool manual; duint instructionc...
C++
x64dbg-development/src/dbg/_scriptapi_gui.cpp
#include "_scriptapi_gui.h" #include "_scriptapi_misc.h" SCRIPT_EXPORT bool Script::Gui::Disassembly::SelectionGet(duint* start, duint* end) { return Gui::SelectionGet(DisassemblyWindow, start, end); } SCRIPT_EXPORT bool Script::Gui::Disassembly::SelectionSet(duint start, duint end) { return Gui::SelectionSet...
C/C++
x64dbg-development/src/dbg/_scriptapi_gui.h
#ifndef _SCRIPTAPI_GUI_H #define _SCRIPTAPI_GUI_H #include "_scriptapi.h" namespace Script { namespace Gui { namespace Disassembly { SCRIPT_EXPORT bool SelectionGet(duint* start, duint* end); SCRIPT_EXPORT bool SelectionSet(duint start, duint end); SCRIPT_EX...
C++
x64dbg-development/src/dbg/_scriptapi_label.cpp
#include "_scriptapi_label.h" #include "_scriptapi_module.h" #include "label.h" SCRIPT_EXPORT bool Script::Label::Set(duint addr, const char* text, bool manual) { return LabelSet(addr, text, manual); } SCRIPT_EXPORT bool Script::Label::Set(duint addr, const char* text, bool manual, bool temporary) { return La...
C/C++
x64dbg-development/src/dbg/_scriptapi_label.h
#ifndef _SCRIPTAPI_LABEL_H #define _SCRIPTAPI_LABEL_H #include "_scriptapi.h" namespace Script { namespace Label { struct LabelInfo { char mod[MAX_MODULE_SIZE]; duint rva; char text[MAX_LABEL_SIZE]; bool manual; }; SCRIPT_EXPORT ...
C++
x64dbg-development/src/dbg/_scriptapi_memory.cpp
#include "_scriptapi_memory.h" #include "memory.h" #include "threading.h" SCRIPT_EXPORT bool Script::Memory::Read(duint addr, void* data, duint size, duint* sizeRead) { return MemRead(addr, data, size, sizeRead); } SCRIPT_EXPORT bool Script::Memory::Write(duint addr, const void* data, duint size, duint* sizeWritt...
C/C++
x64dbg-development/src/dbg/_scriptapi_memory.h
#ifndef _SCRIPTAPI_MEMORY_H #define _SCRIPTAPI_MEMORY_H #include "_scriptapi.h" namespace Script { 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); SC...
C++
x64dbg-development/src/dbg/_scriptapi_misc.cpp
#include "_scriptapi_misc.h" #include "value.h" SCRIPT_EXPORT bool Script::Misc::ParseExpression(const char* expression, duint* value) { return valfromstring(expression, value); } SCRIPT_EXPORT duint Script::Misc::RemoteGetProcAddress(const char* module, const char* api) { duint value; if(!ParseExpression...
C/C++
x64dbg-development/src/dbg/_scriptapi_misc.h
#ifndef _SCRIPTAPI_MISC_H #define _SCRIPTAPI_MISC_H #include "_scriptapi.h" namespace Script { namespace Misc { /// <summary> /// Evaluates an expression and returns the result. Analagous to using the Command field in x64dbg. /// /// Expressions can consist of memory locations,...
C++
x64dbg-development/src/dbg/_scriptapi_module.cpp
#include "_scriptapi_module.h" #include "threading.h" #include "module.h" #include "debugger.h" SCRIPT_EXPORT bool Script::Module::InfoFromAddr(duint addr, ModuleInfo* info) { SHARED_ACQUIRE(LockModules); auto modInfo = ModInfoFromAddr(addr); if(!info || !modInfo) return false; info->base = mod...
C/C++
x64dbg-development/src/dbg/_scriptapi_module.h
#ifndef _SCRIPTAPI_MODULE_H #define _SCRIPTAPI_MODULE_H #include "_scriptapi.h" namespace Script { namespace Module { struct ModuleInfo { duint base; duint size; duint entry; int sectionCount; char name[MAX_MODULE_SIZE]; c...
C++
x64dbg-development/src/dbg/_scriptapi_pattern.cpp
#include "_scriptapi_pattern.h" #include "patternfind.h" #include "memory.h" SCRIPT_EXPORT duint Script::Pattern::Find(unsigned char* data, duint datasize, const char* pattern) { return patternfind(data, datasize, pattern); } SCRIPT_EXPORT duint Script::Pattern::FindMem(duint start, duint size, const char* patter...
C/C++
x64dbg-development/src/dbg/_scriptapi_pattern.h
#ifndef _SCRIPTAPI_PATTERN_H #define _SCRIPTAPI_PATTERN_H #include "_scriptapi.h" namespace Script { namespace Pattern { SCRIPT_EXPORT duint Find(unsigned char* data, duint datasize, const char* pattern); SCRIPT_EXPORT duint FindMem(duint start, duint size, const char* pattern); SCRIPT...