why is this not finding the right stuff in ida the idea is that strings are found in…
- User
why is this not finding the right stuff in ida the idea is that strings are found in rdata then references found in data and then subtracts 10 from base to get function pointer but fails to find the string in ida when i search wit hthe offset i got and adresses fail with jumpask fail this was a simple test for notepad program #include <stdio.h> #include <stdlib.h> #include <windows.h> #include <tlhelp32.h> #include #include #include
// Function to log messages both to console and a file void log_message(FILE* log_file, const char* format, ...) { va_list args; va_start(args, format); vprintf(format, args); // Console output if (log_file != NULL) { vfprintf(log_file, format, args); // File output fflush(log_file); } va_end(args); }
// Function to get the process ID by name DWORD get_process_id_by_name(const char* process_name) { PROCESSENTRY32 pe32; HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hSnapshot == INVALID_HANDLE_VALUE) { return 0; } pe32.dwSize = sizeof(PROCESSENTRY32); if (!Process32First(hSnapshot, &pe32)) { CloseHandle(hSnapshot); return 0; } do { char exeFile[MAX_PATH]; size_t converted_chars = 0; wcstombs_s(&converted_chars, exeFile, MAX_PATH, pe32.szExeFile, _TRUNCATE); if (_stricmp(exeFile, process_name) == 0) { CloseHandle(hSnapshot); return pe32.th32ProcessID; } } while (Process32Next(hSnapshot, &pe32));
codeCloseHandle(hSnapshot); return 0;}
// Function to get the base address of the process uintptr_t get_base_address(DWORD pid) { MODULEENTRY32 me32 = { sizeof(me32) }; HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, pid); if (hSnapshot == INVALID_HANDLE_VALUE) { return 0; } if (Module32First(hSnapshot, &me32)) { CloseHandle(hSnapshot); return reinterpret_cast<uintptr_t>(me32.modBaseAddr); } CloseHandle(hSnapshot); return 0; }
// Function to get the start and end addresses of a specific section in the process bool get_section_limits(HANDLE hProcess, uintptr_t base_addr, const char* section_name, uintptr_t& section_start, uintptr_t& section_end) { IMAGE_DOS_HEADER dos_header; if (!ReadProcessMemory(hProcess, (LPCVOID)base_addr, &dos_header, sizeof(dos_header), NULL)) { return false; } if (dos_header.e_magic != IMAGE_DOS_SIGNATURE) { return false; } IMAGE_NT_HEADERS nt_headers; if (!ReadProcessMemory(hProcess, (LPCVOID)(base_addr + dos_header.e_lfanew), &nt_headers, sizeof(nt_headers), NULL)) { return false; } if (nt_headers.Signature != IMAGE_NT_SIGNATURE) { return false; }
code - Assistant