BVB Source Codes

x64dbg Show _scriptapi_symbol.cpp Source code

Return Download x64dbg: download _scriptapi_symbol.cpp Source code - Download x64dbg Source code - Type:.cpp
  1. #include "_scriptapi_symbol.h"
  2. #include "_scriptapi_label.h"
  3. #include "symbolinfo.h"
  4.  
  5. using namespace Script::Symbol;
  6.  
  7. struct cbSymbolEnumCtx
  8. {
  9.     const SYMBOLMODULEINFO* module;
  10.     std::vector<SymbolInfo>* symbols;
  11. } ;
  12.  
  13. static void cbSymbolEnum(SYMBOLINFO* info, void* user)
  14. {
  15.     auto ctx = (cbSymbolEnumCtx*)user;
  16.  
  17.     SymbolInfo symbol = {};
  18.     strncpy_s(symbol.mod, sizeof(symbol.mod), ctx->module->name, sizeof(symbol.mod) - 1);
  19.     symbol.rva = info->addr - ctx->module->base;
  20.     strncpy_s(symbol.name, sizeof(symbol.name), info->undecoratedSymbol ? info->undecoratedSymbol : info->decoratedSymbol, sizeof(symbol.name) - 1);
  21.     symbol.manual = false;
  22.     symbol.type = info->isImported ? Import : Export;
  23.     ctx->symbols->push_back(symbol);
  24. }
  25.  
  26. SCRIPT_EXPORT bool Script::Symbol::GetList(ListOf(SymbolInfo) list)
  27. {
  28.     BridgeList<Label::LabelInfo> labels;
  29.     if(!Label::GetList(&labels))
  30.         return false;
  31.     std::vector<SymbolInfo> symbols;
  32.     symbols.reserve(labels.Count());
  33.     for(auto i = 0; i < labels.Count(); i++)
  34.     {
  35.         const auto & label = labels[i];
  36.         SymbolInfo symbol;
  37.         strcpy_s(symbol.mod, label.mod);
  38.         symbol.rva = label.rva;
  39.         strcpy_s(symbol.name, label.text);
  40.         symbol.manual = label.manual;
  41.         symbol.type = Function;
  42.         symbols.push_back(symbol);
  43.     }
  44.  
  45.     std::vector<SYMBOLMODULEINFO> modules;
  46.     SymGetModuleList(&modules);
  47.     cbSymbolEnumCtx ctx;
  48.     ctx.symbols = &symbols;
  49.  
  50.     for(const auto & mod : modules)
  51.     {
  52.         ctx.module = &mod;
  53.         DbgSymbolEnumFromCache(mod.base, cbSymbolEnum, &ctx);
  54.     }
  55.  
  56.  
  57.     //TODO: enumerate actual symbols + virtual symbols (sub_XXXXXX) + imports + exports in addition to user-defined labels.
  58.     return BridgeList<SymbolInfo>::CopyData(list, symbols);
  59. }
  60.  
download_scriptapi_symbol.cpp Source code - Download x64dbg Source code
Related Source Codes/Software:
pencil - Multiplatform GUI Prototyping/Wireframing 2017-04-16
rainloop-webmail - Simple, modern & fast web-based email client ... 2017-04-16
qt - Qt binding for Go (Golang) which supports Windows ... 2017-04-16
MLeaksFinder - Find memory leaks in your iOS app at develop time. 2017-04-16
jsfeat - JavaScript Computer Vision library. 2017-04-16
later - A javascript library for defining recurring schedu... 2017-04-16
Android-ItemTouchHelper-Demo - Basic example of using ItemTouchHelper to add drag... 2017-04-16
onionshare - Securely and anonymously share a file of any size ... 2017-04-16
android-viewflow - A horizontal view scroller library for Android 2017-04-16
css-in-js - React: CSS in JS techniques comparison. 2017-04-16
mama2 - Mother plan - all firewood high flame 2017-04-23
BlurEffectForAndroidDesign - Sample to show how to implement blur graphical tri... 2017-04-23
sphinx_rtd_theme - Sphinx theme for readthedocs.org 2017-04-23
rouge - A pure-ruby code highlighter that is compatible wi... 2017-04-23
spring-security-oauth - Support for adding OAuth1(a) and OAuth2 features (... 2017-04-23
Toucan - Fabulous Image Processing in Swift 2017-04-23
CoffeeScriptRedux - 2017-04-23
breakpoint - Really simple media queries in Sa 2017-04-23
libsvm - 2017-04-22
grr - GRR Rapid Response: remote live forensics for inci... 2017-04-22

 Back to top