14 std::size_t len = str.length();
16 size_t separator_pos = 0;
17 for (
size_t k = len; k != 0; k--) {
21 if (c ==
'.' && ext_pos == len) {
25 if (c ==
'\\' || c ==
'/') {
30 const size_t new_len = ext_pos - separator_pos;
31 std::string name = str.substr(separator_pos, new_len);
32 std::transform(name.begin(), name.end(), name.begin(), tolower);
41 while ((*fPtr >=
'a' && *fPtr <=
'z')
42 || (*fPtr >=
'A' && *fPtr <=
'Z')
43 || (*fPtr >=
'0' && *fPtr <=
'9')
51 if (*fPtr ==
'.') has_dot =
true;
66 std::size_t len = str.length();
67 std::size_t ext = str.find_last_of(
".");
68 if (ext >= len)
return "";
70 std::string name = str.substr(ext+1, len - (ext+1));
76 std::stringstream stream;
78 stream << std::dec << func_ordinal;
84 if (func_name_str.length() < 2)
return false;
85 return (func_name_str[0] ==
'#');
91 const char* func_name = func_name_str.c_str();
92 return atoi(func_name + 1);
99 if (dllName.length() == 0 || funcName.length() == 0) {
102 std::transform(dllName.begin(), dllName.end(), dllName.begin(), tolower);
103 return dllName +
"." + funcName;
133 if (func_name_str.length() < 2) {
138 std::cerr <<
"Invalid function data" << std::endl;
158 if (name.length() == 0) {
161 std::transform(name.begin(), name.end(), name.begin(), tolower);
182 if (ext.length() > 3) {
186 for (
size_t j = 0; j < ext.length(); j++) {
187 if (!isalpha(ext[j])) {
196 size_t len = str.length();
198 if (ext_pos == len) {
201 std::string ext = str.substr(ext_pos + 1);
203 std::string str1 = str.substr(0, ext_pos);
214 if (file1 == file2) {
219 if (short1 == short2) {
239 return "[Invalid func]";
241 std::stringstream stream;
static bool isTheSameFunc(const peconv::ExportedFunc &func1, const peconv::ExportedFunc &func2)
Compares functions' names. If function is defined by an ordinal, compares ordinals....
std::string nameToString() const
static bool isTheSameDllName(const peconv::ExportedFunc &func1, const peconv::ExportedFunc &func2)
Compares functions' DLL names.
static bool isTheSameFuncName(const peconv::ExportedFunc &func1, const peconv::ExportedFunc &func2)
Compares functions' names. If function is defined by an ordinal, compares ordinals....
static std::string formatName(std::string name)
std::string toString() const
A definition of ExportedFunc class - used for storing the details of the exported function....
Functions related to operations on files. Wrappers for read/write.
bool is_ordinal_string(const std::string &str)
std::string ordinal_to_string(DWORD func_ordinal)
size_t forwarder_name_len(BYTE *fPtr)
std::string get_func_name(const std::string &str)
bool is_valid_extension(const std::string &ext)
std::string remove_module_extension(IN const std::string str)
std::string format_dll_func(const std::string &str)
DWORD ordinal_string_to_val(const std::string &str)
std::string get_dll_shortname(const std::string &str)
size_t find_extension_pos(IN const std::string str)
std::string get_file_name(IN const std::string full_path)