int main (int argc, char *argv[]) { if (InitCVIRTE (0, argv, 0) == 0) return -1; /* out of memory */ if (argc != 2) { fprintf(stderr, "you must pass the path to a module to test"); return -1; } char *testModule = argv[1]; if (!FileExists(testModule, 0)) { fprintf(stderr, "you must pass the path to a module to test"); } ListType names; SymbolParser *parser = MakeParser(testModule); names = GetExports(parser); context = CreateContext(); LoadTestInfo info = { .parser = parser, .executeOnContext = context->ExecuteTests }; ListApplyToEach(names, 1, LoadUserTests, &info); DeleteParser(parser); FreeContext(context); return 0; }
void RSOView::Apply(PPCSymbolDB* symbol_db) const { for (const RSOExport& rso_export : GetExports()) { u32 address = GetExportAddress(rso_export); if (address != 0) { Symbol* symbol = symbol_db->AddFunction(address); if (!symbol) symbol = symbol_db->GetSymbolFromAddr(address); const std::string export_name = GetExportName(rso_export); if (symbol) { // Function symbol symbol->Rename(export_name); } else { // Data symbol symbol_db->AddKnownSymbol(address, 0, export_name, Symbol::Type::Data); } } } DEBUG_LOG(SYMBOLS, "RSO(%s): %zu symbols applied", GetName().c_str(), GetExportsCount()); }
void Plugins::FindCommands(char* path,bool displayInfo) { if (path) { int length = strlen(path); if (length > 0) { WIN32_FIND_DATA data; HANDLE handle; if (path[length-1] == '\\' || path[length-1] == '/') { length--; } char* basePath = new char [length+1]; strncpy(basePath,path,length); basePath[length] = 0; char* pathAndWildcard = new char [length+7]; strcpy(pathAndWildcard,basePath); strcat(pathAndWildcard,"\\*.dll"); handle = FindFirstFile(pathAndWildcard,&data); if (handle != INVALID_HANDLE_VALUE) { do { char* dllPath = new char [length+strlen(data.cFileName)+2]; wsprintf(dllPath,"%s\\%s",basePath,data.cFileName); GetExports(dllPath,displayInfo); delete[] dllPath; } while (FindNextFile(handle,&data)); } delete[] pathAndWildcard; delete[] basePath; } } }
void Plugins::FindCommands(char* path, bool displayInfo) { if (!path) return; dir_reader *dr = new_dir_reader(); dr->read(path); dir_reader::iterator files_itr = dr->files().begin(); dir_reader::iterator files_end = dr->files().end(); for (; files_itr != files_end; files_itr++) { if (!dir_reader::matches(*files_itr, "*.dll")) continue; string plugin = string(path) + PLATFORM_PATH_SEPARATOR_C + *files_itr; GetExports((char *) plugin.c_str(), displayInfo); } delete dr; }