This is page 3 of 21. Use http://codebase.md/wasdubya/x64dbgmcp?lines=true&page={x} to view the full context. # Directory Structure ``` ├── build │ ├── MCPx64dbg.dp32 │ └── MCPx64dbg.dp64 ├── CMakeLists.txt ├── deps │ ├── pluginsdk │ │ ├── _dbgfunctions.h │ │ ├── _plugin_types.h │ │ ├── _plugins.h │ │ ├── _scriptapi_argument.h │ │ ├── _scriptapi_assembler.h │ │ ├── _scriptapi_bookmark.h │ │ ├── _scriptapi_comment.h │ │ ├── _scriptapi_debug.h │ │ ├── _scriptapi_flag.h │ │ ├── _scriptapi_function.h │ │ ├── _scriptapi_gui.h │ │ ├── _scriptapi_label.h │ │ ├── _scriptapi_memory.h │ │ ├── _scriptapi_misc.h │ │ ├── _scriptapi_module.h │ │ ├── _scriptapi_pattern.h │ │ ├── _scriptapi_register.h │ │ ├── _scriptapi_stack.h │ │ ├── _scriptapi_symbol.h │ │ ├── _scriptapi.h │ │ ├── bridgegraph.h │ │ ├── bridgelist.h │ │ ├── bridgemain.h │ │ ├── dbghelp │ │ │ ├── dbghelp_x64.a │ │ │ ├── dbghelp_x64.lib │ │ │ ├── dbghelp_x86.a │ │ │ ├── dbghelp_x86.lib │ │ │ └── dbghelp.h │ │ ├── DeviceNameResolver │ │ │ ├── DeviceNameResolver_x64.a │ │ │ ├── DeviceNameResolver_x64.lib │ │ │ ├── DeviceNameResolver_x86.a │ │ │ ├── DeviceNameResolver_x86.lib │ │ │ └── DeviceNameResolver.h │ │ ├── jansson │ │ │ ├── jansson_config.h │ │ │ ├── jansson_x64.a │ │ │ ├── jansson_x64.lib │ │ │ ├── jansson_x64dbg.h │ │ │ ├── jansson_x86.a │ │ │ ├── jansson_x86.lib │ │ │ └── jansson.h │ │ ├── lz4 │ │ │ ├── lz4_x64.a │ │ │ ├── lz4_x64.lib │ │ │ ├── lz4_x86.a │ │ │ ├── lz4_x86.lib │ │ │ ├── lz4.h │ │ │ ├── lz4file.h │ │ │ └── lz4hc.h │ │ ├── nlohmann │ │ │ ├── adl_serializer.hpp │ │ │ ├── byte_container_with_subtype.hpp │ │ │ ├── detail │ │ │ │ ├── abi_macros.hpp │ │ │ │ ├── conversions │ │ │ │ │ ├── from_json.hpp │ │ │ │ │ ├── to_chars.hpp │ │ │ │ │ └── to_json.hpp │ │ │ │ ├── exceptions.hpp │ │ │ │ ├── hash.hpp │ │ │ │ ├── input │ │ │ │ │ ├── binary_reader.hpp │ │ │ │ │ ├── input_adapters.hpp │ │ │ │ │ ├── json_sax.hpp │ │ │ │ │ ├── lexer.hpp │ │ │ │ │ ├── parser.hpp │ │ │ │ │ └── position_t.hpp │ │ │ │ ├── iterators │ │ │ │ │ ├── internal_iterator.hpp │ │ │ │ │ ├── iter_impl.hpp │ │ │ │ │ ├── iteration_proxy.hpp │ │ │ │ │ ├── iterator_traits.hpp │ │ │ │ │ ├── json_reverse_iterator.hpp │ │ │ │ │ └── primitive_iterator.hpp │ │ │ │ ├── json_custom_base_class.hpp │ │ │ │ ├── json_pointer.hpp │ │ │ │ ├── json_ref.hpp │ │ │ │ ├── macro_scope.hpp │ │ │ │ ├── macro_unscope.hpp │ │ │ │ ├── meta │ │ │ │ │ ├── call_std │ │ │ │ │ │ ├── begin.hpp │ │ │ │ │ │ └── end.hpp │ │ │ │ │ ├── cpp_future.hpp │ │ │ │ │ ├── detected.hpp │ │ │ │ │ ├── identity_tag.hpp │ │ │ │ │ ├── is_sax.hpp │ │ │ │ │ ├── std_fs.hpp │ │ │ │ │ ├── type_traits.hpp │ │ │ │ │ └── void_t.hpp │ │ │ │ ├── output │ │ │ │ │ ├── binary_writer.hpp │ │ │ │ │ ├── output_adapters.hpp │ │ │ │ │ └── serializer.hpp │ │ │ │ ├── string_concat.hpp │ │ │ │ ├── string_escape.hpp │ │ │ │ └── value_t.hpp │ │ │ ├── json_fwd.hpp │ │ │ ├── json.hpp │ │ │ ├── ordered_map.hpp │ │ │ └── thirdparty │ │ │ └── hedley │ │ │ ├── hedley_undef.hpp │ │ │ └── hedley.hpp │ │ ├── TitanEngine │ │ │ ├── TitanEngine_x64.a │ │ │ ├── TitanEngine_x64.lib │ │ │ ├── TitanEngine_x86.a │ │ │ ├── TitanEngine_x86.lib │ │ │ └── TitanEngine.h │ │ ├── x32bridge.lib │ │ ├── x32dbg.lib │ │ ├── x64bridge.lib │ │ ├── x64dbg.lib │ │ └── XEDParse │ │ ├── XEDParse_x64.a │ │ ├── XEDParse_x64.lib │ │ ├── XEDParse_x86.a │ │ ├── XEDParse_x86.lib │ │ └── XEDParse.h │ └── x64dbg_sdk │ └── pluginsdk │ ├── _dbgfunctions.h │ ├── _plugin_types.h │ ├── _plugins.h │ ├── _scriptapi_argument.h │ ├── _scriptapi_assembler.h │ ├── _scriptapi_bookmark.h │ ├── _scriptapi_comment.h │ ├── _scriptapi_debug.h │ ├── _scriptapi_flag.h │ ├── _scriptapi_function.h │ ├── _scriptapi_gui.h │ ├── _scriptapi_label.h │ ├── _scriptapi_memory.h │ ├── _scriptapi_misc.h │ ├── _scriptapi_module.h │ ├── _scriptapi_pattern.h │ ├── _scriptapi_register.h │ ├── _scriptapi_stack.h │ ├── _scriptapi_symbol.h │ ├── _scriptapi.h │ ├── bridgegraph.h │ ├── bridgelist.h │ ├── bridgemain.h │ ├── dbghelp │ │ ├── dbghelp_x64.a │ │ ├── dbghelp_x64.lib │ │ ├── dbghelp_x86.a │ │ ├── dbghelp_x86.lib │ │ └── dbghelp.h │ ├── DeviceNameResolver │ │ ├── DeviceNameResolver_x64.a │ │ ├── DeviceNameResolver_x64.lib │ │ ├── DeviceNameResolver_x86.a │ │ ├── DeviceNameResolver_x86.lib │ │ └── DeviceNameResolver.h │ ├── jansson │ │ ├── jansson_config.h │ │ ├── jansson_x64.a │ │ ├── jansson_x64.lib │ │ ├── jansson_x64dbg.h │ │ ├── jansson_x86.a │ │ ├── jansson_x86.lib │ │ └── jansson.h │ ├── lz4 │ │ ├── lz4_x64.a │ │ ├── lz4_x64.lib │ │ ├── lz4_x86.a │ │ ├── lz4_x86.lib │ │ ├── lz4.h │ │ ├── lz4file.h │ │ └── lz4hc.h │ ├── TitanEngine │ │ ├── TitanEngine_x64.a │ │ ├── TitanEngine_x64.lib │ │ ├── TitanEngine_x86.a │ │ ├── TitanEngine_x86.lib │ │ └── TitanEngine.h │ ├── TitanEngine_x64.a │ ├── TitanEngine_x64.lib │ ├── TitanEngine_x86.a │ ├── TitanEngine_x86.lib │ ├── TitanEngine.h │ ├── x32bridge.lib │ ├── x32dbg.lib │ ├── x64bridge.lib │ ├── x64dbg.lib │ └── XEDParse │ ├── XEDParse_x64.a │ ├── XEDParse_x64.lib │ ├── XEDParse_x86.a │ ├── XEDParse_x86.lib │ └── XEDParse.h ├── include │ └── nlohmann │ ├── adl_serializer.hpp │ ├── byte_container_with_subtype.hpp │ ├── detail │ │ ├── abi_macros.hpp │ │ ├── conversions │ │ │ ├── from_json.hpp │ │ │ ├── to_chars.hpp │ │ │ └── to_json.hpp │ │ ├── exceptions.hpp │ │ ├── hash.hpp │ │ ├── input │ │ │ ├── binary_reader.hpp │ │ │ ├── input_adapters.hpp │ │ │ ├── json_sax.hpp │ │ │ ├── lexer.hpp │ │ │ ├── parser.hpp │ │ │ └── position_t.hpp │ │ ├── iterators │ │ │ ├── internal_iterator.hpp │ │ │ ├── iter_impl.hpp │ │ │ ├── iteration_proxy.hpp │ │ │ ├── iterator_traits.hpp │ │ │ ├── json_reverse_iterator.hpp │ │ │ └── primitive_iterator.hpp │ │ ├── json_custom_base_class.hpp │ │ ├── json_pointer.hpp │ │ ├── json_ref.hpp │ │ ├── macro_scope.hpp │ │ ├── macro_unscope.hpp │ │ ├── meta │ │ │ ├── call_std │ │ │ │ ├── begin.hpp │ │ │ │ └── end.hpp │ │ │ ├── cpp_future.hpp │ │ │ ├── detected.hpp │ │ │ ├── identity_tag.hpp │ │ │ ├── is_sax.hpp │ │ │ ├── std_fs.hpp │ │ │ ├── type_traits.hpp │ │ │ └── void_t.hpp │ │ ├── output │ │ │ ├── binary_writer.hpp │ │ │ ├── output_adapters.hpp │ │ │ └── serializer.hpp │ │ ├── string_concat.hpp │ │ ├── string_escape.hpp │ │ └── value_t.hpp │ ├── json_fwd.hpp │ ├── json.hpp │ ├── ordered_map.hpp │ └── thirdparty │ └── hedley │ ├── hedley_undef.hpp │ └── hedley.hpp ├── README.md ├── Showcase.gif ├── side profile of a voxel spider walking.jpg └── src ├── MCPx64dbg.cpp └── x64dbg.py ``` # Files -------------------------------------------------------------------------------- /deps/pluginsdk/_plugins.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _PLUGINS_H 2 | #define _PLUGINS_H 3 | 4 | #ifndef __cplusplus 5 | #include <stdbool.h> 6 | #endif 7 | 8 | #ifndef PLUG_IMPEXP 9 | #ifdef BUILD_DBG 10 | #define PLUG_IMPEXP __declspec(dllexport) 11 | #else 12 | #define PLUG_IMPEXP __declspec(dllimport) 13 | #endif //BUILD_DBG 14 | #endif //PLUG_IMPEXP 15 | 16 | #include "_plugin_types.h" 17 | 18 | //default structure alignments forced 19 | #ifdef _WIN64 20 | #pragma pack(push, 16) 21 | #else //x86 22 | #pragma pack(push, 8) 23 | #endif //_WIN64 24 | 25 | //defines 26 | #define PLUG_SDKVERSION 1 27 | 28 | #define PLUG_DB_LOADSAVE_DATA 1 29 | #define PLUG_DB_LOADSAVE_ALL 2 30 | 31 | //structures 32 | typedef struct 33 | { 34 | //provided by the debugger 35 | int pluginHandle; 36 | //provided by the pluginit function 37 | int sdkVersion; 38 | int pluginVersion; 39 | char pluginName[256]; 40 | } PLUG_INITSTRUCT; 41 | 42 | typedef struct 43 | { 44 | //provided by the debugger 45 | HWND hwndDlg; //gui window handle 46 | int hMenu; //plugin menu handle 47 | int hMenuDisasm; //plugin disasm menu handle 48 | int hMenuDump; //plugin dump menu handle 49 | int hMenuStack; //plugin stack menu handle 50 | int hMenuGraph; //plugin graph menu handle 51 | int hMenuMemmap; //plugin memory map menu handle 52 | int hMenuSymmod; //plugin symbol module menu handle 53 | } PLUG_SETUPSTRUCT; 54 | 55 | typedef struct 56 | { 57 | void* data; //user data 58 | } PLUG_SCRIPTSTRUCT; 59 | 60 | //callback structures 61 | typedef struct 62 | { 63 | const char* szFileName; 64 | } PLUG_CB_INITDEBUG; 65 | 66 | typedef struct 67 | { 68 | void* reserved; 69 | } PLUG_CB_STOPDEBUG; 70 | 71 | typedef struct 72 | { 73 | void* reserved; 74 | } PLUG_CB_STOPPINGDEBUG; 75 | 76 | typedef struct 77 | { 78 | CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo; 79 | IMAGEHLP_MODULE64* modInfo; 80 | const char* DebugFileName; 81 | PROCESS_INFORMATION* fdProcessInfo; 82 | } PLUG_CB_CREATEPROCESS; 83 | 84 | typedef struct 85 | { 86 | EXIT_PROCESS_DEBUG_INFO* ExitProcess; 87 | } PLUG_CB_EXITPROCESS; 88 | 89 | typedef struct 90 | { 91 | CREATE_THREAD_DEBUG_INFO* CreateThread; 92 | DWORD dwThreadId; 93 | } PLUG_CB_CREATETHREAD; 94 | 95 | typedef struct 96 | { 97 | EXIT_THREAD_DEBUG_INFO* ExitThread; 98 | DWORD dwThreadId; 99 | } PLUG_CB_EXITTHREAD; 100 | 101 | typedef struct 102 | { 103 | void* reserved; 104 | } PLUG_CB_SYSTEMBREAKPOINT; 105 | 106 | typedef struct 107 | { 108 | LOAD_DLL_DEBUG_INFO* LoadDll; 109 | IMAGEHLP_MODULE64* modInfo; 110 | const char* modname; 111 | } PLUG_CB_LOADDLL; 112 | 113 | typedef struct 114 | { 115 | UNLOAD_DLL_DEBUG_INFO* UnloadDll; 116 | } PLUG_CB_UNLOADDLL; 117 | 118 | typedef struct 119 | { 120 | OUTPUT_DEBUG_STRING_INFO* DebugString; 121 | } PLUG_CB_OUTPUTDEBUGSTRING; 122 | 123 | typedef struct 124 | { 125 | EXCEPTION_DEBUG_INFO* Exception; 126 | } PLUG_CB_EXCEPTION; 127 | 128 | typedef struct 129 | { 130 | BRIDGEBP* breakpoint; 131 | } PLUG_CB_BREAKPOINT; 132 | 133 | typedef struct 134 | { 135 | void* reserved; 136 | } PLUG_CB_PAUSEDEBUG; 137 | 138 | typedef struct 139 | { 140 | void* reserved; 141 | } PLUG_CB_RESUMEDEBUG; 142 | 143 | typedef struct 144 | { 145 | void* reserved; 146 | } PLUG_CB_STEPPED; 147 | 148 | typedef struct 149 | { 150 | DWORD dwProcessId; 151 | } PLUG_CB_ATTACH; 152 | 153 | typedef struct 154 | { 155 | PROCESS_INFORMATION* fdProcessInfo; 156 | } PLUG_CB_DETACH; 157 | 158 | typedef struct 159 | { 160 | DEBUG_EVENT* DebugEvent; 161 | } PLUG_CB_DEBUGEVENT; 162 | 163 | typedef struct 164 | { 165 | int hEntry; 166 | } PLUG_CB_MENUENTRY; 167 | 168 | typedef struct 169 | { 170 | MSG* message; 171 | long* result; 172 | bool retval; 173 | } PLUG_CB_WINEVENT; 174 | 175 | typedef struct 176 | { 177 | MSG* message; 178 | bool retval; 179 | } PLUG_CB_WINEVENTGLOBAL; 180 | 181 | typedef struct 182 | { 183 | json_t* root; 184 | int loadSaveType; 185 | } PLUG_CB_LOADSAVEDB; 186 | 187 | typedef struct 188 | { 189 | const char* symbol; 190 | bool retval; 191 | } PLUG_CB_FILTERSYMBOL; 192 | 193 | typedef struct 194 | { 195 | duint cip; 196 | bool stop; 197 | } PLUG_CB_TRACEEXECUTE; 198 | 199 | typedef struct 200 | { 201 | int hWindow; 202 | duint VA; 203 | } PLUG_CB_SELCHANGED; 204 | 205 | typedef struct 206 | { 207 | BridgeCFGraphList graph; 208 | } PLUG_CB_ANALYZE; 209 | 210 | typedef struct 211 | { 212 | duint addr; 213 | BRIDGE_ADDRINFO* addrinfo; 214 | bool retval; 215 | } PLUG_CB_ADDRINFO; 216 | 217 | typedef struct 218 | { 219 | const char* string; 220 | duint value; 221 | int* value_size; 222 | bool* isvar; 223 | bool* hexonly; 224 | bool retval; 225 | } PLUG_CB_VALFROMSTRING; 226 | 227 | typedef struct 228 | { 229 | const char* string; 230 | duint value; 231 | bool retval; 232 | } PLUG_CB_VALTOSTRING; 233 | 234 | typedef struct 235 | { 236 | GUIMENUTYPE hMenu; 237 | } PLUG_CB_MENUPREPARE; 238 | 239 | typedef enum 240 | { 241 | ValueTypeNumber, 242 | ValueTypeString, 243 | // Types below cannot be used for values, only for registration 244 | ValueTypeAny, 245 | ValueTypeOptionalNumber, 246 | ValueTypeOptionalString, 247 | ValueTypeOptionalAny, 248 | } ValueType; 249 | 250 | typedef struct 251 | { 252 | const char* ptr; // Should be allocated with BridgeAlloc 253 | bool isOwner; // When set to true BridgeFree will be called on ptr 254 | } StringValue; 255 | 256 | typedef struct 257 | { 258 | ValueType type; 259 | duint number; 260 | StringValue string; 261 | } ExpressionValue; 262 | 263 | //enums 264 | typedef enum 265 | { 266 | CB_INITDEBUG, //PLUG_CB_INITDEBUG 267 | CB_STOPDEBUG, //PLUG_CB_STOPDEBUG 268 | CB_CREATEPROCESS, //PLUG_CB_CREATEPROCESS 269 | CB_EXITPROCESS, //PLUG_CB_EXITPROCESS 270 | CB_CREATETHREAD, //PLUG_CB_CREATETHREAD 271 | CB_EXITTHREAD, //PLUG_CB_EXITTHREAD 272 | CB_SYSTEMBREAKPOINT, //PLUG_CB_SYSTEMBREAKPOINT 273 | CB_LOADDLL, //PLUG_CB_LOADDLL 274 | CB_UNLOADDLL, //PLUG_CB_UNLOADDLL 275 | CB_OUTPUTDEBUGSTRING, //PLUG_CB_OUTPUTDEBUGSTRING 276 | CB_EXCEPTION, //PLUG_CB_EXCEPTION 277 | CB_BREAKPOINT, //PLUG_CB_BREAKPOINT 278 | CB_PAUSEDEBUG, //PLUG_CB_PAUSEDEBUG 279 | CB_RESUMEDEBUG, //PLUG_CB_RESUMEDEBUG 280 | CB_STEPPED, //PLUG_CB_STEPPED 281 | CB_ATTACH, //PLUG_CB_ATTACHED (before attaching, after CB_INITDEBUG) 282 | CB_DETACH, //PLUG_CB_DETACH (before detaching, before CB_STOPDEBUG) 283 | CB_DEBUGEVENT, //PLUG_CB_DEBUGEVENT (called on any debug event) 284 | CB_MENUENTRY, //PLUG_CB_MENUENTRY 285 | CB_WINEVENT, //PLUG_CB_WINEVENT 286 | CB_WINEVENTGLOBAL, //PLUG_CB_WINEVENTGLOBAL 287 | CB_LOADDB, //PLUG_CB_LOADSAVEDB 288 | CB_SAVEDB, //PLUG_CB_LOADSAVEDB 289 | CB_FILTERSYMBOL, //PLUG_CB_FILTERSYMBOL 290 | CB_TRACEEXECUTE, //PLUG_CB_TRACEEXECUTE 291 | CB_SELCHANGED, //PLUG_CB_SELCHANGED 292 | CB_ANALYZE, //PLUG_CB_ANALYZE 293 | CB_ADDRINFO, //PLUG_CB_ADDRINFO 294 | CB_VALFROMSTRING, //PLUG_CB_VALFROMSTRING 295 | CB_VALTOSTRING, //PLUG_CB_VALTOSTRING 296 | CB_MENUPREPARE, //PLUG_CB_MENUPREPARE 297 | CB_STOPPINGDEBUG, //PLUG_CB_STOPDEBUG 298 | CB_LAST 299 | } CBTYPE; 300 | 301 | typedef enum 302 | { 303 | FORMAT_ERROR, //generic failure (no message) 304 | FORMAT_SUCCESS, //success 305 | FORMAT_ERROR_MESSAGE, //formatting failed but an error was put in the buffer (there are always at least 511 characters available). 306 | FORMAT_BUFFER_TOO_SMALL //buffer too small (x64dbg will retry until the buffer is big enough) 307 | } FORMATRESULT; 308 | 309 | //typedefs 310 | typedef void (*CBPLUGIN)(CBTYPE cbType, void* callbackInfo); 311 | typedef bool (*CBPLUGINCOMMAND)(int argc, char** argv); 312 | typedef void (*CBPLUGINSCRIPT)(); 313 | typedef duint(*CBPLUGINEXPRFUNCTION)(int argc, const duint* argv, void* userdata); 314 | typedef bool(*CBPLUGINEXPRFUNCTIONEX)(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata); 315 | typedef FORMATRESULT(*CBPLUGINFORMATFUNCTION)(char* dest, size_t destCount, int argc, char* argv[], duint value, void* userdata); 316 | typedef bool (*CBPLUGINPREDICATE)(void* userdata); 317 | 318 | //exports 319 | #ifdef __cplusplus 320 | extern "C" 321 | { 322 | #endif 323 | 324 | PLUG_IMPEXP void _plugin_registercallback(int pluginHandle, CBTYPE cbType, CBPLUGIN cbPlugin); 325 | PLUG_IMPEXP bool _plugin_unregistercallback(int pluginHandle, CBTYPE cbType); 326 | PLUG_IMPEXP bool _plugin_registercommand(int pluginHandle, const char* command, CBPLUGINCOMMAND cbCommand, bool debugonly); 327 | PLUG_IMPEXP bool _plugin_unregistercommand(int pluginHandle, const char* command); 328 | PLUG_IMPEXP void _plugin_logprintf(const char* format, ...); 329 | PLUG_IMPEXP void _plugin_lograw_html(const char* text); 330 | PLUG_IMPEXP void _plugin_logputs(const char* text); 331 | PLUG_IMPEXP void _plugin_logprint(const char* text); 332 | PLUG_IMPEXP void _plugin_debugpause(); 333 | PLUG_IMPEXP void _plugin_debugskipexceptions(bool skip); 334 | PLUG_IMPEXP int _plugin_menuadd(int hMenu, const char* title); 335 | PLUG_IMPEXP bool _plugin_menuaddentry(int hMenu, int hEntry, const char* title); 336 | PLUG_IMPEXP bool _plugin_menuaddseparator(int hMenu); 337 | PLUG_IMPEXP bool _plugin_menuclear(int hMenu); 338 | PLUG_IMPEXP void _plugin_menuseticon(int hMenu, const ICONDATA* icon); 339 | PLUG_IMPEXP void _plugin_menuentryseticon(int pluginHandle, int hEntry, const ICONDATA* icon); 340 | PLUG_IMPEXP void _plugin_menuentrysetchecked(int pluginHandle, int hEntry, bool checked); 341 | PLUG_IMPEXP void _plugin_menusetvisible(int pluginHandle, int hMenu, bool visible); 342 | PLUG_IMPEXP void _plugin_menuentrysetvisible(int pluginHandle, int hEntry, bool visible); 343 | PLUG_IMPEXP void _plugin_menusetname(int pluginHandle, int hMenu, const char* name); 344 | PLUG_IMPEXP void _plugin_menuentrysetname(int pluginHandle, int hEntry, const char* name); 345 | PLUG_IMPEXP void _plugin_menuentrysethotkey(int pluginHandle, int hEntry, const char* hotkey); 346 | PLUG_IMPEXP bool _plugin_menuremove(int hMenu); 347 | PLUG_IMPEXP bool _plugin_menuentryremove(int pluginHandle, int hEntry); 348 | PLUG_IMPEXP void _plugin_startscript(CBPLUGINSCRIPT cbScript); 349 | PLUG_IMPEXP bool _plugin_waituntilpaused(); 350 | PLUG_IMPEXP bool _plugin_registerexprfunction(int pluginHandle, const char* name, int argc, CBPLUGINEXPRFUNCTION cbFunction, void* userdata); 351 | PLUG_IMPEXP bool _plugin_registerexprfunctionex(int pluginHandle, const char* name, ValueType returnType, const ValueType* argTypes, size_t argCount, CBPLUGINEXPRFUNCTIONEX cbFunction, void* userdata); 352 | PLUG_IMPEXP bool _plugin_unregisterexprfunction(int pluginHandle, const char* name); 353 | PLUG_IMPEXP bool _plugin_unload(const char* pluginName); 354 | PLUG_IMPEXP bool _plugin_load(const char* pluginName); 355 | PLUG_IMPEXP duint _plugin_hash(const void* data, duint size); 356 | PLUG_IMPEXP bool _plugin_registerformatfunction(int pluginHandle, const char* type, CBPLUGINFORMATFUNCTION cbFunction, void* userdata); 357 | PLUG_IMPEXP bool _plugin_unregisterformatfunction(int pluginHandle, const char* type); 358 | 359 | #ifdef __cplusplus 360 | } 361 | #endif 362 | 363 | #pragma pack(pop) 364 | 365 | #endif // _PLUGINS_H 366 | ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/_plugins.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _PLUGINS_H 2 | #define _PLUGINS_H 3 | 4 | #ifndef __cplusplus 5 | #include <stdbool.h> 6 | #endif 7 | 8 | #ifndef PLUG_IMPEXP 9 | #ifdef BUILD_DBG 10 | #define PLUG_IMPEXP __declspec(dllexport) 11 | #else 12 | #define PLUG_IMPEXP __declspec(dllimport) 13 | #endif //BUILD_DBG 14 | #endif //PLUG_IMPEXP 15 | 16 | #include "_plugin_types.h" 17 | 18 | //default structure alignments forced 19 | #ifdef _WIN64 20 | #pragma pack(push, 16) 21 | #else //x86 22 | #pragma pack(push, 8) 23 | #endif //_WIN64 24 | 25 | //defines 26 | #define PLUG_SDKVERSION 1 27 | 28 | #define PLUG_DB_LOADSAVE_DATA 1 29 | #define PLUG_DB_LOADSAVE_ALL 2 30 | 31 | //structures 32 | typedef struct 33 | { 34 | //provided by the debugger 35 | int pluginHandle; 36 | //provided by the pluginit function 37 | int sdkVersion; 38 | int pluginVersion; 39 | char pluginName[256]; 40 | } PLUG_INITSTRUCT; 41 | 42 | typedef struct 43 | { 44 | //provided by the debugger 45 | HWND hwndDlg; //gui window handle 46 | int hMenu; //plugin menu handle 47 | int hMenuDisasm; //plugin disasm menu handle 48 | int hMenuDump; //plugin dump menu handle 49 | int hMenuStack; //plugin stack menu handle 50 | int hMenuGraph; //plugin graph menu handle 51 | int hMenuMemmap; //plugin memory map menu handle 52 | int hMenuSymmod; //plugin symbol module menu handle 53 | } PLUG_SETUPSTRUCT; 54 | 55 | typedef struct 56 | { 57 | void* data; //user data 58 | } PLUG_SCRIPTSTRUCT; 59 | 60 | //callback structures 61 | typedef struct 62 | { 63 | const char* szFileName; 64 | } PLUG_CB_INITDEBUG; 65 | 66 | typedef struct 67 | { 68 | void* reserved; 69 | } PLUG_CB_STOPDEBUG; 70 | 71 | typedef struct 72 | { 73 | void* reserved; 74 | } PLUG_CB_STOPPINGDEBUG; 75 | 76 | typedef struct 77 | { 78 | CREATE_PROCESS_DEBUG_INFO* CreateProcessInfo; 79 | IMAGEHLP_MODULE64* modInfo; 80 | const char* DebugFileName; 81 | PROCESS_INFORMATION* fdProcessInfo; 82 | } PLUG_CB_CREATEPROCESS; 83 | 84 | typedef struct 85 | { 86 | EXIT_PROCESS_DEBUG_INFO* ExitProcess; 87 | } PLUG_CB_EXITPROCESS; 88 | 89 | typedef struct 90 | { 91 | CREATE_THREAD_DEBUG_INFO* CreateThread; 92 | DWORD dwThreadId; 93 | } PLUG_CB_CREATETHREAD; 94 | 95 | typedef struct 96 | { 97 | EXIT_THREAD_DEBUG_INFO* ExitThread; 98 | DWORD dwThreadId; 99 | } PLUG_CB_EXITTHREAD; 100 | 101 | typedef struct 102 | { 103 | void* reserved; 104 | } PLUG_CB_SYSTEMBREAKPOINT; 105 | 106 | typedef struct 107 | { 108 | LOAD_DLL_DEBUG_INFO* LoadDll; 109 | IMAGEHLP_MODULE64* modInfo; 110 | const char* modname; 111 | } PLUG_CB_LOADDLL; 112 | 113 | typedef struct 114 | { 115 | UNLOAD_DLL_DEBUG_INFO* UnloadDll; 116 | } PLUG_CB_UNLOADDLL; 117 | 118 | typedef struct 119 | { 120 | OUTPUT_DEBUG_STRING_INFO* DebugString; 121 | } PLUG_CB_OUTPUTDEBUGSTRING; 122 | 123 | typedef struct 124 | { 125 | EXCEPTION_DEBUG_INFO* Exception; 126 | } PLUG_CB_EXCEPTION; 127 | 128 | typedef struct 129 | { 130 | BRIDGEBP* breakpoint; 131 | } PLUG_CB_BREAKPOINT; 132 | 133 | typedef struct 134 | { 135 | void* reserved; 136 | } PLUG_CB_PAUSEDEBUG; 137 | 138 | typedef struct 139 | { 140 | void* reserved; 141 | } PLUG_CB_RESUMEDEBUG; 142 | 143 | typedef struct 144 | { 145 | void* reserved; 146 | } PLUG_CB_STEPPED; 147 | 148 | typedef struct 149 | { 150 | DWORD dwProcessId; 151 | } PLUG_CB_ATTACH; 152 | 153 | typedef struct 154 | { 155 | PROCESS_INFORMATION* fdProcessInfo; 156 | } PLUG_CB_DETACH; 157 | 158 | typedef struct 159 | { 160 | DEBUG_EVENT* DebugEvent; 161 | } PLUG_CB_DEBUGEVENT; 162 | 163 | typedef struct 164 | { 165 | int hEntry; 166 | } PLUG_CB_MENUENTRY; 167 | 168 | typedef struct 169 | { 170 | MSG* message; 171 | long* result; 172 | bool retval; 173 | } PLUG_CB_WINEVENT; 174 | 175 | typedef struct 176 | { 177 | MSG* message; 178 | bool retval; 179 | } PLUG_CB_WINEVENTGLOBAL; 180 | 181 | typedef struct 182 | { 183 | json_t* root; 184 | int loadSaveType; 185 | } PLUG_CB_LOADSAVEDB; 186 | 187 | typedef struct 188 | { 189 | const char* symbol; 190 | bool retval; 191 | } PLUG_CB_FILTERSYMBOL; 192 | 193 | typedef struct 194 | { 195 | duint cip; 196 | bool stop; 197 | } PLUG_CB_TRACEEXECUTE; 198 | 199 | typedef struct 200 | { 201 | int hWindow; 202 | duint VA; 203 | } PLUG_CB_SELCHANGED; 204 | 205 | typedef struct 206 | { 207 | BridgeCFGraphList graph; 208 | } PLUG_CB_ANALYZE; 209 | 210 | typedef struct 211 | { 212 | duint addr; 213 | BRIDGE_ADDRINFO* addrinfo; 214 | bool retval; 215 | } PLUG_CB_ADDRINFO; 216 | 217 | typedef struct 218 | { 219 | const char* string; 220 | duint value; 221 | int* value_size; 222 | bool* isvar; 223 | bool* hexonly; 224 | bool retval; 225 | } PLUG_CB_VALFROMSTRING; 226 | 227 | typedef struct 228 | { 229 | const char* string; 230 | duint value; 231 | bool retval; 232 | } PLUG_CB_VALTOSTRING; 233 | 234 | typedef struct 235 | { 236 | GUIMENUTYPE hMenu; 237 | } PLUG_CB_MENUPREPARE; 238 | 239 | typedef enum 240 | { 241 | ValueTypeNumber, 242 | ValueTypeString, 243 | // Types below cannot be used for values, only for registration 244 | ValueTypeAny, 245 | ValueTypeOptionalNumber, 246 | ValueTypeOptionalString, 247 | ValueTypeOptionalAny, 248 | } ValueType; 249 | 250 | typedef struct 251 | { 252 | const char* ptr; // Should be allocated with BridgeAlloc 253 | bool isOwner; // When set to true BridgeFree will be called on ptr 254 | } StringValue; 255 | 256 | typedef struct 257 | { 258 | ValueType type; 259 | duint number; 260 | StringValue string; 261 | } ExpressionValue; 262 | 263 | //enums 264 | typedef enum 265 | { 266 | CB_INITDEBUG, //PLUG_CB_INITDEBUG 267 | CB_STOPDEBUG, //PLUG_CB_STOPDEBUG 268 | CB_CREATEPROCESS, //PLUG_CB_CREATEPROCESS 269 | CB_EXITPROCESS, //PLUG_CB_EXITPROCESS 270 | CB_CREATETHREAD, //PLUG_CB_CREATETHREAD 271 | CB_EXITTHREAD, //PLUG_CB_EXITTHREAD 272 | CB_SYSTEMBREAKPOINT, //PLUG_CB_SYSTEMBREAKPOINT 273 | CB_LOADDLL, //PLUG_CB_LOADDLL 274 | CB_UNLOADDLL, //PLUG_CB_UNLOADDLL 275 | CB_OUTPUTDEBUGSTRING, //PLUG_CB_OUTPUTDEBUGSTRING 276 | CB_EXCEPTION, //PLUG_CB_EXCEPTION 277 | CB_BREAKPOINT, //PLUG_CB_BREAKPOINT 278 | CB_PAUSEDEBUG, //PLUG_CB_PAUSEDEBUG 279 | CB_RESUMEDEBUG, //PLUG_CB_RESUMEDEBUG 280 | CB_STEPPED, //PLUG_CB_STEPPED 281 | CB_ATTACH, //PLUG_CB_ATTACHED (before attaching, after CB_INITDEBUG) 282 | CB_DETACH, //PLUG_CB_DETACH (before detaching, before CB_STOPDEBUG) 283 | CB_DEBUGEVENT, //PLUG_CB_DEBUGEVENT (called on any debug event) 284 | CB_MENUENTRY, //PLUG_CB_MENUENTRY 285 | CB_WINEVENT, //PLUG_CB_WINEVENT 286 | CB_WINEVENTGLOBAL, //PLUG_CB_WINEVENTGLOBAL 287 | CB_LOADDB, //PLUG_CB_LOADSAVEDB 288 | CB_SAVEDB, //PLUG_CB_LOADSAVEDB 289 | CB_FILTERSYMBOL, //PLUG_CB_FILTERSYMBOL 290 | CB_TRACEEXECUTE, //PLUG_CB_TRACEEXECUTE 291 | CB_SELCHANGED, //PLUG_CB_SELCHANGED 292 | CB_ANALYZE, //PLUG_CB_ANALYZE 293 | CB_ADDRINFO, //PLUG_CB_ADDRINFO 294 | CB_VALFROMSTRING, //PLUG_CB_VALFROMSTRING 295 | CB_VALTOSTRING, //PLUG_CB_VALTOSTRING 296 | CB_MENUPREPARE, //PLUG_CB_MENUPREPARE 297 | CB_STOPPINGDEBUG, //PLUG_CB_STOPDEBUG 298 | CB_LAST 299 | } CBTYPE; 300 | 301 | typedef enum 302 | { 303 | FORMAT_ERROR, //generic failure (no message) 304 | FORMAT_SUCCESS, //success 305 | FORMAT_ERROR_MESSAGE, //formatting failed but an error was put in the buffer (there are always at least 511 characters available). 306 | FORMAT_BUFFER_TOO_SMALL //buffer too small (x64dbg will retry until the buffer is big enough) 307 | } FORMATRESULT; 308 | 309 | //typedefs 310 | typedef void (*CBPLUGIN)(CBTYPE cbType, void* callbackInfo); 311 | typedef bool (*CBPLUGINCOMMAND)(int argc, char** argv); 312 | typedef void (*CBPLUGINSCRIPT)(); 313 | typedef duint(*CBPLUGINEXPRFUNCTION)(int argc, const duint* argv, void* userdata); 314 | typedef bool(*CBPLUGINEXPRFUNCTIONEX)(ExpressionValue* result, int argc, const ExpressionValue* argv, void* userdata); 315 | typedef FORMATRESULT(*CBPLUGINFORMATFUNCTION)(char* dest, size_t destCount, int argc, char* argv[], duint value, void* userdata); 316 | typedef bool (*CBPLUGINPREDICATE)(void* userdata); 317 | 318 | //exports 319 | #ifdef __cplusplus 320 | extern "C" 321 | { 322 | #endif 323 | 324 | PLUG_IMPEXP void _plugin_registercallback(int pluginHandle, CBTYPE cbType, CBPLUGIN cbPlugin); 325 | PLUG_IMPEXP bool _plugin_unregistercallback(int pluginHandle, CBTYPE cbType); 326 | PLUG_IMPEXP bool _plugin_registercommand(int pluginHandle, const char* command, CBPLUGINCOMMAND cbCommand, bool debugonly); 327 | PLUG_IMPEXP bool _plugin_unregistercommand(int pluginHandle, const char* command); 328 | PLUG_IMPEXP void _plugin_logprintf(const char* format, ...); 329 | PLUG_IMPEXP void _plugin_lograw_html(const char* text); 330 | PLUG_IMPEXP void _plugin_logputs(const char* text); 331 | PLUG_IMPEXP void _plugin_logprint(const char* text); 332 | PLUG_IMPEXP void _plugin_debugpause(); 333 | PLUG_IMPEXP void _plugin_debugskipexceptions(bool skip); 334 | PLUG_IMPEXP int _plugin_menuadd(int hMenu, const char* title); 335 | PLUG_IMPEXP bool _plugin_menuaddentry(int hMenu, int hEntry, const char* title); 336 | PLUG_IMPEXP bool _plugin_menuaddseparator(int hMenu); 337 | PLUG_IMPEXP bool _plugin_menuclear(int hMenu); 338 | PLUG_IMPEXP void _plugin_menuseticon(int hMenu, const ICONDATA* icon); 339 | PLUG_IMPEXP void _plugin_menuentryseticon(int pluginHandle, int hEntry, const ICONDATA* icon); 340 | PLUG_IMPEXP void _plugin_menuentrysetchecked(int pluginHandle, int hEntry, bool checked); 341 | PLUG_IMPEXP void _plugin_menusetvisible(int pluginHandle, int hMenu, bool visible); 342 | PLUG_IMPEXP void _plugin_menuentrysetvisible(int pluginHandle, int hEntry, bool visible); 343 | PLUG_IMPEXP void _plugin_menusetname(int pluginHandle, int hMenu, const char* name); 344 | PLUG_IMPEXP void _plugin_menuentrysetname(int pluginHandle, int hEntry, const char* name); 345 | PLUG_IMPEXP void _plugin_menuentrysethotkey(int pluginHandle, int hEntry, const char* hotkey); 346 | PLUG_IMPEXP bool _plugin_menuremove(int hMenu); 347 | PLUG_IMPEXP bool _plugin_menuentryremove(int pluginHandle, int hEntry); 348 | PLUG_IMPEXP void _plugin_startscript(CBPLUGINSCRIPT cbScript); 349 | PLUG_IMPEXP bool _plugin_waituntilpaused(); 350 | PLUG_IMPEXP bool _plugin_registerexprfunction(int pluginHandle, const char* name, int argc, CBPLUGINEXPRFUNCTION cbFunction, void* userdata); 351 | PLUG_IMPEXP bool _plugin_registerexprfunctionex(int pluginHandle, const char* name, ValueType returnType, const ValueType* argTypes, size_t argCount, CBPLUGINEXPRFUNCTIONEX cbFunction, void* userdata); 352 | PLUG_IMPEXP bool _plugin_unregisterexprfunction(int pluginHandle, const char* name); 353 | PLUG_IMPEXP bool _plugin_unload(const char* pluginName); 354 | PLUG_IMPEXP bool _plugin_load(const char* pluginName); 355 | PLUG_IMPEXP duint _plugin_hash(const void* data, duint size); 356 | PLUG_IMPEXP bool _plugin_registerformatfunction(int pluginHandle, const char* type, CBPLUGINFORMATFUNCTION cbFunction, void* userdata); 357 | PLUG_IMPEXP bool _plugin_unregisterformatfunction(int pluginHandle, const char* type); 358 | 359 | #ifdef __cplusplus 360 | } 361 | #endif 362 | 363 | #pragma pack(pop) 364 | 365 | #endif // _PLUGINS_H 366 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/_dbgfunctions.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _DBGFUNCTIONS_H 2 | #define _DBGFUNCTIONS_H 3 | 4 | #ifndef __cplusplus 5 | #include <stdbool.h> 6 | #else 7 | #include <string> 8 | #endif 9 | 10 | typedef struct 11 | { 12 | char mod[MAX_MODULE_SIZE]; 13 | duint addr; 14 | unsigned char oldbyte; 15 | unsigned char newbyte; 16 | } DBGPATCHINFO; 17 | 18 | typedef struct 19 | { 20 | duint addr; 21 | duint from; 22 | duint to; 23 | char comment[MAX_COMMENT_SIZE]; 24 | } DBGCALLSTACKENTRY; 25 | 26 | typedef struct 27 | { 28 | int total; 29 | DBGCALLSTACKENTRY* entries; 30 | } DBGCALLSTACK; 31 | 32 | typedef struct 33 | { 34 | duint addr; 35 | duint handler; 36 | } DBGSEHRECORD; 37 | 38 | typedef struct 39 | { 40 | duint total; 41 | DBGSEHRECORD* records; 42 | } DBGSEHCHAIN; 43 | 44 | typedef struct 45 | { 46 | DWORD dwProcessId; 47 | char szExeFile[MAX_PATH]; 48 | char szExeMainWindowTitle[MAX_PATH]; 49 | char szExeArgs[MAX_COMMAND_LINE_SIZE]; 50 | } DBGPROCESSINFO; 51 | 52 | typedef struct 53 | { 54 | DWORD rva; 55 | BYTE type; 56 | WORD size; 57 | } DBGRELOCATIONINFO; 58 | 59 | typedef enum 60 | { 61 | InstructionBody = 0, 62 | InstructionHeading = 1, 63 | InstructionTailing = 2, 64 | InstructionOverlapped = 3, // The byte was executed with differing instruction base addresses 65 | DataByte, // This and the following is not implemented yet. 66 | DataWord, 67 | DataDWord, 68 | DataQWord, 69 | DataFloat, 70 | DataDouble, 71 | DataLongDouble, 72 | DataXMM, 73 | DataYMM, 74 | DataMMX, 75 | DataMixed, //the byte is accessed in multiple ways 76 | InstructionDataMixed //the byte is both executed and written 77 | } TRACERECORDBYTETYPE; 78 | 79 | typedef enum 80 | { 81 | TraceRecordNone, 82 | TraceRecordBitExec, 83 | TraceRecordByteWithExecTypeAndCounter, 84 | TraceRecordWordWithExecTypeAndCounter 85 | } TRACERECORDTYPE; 86 | 87 | typedef struct 88 | { 89 | duint Handle; 90 | unsigned char TypeNumber; 91 | unsigned int GrantedAccess; 92 | } HANDLEINFO; 93 | 94 | // The longest ip address is 1234:6789:1234:6789:1234:6789:123.567.901.345 (46 bytes) 95 | #define TCP_ADDR_SIZE 50 96 | 97 | typedef struct 98 | { 99 | char RemoteAddress[TCP_ADDR_SIZE]; 100 | unsigned short RemotePort; 101 | char LocalAddress[TCP_ADDR_SIZE]; 102 | unsigned short LocalPort; 103 | char StateText[TCP_ADDR_SIZE]; 104 | unsigned int State; 105 | } TCPCONNECTIONINFO; 106 | 107 | typedef struct 108 | { 109 | duint handle; 110 | duint parent; 111 | DWORD threadId; 112 | DWORD style; 113 | DWORD styleEx; 114 | duint wndProc; 115 | bool enabled; 116 | RECT position; 117 | char windowTitle[MAX_COMMENT_SIZE]; 118 | char windowClass[MAX_COMMENT_SIZE]; 119 | } WINDOW_INFO; 120 | 121 | typedef struct 122 | { 123 | duint addr; 124 | duint size; 125 | duint flags; 126 | } HEAPINFO; 127 | 128 | typedef struct 129 | { 130 | const char* name; 131 | duint value; 132 | } CONSTANTINFO; 133 | 134 | typedef enum 135 | { 136 | MODSYMUNLOADED = 0, 137 | MODSYMLOADING, 138 | MODSYMLOADED 139 | } MODULESYMBOLSTATUS; 140 | 141 | typedef enum 142 | { 143 | bpf_type, // number (read-only, BPXTYPE) 144 | bpf_offset, // number (read-only) 145 | bpf_address, // number (read-only) 146 | bpf_enabled, // number (bool) 147 | bpf_singleshoot, // number (bool) 148 | bpf_active, // number (read-only) 149 | bpf_silent, // number (bool) 150 | bpf_typeex, // number (read-only, BPHWTYPE/BPMEMTYPE/BPDLLTYPE/BPEXTYPE) 151 | bpf_hwsize, // number (read-only, BPHWSIZE) 152 | bpf_hwslot, // number (read-only) 153 | bpf_oldbytes, // number (read-only, uint16_t) 154 | bpf_fastresume, // number (bool) 155 | bpf_hitcount, // number 156 | bpf_module, // text (read-only) 157 | bpf_name, // text 158 | bpf_breakcondition, // text 159 | bpf_logtext, // text 160 | bpf_logcondition, // text 161 | bpf_commandtext, // text 162 | bpf_commandcondition, // text 163 | bpf_logfile, // text 164 | } BP_FIELD; 165 | 166 | // An instance of this structure represents a reference to a breakpoint. 167 | // Use DbgFunctions()->BpRefXxx() list/create references. 168 | // Use DbgFunctions()->BpXxx() to manipulate breakpoints with the references. 169 | struct BP_REF 170 | { 171 | BPXTYPE type; 172 | duint module; 173 | duint offset; 174 | 175 | // C++ helper functions 176 | #ifdef __cplusplus 177 | bool GetField(BP_FIELD field, duint & value); 178 | bool GetField(BP_FIELD field, bool & value); 179 | bool SetField(BP_FIELD field, duint value); 180 | bool GetField(BP_FIELD field, std::string & value); 181 | bool SetField(BP_FIELD field, const std::string & value); 182 | 183 | template<class T, typename = typename std::enable_if< std::is_enum<T>::value, T >::type> 184 | void GetField(BP_FIELD field, T & value) 185 | { 186 | duint n = 0; 187 | GetField(field, n); 188 | value = (T)n; 189 | } 190 | #endif // __cplusplus 191 | }; 192 | 193 | typedef struct BP_REF BP_REF; 194 | 195 | typedef void(*CBSTRING)(const char* str, void* userdata); 196 | 197 | //The list of all the DbgFunctions() return value. 198 | //WARNING: This list is append only. Do not insert things in the middle or plugins would break. 199 | typedef struct DBGFUNCTIONS_ 200 | { 201 | bool (*AssembleAtEx)(duint addr, const char* instruction, char* error, bool fillnop); 202 | bool (*SectionFromAddr)(duint addr, char* section); 203 | bool (*ModNameFromAddr)(duint addr, char* modname, bool extension); 204 | duint(*ModBaseFromAddr)(duint addr); 205 | duint(*ModBaseFromName)(const char* modname); 206 | duint(*ModSizeFromAddr)(duint addr); 207 | bool (*Assemble)(duint addr, unsigned char* dest, int* size, const char* instruction, char* error); 208 | bool (*PatchGet)(duint addr); 209 | bool (*PatchInRange)(duint start, duint end); 210 | bool (*MemPatch)(duint va, const unsigned char* src, duint size); 211 | void (*PatchRestoreRange)(duint start, duint end); 212 | bool (*PatchEnum)(DBGPATCHINFO* patchlist, size_t* cbsize); 213 | bool (*PatchRestore)(duint addr); 214 | int (*PatchFile)(DBGPATCHINFO* patchlist, int count, const char* szFileName, char* error); 215 | int (*ModPathFromAddr)(duint addr, char* path, int size); 216 | int (*ModPathFromName)(const char* modname, char* path, int size); 217 | bool (*DisasmFast)(const unsigned char* data, duint addr, BASIC_INSTRUCTION_INFO* basicinfo); 218 | void (*MemUpdateMap)(); 219 | void (*GetCallStack)(DBGCALLSTACK* callstack); 220 | void (*GetSEHChain)(DBGSEHCHAIN* sehchain); 221 | void (*SymbolDownloadAllSymbols)(const char* szSymbolStore); 222 | bool (*GetJitAuto)(bool* jitauto); 223 | bool (*GetJit)(char* jit, bool x64); 224 | bool (*GetDefJit)(char* defjit); 225 | bool (*GetProcessList)(DBGPROCESSINFO** entries, int* count); 226 | bool (*GetPageRights)(duint addr, char* rights); 227 | bool (*SetPageRights)(duint addr, const char* rights); 228 | bool (*PageRightsToString)(DWORD protect, char* rights); 229 | bool (*IsProcessElevated)(); 230 | bool (*GetCmdline)(char* cmdline, size_t* cbsize); 231 | bool (*SetCmdline)(const char* cmdline); 232 | duint(*FileOffsetToVa)(const char* modname, duint offset); 233 | duint(*VaToFileOffset)(duint va); 234 | duint(*GetAddrFromLine)(const char* szSourceFile, int line, duint* displacement); 235 | bool (*GetSourceFromAddr)(duint addr, char* szSourceFile, int* line); 236 | bool (*ValFromString)(const char* string, duint* value); 237 | bool (*PatchGetEx)(duint addr, DBGPATCHINFO* info); 238 | bool (*GetBridgeBp)(BPXTYPE type, duint addr, BRIDGEBP* bp); 239 | bool (*StringFormatInline)(const char* format, size_t resultSize, char* result); 240 | void (*GetMnemonicBrief)(const char* mnem, size_t resultSize, char* result); 241 | unsigned int (*GetTraceRecordHitCount)(duint address); 242 | TRACERECORDBYTETYPE(*GetTraceRecordByteType)(duint address); 243 | bool (*SetTraceRecordType)(duint pageAddress, TRACERECORDTYPE type); 244 | TRACERECORDTYPE(*GetTraceRecordType)(duint pageAddress); 245 | bool (*EnumHandles)(ListOf(HANDLEINFO) handles); 246 | bool (*GetHandleName)(duint handle, char* name, size_t nameSize, char* typeName, size_t typeNameSize); 247 | bool (*EnumTcpConnections)(ListOf(TCPCONNECTIONINFO) connections); 248 | duint(*GetDbgEvents)(); 249 | MODULEPARTY(*ModGetParty)(duint base); 250 | void (*ModSetParty)(duint base, MODULEPARTY party); 251 | bool (*WatchIsWatchdogTriggered)(unsigned int id); 252 | bool (*MemIsCodePage)(duint addr, bool refresh); 253 | bool (*AnimateCommand)(const char* command); 254 | void (*DbgSetDebuggeeInitScript)(const char* fileName); 255 | const char* (*DbgGetDebuggeeInitScript)(); 256 | bool (*EnumWindows)(ListOf(WINDOW_INFO) windows); 257 | bool (*EnumHeaps)(ListOf(HEAPINFO) heaps); 258 | bool (*ThreadGetName)(DWORD tid, char* name); 259 | bool (*IsDepEnabled)(); 260 | void (*GetCallStackEx)(DBGCALLSTACK* callstack, bool cache); 261 | bool (*GetUserComment)(duint addr, char* comment); 262 | void (*EnumConstants)(ListOf(CONSTANTINFO) constants); 263 | void (*EnumErrorCodes)(ListOf(CONSTANTINFO) constants); 264 | void (*EnumExceptions)(ListOf(CONSTANTINFO) constants); 265 | duint(*MemBpSize)(duint addr); 266 | bool (*ModRelocationsFromAddr)(duint addr, ListOf(DBGRELOCATIONINFO) relocations); 267 | bool (*ModRelocationAtAddr)(duint addr, DBGRELOCATIONINFO* relocation); 268 | bool (*ModRelocationsInRange)(duint addr, duint size, ListOf(DBGRELOCATIONINFO) relocations); 269 | duint(*DbGetHash)(); 270 | int (*SymAutoComplete)(const char* Search, char** Buffer, int MaxSymbols); 271 | void (*RefreshModuleList)(); 272 | duint(*GetAddrFromLineEx)(duint mod, const char* szSourceFile, int line); 273 | MODULESYMBOLSTATUS(*ModSymbolStatus)(duint mod); 274 | void (*GetCallStackByThread)(HANDLE thread, DBGCALLSTACK* callstack); 275 | void (*EnumStructs)(CBSTRING callback, void* userdata); 276 | BP_REF* (*BpRefList)(duint* count); 277 | bool (*BpRefVa)(BP_REF* ref, BPXTYPE type, duint va); 278 | bool (*BpRefRva)(BP_REF* ref, BPXTYPE type, const char* module, duint rva); 279 | void (*BpRefDll)(BP_REF* ref, const char* module); 280 | void (*BpRefException)(BP_REF* ref, unsigned int code); 281 | bool (*BpRefExists)(const BP_REF* ref); 282 | bool (*BpGetFieldNumber)(const BP_REF* ref, BP_FIELD field, duint* value); 283 | bool (*BpSetFieldNumber)(const BP_REF* ref, BP_FIELD field, duint value); 284 | bool (*BpGetFieldText)(const BP_REF* ref, BP_FIELD field, CBSTRING callback, void* userdata); 285 | bool (*BpSetFieldText)(const BP_REF* ref, BP_FIELD field, const char* value); 286 | } DBGFUNCTIONS; 287 | 288 | #ifdef __cplusplus 289 | inline bool BP_REF::GetField(BP_FIELD field, duint & value) 290 | { 291 | return DbgFunctions()->BpGetFieldNumber(this, field, &value); 292 | } 293 | 294 | inline bool BP_REF::GetField(BP_FIELD field, bool & value) 295 | { 296 | duint n = 0; 297 | if(!DbgFunctions()->BpGetFieldNumber(this, field, &n)) 298 | return false; 299 | value = !!n; 300 | return true; 301 | } 302 | 303 | inline bool BP_REF::SetField(BP_FIELD field, duint value) 304 | { 305 | return DbgFunctions()->BpSetFieldNumber(this, field, value); 306 | } 307 | 308 | inline bool BP_REF::GetField(BP_FIELD field, std::string & value) 309 | { 310 | return DbgFunctions()->BpGetFieldText(this, field, [](const char* str, void* userdata) 311 | { 312 | *(std::string*)userdata = str; 313 | }, &value); 314 | } 315 | 316 | inline bool BP_REF::SetField(BP_FIELD field, const std::string & value) 317 | { 318 | return DbgFunctions()->BpSetFieldText(this, field, value.c_str()); 319 | } 320 | #endif // __cplusplus 321 | 322 | #ifdef BUILD_DBG 323 | 324 | const DBGFUNCTIONS* dbgfunctionsget(); 325 | void dbgfunctionsinit(); 326 | 327 | #endif //BUILD_DBG 328 | 329 | #endif //_DBGFUNCTIONS_H 330 | ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/_dbgfunctions.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _DBGFUNCTIONS_H 2 | #define _DBGFUNCTIONS_H 3 | 4 | #ifndef __cplusplus 5 | #include <stdbool.h> 6 | #else 7 | #include <string> 8 | #endif 9 | 10 | typedef struct 11 | { 12 | char mod[MAX_MODULE_SIZE]; 13 | duint addr; 14 | unsigned char oldbyte; 15 | unsigned char newbyte; 16 | } DBGPATCHINFO; 17 | 18 | typedef struct 19 | { 20 | duint addr; 21 | duint from; 22 | duint to; 23 | char comment[MAX_COMMENT_SIZE]; 24 | } DBGCALLSTACKENTRY; 25 | 26 | typedef struct 27 | { 28 | int total; 29 | DBGCALLSTACKENTRY* entries; 30 | } DBGCALLSTACK; 31 | 32 | typedef struct 33 | { 34 | duint addr; 35 | duint handler; 36 | } DBGSEHRECORD; 37 | 38 | typedef struct 39 | { 40 | duint total; 41 | DBGSEHRECORD* records; 42 | } DBGSEHCHAIN; 43 | 44 | typedef struct 45 | { 46 | DWORD dwProcessId; 47 | char szExeFile[MAX_PATH]; 48 | char szExeMainWindowTitle[MAX_PATH]; 49 | char szExeArgs[MAX_COMMAND_LINE_SIZE]; 50 | } DBGPROCESSINFO; 51 | 52 | typedef struct 53 | { 54 | DWORD rva; 55 | BYTE type; 56 | WORD size; 57 | } DBGRELOCATIONINFO; 58 | 59 | typedef enum 60 | { 61 | InstructionBody = 0, 62 | InstructionHeading = 1, 63 | InstructionTailing = 2, 64 | InstructionOverlapped = 3, // The byte was executed with differing instruction base addresses 65 | DataByte, // This and the following is not implemented yet. 66 | DataWord, 67 | DataDWord, 68 | DataQWord, 69 | DataFloat, 70 | DataDouble, 71 | DataLongDouble, 72 | DataXMM, 73 | DataYMM, 74 | DataMMX, 75 | DataMixed, //the byte is accessed in multiple ways 76 | InstructionDataMixed //the byte is both executed and written 77 | } TRACERECORDBYTETYPE; 78 | 79 | typedef enum 80 | { 81 | TraceRecordNone, 82 | TraceRecordBitExec, 83 | TraceRecordByteWithExecTypeAndCounter, 84 | TraceRecordWordWithExecTypeAndCounter 85 | } TRACERECORDTYPE; 86 | 87 | typedef struct 88 | { 89 | duint Handle; 90 | unsigned char TypeNumber; 91 | unsigned int GrantedAccess; 92 | } HANDLEINFO; 93 | 94 | // The longest ip address is 1234:6789:1234:6789:1234:6789:123.567.901.345 (46 bytes) 95 | #define TCP_ADDR_SIZE 50 96 | 97 | typedef struct 98 | { 99 | char RemoteAddress[TCP_ADDR_SIZE]; 100 | unsigned short RemotePort; 101 | char LocalAddress[TCP_ADDR_SIZE]; 102 | unsigned short LocalPort; 103 | char StateText[TCP_ADDR_SIZE]; 104 | unsigned int State; 105 | } TCPCONNECTIONINFO; 106 | 107 | typedef struct 108 | { 109 | duint handle; 110 | duint parent; 111 | DWORD threadId; 112 | DWORD style; 113 | DWORD styleEx; 114 | duint wndProc; 115 | bool enabled; 116 | RECT position; 117 | char windowTitle[MAX_COMMENT_SIZE]; 118 | char windowClass[MAX_COMMENT_SIZE]; 119 | } WINDOW_INFO; 120 | 121 | typedef struct 122 | { 123 | duint addr; 124 | duint size; 125 | duint flags; 126 | } HEAPINFO; 127 | 128 | typedef struct 129 | { 130 | const char* name; 131 | duint value; 132 | } CONSTANTINFO; 133 | 134 | typedef enum 135 | { 136 | MODSYMUNLOADED = 0, 137 | MODSYMLOADING, 138 | MODSYMLOADED 139 | } MODULESYMBOLSTATUS; 140 | 141 | typedef enum 142 | { 143 | bpf_type, // number (read-only, BPXTYPE) 144 | bpf_offset, // number (read-only) 145 | bpf_address, // number (read-only) 146 | bpf_enabled, // number (bool) 147 | bpf_singleshoot, // number (bool) 148 | bpf_active, // number (read-only) 149 | bpf_silent, // number (bool) 150 | bpf_typeex, // number (read-only, BPHWTYPE/BPMEMTYPE/BPDLLTYPE/BPEXTYPE) 151 | bpf_hwsize, // number (read-only, BPHWSIZE) 152 | bpf_hwslot, // number (read-only) 153 | bpf_oldbytes, // number (read-only, uint16_t) 154 | bpf_fastresume, // number (bool) 155 | bpf_hitcount, // number 156 | bpf_module, // text (read-only) 157 | bpf_name, // text 158 | bpf_breakcondition, // text 159 | bpf_logtext, // text 160 | bpf_logcondition, // text 161 | bpf_commandtext, // text 162 | bpf_commandcondition, // text 163 | bpf_logfile, // text 164 | } BP_FIELD; 165 | 166 | // An instance of this structure represents a reference to a breakpoint. 167 | // Use DbgFunctions()->BpRefXxx() list/create references. 168 | // Use DbgFunctions()->BpXxx() to manipulate breakpoints with the references. 169 | struct BP_REF 170 | { 171 | BPXTYPE type; 172 | duint module; 173 | duint offset; 174 | 175 | // C++ helper functions 176 | #ifdef __cplusplus 177 | bool GetField(BP_FIELD field, duint & value); 178 | bool GetField(BP_FIELD field, bool & value); 179 | bool SetField(BP_FIELD field, duint value); 180 | bool GetField(BP_FIELD field, std::string & value); 181 | bool SetField(BP_FIELD field, const std::string & value); 182 | 183 | template<class T, typename = typename std::enable_if< std::is_enum<T>::value, T >::type> 184 | void GetField(BP_FIELD field, T & value) 185 | { 186 | duint n = 0; 187 | GetField(field, n); 188 | value = (T)n; 189 | } 190 | #endif // __cplusplus 191 | }; 192 | 193 | typedef struct BP_REF BP_REF; 194 | 195 | typedef void(*CBSTRING)(const char* str, void* userdata); 196 | 197 | //The list of all the DbgFunctions() return value. 198 | //WARNING: This list is append only. Do not insert things in the middle or plugins would break. 199 | typedef struct DBGFUNCTIONS_ 200 | { 201 | bool (*AssembleAtEx)(duint addr, const char* instruction, char* error, bool fillnop); 202 | bool (*SectionFromAddr)(duint addr, char* section); 203 | bool (*ModNameFromAddr)(duint addr, char* modname, bool extension); 204 | duint(*ModBaseFromAddr)(duint addr); 205 | duint(*ModBaseFromName)(const char* modname); 206 | duint(*ModSizeFromAddr)(duint addr); 207 | bool (*Assemble)(duint addr, unsigned char* dest, int* size, const char* instruction, char* error); 208 | bool (*PatchGet)(duint addr); 209 | bool (*PatchInRange)(duint start, duint end); 210 | bool (*MemPatch)(duint va, const unsigned char* src, duint size); 211 | void (*PatchRestoreRange)(duint start, duint end); 212 | bool (*PatchEnum)(DBGPATCHINFO* patchlist, size_t* cbsize); 213 | bool (*PatchRestore)(duint addr); 214 | int (*PatchFile)(DBGPATCHINFO* patchlist, int count, const char* szFileName, char* error); 215 | int (*ModPathFromAddr)(duint addr, char* path, int size); 216 | int (*ModPathFromName)(const char* modname, char* path, int size); 217 | bool (*DisasmFast)(const unsigned char* data, duint addr, BASIC_INSTRUCTION_INFO* basicinfo); 218 | void (*MemUpdateMap)(); 219 | void (*GetCallStack)(DBGCALLSTACK* callstack); 220 | void (*GetSEHChain)(DBGSEHCHAIN* sehchain); 221 | void (*SymbolDownloadAllSymbols)(const char* szSymbolStore); 222 | bool (*GetJitAuto)(bool* jitauto); 223 | bool (*GetJit)(char* jit, bool x64); 224 | bool (*GetDefJit)(char* defjit); 225 | bool (*GetProcessList)(DBGPROCESSINFO** entries, int* count); 226 | bool (*GetPageRights)(duint addr, char* rights); 227 | bool (*SetPageRights)(duint addr, const char* rights); 228 | bool (*PageRightsToString)(DWORD protect, char* rights); 229 | bool (*IsProcessElevated)(); 230 | bool (*GetCmdline)(char* cmdline, size_t* cbsize); 231 | bool (*SetCmdline)(const char* cmdline); 232 | duint(*FileOffsetToVa)(const char* modname, duint offset); 233 | duint(*VaToFileOffset)(duint va); 234 | duint(*GetAddrFromLine)(const char* szSourceFile, int line, duint* displacement); 235 | bool (*GetSourceFromAddr)(duint addr, char* szSourceFile, int* line); 236 | bool (*ValFromString)(const char* string, duint* value); 237 | bool (*PatchGetEx)(duint addr, DBGPATCHINFO* info); 238 | bool (*GetBridgeBp)(BPXTYPE type, duint addr, BRIDGEBP* bp); 239 | bool (*StringFormatInline)(const char* format, size_t resultSize, char* result); 240 | void (*GetMnemonicBrief)(const char* mnem, size_t resultSize, char* result); 241 | unsigned int (*GetTraceRecordHitCount)(duint address); 242 | TRACERECORDBYTETYPE(*GetTraceRecordByteType)(duint address); 243 | bool (*SetTraceRecordType)(duint pageAddress, TRACERECORDTYPE type); 244 | TRACERECORDTYPE(*GetTraceRecordType)(duint pageAddress); 245 | bool (*EnumHandles)(ListOf(HANDLEINFO) handles); 246 | bool (*GetHandleName)(duint handle, char* name, size_t nameSize, char* typeName, size_t typeNameSize); 247 | bool (*EnumTcpConnections)(ListOf(TCPCONNECTIONINFO) connections); 248 | duint(*GetDbgEvents)(); 249 | MODULEPARTY(*ModGetParty)(duint base); 250 | void (*ModSetParty)(duint base, MODULEPARTY party); 251 | bool (*WatchIsWatchdogTriggered)(unsigned int id); 252 | bool (*MemIsCodePage)(duint addr, bool refresh); 253 | bool (*AnimateCommand)(const char* command); 254 | void (*DbgSetDebuggeeInitScript)(const char* fileName); 255 | const char* (*DbgGetDebuggeeInitScript)(); 256 | bool (*EnumWindows)(ListOf(WINDOW_INFO) windows); 257 | bool (*EnumHeaps)(ListOf(HEAPINFO) heaps); 258 | bool (*ThreadGetName)(DWORD tid, char* name); 259 | bool (*IsDepEnabled)(); 260 | void (*GetCallStackEx)(DBGCALLSTACK* callstack, bool cache); 261 | bool (*GetUserComment)(duint addr, char* comment); 262 | void (*EnumConstants)(ListOf(CONSTANTINFO) constants); 263 | void (*EnumErrorCodes)(ListOf(CONSTANTINFO) constants); 264 | void (*EnumExceptions)(ListOf(CONSTANTINFO) constants); 265 | duint(*MemBpSize)(duint addr); 266 | bool (*ModRelocationsFromAddr)(duint addr, ListOf(DBGRELOCATIONINFO) relocations); 267 | bool (*ModRelocationAtAddr)(duint addr, DBGRELOCATIONINFO* relocation); 268 | bool (*ModRelocationsInRange)(duint addr, duint size, ListOf(DBGRELOCATIONINFO) relocations); 269 | duint(*DbGetHash)(); 270 | int (*SymAutoComplete)(const char* Search, char** Buffer, int MaxSymbols); 271 | void (*RefreshModuleList)(); 272 | duint(*GetAddrFromLineEx)(duint mod, const char* szSourceFile, int line); 273 | MODULESYMBOLSTATUS(*ModSymbolStatus)(duint mod); 274 | void (*GetCallStackByThread)(HANDLE thread, DBGCALLSTACK* callstack); 275 | void (*EnumStructs)(CBSTRING callback, void* userdata); 276 | BP_REF* (*BpRefList)(duint* count); 277 | bool (*BpRefVa)(BP_REF* ref, BPXTYPE type, duint va); 278 | bool (*BpRefRva)(BP_REF* ref, BPXTYPE type, const char* module, duint rva); 279 | void (*BpRefDll)(BP_REF* ref, const char* module); 280 | void (*BpRefException)(BP_REF* ref, unsigned int code); 281 | bool (*BpRefExists)(const BP_REF* ref); 282 | bool (*BpGetFieldNumber)(const BP_REF* ref, BP_FIELD field, duint* value); 283 | bool (*BpSetFieldNumber)(const BP_REF* ref, BP_FIELD field, duint value); 284 | bool (*BpGetFieldText)(const BP_REF* ref, BP_FIELD field, CBSTRING callback, void* userdata); 285 | bool (*BpSetFieldText)(const BP_REF* ref, BP_FIELD field, const char* value); 286 | } DBGFUNCTIONS; 287 | 288 | #ifdef __cplusplus 289 | inline bool BP_REF::GetField(BP_FIELD field, duint & value) 290 | { 291 | return DbgFunctions()->BpGetFieldNumber(this, field, &value); 292 | } 293 | 294 | inline bool BP_REF::GetField(BP_FIELD field, bool & value) 295 | { 296 | duint n = 0; 297 | if(!DbgFunctions()->BpGetFieldNumber(this, field, &n)) 298 | return false; 299 | value = !!n; 300 | return true; 301 | } 302 | 303 | inline bool BP_REF::SetField(BP_FIELD field, duint value) 304 | { 305 | return DbgFunctions()->BpSetFieldNumber(this, field, value); 306 | } 307 | 308 | inline bool BP_REF::GetField(BP_FIELD field, std::string & value) 309 | { 310 | return DbgFunctions()->BpGetFieldText(this, field, [](const char* str, void* userdata) 311 | { 312 | *(std::string*)userdata = str; 313 | }, &value); 314 | } 315 | 316 | inline bool BP_REF::SetField(BP_FIELD field, const std::string & value) 317 | { 318 | return DbgFunctions()->BpSetFieldText(this, field, value.c_str()); 319 | } 320 | #endif // __cplusplus 321 | 322 | #ifdef BUILD_DBG 323 | 324 | const DBGFUNCTIONS* dbgfunctionsget(); 325 | void dbgfunctionsinit(); 326 | 327 | #endif //BUILD_DBG 328 | 329 | #endif //_DBGFUNCTIONS_H 330 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/_scriptapi_register.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _SCRIPTAPI_REGISTER_H 2 | #define _SCRIPTAPI_REGISTER_H 3 | 4 | #include "_scriptapi.h" 5 | 6 | namespace Script 7 | { 8 | namespace Register 9 | { 10 | enum RegisterEnum 11 | { 12 | DR0, 13 | DR1, 14 | DR2, 15 | DR3, 16 | DR6, 17 | DR7, 18 | 19 | EAX, 20 | AX, 21 | AH, 22 | AL, 23 | EBX, 24 | BX, 25 | BH, 26 | BL, 27 | ECX, 28 | CX, 29 | CH, 30 | CL, 31 | EDX, 32 | DX, 33 | DH, 34 | DL, 35 | EDI, 36 | DI, 37 | ESI, 38 | SI, 39 | EBP, 40 | BP, 41 | ESP, 42 | SP, 43 | EIP, 44 | 45 | #ifdef _WIN64 46 | RAX, 47 | RBX, 48 | RCX, 49 | RDX, 50 | RSI, 51 | SIL, 52 | RDI, 53 | DIL, 54 | RBP, 55 | BPL, 56 | RSP, 57 | SPL, 58 | RIP, 59 | R8, 60 | R8D, 61 | R8W, 62 | R8B, 63 | R9, 64 | R9D, 65 | R9W, 66 | R9B, 67 | R10, 68 | R10D, 69 | R10W, 70 | R10B, 71 | R11, 72 | R11D, 73 | R11W, 74 | R11B, 75 | R12, 76 | R12D, 77 | R12W, 78 | R12B, 79 | R13, 80 | R13D, 81 | R13W, 82 | R13B, 83 | R14, 84 | R14D, 85 | R14W, 86 | R14B, 87 | R15, 88 | R15D, 89 | R15W, 90 | R15B, 91 | #endif //_WIN64 92 | 93 | CIP, 94 | CSP, 95 | CAX, 96 | CBX, 97 | CCX, 98 | CDX, 99 | CDI, 100 | CSI, 101 | CBP, 102 | CFLAGS 103 | }; //RegisterEnum 104 | 105 | SCRIPT_EXPORT duint Get(RegisterEnum reg); 106 | SCRIPT_EXPORT bool Set(RegisterEnum reg, duint value); 107 | SCRIPT_EXPORT int Size(); //gets architecture register size in bytes 108 | 109 | SCRIPT_EXPORT duint GetDR0(); 110 | SCRIPT_EXPORT bool SetDR0(duint value); 111 | SCRIPT_EXPORT duint GetDR1(); 112 | SCRIPT_EXPORT bool SetDR1(duint value); 113 | SCRIPT_EXPORT duint GetDR2(); 114 | SCRIPT_EXPORT bool SetDR2(duint value); 115 | SCRIPT_EXPORT duint GetDR3(); 116 | SCRIPT_EXPORT bool SetDR3(duint value); 117 | SCRIPT_EXPORT duint GetDR6(); 118 | SCRIPT_EXPORT bool SetDR6(duint value); 119 | SCRIPT_EXPORT duint GetDR7(); 120 | SCRIPT_EXPORT bool SetDR7(duint value); 121 | 122 | SCRIPT_EXPORT unsigned int GetEAX(); 123 | SCRIPT_EXPORT bool SetEAX(unsigned int value); 124 | SCRIPT_EXPORT unsigned short GetAX(); 125 | SCRIPT_EXPORT bool SetAX(unsigned short value); 126 | SCRIPT_EXPORT unsigned char GetAH(); 127 | SCRIPT_EXPORT bool SetAH(unsigned char value); 128 | SCRIPT_EXPORT unsigned char GetAL(); 129 | SCRIPT_EXPORT bool SetAL(unsigned char value); 130 | SCRIPT_EXPORT unsigned int GetEBX(); 131 | SCRIPT_EXPORT bool SetEBX(unsigned int value); 132 | SCRIPT_EXPORT unsigned short GetBX(); 133 | SCRIPT_EXPORT bool SetBX(unsigned short value); 134 | SCRIPT_EXPORT unsigned char GetBH(); 135 | SCRIPT_EXPORT bool SetBH(unsigned char value); 136 | SCRIPT_EXPORT unsigned char GetBL(); 137 | SCRIPT_EXPORT bool SetBL(unsigned char value); 138 | SCRIPT_EXPORT unsigned int GetECX(); 139 | SCRIPT_EXPORT bool SetECX(unsigned int value); 140 | SCRIPT_EXPORT unsigned short GetCX(); 141 | SCRIPT_EXPORT bool SetCX(unsigned short value); 142 | SCRIPT_EXPORT unsigned char GetCH(); 143 | SCRIPT_EXPORT bool SetCH(unsigned char value); 144 | SCRIPT_EXPORT unsigned char GetCL(); 145 | SCRIPT_EXPORT bool SetCL(unsigned char value); 146 | SCRIPT_EXPORT unsigned int GetEDX(); 147 | SCRIPT_EXPORT bool SetEDX(unsigned int value); 148 | SCRIPT_EXPORT unsigned short GetDX(); 149 | SCRIPT_EXPORT bool SetDX(unsigned short value); 150 | SCRIPT_EXPORT unsigned char GetDH(); 151 | SCRIPT_EXPORT bool SetDH(unsigned char value); 152 | SCRIPT_EXPORT unsigned char GetDL(); 153 | SCRIPT_EXPORT bool SetDL(unsigned char value); 154 | SCRIPT_EXPORT unsigned int GetEDI(); 155 | SCRIPT_EXPORT bool SetEDI(unsigned int value); 156 | SCRIPT_EXPORT unsigned short GetDI(); 157 | SCRIPT_EXPORT bool SetDI(unsigned short value); 158 | SCRIPT_EXPORT unsigned int GetESI(); 159 | SCRIPT_EXPORT bool SetESI(unsigned int value); 160 | SCRIPT_EXPORT unsigned short GetSI(); 161 | SCRIPT_EXPORT bool SetSI(unsigned short value); 162 | SCRIPT_EXPORT unsigned int GetEBP(); 163 | SCRIPT_EXPORT bool SetEBP(unsigned int value); 164 | SCRIPT_EXPORT unsigned short GetBP(); 165 | SCRIPT_EXPORT bool SetBP(unsigned short value); 166 | SCRIPT_EXPORT unsigned int GetESP(); 167 | SCRIPT_EXPORT bool SetESP(unsigned int value); 168 | SCRIPT_EXPORT unsigned short GetSP(); 169 | SCRIPT_EXPORT bool SetSP(unsigned short value); 170 | SCRIPT_EXPORT unsigned int GetEIP(); 171 | SCRIPT_EXPORT bool SetEIP(unsigned int value); 172 | 173 | #ifdef _WIN64 174 | SCRIPT_EXPORT unsigned long long GetRAX(); 175 | SCRIPT_EXPORT bool SetRAX(unsigned long long value); 176 | SCRIPT_EXPORT unsigned long long GetRBX(); 177 | SCRIPT_EXPORT bool SetRBX(unsigned long long value); 178 | SCRIPT_EXPORT unsigned long long GetRCX(); 179 | SCRIPT_EXPORT bool SetRCX(unsigned long long value); 180 | SCRIPT_EXPORT unsigned long long GetRDX(); 181 | SCRIPT_EXPORT bool SetRDX(unsigned long long value); 182 | SCRIPT_EXPORT unsigned long long GetRSI(); 183 | SCRIPT_EXPORT bool SetRSI(unsigned long long value); 184 | SCRIPT_EXPORT unsigned char GetSIL(); 185 | SCRIPT_EXPORT bool SetSIL(unsigned char value); 186 | SCRIPT_EXPORT unsigned long long GetRDI(); 187 | SCRIPT_EXPORT bool SetRDI(unsigned long long value); 188 | SCRIPT_EXPORT unsigned char GetDIL(); 189 | SCRIPT_EXPORT bool SetDIL(unsigned char value); 190 | SCRIPT_EXPORT unsigned long long GetRBP(); 191 | SCRIPT_EXPORT bool SetRBP(unsigned long long value); 192 | SCRIPT_EXPORT unsigned char GetBPL(); 193 | SCRIPT_EXPORT bool SetBPL(unsigned char value); 194 | SCRIPT_EXPORT unsigned long long GetRSP(); 195 | SCRIPT_EXPORT bool SetRSP(unsigned long long value); 196 | SCRIPT_EXPORT unsigned char GetSPL(); 197 | SCRIPT_EXPORT bool SetSPL(unsigned char value); 198 | SCRIPT_EXPORT unsigned long long GetRIP(); 199 | SCRIPT_EXPORT bool SetRIP(unsigned long long value); 200 | SCRIPT_EXPORT unsigned long long GetR8(); 201 | SCRIPT_EXPORT bool SetR8(unsigned long long value); 202 | SCRIPT_EXPORT unsigned int GetR8D(); 203 | SCRIPT_EXPORT bool SetR8D(unsigned int value); 204 | SCRIPT_EXPORT unsigned short GetR8W(); 205 | SCRIPT_EXPORT bool SetR8W(unsigned short value); 206 | SCRIPT_EXPORT unsigned char GetR8B(); 207 | SCRIPT_EXPORT bool SetR8B(unsigned char value); 208 | SCRIPT_EXPORT unsigned long long GetR9(); 209 | SCRIPT_EXPORT bool SetR9(unsigned long long value); 210 | SCRIPT_EXPORT unsigned int GetR9D(); 211 | SCRIPT_EXPORT bool SetR9D(unsigned int value); 212 | SCRIPT_EXPORT unsigned short GetR9W(); 213 | SCRIPT_EXPORT bool SetR9W(unsigned short value); 214 | SCRIPT_EXPORT unsigned char GetR9B(); 215 | SCRIPT_EXPORT bool SetR9B(unsigned char value); 216 | SCRIPT_EXPORT unsigned long long GetR10(); 217 | SCRIPT_EXPORT bool SetR10(unsigned long long value); 218 | SCRIPT_EXPORT unsigned int GetR10D(); 219 | SCRIPT_EXPORT bool SetR10D(unsigned int value); 220 | SCRIPT_EXPORT unsigned short GetR10W(); 221 | SCRIPT_EXPORT bool SetR10W(unsigned short value); 222 | SCRIPT_EXPORT unsigned char GetR10B(); 223 | SCRIPT_EXPORT bool SetR10B(unsigned char value); 224 | SCRIPT_EXPORT unsigned long long GetR11(); 225 | SCRIPT_EXPORT bool SetR11(unsigned long long value); 226 | SCRIPT_EXPORT unsigned int GetR11D(); 227 | SCRIPT_EXPORT bool SetR11D(unsigned int value); 228 | SCRIPT_EXPORT unsigned short GetR11W(); 229 | SCRIPT_EXPORT bool SetR11W(unsigned short value); 230 | SCRIPT_EXPORT unsigned char GetR11B(); 231 | SCRIPT_EXPORT bool SetR11B(unsigned char value); 232 | SCRIPT_EXPORT unsigned long long GetR12(); 233 | SCRIPT_EXPORT bool SetR12(unsigned long long value); 234 | SCRIPT_EXPORT unsigned int GetR12D(); 235 | SCRIPT_EXPORT bool SetR12D(unsigned int value); 236 | SCRIPT_EXPORT unsigned short GetR12W(); 237 | SCRIPT_EXPORT bool SetR12W(unsigned short value); 238 | SCRIPT_EXPORT unsigned char GetR12B(); 239 | SCRIPT_EXPORT bool SetR12B(unsigned char value); 240 | SCRIPT_EXPORT unsigned long long GetR13(); 241 | SCRIPT_EXPORT bool SetR13(unsigned long long value); 242 | SCRIPT_EXPORT unsigned int GetR13D(); 243 | SCRIPT_EXPORT bool SetR13D(unsigned int value); 244 | SCRIPT_EXPORT unsigned short GetR13W(); 245 | SCRIPT_EXPORT bool SetR13W(unsigned short value); 246 | SCRIPT_EXPORT unsigned char GetR13B(); 247 | SCRIPT_EXPORT bool SetR13B(unsigned char value); 248 | SCRIPT_EXPORT unsigned long long GetR14(); 249 | SCRIPT_EXPORT bool SetR14(unsigned long long value); 250 | SCRIPT_EXPORT unsigned int GetR14D(); 251 | SCRIPT_EXPORT bool SetR14D(unsigned int value); 252 | SCRIPT_EXPORT unsigned short GetR14W(); 253 | SCRIPT_EXPORT bool SetR14W(unsigned short value); 254 | SCRIPT_EXPORT unsigned char GetR14B(); 255 | SCRIPT_EXPORT bool SetR14B(unsigned char value); 256 | SCRIPT_EXPORT unsigned long long GetR15(); 257 | SCRIPT_EXPORT bool SetR15(unsigned long long value); 258 | SCRIPT_EXPORT unsigned int GetR15D(); 259 | SCRIPT_EXPORT bool SetR15D(unsigned int value); 260 | SCRIPT_EXPORT unsigned short GetR15W(); 261 | SCRIPT_EXPORT bool SetR15W(unsigned short value); 262 | SCRIPT_EXPORT unsigned char GetR15B(); 263 | SCRIPT_EXPORT bool SetR15B(unsigned char value); 264 | #endif //_WIN64 265 | 266 | SCRIPT_EXPORT duint GetCAX(); 267 | SCRIPT_EXPORT bool SetCAX(duint value); 268 | SCRIPT_EXPORT duint GetCBX(); 269 | SCRIPT_EXPORT bool SetCBX(duint value); 270 | SCRIPT_EXPORT duint GetCCX(); 271 | SCRIPT_EXPORT bool SetCCX(duint value); 272 | SCRIPT_EXPORT duint GetCDX(); 273 | SCRIPT_EXPORT bool SetCDX(duint value); 274 | SCRIPT_EXPORT duint GetCDI(); 275 | SCRIPT_EXPORT bool SetCDI(duint value); 276 | SCRIPT_EXPORT duint GetCSI(); 277 | SCRIPT_EXPORT bool SetCSI(duint value); 278 | SCRIPT_EXPORT duint GetCBP(); 279 | SCRIPT_EXPORT bool SetCBP(duint value); 280 | SCRIPT_EXPORT duint GetCSP(); 281 | SCRIPT_EXPORT bool SetCSP(duint value); 282 | SCRIPT_EXPORT duint GetCIP(); 283 | SCRIPT_EXPORT bool SetCIP(duint value); 284 | SCRIPT_EXPORT duint GetCFLAGS(); 285 | SCRIPT_EXPORT bool SetCFLAGS(duint value); 286 | }; //Register 287 | }; //Script 288 | 289 | #endif //_SCRIPTAPI_REGISTER_H ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/_scriptapi_register.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _SCRIPTAPI_REGISTER_H 2 | #define _SCRIPTAPI_REGISTER_H 3 | 4 | #include "_scriptapi.h" 5 | 6 | namespace Script 7 | { 8 | namespace Register 9 | { 10 | enum RegisterEnum 11 | { 12 | DR0, 13 | DR1, 14 | DR2, 15 | DR3, 16 | DR6, 17 | DR7, 18 | 19 | EAX, 20 | AX, 21 | AH, 22 | AL, 23 | EBX, 24 | BX, 25 | BH, 26 | BL, 27 | ECX, 28 | CX, 29 | CH, 30 | CL, 31 | EDX, 32 | DX, 33 | DH, 34 | DL, 35 | EDI, 36 | DI, 37 | ESI, 38 | SI, 39 | EBP, 40 | BP, 41 | ESP, 42 | SP, 43 | EIP, 44 | 45 | #ifdef _WIN64 46 | RAX, 47 | RBX, 48 | RCX, 49 | RDX, 50 | RSI, 51 | SIL, 52 | RDI, 53 | DIL, 54 | RBP, 55 | BPL, 56 | RSP, 57 | SPL, 58 | RIP, 59 | R8, 60 | R8D, 61 | R8W, 62 | R8B, 63 | R9, 64 | R9D, 65 | R9W, 66 | R9B, 67 | R10, 68 | R10D, 69 | R10W, 70 | R10B, 71 | R11, 72 | R11D, 73 | R11W, 74 | R11B, 75 | R12, 76 | R12D, 77 | R12W, 78 | R12B, 79 | R13, 80 | R13D, 81 | R13W, 82 | R13B, 83 | R14, 84 | R14D, 85 | R14W, 86 | R14B, 87 | R15, 88 | R15D, 89 | R15W, 90 | R15B, 91 | #endif //_WIN64 92 | 93 | CIP, 94 | CSP, 95 | CAX, 96 | CBX, 97 | CCX, 98 | CDX, 99 | CDI, 100 | CSI, 101 | CBP, 102 | CFLAGS 103 | }; //RegisterEnum 104 | 105 | SCRIPT_EXPORT duint Get(RegisterEnum reg); 106 | SCRIPT_EXPORT bool Set(RegisterEnum reg, duint value); 107 | SCRIPT_EXPORT int Size(); //gets architecture register size in bytes 108 | 109 | SCRIPT_EXPORT duint GetDR0(); 110 | SCRIPT_EXPORT bool SetDR0(duint value); 111 | SCRIPT_EXPORT duint GetDR1(); 112 | SCRIPT_EXPORT bool SetDR1(duint value); 113 | SCRIPT_EXPORT duint GetDR2(); 114 | SCRIPT_EXPORT bool SetDR2(duint value); 115 | SCRIPT_EXPORT duint GetDR3(); 116 | SCRIPT_EXPORT bool SetDR3(duint value); 117 | SCRIPT_EXPORT duint GetDR6(); 118 | SCRIPT_EXPORT bool SetDR6(duint value); 119 | SCRIPT_EXPORT duint GetDR7(); 120 | SCRIPT_EXPORT bool SetDR7(duint value); 121 | 122 | SCRIPT_EXPORT unsigned int GetEAX(); 123 | SCRIPT_EXPORT bool SetEAX(unsigned int value); 124 | SCRIPT_EXPORT unsigned short GetAX(); 125 | SCRIPT_EXPORT bool SetAX(unsigned short value); 126 | SCRIPT_EXPORT unsigned char GetAH(); 127 | SCRIPT_EXPORT bool SetAH(unsigned char value); 128 | SCRIPT_EXPORT unsigned char GetAL(); 129 | SCRIPT_EXPORT bool SetAL(unsigned char value); 130 | SCRIPT_EXPORT unsigned int GetEBX(); 131 | SCRIPT_EXPORT bool SetEBX(unsigned int value); 132 | SCRIPT_EXPORT unsigned short GetBX(); 133 | SCRIPT_EXPORT bool SetBX(unsigned short value); 134 | SCRIPT_EXPORT unsigned char GetBH(); 135 | SCRIPT_EXPORT bool SetBH(unsigned char value); 136 | SCRIPT_EXPORT unsigned char GetBL(); 137 | SCRIPT_EXPORT bool SetBL(unsigned char value); 138 | SCRIPT_EXPORT unsigned int GetECX(); 139 | SCRIPT_EXPORT bool SetECX(unsigned int value); 140 | SCRIPT_EXPORT unsigned short GetCX(); 141 | SCRIPT_EXPORT bool SetCX(unsigned short value); 142 | SCRIPT_EXPORT unsigned char GetCH(); 143 | SCRIPT_EXPORT bool SetCH(unsigned char value); 144 | SCRIPT_EXPORT unsigned char GetCL(); 145 | SCRIPT_EXPORT bool SetCL(unsigned char value); 146 | SCRIPT_EXPORT unsigned int GetEDX(); 147 | SCRIPT_EXPORT bool SetEDX(unsigned int value); 148 | SCRIPT_EXPORT unsigned short GetDX(); 149 | SCRIPT_EXPORT bool SetDX(unsigned short value); 150 | SCRIPT_EXPORT unsigned char GetDH(); 151 | SCRIPT_EXPORT bool SetDH(unsigned char value); 152 | SCRIPT_EXPORT unsigned char GetDL(); 153 | SCRIPT_EXPORT bool SetDL(unsigned char value); 154 | SCRIPT_EXPORT unsigned int GetEDI(); 155 | SCRIPT_EXPORT bool SetEDI(unsigned int value); 156 | SCRIPT_EXPORT unsigned short GetDI(); 157 | SCRIPT_EXPORT bool SetDI(unsigned short value); 158 | SCRIPT_EXPORT unsigned int GetESI(); 159 | SCRIPT_EXPORT bool SetESI(unsigned int value); 160 | SCRIPT_EXPORT unsigned short GetSI(); 161 | SCRIPT_EXPORT bool SetSI(unsigned short value); 162 | SCRIPT_EXPORT unsigned int GetEBP(); 163 | SCRIPT_EXPORT bool SetEBP(unsigned int value); 164 | SCRIPT_EXPORT unsigned short GetBP(); 165 | SCRIPT_EXPORT bool SetBP(unsigned short value); 166 | SCRIPT_EXPORT unsigned int GetESP(); 167 | SCRIPT_EXPORT bool SetESP(unsigned int value); 168 | SCRIPT_EXPORT unsigned short GetSP(); 169 | SCRIPT_EXPORT bool SetSP(unsigned short value); 170 | SCRIPT_EXPORT unsigned int GetEIP(); 171 | SCRIPT_EXPORT bool SetEIP(unsigned int value); 172 | 173 | #ifdef _WIN64 174 | SCRIPT_EXPORT unsigned long long GetRAX(); 175 | SCRIPT_EXPORT bool SetRAX(unsigned long long value); 176 | SCRIPT_EXPORT unsigned long long GetRBX(); 177 | SCRIPT_EXPORT bool SetRBX(unsigned long long value); 178 | SCRIPT_EXPORT unsigned long long GetRCX(); 179 | SCRIPT_EXPORT bool SetRCX(unsigned long long value); 180 | SCRIPT_EXPORT unsigned long long GetRDX(); 181 | SCRIPT_EXPORT bool SetRDX(unsigned long long value); 182 | SCRIPT_EXPORT unsigned long long GetRSI(); 183 | SCRIPT_EXPORT bool SetRSI(unsigned long long value); 184 | SCRIPT_EXPORT unsigned char GetSIL(); 185 | SCRIPT_EXPORT bool SetSIL(unsigned char value); 186 | SCRIPT_EXPORT unsigned long long GetRDI(); 187 | SCRIPT_EXPORT bool SetRDI(unsigned long long value); 188 | SCRIPT_EXPORT unsigned char GetDIL(); 189 | SCRIPT_EXPORT bool SetDIL(unsigned char value); 190 | SCRIPT_EXPORT unsigned long long GetRBP(); 191 | SCRIPT_EXPORT bool SetRBP(unsigned long long value); 192 | SCRIPT_EXPORT unsigned char GetBPL(); 193 | SCRIPT_EXPORT bool SetBPL(unsigned char value); 194 | SCRIPT_EXPORT unsigned long long GetRSP(); 195 | SCRIPT_EXPORT bool SetRSP(unsigned long long value); 196 | SCRIPT_EXPORT unsigned char GetSPL(); 197 | SCRIPT_EXPORT bool SetSPL(unsigned char value); 198 | SCRIPT_EXPORT unsigned long long GetRIP(); 199 | SCRIPT_EXPORT bool SetRIP(unsigned long long value); 200 | SCRIPT_EXPORT unsigned long long GetR8(); 201 | SCRIPT_EXPORT bool SetR8(unsigned long long value); 202 | SCRIPT_EXPORT unsigned int GetR8D(); 203 | SCRIPT_EXPORT bool SetR8D(unsigned int value); 204 | SCRIPT_EXPORT unsigned short GetR8W(); 205 | SCRIPT_EXPORT bool SetR8W(unsigned short value); 206 | SCRIPT_EXPORT unsigned char GetR8B(); 207 | SCRIPT_EXPORT bool SetR8B(unsigned char value); 208 | SCRIPT_EXPORT unsigned long long GetR9(); 209 | SCRIPT_EXPORT bool SetR9(unsigned long long value); 210 | SCRIPT_EXPORT unsigned int GetR9D(); 211 | SCRIPT_EXPORT bool SetR9D(unsigned int value); 212 | SCRIPT_EXPORT unsigned short GetR9W(); 213 | SCRIPT_EXPORT bool SetR9W(unsigned short value); 214 | SCRIPT_EXPORT unsigned char GetR9B(); 215 | SCRIPT_EXPORT bool SetR9B(unsigned char value); 216 | SCRIPT_EXPORT unsigned long long GetR10(); 217 | SCRIPT_EXPORT bool SetR10(unsigned long long value); 218 | SCRIPT_EXPORT unsigned int GetR10D(); 219 | SCRIPT_EXPORT bool SetR10D(unsigned int value); 220 | SCRIPT_EXPORT unsigned short GetR10W(); 221 | SCRIPT_EXPORT bool SetR10W(unsigned short value); 222 | SCRIPT_EXPORT unsigned char GetR10B(); 223 | SCRIPT_EXPORT bool SetR10B(unsigned char value); 224 | SCRIPT_EXPORT unsigned long long GetR11(); 225 | SCRIPT_EXPORT bool SetR11(unsigned long long value); 226 | SCRIPT_EXPORT unsigned int GetR11D(); 227 | SCRIPT_EXPORT bool SetR11D(unsigned int value); 228 | SCRIPT_EXPORT unsigned short GetR11W(); 229 | SCRIPT_EXPORT bool SetR11W(unsigned short value); 230 | SCRIPT_EXPORT unsigned char GetR11B(); 231 | SCRIPT_EXPORT bool SetR11B(unsigned char value); 232 | SCRIPT_EXPORT unsigned long long GetR12(); 233 | SCRIPT_EXPORT bool SetR12(unsigned long long value); 234 | SCRIPT_EXPORT unsigned int GetR12D(); 235 | SCRIPT_EXPORT bool SetR12D(unsigned int value); 236 | SCRIPT_EXPORT unsigned short GetR12W(); 237 | SCRIPT_EXPORT bool SetR12W(unsigned short value); 238 | SCRIPT_EXPORT unsigned char GetR12B(); 239 | SCRIPT_EXPORT bool SetR12B(unsigned char value); 240 | SCRIPT_EXPORT unsigned long long GetR13(); 241 | SCRIPT_EXPORT bool SetR13(unsigned long long value); 242 | SCRIPT_EXPORT unsigned int GetR13D(); 243 | SCRIPT_EXPORT bool SetR13D(unsigned int value); 244 | SCRIPT_EXPORT unsigned short GetR13W(); 245 | SCRIPT_EXPORT bool SetR13W(unsigned short value); 246 | SCRIPT_EXPORT unsigned char GetR13B(); 247 | SCRIPT_EXPORT bool SetR13B(unsigned char value); 248 | SCRIPT_EXPORT unsigned long long GetR14(); 249 | SCRIPT_EXPORT bool SetR14(unsigned long long value); 250 | SCRIPT_EXPORT unsigned int GetR14D(); 251 | SCRIPT_EXPORT bool SetR14D(unsigned int value); 252 | SCRIPT_EXPORT unsigned short GetR14W(); 253 | SCRIPT_EXPORT bool SetR14W(unsigned short value); 254 | SCRIPT_EXPORT unsigned char GetR14B(); 255 | SCRIPT_EXPORT bool SetR14B(unsigned char value); 256 | SCRIPT_EXPORT unsigned long long GetR15(); 257 | SCRIPT_EXPORT bool SetR15(unsigned long long value); 258 | SCRIPT_EXPORT unsigned int GetR15D(); 259 | SCRIPT_EXPORT bool SetR15D(unsigned int value); 260 | SCRIPT_EXPORT unsigned short GetR15W(); 261 | SCRIPT_EXPORT bool SetR15W(unsigned short value); 262 | SCRIPT_EXPORT unsigned char GetR15B(); 263 | SCRIPT_EXPORT bool SetR15B(unsigned char value); 264 | #endif //_WIN64 265 | 266 | SCRIPT_EXPORT duint GetCAX(); 267 | SCRIPT_EXPORT bool SetCAX(duint value); 268 | SCRIPT_EXPORT duint GetCBX(); 269 | SCRIPT_EXPORT bool SetCBX(duint value); 270 | SCRIPT_EXPORT duint GetCCX(); 271 | SCRIPT_EXPORT bool SetCCX(duint value); 272 | SCRIPT_EXPORT duint GetCDX(); 273 | SCRIPT_EXPORT bool SetCDX(duint value); 274 | SCRIPT_EXPORT duint GetCDI(); 275 | SCRIPT_EXPORT bool SetCDI(duint value); 276 | SCRIPT_EXPORT duint GetCSI(); 277 | SCRIPT_EXPORT bool SetCSI(duint value); 278 | SCRIPT_EXPORT duint GetCBP(); 279 | SCRIPT_EXPORT bool SetCBP(duint value); 280 | SCRIPT_EXPORT duint GetCSP(); 281 | SCRIPT_EXPORT bool SetCSP(duint value); 282 | SCRIPT_EXPORT duint GetCIP(); 283 | SCRIPT_EXPORT bool SetCIP(duint value); 284 | SCRIPT_EXPORT duint GetCFLAGS(); 285 | SCRIPT_EXPORT bool SetCFLAGS(duint value); 286 | }; //Register 287 | }; //Script 288 | 289 | #endif //_SCRIPTAPI_REGISTER_H ``` -------------------------------------------------------------------------------- /deps/pluginsdk/jansson/jansson.h: -------------------------------------------------------------------------------- ``` 1 | /* 2 | * Copyright (c) 2009-2016 Petri Lehtinen <[email protected]> 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef JANSSON_H 9 | #define JANSSON_H 10 | 11 | #include <stdio.h> 12 | #include <stdlib.h> /* for size_t */ 13 | #include <stdarg.h> 14 | 15 | #include "jansson_config.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* version */ 22 | 23 | #define JANSSON_MAJOR_VERSION 2 24 | #define JANSSON_MINOR_VERSION 9 25 | #define JANSSON_MICRO_VERSION 0 26 | 27 | /* Micro version is omitted if it's 0 */ 28 | #define JANSSON_VERSION "2.9" 29 | 30 | /* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this 31 | for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ 32 | #define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \ 33 | (JANSSON_MINOR_VERSION << 8) | \ 34 | (JANSSON_MICRO_VERSION << 0)) 35 | 36 | 37 | /* types */ 38 | 39 | typedef enum 40 | { 41 | JSON_OBJECT, 42 | JSON_ARRAY, 43 | JSON_STRING, 44 | JSON_INTEGER, 45 | JSON_REAL, 46 | JSON_TRUE, 47 | JSON_FALSE, 48 | JSON_NULL 49 | } json_type; 50 | 51 | typedef struct json_t 52 | { 53 | json_type type; 54 | size_t refcount; 55 | } json_t; 56 | 57 | #ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ 58 | #if JSON_INTEGER_IS_LONG_LONG 59 | #ifdef _WIN32 60 | #define JSON_INTEGER_FORMAT "I64d" 61 | #else 62 | #define JSON_INTEGER_FORMAT "lld" 63 | #endif 64 | typedef long long json_int_t; 65 | #else 66 | #define JSON_INTEGER_FORMAT "ld" 67 | typedef long json_int_t; 68 | #endif /* JSON_INTEGER_IS_LONG_LONG */ 69 | #endif 70 | 71 | #define json_typeof(json) ((json)->type) 72 | #define json_is_object(json) ((json) && json_typeof(json) == JSON_OBJECT) 73 | #define json_is_array(json) ((json) && json_typeof(json) == JSON_ARRAY) 74 | #define json_is_string(json) ((json) && json_typeof(json) == JSON_STRING) 75 | #define json_is_integer(json) ((json) && json_typeof(json) == JSON_INTEGER) 76 | #define json_is_real(json) ((json) && json_typeof(json) == JSON_REAL) 77 | #define json_is_number(json) (json_is_integer(json) || json_is_real(json)) 78 | #define json_is_true(json) ((json) && json_typeof(json) == JSON_TRUE) 79 | #define json_is_false(json) ((json) && json_typeof(json) == JSON_FALSE) 80 | #define json_boolean_value json_is_true 81 | #define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) 82 | #define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL) 83 | 84 | /* construction, destruction, reference counting */ 85 | 86 | __declspec(dllimport) json_t* json_object(void); 87 | __declspec(dllimport) json_t* json_array(void); 88 | __declspec(dllimport) json_t* json_string(const char* value); 89 | __declspec(dllimport) json_t* json_stringn(const char* value, size_t len); 90 | __declspec(dllimport) json_t* json_string_nocheck(const char* value); 91 | __declspec(dllimport) json_t* json_stringn_nocheck(const char* value, size_t len); 92 | __declspec(dllimport) json_t* json_integer(json_int_t value); 93 | __declspec(dllimport) json_t* json_real(double value); 94 | __declspec(dllimport) json_t* json_true(void); 95 | __declspec(dllimport) json_t* json_false(void); 96 | #define json_boolean(val) ((val) ? json_true() : json_false()) 97 | __declspec(dllimport) json_t* json_null(void); 98 | 99 | static JSON_INLINE 100 | json_t* json_incref(json_t* json) 101 | { 102 | if(json && json->refcount != (size_t) - 1) 103 | ++json->refcount; 104 | return json; 105 | } 106 | 107 | /* do not call json_delete directly */ 108 | __declspec(dllimport) void json_delete(json_t* json); 109 | 110 | static JSON_INLINE 111 | void json_decref(json_t* json) 112 | { 113 | if(json && json->refcount != (size_t) - 1 && --json->refcount == 0) 114 | json_delete(json); 115 | } 116 | 117 | #if defined(__GNUC__) || defined(__clang__) 118 | static JSON_INLINE 119 | void json_decrefp(json_t** json) 120 | { 121 | if(json) 122 | { 123 | json_decref(*json); 124 | *json = NULL; 125 | } 126 | } 127 | 128 | #define json_auto_t json_t __attribute__((cleanup(json_decrefp))) 129 | #endif 130 | 131 | 132 | /* error reporting */ 133 | 134 | #define JSON_ERROR_TEXT_LENGTH 160 135 | #define JSON_ERROR_SOURCE_LENGTH 80 136 | 137 | typedef struct 138 | { 139 | int line; 140 | int column; 141 | int position; 142 | char source[JSON_ERROR_SOURCE_LENGTH]; 143 | char text[JSON_ERROR_TEXT_LENGTH]; 144 | } json_error_t; 145 | 146 | 147 | /* getters, setters, manipulation */ 148 | 149 | __declspec(dllimport) void json_object_seed(size_t seed); 150 | __declspec(dllimport) size_t json_object_size(const json_t* object); 151 | __declspec(dllimport) json_t* json_object_get(const json_t* object, const char* key); 152 | __declspec(dllimport) int json_object_set_new(json_t* object, const char* key, json_t* value); 153 | __declspec(dllimport) int json_object_set_new_nocheck(json_t* object, const char* key, json_t* value); 154 | __declspec(dllimport) int json_object_del(json_t* object, const char* key); 155 | __declspec(dllimport) int json_object_clear(json_t* object); 156 | __declspec(dllimport) int json_object_update(json_t* object, json_t* other); 157 | __declspec(dllimport) int json_object_update_existing(json_t* object, json_t* other); 158 | __declspec(dllimport) int json_object_update_missing(json_t* object, json_t* other); 159 | __declspec(dllimport) void* json_object_iter(json_t* object); 160 | __declspec(dllimport) void* json_object_iter_at(json_t* object, const char* key); 161 | __declspec(dllimport) void* json_object_key_to_iter(const char* key); 162 | __declspec(dllimport) void* json_object_iter_next(json_t* object, void* iter); 163 | __declspec(dllimport) const char* json_object_iter_key(void* iter); 164 | __declspec(dllimport) json_t* json_object_iter_value(void* iter); 165 | __declspec(dllimport) int json_object_iter_set_new(json_t* object, void* iter, json_t* value); 166 | 167 | #define json_object_foreach(object, key, value) \ 168 | for(key = json_object_iter_key(json_object_iter(object)); \ 169 | key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ 170 | key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key)))) 171 | 172 | #define json_object_foreach_safe(object, n, key, value) \ 173 | for(key = json_object_iter_key(json_object_iter(object)), \ 174 | n = json_object_iter_next(object, json_object_key_to_iter(key)); \ 175 | key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ 176 | key = json_object_iter_key(n), \ 177 | n = json_object_iter_next(object, json_object_key_to_iter(key))) 178 | 179 | #define json_array_foreach(array, index, value) \ 180 | for(index = 0; \ 181 | index < json_array_size(array) && (value = json_array_get(array, index)); \ 182 | index++) 183 | 184 | static JSON_INLINE 185 | int json_object_set(json_t* object, const char* key, json_t* value) 186 | { 187 | return json_object_set_new(object, key, json_incref(value)); 188 | } 189 | 190 | static JSON_INLINE 191 | int json_object_set_nocheck(json_t* object, const char* key, json_t* value) 192 | { 193 | return json_object_set_new_nocheck(object, key, json_incref(value)); 194 | } 195 | 196 | static JSON_INLINE 197 | int json_object_iter_set(json_t* object, void* iter, json_t* value) 198 | { 199 | return json_object_iter_set_new(object, iter, json_incref(value)); 200 | } 201 | 202 | __declspec(dllimport) size_t json_array_size(const json_t* array); 203 | __declspec(dllimport) json_t* json_array_get(const json_t* array, size_t index); 204 | __declspec(dllimport) int json_array_set_new(json_t* array, size_t index, json_t* value); 205 | __declspec(dllimport) int json_array_append_new(json_t* array, json_t* value); 206 | __declspec(dllimport) int json_array_insert_new(json_t* array, size_t index, json_t* value); 207 | __declspec(dllimport) int json_array_remove(json_t* array, size_t index); 208 | __declspec(dllimport) int json_array_clear(json_t* array); 209 | __declspec(dllimport) int json_array_extend(json_t* array, json_t* other); 210 | 211 | static JSON_INLINE 212 | int json_array_set(json_t* array, size_t ind, json_t* value) 213 | { 214 | return json_array_set_new(array, ind, json_incref(value)); 215 | } 216 | 217 | static JSON_INLINE 218 | int json_array_append(json_t* array, json_t* value) 219 | { 220 | return json_array_append_new(array, json_incref(value)); 221 | } 222 | 223 | static JSON_INLINE 224 | int json_array_insert(json_t* array, size_t ind, json_t* value) 225 | { 226 | return json_array_insert_new(array, ind, json_incref(value)); 227 | } 228 | 229 | __declspec(dllimport) const char* json_string_value(const json_t* string); 230 | __declspec(dllimport) size_t json_string_length(const json_t* string); 231 | __declspec(dllimport) json_int_t json_integer_value(const json_t* integer); 232 | __declspec(dllimport) double json_real_value(const json_t* real); 233 | __declspec(dllimport) double json_number_value(const json_t* json); 234 | 235 | __declspec(dllimport) int json_string_set(json_t* string, const char* value); 236 | __declspec(dllimport) int json_string_setn(json_t* string, const char* value, size_t len); 237 | __declspec(dllimport) int json_string_set_nocheck(json_t* string, const char* value); 238 | __declspec(dllimport) int json_string_setn_nocheck(json_t* string, const char* value, size_t len); 239 | __declspec(dllimport) int json_integer_set(json_t* integer, json_int_t value); 240 | __declspec(dllimport) int json_real_set(json_t* real, double value); 241 | 242 | /* pack, unpack */ 243 | 244 | __declspec(dllimport) json_t* json_pack(const char* fmt, ...); 245 | __declspec(dllimport) json_t* json_pack_ex(json_error_t* error, size_t flags, const char* fmt, ...); 246 | __declspec(dllimport) json_t* json_vpack_ex(json_error_t* error, size_t flags, const char* fmt, va_list ap); 247 | 248 | #define JSON_VALIDATE_ONLY 0x1 249 | #define JSON_STRICT 0x2 250 | 251 | __declspec(dllimport) int json_unpack(json_t* root, const char* fmt, ...); 252 | __declspec(dllimport) int json_unpack_ex(json_t* root, json_error_t* error, size_t flags, const char* fmt, ...); 253 | __declspec(dllimport) int json_vunpack_ex(json_t* root, json_error_t* error, size_t flags, const char* fmt, va_list ap); 254 | 255 | 256 | /* equality */ 257 | 258 | __declspec(dllimport) int json_equal(json_t* value1, json_t* value2); 259 | 260 | 261 | /* copying */ 262 | 263 | __declspec(dllimport) json_t* json_copy(json_t* value); 264 | __declspec(dllimport) json_t* json_deep_copy(const json_t* value); 265 | 266 | 267 | /* decoding */ 268 | 269 | #define JSON_REJECT_DUPLICATES 0x1 270 | #define JSON_DISABLE_EOF_CHECK 0x2 271 | #define JSON_DECODE_ANY 0x4 272 | #define JSON_DECODE_INT_AS_REAL 0x8 273 | #define JSON_ALLOW_NUL 0x10 274 | 275 | typedef size_t (*json_load_callback_t)(void* buffer, size_t buflen, void* data); 276 | 277 | __declspec(dllimport) json_t* json_loads(const char* input, size_t flags, json_error_t* error); 278 | __declspec(dllimport) json_t* json_loadb(const char* buffer, size_t buflen, size_t flags, json_error_t* error); 279 | __declspec(dllimport) json_t* json_loadf(FILE* input, size_t flags, json_error_t* error); 280 | __declspec(dllimport) json_t* json_load_file(const char* path, size_t flags, json_error_t* error); 281 | __declspec(dllimport) json_t* json_load_callback(json_load_callback_t callback, void* data, size_t flags, json_error_t* error); 282 | 283 | 284 | /* encoding */ 285 | 286 | #define JSON_MAX_INDENT 0x1F 287 | #define JSON_INDENT(n) ((n) & JSON_MAX_INDENT) 288 | #define JSON_COMPACT 0x20 289 | #define JSON_ENSURE_ASCII 0x40 290 | #define JSON_SORT_KEYS 0x80 291 | #define JSON_PRESERVE_ORDER 0x100 292 | #define JSON_ENCODE_ANY 0x200 293 | #define JSON_ESCAPE_SLASH 0x400 294 | #define JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11) 295 | 296 | typedef int (*json_dump_callback_t)(const char* buffer, size_t size, void* data); 297 | 298 | __declspec(dllimport) char* json_dumps(const json_t* json, size_t flags); 299 | __declspec(dllimport) int json_dumpf(const json_t* json, FILE* output, size_t flags); 300 | __declspec(dllimport) int json_dump_file(const json_t* json, const char* path, size_t flags); 301 | __declspec(dllimport) int json_dump_callback(const json_t* json, json_dump_callback_t callback, void* data, size_t flags); 302 | 303 | /* custom memory allocation */ 304 | 305 | typedef void* (*json_malloc_t)(size_t); 306 | typedef void (*json_free_t)(void*); 307 | 308 | __declspec(dllimport) void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); 309 | __declspec(dllimport) void json_get_alloc_funcs(json_malloc_t* malloc_fn, json_free_t* free_fn); 310 | 311 | #ifdef __cplusplus 312 | } 313 | #endif 314 | 315 | #endif 316 | ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/jansson/jansson.h: -------------------------------------------------------------------------------- ``` 1 | /* 2 | * Copyright (c) 2009-2016 Petri Lehtinen <[email protected]> 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef JANSSON_H 9 | #define JANSSON_H 10 | 11 | #include <stdio.h> 12 | #include <stdlib.h> /* for size_t */ 13 | #include <stdarg.h> 14 | 15 | #include "jansson_config.h" 16 | 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | /* version */ 22 | 23 | #define JANSSON_MAJOR_VERSION 2 24 | #define JANSSON_MINOR_VERSION 9 25 | #define JANSSON_MICRO_VERSION 0 26 | 27 | /* Micro version is omitted if it's 0 */ 28 | #define JANSSON_VERSION "2.9" 29 | 30 | /* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this 31 | for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ 32 | #define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \ 33 | (JANSSON_MINOR_VERSION << 8) | \ 34 | (JANSSON_MICRO_VERSION << 0)) 35 | 36 | 37 | /* types */ 38 | 39 | typedef enum 40 | { 41 | JSON_OBJECT, 42 | JSON_ARRAY, 43 | JSON_STRING, 44 | JSON_INTEGER, 45 | JSON_REAL, 46 | JSON_TRUE, 47 | JSON_FALSE, 48 | JSON_NULL 49 | } json_type; 50 | 51 | typedef struct json_t 52 | { 53 | json_type type; 54 | size_t refcount; 55 | } json_t; 56 | 57 | #ifndef JANSSON_USING_CMAKE /* disabled if using cmake */ 58 | #if JSON_INTEGER_IS_LONG_LONG 59 | #ifdef _WIN32 60 | #define JSON_INTEGER_FORMAT "I64d" 61 | #else 62 | #define JSON_INTEGER_FORMAT "lld" 63 | #endif 64 | typedef long long json_int_t; 65 | #else 66 | #define JSON_INTEGER_FORMAT "ld" 67 | typedef long json_int_t; 68 | #endif /* JSON_INTEGER_IS_LONG_LONG */ 69 | #endif 70 | 71 | #define json_typeof(json) ((json)->type) 72 | #define json_is_object(json) ((json) && json_typeof(json) == JSON_OBJECT) 73 | #define json_is_array(json) ((json) && json_typeof(json) == JSON_ARRAY) 74 | #define json_is_string(json) ((json) && json_typeof(json) == JSON_STRING) 75 | #define json_is_integer(json) ((json) && json_typeof(json) == JSON_INTEGER) 76 | #define json_is_real(json) ((json) && json_typeof(json) == JSON_REAL) 77 | #define json_is_number(json) (json_is_integer(json) || json_is_real(json)) 78 | #define json_is_true(json) ((json) && json_typeof(json) == JSON_TRUE) 79 | #define json_is_false(json) ((json) && json_typeof(json) == JSON_FALSE) 80 | #define json_boolean_value json_is_true 81 | #define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) 82 | #define json_is_null(json) ((json) && json_typeof(json) == JSON_NULL) 83 | 84 | /* construction, destruction, reference counting */ 85 | 86 | __declspec(dllimport) json_t* json_object(void); 87 | __declspec(dllimport) json_t* json_array(void); 88 | __declspec(dllimport) json_t* json_string(const char* value); 89 | __declspec(dllimport) json_t* json_stringn(const char* value, size_t len); 90 | __declspec(dllimport) json_t* json_string_nocheck(const char* value); 91 | __declspec(dllimport) json_t* json_stringn_nocheck(const char* value, size_t len); 92 | __declspec(dllimport) json_t* json_integer(json_int_t value); 93 | __declspec(dllimport) json_t* json_real(double value); 94 | __declspec(dllimport) json_t* json_true(void); 95 | __declspec(dllimport) json_t* json_false(void); 96 | #define json_boolean(val) ((val) ? json_true() : json_false()) 97 | __declspec(dllimport) json_t* json_null(void); 98 | 99 | static JSON_INLINE 100 | json_t* json_incref(json_t* json) 101 | { 102 | if(json && json->refcount != (size_t) - 1) 103 | ++json->refcount; 104 | return json; 105 | } 106 | 107 | /* do not call json_delete directly */ 108 | __declspec(dllimport) void json_delete(json_t* json); 109 | 110 | static JSON_INLINE 111 | void json_decref(json_t* json) 112 | { 113 | if(json && json->refcount != (size_t) - 1 && --json->refcount == 0) 114 | json_delete(json); 115 | } 116 | 117 | #if defined(__GNUC__) || defined(__clang__) 118 | static JSON_INLINE 119 | void json_decrefp(json_t** json) 120 | { 121 | if(json) 122 | { 123 | json_decref(*json); 124 | *json = NULL; 125 | } 126 | } 127 | 128 | #define json_auto_t json_t __attribute__((cleanup(json_decrefp))) 129 | #endif 130 | 131 | 132 | /* error reporting */ 133 | 134 | #define JSON_ERROR_TEXT_LENGTH 160 135 | #define JSON_ERROR_SOURCE_LENGTH 80 136 | 137 | typedef struct 138 | { 139 | int line; 140 | int column; 141 | int position; 142 | char source[JSON_ERROR_SOURCE_LENGTH]; 143 | char text[JSON_ERROR_TEXT_LENGTH]; 144 | } json_error_t; 145 | 146 | 147 | /* getters, setters, manipulation */ 148 | 149 | __declspec(dllimport) void json_object_seed(size_t seed); 150 | __declspec(dllimport) size_t json_object_size(const json_t* object); 151 | __declspec(dllimport) json_t* json_object_get(const json_t* object, const char* key); 152 | __declspec(dllimport) int json_object_set_new(json_t* object, const char* key, json_t* value); 153 | __declspec(dllimport) int json_object_set_new_nocheck(json_t* object, const char* key, json_t* value); 154 | __declspec(dllimport) int json_object_del(json_t* object, const char* key); 155 | __declspec(dllimport) int json_object_clear(json_t* object); 156 | __declspec(dllimport) int json_object_update(json_t* object, json_t* other); 157 | __declspec(dllimport) int json_object_update_existing(json_t* object, json_t* other); 158 | __declspec(dllimport) int json_object_update_missing(json_t* object, json_t* other); 159 | __declspec(dllimport) void* json_object_iter(json_t* object); 160 | __declspec(dllimport) void* json_object_iter_at(json_t* object, const char* key); 161 | __declspec(dllimport) void* json_object_key_to_iter(const char* key); 162 | __declspec(dllimport) void* json_object_iter_next(json_t* object, void* iter); 163 | __declspec(dllimport) const char* json_object_iter_key(void* iter); 164 | __declspec(dllimport) json_t* json_object_iter_value(void* iter); 165 | __declspec(dllimport) int json_object_iter_set_new(json_t* object, void* iter, json_t* value); 166 | 167 | #define json_object_foreach(object, key, value) \ 168 | for(key = json_object_iter_key(json_object_iter(object)); \ 169 | key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ 170 | key = json_object_iter_key(json_object_iter_next(object, json_object_key_to_iter(key)))) 171 | 172 | #define json_object_foreach_safe(object, n, key, value) \ 173 | for(key = json_object_iter_key(json_object_iter(object)), \ 174 | n = json_object_iter_next(object, json_object_key_to_iter(key)); \ 175 | key && (value = json_object_iter_value(json_object_key_to_iter(key))); \ 176 | key = json_object_iter_key(n), \ 177 | n = json_object_iter_next(object, json_object_key_to_iter(key))) 178 | 179 | #define json_array_foreach(array, index, value) \ 180 | for(index = 0; \ 181 | index < json_array_size(array) && (value = json_array_get(array, index)); \ 182 | index++) 183 | 184 | static JSON_INLINE 185 | int json_object_set(json_t* object, const char* key, json_t* value) 186 | { 187 | return json_object_set_new(object, key, json_incref(value)); 188 | } 189 | 190 | static JSON_INLINE 191 | int json_object_set_nocheck(json_t* object, const char* key, json_t* value) 192 | { 193 | return json_object_set_new_nocheck(object, key, json_incref(value)); 194 | } 195 | 196 | static JSON_INLINE 197 | int json_object_iter_set(json_t* object, void* iter, json_t* value) 198 | { 199 | return json_object_iter_set_new(object, iter, json_incref(value)); 200 | } 201 | 202 | __declspec(dllimport) size_t json_array_size(const json_t* array); 203 | __declspec(dllimport) json_t* json_array_get(const json_t* array, size_t index); 204 | __declspec(dllimport) int json_array_set_new(json_t* array, size_t index, json_t* value); 205 | __declspec(dllimport) int json_array_append_new(json_t* array, json_t* value); 206 | __declspec(dllimport) int json_array_insert_new(json_t* array, size_t index, json_t* value); 207 | __declspec(dllimport) int json_array_remove(json_t* array, size_t index); 208 | __declspec(dllimport) int json_array_clear(json_t* array); 209 | __declspec(dllimport) int json_array_extend(json_t* array, json_t* other); 210 | 211 | static JSON_INLINE 212 | int json_array_set(json_t* array, size_t ind, json_t* value) 213 | { 214 | return json_array_set_new(array, ind, json_incref(value)); 215 | } 216 | 217 | static JSON_INLINE 218 | int json_array_append(json_t* array, json_t* value) 219 | { 220 | return json_array_append_new(array, json_incref(value)); 221 | } 222 | 223 | static JSON_INLINE 224 | int json_array_insert(json_t* array, size_t ind, json_t* value) 225 | { 226 | return json_array_insert_new(array, ind, json_incref(value)); 227 | } 228 | 229 | __declspec(dllimport) const char* json_string_value(const json_t* string); 230 | __declspec(dllimport) size_t json_string_length(const json_t* string); 231 | __declspec(dllimport) json_int_t json_integer_value(const json_t* integer); 232 | __declspec(dllimport) double json_real_value(const json_t* real); 233 | __declspec(dllimport) double json_number_value(const json_t* json); 234 | 235 | __declspec(dllimport) int json_string_set(json_t* string, const char* value); 236 | __declspec(dllimport) int json_string_setn(json_t* string, const char* value, size_t len); 237 | __declspec(dllimport) int json_string_set_nocheck(json_t* string, const char* value); 238 | __declspec(dllimport) int json_string_setn_nocheck(json_t* string, const char* value, size_t len); 239 | __declspec(dllimport) int json_integer_set(json_t* integer, json_int_t value); 240 | __declspec(dllimport) int json_real_set(json_t* real, double value); 241 | 242 | /* pack, unpack */ 243 | 244 | __declspec(dllimport) json_t* json_pack(const char* fmt, ...); 245 | __declspec(dllimport) json_t* json_pack_ex(json_error_t* error, size_t flags, const char* fmt, ...); 246 | __declspec(dllimport) json_t* json_vpack_ex(json_error_t* error, size_t flags, const char* fmt, va_list ap); 247 | 248 | #define JSON_VALIDATE_ONLY 0x1 249 | #define JSON_STRICT 0x2 250 | 251 | __declspec(dllimport) int json_unpack(json_t* root, const char* fmt, ...); 252 | __declspec(dllimport) int json_unpack_ex(json_t* root, json_error_t* error, size_t flags, const char* fmt, ...); 253 | __declspec(dllimport) int json_vunpack_ex(json_t* root, json_error_t* error, size_t flags, const char* fmt, va_list ap); 254 | 255 | 256 | /* equality */ 257 | 258 | __declspec(dllimport) int json_equal(json_t* value1, json_t* value2); 259 | 260 | 261 | /* copying */ 262 | 263 | __declspec(dllimport) json_t* json_copy(json_t* value); 264 | __declspec(dllimport) json_t* json_deep_copy(const json_t* value); 265 | 266 | 267 | /* decoding */ 268 | 269 | #define JSON_REJECT_DUPLICATES 0x1 270 | #define JSON_DISABLE_EOF_CHECK 0x2 271 | #define JSON_DECODE_ANY 0x4 272 | #define JSON_DECODE_INT_AS_REAL 0x8 273 | #define JSON_ALLOW_NUL 0x10 274 | 275 | typedef size_t (*json_load_callback_t)(void* buffer, size_t buflen, void* data); 276 | 277 | __declspec(dllimport) json_t* json_loads(const char* input, size_t flags, json_error_t* error); 278 | __declspec(dllimport) json_t* json_loadb(const char* buffer, size_t buflen, size_t flags, json_error_t* error); 279 | __declspec(dllimport) json_t* json_loadf(FILE* input, size_t flags, json_error_t* error); 280 | __declspec(dllimport) json_t* json_load_file(const char* path, size_t flags, json_error_t* error); 281 | __declspec(dllimport) json_t* json_load_callback(json_load_callback_t callback, void* data, size_t flags, json_error_t* error); 282 | 283 | 284 | /* encoding */ 285 | 286 | #define JSON_MAX_INDENT 0x1F 287 | #define JSON_INDENT(n) ((n) & JSON_MAX_INDENT) 288 | #define JSON_COMPACT 0x20 289 | #define JSON_ENSURE_ASCII 0x40 290 | #define JSON_SORT_KEYS 0x80 291 | #define JSON_PRESERVE_ORDER 0x100 292 | #define JSON_ENCODE_ANY 0x200 293 | #define JSON_ESCAPE_SLASH 0x400 294 | #define JSON_REAL_PRECISION(n) (((n) & 0x1F) << 11) 295 | 296 | typedef int (*json_dump_callback_t)(const char* buffer, size_t size, void* data); 297 | 298 | __declspec(dllimport) char* json_dumps(const json_t* json, size_t flags); 299 | __declspec(dllimport) int json_dumpf(const json_t* json, FILE* output, size_t flags); 300 | __declspec(dllimport) int json_dump_file(const json_t* json, const char* path, size_t flags); 301 | __declspec(dllimport) int json_dump_callback(const json_t* json, json_dump_callback_t callback, void* data, size_t flags); 302 | 303 | /* custom memory allocation */ 304 | 305 | typedef void* (*json_malloc_t)(size_t); 306 | typedef void (*json_free_t)(void*); 307 | 308 | __declspec(dllimport) void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); 309 | __declspec(dllimport) void json_get_alloc_funcs(json_malloc_t* malloc_fn, json_free_t* free_fn); 310 | 311 | #ifdef __cplusplus 312 | } 313 | #endif 314 | 315 | #endif 316 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/ordered_map.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <functional> // equal_to, less 12 | #include <initializer_list> // initializer_list 13 | #include <iterator> // input_iterator_tag, iterator_traits 14 | #include <memory> // allocator 15 | #include <stdexcept> // for out_of_range 16 | #include <type_traits> // enable_if, is_convertible 17 | #include <utility> // pair 18 | #include <vector> // vector 19 | 20 | #include <nlohmann/detail/macro_scope.hpp> 21 | #include <nlohmann/detail/meta/type_traits.hpp> 22 | 23 | NLOHMANN_JSON_NAMESPACE_BEGIN 24 | 25 | /// ordered_map: a minimal map-like container that preserves insertion order 26 | /// for use within nlohmann::basic_json<ordered_map> 27 | template <class Key, class T, class IgnoredLess = std::less<Key>, 28 | class Allocator = std::allocator<std::pair<const Key, T>>> 29 | struct ordered_map : std::vector<std::pair<const Key, T>, Allocator> 30 | { 31 | using key_type = Key; 32 | using mapped_type = T; 33 | using Container = std::vector<std::pair<const Key, T>, Allocator>; 34 | using iterator = typename Container::iterator; 35 | using const_iterator = typename Container::const_iterator; 36 | using size_type = typename Container::size_type; 37 | using value_type = typename Container::value_type; 38 | #ifdef JSON_HAS_CPP_14 39 | using key_compare = std::equal_to<>; 40 | #else 41 | using key_compare = std::equal_to<Key>; 42 | #endif 43 | 44 | // Explicit constructors instead of `using Container::Container` 45 | // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) 46 | ordered_map() noexcept(noexcept(Container())) : Container{} {} 47 | explicit ordered_map(const Allocator& alloc) noexcept(noexcept(Container(alloc))) : Container{alloc} {} 48 | template <class It> 49 | ordered_map(It first, It last, const Allocator& alloc = Allocator()) 50 | : Container{first, last, alloc} {} 51 | ordered_map(std::initializer_list<value_type> init, const Allocator& alloc = Allocator() ) 52 | : Container{init, alloc} {} 53 | 54 | std::pair<iterator, bool> emplace(const key_type& key, T&& t) 55 | { 56 | for (auto it = this->begin(); it != this->end(); ++it) 57 | { 58 | if (m_compare(it->first, key)) 59 | { 60 | return {it, false}; 61 | } 62 | } 63 | Container::emplace_back(key, std::forward<T>(t)); 64 | return {std::prev(this->end()), true}; 65 | } 66 | 67 | template<class KeyType, detail::enable_if_t< 68 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 69 | std::pair<iterator, bool> emplace(KeyType && key, T && t) 70 | { 71 | for (auto it = this->begin(); it != this->end(); ++it) 72 | { 73 | if (m_compare(it->first, key)) 74 | { 75 | return {it, false}; 76 | } 77 | } 78 | Container::emplace_back(std::forward<KeyType>(key), std::forward<T>(t)); 79 | return {std::prev(this->end()), true}; 80 | } 81 | 82 | T& operator[](const key_type& key) 83 | { 84 | return emplace(key, T{}).first->second; 85 | } 86 | 87 | template<class KeyType, detail::enable_if_t< 88 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 89 | T & operator[](KeyType && key) 90 | { 91 | return emplace(std::forward<KeyType>(key), T{}).first->second; 92 | } 93 | 94 | const T& operator[](const key_type& key) const 95 | { 96 | return at(key); 97 | } 98 | 99 | template<class KeyType, detail::enable_if_t< 100 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 101 | const T & operator[](KeyType && key) const 102 | { 103 | return at(std::forward<KeyType>(key)); 104 | } 105 | 106 | T& at(const key_type& key) 107 | { 108 | for (auto it = this->begin(); it != this->end(); ++it) 109 | { 110 | if (m_compare(it->first, key)) 111 | { 112 | return it->second; 113 | } 114 | } 115 | 116 | JSON_THROW(std::out_of_range("key not found")); 117 | } 118 | 119 | template<class KeyType, detail::enable_if_t< 120 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 121 | T & at(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward) 122 | { 123 | for (auto it = this->begin(); it != this->end(); ++it) 124 | { 125 | if (m_compare(it->first, key)) 126 | { 127 | return it->second; 128 | } 129 | } 130 | 131 | JSON_THROW(std::out_of_range("key not found")); 132 | } 133 | 134 | const T& at(const key_type& key) const 135 | { 136 | for (auto it = this->begin(); it != this->end(); ++it) 137 | { 138 | if (m_compare(it->first, key)) 139 | { 140 | return it->second; 141 | } 142 | } 143 | 144 | JSON_THROW(std::out_of_range("key not found")); 145 | } 146 | 147 | template<class KeyType, detail::enable_if_t< 148 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 149 | const T & at(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward) 150 | { 151 | for (auto it = this->begin(); it != this->end(); ++it) 152 | { 153 | if (m_compare(it->first, key)) 154 | { 155 | return it->second; 156 | } 157 | } 158 | 159 | JSON_THROW(std::out_of_range("key not found")); 160 | } 161 | 162 | size_type erase(const key_type& key) 163 | { 164 | for (auto it = this->begin(); it != this->end(); ++it) 165 | { 166 | if (m_compare(it->first, key)) 167 | { 168 | // Since we cannot move const Keys, re-construct them in place 169 | for (auto next = it; ++next != this->end(); ++it) 170 | { 171 | it->~value_type(); // Destroy but keep allocation 172 | new (&*it) value_type{std::move(*next)}; 173 | } 174 | Container::pop_back(); 175 | return 1; 176 | } 177 | } 178 | return 0; 179 | } 180 | 181 | template<class KeyType, detail::enable_if_t< 182 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 183 | size_type erase(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward) 184 | { 185 | for (auto it = this->begin(); it != this->end(); ++it) 186 | { 187 | if (m_compare(it->first, key)) 188 | { 189 | // Since we cannot move const Keys, re-construct them in place 190 | for (auto next = it; ++next != this->end(); ++it) 191 | { 192 | it->~value_type(); // Destroy but keep allocation 193 | new (&*it) value_type{std::move(*next)}; 194 | } 195 | Container::pop_back(); 196 | return 1; 197 | } 198 | } 199 | return 0; 200 | } 201 | 202 | iterator erase(iterator pos) 203 | { 204 | return erase(pos, std::next(pos)); 205 | } 206 | 207 | iterator erase(iterator first, iterator last) 208 | { 209 | if (first == last) 210 | { 211 | return first; 212 | } 213 | 214 | const auto elements_affected = std::distance(first, last); 215 | const auto offset = std::distance(Container::begin(), first); 216 | 217 | // This is the start situation. We need to delete elements_affected 218 | // elements (3 in this example: e, f, g), and need to return an 219 | // iterator past the last deleted element (h in this example). 220 | // Note that offset is the distance from the start of the vector 221 | // to first. We will need this later. 222 | 223 | // [ a, b, c, d, e, f, g, h, i, j ] 224 | // ^ ^ 225 | // first last 226 | 227 | // Since we cannot move const Keys, we re-construct them in place. 228 | // We start at first and re-construct (viz. copy) the elements from 229 | // the back of the vector. Example for first iteration: 230 | 231 | // ,--------. 232 | // v | destroy e and re-construct with h 233 | // [ a, b, c, d, e, f, g, h, i, j ] 234 | // ^ ^ 235 | // it it + elements_affected 236 | 237 | for (auto it = first; std::next(it, elements_affected) != Container::end(); ++it) 238 | { 239 | it->~value_type(); // destroy but keep allocation 240 | new (&*it) value_type{std::move(*std::next(it, elements_affected))}; // "move" next element to it 241 | } 242 | 243 | // [ a, b, c, d, h, i, j, h, i, j ] 244 | // ^ ^ 245 | // first last 246 | 247 | // remove the unneeded elements at the end of the vector 248 | Container::resize(this->size() - static_cast<size_type>(elements_affected)); 249 | 250 | // [ a, b, c, d, h, i, j ] 251 | // ^ ^ 252 | // first last 253 | 254 | // first is now pointing past the last deleted element, but we cannot 255 | // use this iterator, because it may have been invalidated by the 256 | // resize call. Instead, we can return begin() + offset. 257 | return Container::begin() + offset; 258 | } 259 | 260 | size_type count(const key_type& key) const 261 | { 262 | for (auto it = this->begin(); it != this->end(); ++it) 263 | { 264 | if (m_compare(it->first, key)) 265 | { 266 | return 1; 267 | } 268 | } 269 | return 0; 270 | } 271 | 272 | template<class KeyType, detail::enable_if_t< 273 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 274 | size_type count(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward) 275 | { 276 | for (auto it = this->begin(); it != this->end(); ++it) 277 | { 278 | if (m_compare(it->first, key)) 279 | { 280 | return 1; 281 | } 282 | } 283 | return 0; 284 | } 285 | 286 | iterator find(const key_type& key) 287 | { 288 | for (auto it = this->begin(); it != this->end(); ++it) 289 | { 290 | if (m_compare(it->first, key)) 291 | { 292 | return it; 293 | } 294 | } 295 | return Container::end(); 296 | } 297 | 298 | template<class KeyType, detail::enable_if_t< 299 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 300 | iterator find(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward) 301 | { 302 | for (auto it = this->begin(); it != this->end(); ++it) 303 | { 304 | if (m_compare(it->first, key)) 305 | { 306 | return it; 307 | } 308 | } 309 | return Container::end(); 310 | } 311 | 312 | const_iterator find(const key_type& key) const 313 | { 314 | for (auto it = this->begin(); it != this->end(); ++it) 315 | { 316 | if (m_compare(it->first, key)) 317 | { 318 | return it; 319 | } 320 | } 321 | return Container::end(); 322 | } 323 | 324 | std::pair<iterator, bool> insert( value_type&& value ) 325 | { 326 | return emplace(value.first, std::move(value.second)); 327 | } 328 | 329 | std::pair<iterator, bool> insert( const value_type& value ) 330 | { 331 | for (auto it = this->begin(); it != this->end(); ++it) 332 | { 333 | if (m_compare(it->first, value.first)) 334 | { 335 | return {it, false}; 336 | } 337 | } 338 | Container::push_back(value); 339 | return {--this->end(), true}; 340 | } 341 | 342 | template<typename InputIt> 343 | using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category, 344 | std::input_iterator_tag>::value>::type; 345 | 346 | template<typename InputIt, typename = require_input_iter<InputIt>> 347 | void insert(InputIt first, InputIt last) 348 | { 349 | for (auto it = first; it != last; ++it) 350 | { 351 | insert(*it); 352 | } 353 | } 354 | 355 | private: 356 | JSON_NO_UNIQUE_ADDRESS key_compare m_compare = key_compare(); 357 | }; 358 | 359 | NLOHMANN_JSON_NAMESPACE_END 360 | ``` -------------------------------------------------------------------------------- /include/nlohmann/ordered_map.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <functional> // equal_to, less 12 | #include <initializer_list> // initializer_list 13 | #include <iterator> // input_iterator_tag, iterator_traits 14 | #include <memory> // allocator 15 | #include <stdexcept> // for out_of_range 16 | #include <type_traits> // enable_if, is_convertible 17 | #include <utility> // pair 18 | #include <vector> // vector 19 | 20 | #include <nlohmann/detail/macro_scope.hpp> 21 | #include <nlohmann/detail/meta/type_traits.hpp> 22 | 23 | NLOHMANN_JSON_NAMESPACE_BEGIN 24 | 25 | /// ordered_map: a minimal map-like container that preserves insertion order 26 | /// for use within nlohmann::basic_json<ordered_map> 27 | template <class Key, class T, class IgnoredLess = std::less<Key>, 28 | class Allocator = std::allocator<std::pair<const Key, T>>> 29 | struct ordered_map : std::vector<std::pair<const Key, T>, Allocator> 30 | { 31 | using key_type = Key; 32 | using mapped_type = T; 33 | using Container = std::vector<std::pair<const Key, T>, Allocator>; 34 | using iterator = typename Container::iterator; 35 | using const_iterator = typename Container::const_iterator; 36 | using size_type = typename Container::size_type; 37 | using value_type = typename Container::value_type; 38 | #ifdef JSON_HAS_CPP_14 39 | using key_compare = std::equal_to<>; 40 | #else 41 | using key_compare = std::equal_to<Key>; 42 | #endif 43 | 44 | // Explicit constructors instead of `using Container::Container` 45 | // otherwise older compilers choke on it (GCC <= 5.5, xcode <= 9.4) 46 | ordered_map() noexcept(noexcept(Container())) : Container{} {} 47 | explicit ordered_map(const Allocator& alloc) noexcept(noexcept(Container(alloc))) : Container{alloc} {} 48 | template <class It> 49 | ordered_map(It first, It last, const Allocator& alloc = Allocator()) 50 | : Container{first, last, alloc} {} 51 | ordered_map(std::initializer_list<value_type> init, const Allocator& alloc = Allocator() ) 52 | : Container{init, alloc} {} 53 | 54 | std::pair<iterator, bool> emplace(const key_type& key, T&& t) 55 | { 56 | for (auto it = this->begin(); it != this->end(); ++it) 57 | { 58 | if (m_compare(it->first, key)) 59 | { 60 | return {it, false}; 61 | } 62 | } 63 | Container::emplace_back(key, std::forward<T>(t)); 64 | return {std::prev(this->end()), true}; 65 | } 66 | 67 | template<class KeyType, detail::enable_if_t< 68 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 69 | std::pair<iterator, bool> emplace(KeyType && key, T && t) 70 | { 71 | for (auto it = this->begin(); it != this->end(); ++it) 72 | { 73 | if (m_compare(it->first, key)) 74 | { 75 | return {it, false}; 76 | } 77 | } 78 | Container::emplace_back(std::forward<KeyType>(key), std::forward<T>(t)); 79 | return {std::prev(this->end()), true}; 80 | } 81 | 82 | T& operator[](const key_type& key) 83 | { 84 | return emplace(key, T{}).first->second; 85 | } 86 | 87 | template<class KeyType, detail::enable_if_t< 88 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 89 | T & operator[](KeyType && key) 90 | { 91 | return emplace(std::forward<KeyType>(key), T{}).first->second; 92 | } 93 | 94 | const T& operator[](const key_type& key) const 95 | { 96 | return at(key); 97 | } 98 | 99 | template<class KeyType, detail::enable_if_t< 100 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 101 | const T & operator[](KeyType && key) const 102 | { 103 | return at(std::forward<KeyType>(key)); 104 | } 105 | 106 | T& at(const key_type& key) 107 | { 108 | for (auto it = this->begin(); it != this->end(); ++it) 109 | { 110 | if (m_compare(it->first, key)) 111 | { 112 | return it->second; 113 | } 114 | } 115 | 116 | JSON_THROW(std::out_of_range("key not found")); 117 | } 118 | 119 | template<class KeyType, detail::enable_if_t< 120 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 121 | T & at(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward) 122 | { 123 | for (auto it = this->begin(); it != this->end(); ++it) 124 | { 125 | if (m_compare(it->first, key)) 126 | { 127 | return it->second; 128 | } 129 | } 130 | 131 | JSON_THROW(std::out_of_range("key not found")); 132 | } 133 | 134 | const T& at(const key_type& key) const 135 | { 136 | for (auto it = this->begin(); it != this->end(); ++it) 137 | { 138 | if (m_compare(it->first, key)) 139 | { 140 | return it->second; 141 | } 142 | } 143 | 144 | JSON_THROW(std::out_of_range("key not found")); 145 | } 146 | 147 | template<class KeyType, detail::enable_if_t< 148 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 149 | const T & at(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward) 150 | { 151 | for (auto it = this->begin(); it != this->end(); ++it) 152 | { 153 | if (m_compare(it->first, key)) 154 | { 155 | return it->second; 156 | } 157 | } 158 | 159 | JSON_THROW(std::out_of_range("key not found")); 160 | } 161 | 162 | size_type erase(const key_type& key) 163 | { 164 | for (auto it = this->begin(); it != this->end(); ++it) 165 | { 166 | if (m_compare(it->first, key)) 167 | { 168 | // Since we cannot move const Keys, re-construct them in place 169 | for (auto next = it; ++next != this->end(); ++it) 170 | { 171 | it->~value_type(); // Destroy but keep allocation 172 | new (&*it) value_type{std::move(*next)}; 173 | } 174 | Container::pop_back(); 175 | return 1; 176 | } 177 | } 178 | return 0; 179 | } 180 | 181 | template<class KeyType, detail::enable_if_t< 182 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 183 | size_type erase(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward) 184 | { 185 | for (auto it = this->begin(); it != this->end(); ++it) 186 | { 187 | if (m_compare(it->first, key)) 188 | { 189 | // Since we cannot move const Keys, re-construct them in place 190 | for (auto next = it; ++next != this->end(); ++it) 191 | { 192 | it->~value_type(); // Destroy but keep allocation 193 | new (&*it) value_type{std::move(*next)}; 194 | } 195 | Container::pop_back(); 196 | return 1; 197 | } 198 | } 199 | return 0; 200 | } 201 | 202 | iterator erase(iterator pos) 203 | { 204 | return erase(pos, std::next(pos)); 205 | } 206 | 207 | iterator erase(iterator first, iterator last) 208 | { 209 | if (first == last) 210 | { 211 | return first; 212 | } 213 | 214 | const auto elements_affected = std::distance(first, last); 215 | const auto offset = std::distance(Container::begin(), first); 216 | 217 | // This is the start situation. We need to delete elements_affected 218 | // elements (3 in this example: e, f, g), and need to return an 219 | // iterator past the last deleted element (h in this example). 220 | // Note that offset is the distance from the start of the vector 221 | // to first. We will need this later. 222 | 223 | // [ a, b, c, d, e, f, g, h, i, j ] 224 | // ^ ^ 225 | // first last 226 | 227 | // Since we cannot move const Keys, we re-construct them in place. 228 | // We start at first and re-construct (viz. copy) the elements from 229 | // the back of the vector. Example for first iteration: 230 | 231 | // ,--------. 232 | // v | destroy e and re-construct with h 233 | // [ a, b, c, d, e, f, g, h, i, j ] 234 | // ^ ^ 235 | // it it + elements_affected 236 | 237 | for (auto it = first; std::next(it, elements_affected) != Container::end(); ++it) 238 | { 239 | it->~value_type(); // destroy but keep allocation 240 | new (&*it) value_type{std::move(*std::next(it, elements_affected))}; // "move" next element to it 241 | } 242 | 243 | // [ a, b, c, d, h, i, j, h, i, j ] 244 | // ^ ^ 245 | // first last 246 | 247 | // remove the unneeded elements at the end of the vector 248 | Container::resize(this->size() - static_cast<size_type>(elements_affected)); 249 | 250 | // [ a, b, c, d, h, i, j ] 251 | // ^ ^ 252 | // first last 253 | 254 | // first is now pointing past the last deleted element, but we cannot 255 | // use this iterator, because it may have been invalidated by the 256 | // resize call. Instead, we can return begin() + offset. 257 | return Container::begin() + offset; 258 | } 259 | 260 | size_type count(const key_type& key) const 261 | { 262 | for (auto it = this->begin(); it != this->end(); ++it) 263 | { 264 | if (m_compare(it->first, key)) 265 | { 266 | return 1; 267 | } 268 | } 269 | return 0; 270 | } 271 | 272 | template<class KeyType, detail::enable_if_t< 273 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 274 | size_type count(KeyType && key) const // NOLINT(cppcoreguidelines-missing-std-forward) 275 | { 276 | for (auto it = this->begin(); it != this->end(); ++it) 277 | { 278 | if (m_compare(it->first, key)) 279 | { 280 | return 1; 281 | } 282 | } 283 | return 0; 284 | } 285 | 286 | iterator find(const key_type& key) 287 | { 288 | for (auto it = this->begin(); it != this->end(); ++it) 289 | { 290 | if (m_compare(it->first, key)) 291 | { 292 | return it; 293 | } 294 | } 295 | return Container::end(); 296 | } 297 | 298 | template<class KeyType, detail::enable_if_t< 299 | detail::is_usable_as_key_type<key_compare, key_type, KeyType>::value, int> = 0> 300 | iterator find(KeyType && key) // NOLINT(cppcoreguidelines-missing-std-forward) 301 | { 302 | for (auto it = this->begin(); it != this->end(); ++it) 303 | { 304 | if (m_compare(it->first, key)) 305 | { 306 | return it; 307 | } 308 | } 309 | return Container::end(); 310 | } 311 | 312 | const_iterator find(const key_type& key) const 313 | { 314 | for (auto it = this->begin(); it != this->end(); ++it) 315 | { 316 | if (m_compare(it->first, key)) 317 | { 318 | return it; 319 | } 320 | } 321 | return Container::end(); 322 | } 323 | 324 | std::pair<iterator, bool> insert( value_type&& value ) 325 | { 326 | return emplace(value.first, std::move(value.second)); 327 | } 328 | 329 | std::pair<iterator, bool> insert( const value_type& value ) 330 | { 331 | for (auto it = this->begin(); it != this->end(); ++it) 332 | { 333 | if (m_compare(it->first, value.first)) 334 | { 335 | return {it, false}; 336 | } 337 | } 338 | Container::push_back(value); 339 | return {--this->end(), true}; 340 | } 341 | 342 | template<typename InputIt> 343 | using require_input_iter = typename std::enable_if<std::is_convertible<typename std::iterator_traits<InputIt>::iterator_category, 344 | std::input_iterator_tag>::value>::type; 345 | 346 | template<typename InputIt, typename = require_input_iter<InputIt>> 347 | void insert(InputIt first, InputIt last) 348 | { 349 | for (auto it = first; it != last; ++it) 350 | { 351 | insert(*it); 352 | } 353 | } 354 | 355 | private: 356 | JSON_NO_UNIQUE_ADDRESS key_compare m_compare = key_compare(); 357 | }; 358 | 359 | NLOHMANN_JSON_NAMESPACE_END 360 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/lz4/lz4.h: -------------------------------------------------------------------------------- ``` 1 | /* 2 | LZ4 - Fast LZ compression algorithm 3 | Header File 4 | Copyright (C) 2011-2014, Yann Collet. 5 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided with the 16 | distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | You can contact the author at : 31 | - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html 32 | - LZ4 source repository : http://code.google.com/p/lz4/ 33 | */ 34 | #ifndef _LZ4_H 35 | #define _LZ4_H 36 | 37 | #if defined (__cplusplus) 38 | extern "C" 39 | { 40 | #endif 41 | 42 | 43 | /************************************** 44 | Version 45 | **************************************/ 46 | #define LZ4_VERSION_MAJOR 1 /* for major interface/format changes */ 47 | #define LZ4_VERSION_MINOR 1 /* for minor interface/format changes */ 48 | #define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */ 49 | 50 | 51 | /************************************** 52 | Compiler Options 53 | **************************************/ 54 | #if (defined(__GNUC__) && defined(__STRICT_ANSI__)) || (defined(_MSC_VER) && !defined(__cplusplus)) /* Visual Studio */ 55 | # define inline __inline /* Visual C is not C99, but supports some kind of inline */ 56 | #endif 57 | 58 | 59 | /************************************** 60 | Simple Functions 61 | **************************************/ 62 | 63 | __declspec(dllimport) int LZ4_compress(const char* source, char* dest, int inputSize); 64 | __declspec(dllimport) int LZ4_decompress_safe(const char* source, char* dest, int inputSize, int maxOutputSize); 65 | 66 | /* 67 | LZ4_compress() : 68 | Compresses 'inputSize' bytes from 'source' into 'dest'. 69 | Destination buffer must be already allocated, 70 | and must be sized to handle worst cases situations (input data not compressible) 71 | Worst case size evaluation is provided by function LZ4_compressBound() 72 | inputSize : Max supported value is LZ4_MAX_INPUT_VALUE 73 | return : the number of bytes written in buffer dest 74 | or 0 if the compression fails 75 | 76 | LZ4_decompress_safe() : 77 | maxOutputSize : is the size of the destination buffer (which must be already allocated) 78 | return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize) 79 | If the source stream is detected malformed, the function will stop decoding and return a negative result. 80 | This function is protected against buffer overflow exploits (never writes outside of output buffer, and never reads outside of input buffer). Therefore, it is protected against malicious data packets 81 | */ 82 | 83 | 84 | /************************************** 85 | Advanced Functions 86 | **************************************/ 87 | #define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */ 88 | #define LZ4_COMPRESSBOUND(isize) ((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) 89 | 90 | /* 91 | LZ4_compressBound() : 92 | Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible) 93 | primarily useful for memory allocation of output buffer. 94 | inline function is recommended for the general case, 95 | macro is also provided when result needs to be evaluated at compilation (such as stack memory allocation). 96 | 97 | isize : is the input size. Max supported value is LZ4_MAX_INPUT_SIZE 98 | return : maximum output size in a "worst case" scenario 99 | or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE) 100 | */ 101 | __declspec(dllimport) int LZ4_compressBound(int isize); 102 | 103 | 104 | /* 105 | LZ4_compress_limitedOutput() : 106 | Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. 107 | If it cannot achieve it, compression will stop, and result of the function will be zero. 108 | This function never writes outside of provided output buffer. 109 | 110 | inputSize : Max supported value is LZ4_MAX_INPUT_VALUE 111 | maxOutputSize : is the size of the destination buffer (which must be already allocated) 112 | return : the number of bytes written in buffer 'dest' 113 | or 0 if the compression fails 114 | */ 115 | __declspec(dllimport) int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize); 116 | 117 | 118 | /* 119 | LZ4_decompress_fast() : 120 | originalSize : is the original and therefore uncompressed size 121 | return : the number of bytes read from the source buffer (in other words, the compressed size) 122 | If the source stream is malformed, the function will stop decoding and return a negative result. 123 | note : This function is a bit faster than LZ4_decompress_safe() 124 | This function never writes outside of output buffers, but may read beyond input buffer in case of malicious data packet. 125 | Use this function preferably into a trusted environment (data to decode comes from a trusted source). 126 | Destination buffer must be already allocated. Its size must be a minimum of 'outputSize' bytes. 127 | */ 128 | __declspec(dllimport) int LZ4_decompress_fast(const char* source, char* dest, int originalSize); 129 | 130 | 131 | /* 132 | LZ4_decompress_safe_partial() : 133 | This function decompress a compressed block of size 'inputSize' at position 'source' 134 | into output buffer 'dest' of size 'maxOutputSize'. 135 | The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached, 136 | reducing decompression time. 137 | return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize) 138 | Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller. 139 | Always control how many bytes were decoded. 140 | If the source stream is detected malformed, the function will stop decoding and return a negative result. 141 | This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets 142 | */ 143 | __declspec(dllimport) int LZ4_decompress_safe_partial(const char* source, char* dest, int inputSize, int targetOutputSize, int maxOutputSize); 144 | 145 | 146 | /* 147 | These functions are provided should you prefer to allocate memory for compression tables with your own allocation methods. 148 | To know how much memory must be allocated for the compression tables, use : 149 | int LZ4_sizeofState(); 150 | 151 | Note that tables must be aligned on 4-bytes boundaries, otherwise compression will fail (return code 0). 152 | 153 | The allocated memory can be provided to the compressions functions using 'void* state' parameter. 154 | LZ4_compress_withState() and LZ4_compress_limitedOutput_withState() are equivalent to previously described functions. 155 | They just use the externally allocated memory area instead of allocating their own (on stack, or on heap). 156 | */ 157 | __declspec(dllimport) int LZ4_sizeofState(void); 158 | __declspec(dllimport) int LZ4_compress_withState(void* state, const char* source, char* dest, int inputSize); 159 | __declspec(dllimport) int LZ4_compress_limitedOutput_withState(void* state, const char* source, char* dest, int inputSize, int maxOutputSize); 160 | 161 | 162 | /************************************** 163 | Streaming Functions 164 | **************************************/ 165 | __declspec(dllimport) void* LZ4_create(const char* inputBuffer); 166 | __declspec(dllimport) int LZ4_compress_continue(void* LZ4_Data, const char* source, char* dest, int inputSize); 167 | __declspec(dllimport) int LZ4_compress_limitedOutput_continue(void* LZ4_Data, const char* source, char* dest, int inputSize, int maxOutputSize); 168 | __declspec(dllimport) char* LZ4_slideInputBuffer(void* LZ4_Data); 169 | __declspec(dllimport) int LZ4_free(void* LZ4_Data); 170 | 171 | /* 172 | These functions allow the compression of dependent blocks, where each block benefits from prior 64 KB within preceding blocks. 173 | In order to achieve this, it is necessary to start creating the LZ4 Data Structure, thanks to the function : 174 | 175 | void* LZ4_create (const char* inputBuffer); 176 | The result of the function is the (void*) pointer on the LZ4 Data Structure. 177 | This pointer will be needed in all other functions. 178 | If the pointer returned is NULL, then the allocation has failed, and compression must be aborted. 179 | The only parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 180 | The input buffer must be already allocated, and size at least 192KB. 181 | 'inputBuffer' will also be the 'const char* source' of the first block. 182 | 183 | All blocks are expected to lay next to each other within the input buffer, starting from 'inputBuffer'. 184 | To compress each block, use either LZ4_compress_continue() or LZ4_compress_limitedOutput_continue(). 185 | Their behavior are identical to LZ4_compress() or LZ4_compress_limitedOutput(), 186 | but require the LZ4 Data Structure as their first argument, and check that each block starts right after the previous one. 187 | If next block does not begin immediately after the previous one, the compression will fail (return 0). 188 | 189 | When it's no longer possible to lay the next block after the previous one (not enough space left into input buffer), a call to : 190 | char* LZ4_slideInputBuffer(void* LZ4_Data); 191 | must be performed. It will typically copy the latest 64KB of input at the beginning of input buffer. 192 | Note that, for this function to work properly, minimum size of an input buffer must be 192KB. 193 | ==> The memory position where the next input data block must start is provided as the result of the function. 194 | 195 | Compression can then resume, using LZ4_compress_continue() or LZ4_compress_limitedOutput_continue(), as usual. 196 | 197 | When compression is completed, a call to LZ4_free() will release the memory used by the LZ4 Data Structure. 198 | */ 199 | 200 | 201 | __declspec(dllimport) int LZ4_sizeofStreamState(void); 202 | __declspec(dllimport) int LZ4_resetStreamState(void* state, const char* inputBuffer); 203 | 204 | /* 205 | These functions achieve the same result as : 206 | void* LZ4_create (const char* inputBuffer); 207 | 208 | They are provided here to allow the user program to allocate memory using its own routines. 209 | 210 | To know how much space must be allocated, use LZ4_sizeofStreamState(); 211 | Note also that space must be 4-bytes aligned. 212 | 213 | Once space is allocated, you must initialize it using : LZ4_resetStreamState(void* state, const char* inputBuffer); 214 | void* state is a pointer to the space allocated. 215 | It must be aligned on 4-bytes boundaries, and be large enough. 216 | The parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 217 | The input buffer must be already allocated, and size at least 192KB. 218 | 'inputBuffer' will also be the 'const char* source' of the first block. 219 | 220 | The same space can be re-used multiple times, just by initializing it each time with LZ4_resetStreamState(). 221 | return value of LZ4_resetStreamState() must be 0 is OK. 222 | Any other value means there was an error (typically, pointer is not aligned on 4-bytes boundaries). 223 | */ 224 | 225 | 226 | __declspec(dllimport) int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int inputSize, int maxOutputSize); 227 | __declspec(dllimport) int LZ4_decompress_fast_withPrefix64k(const char* source, char* dest, int outputSize); 228 | 229 | /* 230 | *_withPrefix64k() : 231 | These decoding functions work the same as their "normal name" versions, 232 | but can use up to 64KB of data in front of 'char* dest'. 233 | These functions are necessary to decode inter-dependant blocks. 234 | */ 235 | 236 | 237 | /************************************** 238 | Obsolete Functions 239 | **************************************/ 240 | /* 241 | These functions are deprecated and should no longer be used. 242 | They are provided here for compatibility with existing user programs. 243 | */ 244 | __declspec(dllimport) int LZ4_uncompress(const char* source, char* dest, int outputSize); 245 | __declspec(dllimport) int LZ4_uncompress_unknownOutputSize(const char* source, char* dest, int isize, int maxOutputSize); 246 | 247 | 248 | #if defined (__cplusplus) 249 | } 250 | #endif 251 | 252 | #endif //_LZ4_H ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/lz4/lz4.h: -------------------------------------------------------------------------------- ``` 1 | /* 2 | LZ4 - Fast LZ compression algorithm 3 | Header File 4 | Copyright (C) 2011-2014, Yann Collet. 5 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided with the 16 | distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | You can contact the author at : 31 | - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html 32 | - LZ4 source repository : http://code.google.com/p/lz4/ 33 | */ 34 | #ifndef _LZ4_H 35 | #define _LZ4_H 36 | 37 | #if defined (__cplusplus) 38 | extern "C" 39 | { 40 | #endif 41 | 42 | 43 | /************************************** 44 | Version 45 | **************************************/ 46 | #define LZ4_VERSION_MAJOR 1 /* for major interface/format changes */ 47 | #define LZ4_VERSION_MINOR 1 /* for minor interface/format changes */ 48 | #define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */ 49 | 50 | 51 | /************************************** 52 | Compiler Options 53 | **************************************/ 54 | #if (defined(__GNUC__) && defined(__STRICT_ANSI__)) || (defined(_MSC_VER) && !defined(__cplusplus)) /* Visual Studio */ 55 | # define inline __inline /* Visual C is not C99, but supports some kind of inline */ 56 | #endif 57 | 58 | 59 | /************************************** 60 | Simple Functions 61 | **************************************/ 62 | 63 | __declspec(dllimport) int LZ4_compress(const char* source, char* dest, int inputSize); 64 | __declspec(dllimport) int LZ4_decompress_safe(const char* source, char* dest, int inputSize, int maxOutputSize); 65 | 66 | /* 67 | LZ4_compress() : 68 | Compresses 'inputSize' bytes from 'source' into 'dest'. 69 | Destination buffer must be already allocated, 70 | and must be sized to handle worst cases situations (input data not compressible) 71 | Worst case size evaluation is provided by function LZ4_compressBound() 72 | inputSize : Max supported value is LZ4_MAX_INPUT_VALUE 73 | return : the number of bytes written in buffer dest 74 | or 0 if the compression fails 75 | 76 | LZ4_decompress_safe() : 77 | maxOutputSize : is the size of the destination buffer (which must be already allocated) 78 | return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize) 79 | If the source stream is detected malformed, the function will stop decoding and return a negative result. 80 | This function is protected against buffer overflow exploits (never writes outside of output buffer, and never reads outside of input buffer). Therefore, it is protected against malicious data packets 81 | */ 82 | 83 | 84 | /************************************** 85 | Advanced Functions 86 | **************************************/ 87 | #define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */ 88 | #define LZ4_COMPRESSBOUND(isize) ((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) 89 | 90 | /* 91 | LZ4_compressBound() : 92 | Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible) 93 | primarily useful for memory allocation of output buffer. 94 | inline function is recommended for the general case, 95 | macro is also provided when result needs to be evaluated at compilation (such as stack memory allocation). 96 | 97 | isize : is the input size. Max supported value is LZ4_MAX_INPUT_SIZE 98 | return : maximum output size in a "worst case" scenario 99 | or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE) 100 | */ 101 | __declspec(dllimport) int LZ4_compressBound(int isize); 102 | 103 | 104 | /* 105 | LZ4_compress_limitedOutput() : 106 | Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. 107 | If it cannot achieve it, compression will stop, and result of the function will be zero. 108 | This function never writes outside of provided output buffer. 109 | 110 | inputSize : Max supported value is LZ4_MAX_INPUT_VALUE 111 | maxOutputSize : is the size of the destination buffer (which must be already allocated) 112 | return : the number of bytes written in buffer 'dest' 113 | or 0 if the compression fails 114 | */ 115 | __declspec(dllimport) int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize); 116 | 117 | 118 | /* 119 | LZ4_decompress_fast() : 120 | originalSize : is the original and therefore uncompressed size 121 | return : the number of bytes read from the source buffer (in other words, the compressed size) 122 | If the source stream is malformed, the function will stop decoding and return a negative result. 123 | note : This function is a bit faster than LZ4_decompress_safe() 124 | This function never writes outside of output buffers, but may read beyond input buffer in case of malicious data packet. 125 | Use this function preferably into a trusted environment (data to decode comes from a trusted source). 126 | Destination buffer must be already allocated. Its size must be a minimum of 'outputSize' bytes. 127 | */ 128 | __declspec(dllimport) int LZ4_decompress_fast(const char* source, char* dest, int originalSize); 129 | 130 | 131 | /* 132 | LZ4_decompress_safe_partial() : 133 | This function decompress a compressed block of size 'inputSize' at position 'source' 134 | into output buffer 'dest' of size 'maxOutputSize'. 135 | The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached, 136 | reducing decompression time. 137 | return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize) 138 | Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller. 139 | Always control how many bytes were decoded. 140 | If the source stream is detected malformed, the function will stop decoding and return a negative result. 141 | This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets 142 | */ 143 | __declspec(dllimport) int LZ4_decompress_safe_partial(const char* source, char* dest, int inputSize, int targetOutputSize, int maxOutputSize); 144 | 145 | 146 | /* 147 | These functions are provided should you prefer to allocate memory for compression tables with your own allocation methods. 148 | To know how much memory must be allocated for the compression tables, use : 149 | int LZ4_sizeofState(); 150 | 151 | Note that tables must be aligned on 4-bytes boundaries, otherwise compression will fail (return code 0). 152 | 153 | The allocated memory can be provided to the compressions functions using 'void* state' parameter. 154 | LZ4_compress_withState() and LZ4_compress_limitedOutput_withState() are equivalent to previously described functions. 155 | They just use the externally allocated memory area instead of allocating their own (on stack, or on heap). 156 | */ 157 | __declspec(dllimport) int LZ4_sizeofState(void); 158 | __declspec(dllimport) int LZ4_compress_withState(void* state, const char* source, char* dest, int inputSize); 159 | __declspec(dllimport) int LZ4_compress_limitedOutput_withState(void* state, const char* source, char* dest, int inputSize, int maxOutputSize); 160 | 161 | 162 | /************************************** 163 | Streaming Functions 164 | **************************************/ 165 | __declspec(dllimport) void* LZ4_create(const char* inputBuffer); 166 | __declspec(dllimport) int LZ4_compress_continue(void* LZ4_Data, const char* source, char* dest, int inputSize); 167 | __declspec(dllimport) int LZ4_compress_limitedOutput_continue(void* LZ4_Data, const char* source, char* dest, int inputSize, int maxOutputSize); 168 | __declspec(dllimport) char* LZ4_slideInputBuffer(void* LZ4_Data); 169 | __declspec(dllimport) int LZ4_free(void* LZ4_Data); 170 | 171 | /* 172 | These functions allow the compression of dependent blocks, where each block benefits from prior 64 KB within preceding blocks. 173 | In order to achieve this, it is necessary to start creating the LZ4 Data Structure, thanks to the function : 174 | 175 | void* LZ4_create (const char* inputBuffer); 176 | The result of the function is the (void*) pointer on the LZ4 Data Structure. 177 | This pointer will be needed in all other functions. 178 | If the pointer returned is NULL, then the allocation has failed, and compression must be aborted. 179 | The only parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 180 | The input buffer must be already allocated, and size at least 192KB. 181 | 'inputBuffer' will also be the 'const char* source' of the first block. 182 | 183 | All blocks are expected to lay next to each other within the input buffer, starting from 'inputBuffer'. 184 | To compress each block, use either LZ4_compress_continue() or LZ4_compress_limitedOutput_continue(). 185 | Their behavior are identical to LZ4_compress() or LZ4_compress_limitedOutput(), 186 | but require the LZ4 Data Structure as their first argument, and check that each block starts right after the previous one. 187 | If next block does not begin immediately after the previous one, the compression will fail (return 0). 188 | 189 | When it's no longer possible to lay the next block after the previous one (not enough space left into input buffer), a call to : 190 | char* LZ4_slideInputBuffer(void* LZ4_Data); 191 | must be performed. It will typically copy the latest 64KB of input at the beginning of input buffer. 192 | Note that, for this function to work properly, minimum size of an input buffer must be 192KB. 193 | ==> The memory position where the next input data block must start is provided as the result of the function. 194 | 195 | Compression can then resume, using LZ4_compress_continue() or LZ4_compress_limitedOutput_continue(), as usual. 196 | 197 | When compression is completed, a call to LZ4_free() will release the memory used by the LZ4 Data Structure. 198 | */ 199 | 200 | 201 | __declspec(dllimport) int LZ4_sizeofStreamState(void); 202 | __declspec(dllimport) int LZ4_resetStreamState(void* state, const char* inputBuffer); 203 | 204 | /* 205 | These functions achieve the same result as : 206 | void* LZ4_create (const char* inputBuffer); 207 | 208 | They are provided here to allow the user program to allocate memory using its own routines. 209 | 210 | To know how much space must be allocated, use LZ4_sizeofStreamState(); 211 | Note also that space must be 4-bytes aligned. 212 | 213 | Once space is allocated, you must initialize it using : LZ4_resetStreamState(void* state, const char* inputBuffer); 214 | void* state is a pointer to the space allocated. 215 | It must be aligned on 4-bytes boundaries, and be large enough. 216 | The parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 217 | The input buffer must be already allocated, and size at least 192KB. 218 | 'inputBuffer' will also be the 'const char* source' of the first block. 219 | 220 | The same space can be re-used multiple times, just by initializing it each time with LZ4_resetStreamState(). 221 | return value of LZ4_resetStreamState() must be 0 is OK. 222 | Any other value means there was an error (typically, pointer is not aligned on 4-bytes boundaries). 223 | */ 224 | 225 | 226 | __declspec(dllimport) int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int inputSize, int maxOutputSize); 227 | __declspec(dllimport) int LZ4_decompress_fast_withPrefix64k(const char* source, char* dest, int outputSize); 228 | 229 | /* 230 | *_withPrefix64k() : 231 | These decoding functions work the same as their "normal name" versions, 232 | but can use up to 64KB of data in front of 'char* dest'. 233 | These functions are necessary to decode inter-dependant blocks. 234 | */ 235 | 236 | 237 | /************************************** 238 | Obsolete Functions 239 | **************************************/ 240 | /* 241 | These functions are deprecated and should no longer be used. 242 | They are provided here for compatibility with existing user programs. 243 | */ 244 | __declspec(dllimport) int LZ4_uncompress(const char* source, char* dest, int outputSize); 245 | __declspec(dllimport) int LZ4_uncompress_unknownOutputSize(const char* source, char* dest, int isize, int maxOutputSize); 246 | 247 | 248 | #if defined (__cplusplus) 249 | } 250 | #endif 251 | 252 | #endif //_LZ4_H ```