AdCKuY_DpO4uLa
Известный
- 287
- 477
У тебя объявлена функция StrStr, но в коде нет ее реализации, если тебе нужно узнать, если ли в строке подстрока, то можешь юзать strstr()
У тебя объявлена функция StrStr, но в коде нет ее реализации, если тебе нужно узнать, если ли в строке подстрока, то можешь юзать strstr()
The most obvious mistake in your code is that you are trying to add int to the pointer returned by the GetModuleHandleA function. In this case, pointer arithmetic works. The pointer is shifted by 0x9C0A0*sizeof(the type the pointer points to, in this case it is HINSTANCE__ whose size is equal to 4).есть строка на луа:
writeMemory(sampGetBase() + 0x9C0A0, 4, 0x000008C2, true)
пытался переписать на плюсы но чет нихуя не выходит, пробовал:
WriteMemory(GetModuleHandleA("samp.dll") + 0x9C0A0, (void*)4, 0x0008C2); патч срабатывал, Но игра крашилась
был вариант
WriteMemory(GetModuleHandleA("samp.dll") + 0x9C0A0, (uint8_t*)0x0008C2, 4); нихера не срабатывало, а игра все равно крашилась
крч помогите плз💞
void make_night() {
const auto samp =
reinterpret_cast<std::uintptr_t>(GetModuleHandle("samp.dll"));
if (const auto ptr = reinterpret_cast<void*>(
samp + 0x9C0A0)) { // prevent contamination of the local namespace
const char raw[] = "\xC2\x08\x00\x00";
::DWORD old_prot{};
VirtualProtect(ptr, sizeof(raw) - 1, PAGE_READWRITE, &old_prot);
std::memcpy(ptr, raw, 4);
VirtualProtect(ptr, sizeof(raw) - 1, old_prot, &old_prot);
}
}
Do not use strstr.
#include <string>
if (std::string_view{cmdline}.find("-samp") != std::string::npos) { // C++17 and higher
// ...
}
where from u got this string? i want to knowThe most obvious mistake in your code is that you are trying to add int to the pointer returned by the GetModuleHandleA function. In this case, pointer arithmetic works. The pointer is shifted by 0x9C0A0*sizeof(the type the pointer points to, in this case it is HINSTANCE__ whose size is equal to 4).
The second mistake is that you do not remove the memory protection.
C++:void make_night() { const auto samp = reinterpret_cast<std::uintptr_t>(GetModuleHandle("samp.dll")); if (const auto ptr = reinterpret_cast<void*>( samp + 0x9C0A0)) { // prevent contamination of the local namespace const char raw[] = "\xC2\x08\x00\x00"; ::DWORD old_prot{}; VirtualProtect(ptr, sizeof(raw) - 1, PAGE_READWRITE, &old_prot); std::memcpy(ptr, raw, 4); VirtualProtect(ptr, sizeof(raw) - 1, old_prot, &old_prot); } }
Do not use strstr.
C++:#include <string> if (std::string_view{cmdline}.find("-samp") != std::string::npos) { // C++17 and higher // ... }
const char raw[] = "\xC2\x08\x00\x00";
как ты вообще собрал это если вместо wpm у тебя луашная функцияесть строка на луа:
writeMemory(sampGetBase() + 0x9C0A0, 4, 0x000008C2, true)
пытался переписать на плюсы но чет нихуя не выходит, пробовал:
WriteMemory(GetModuleHandleA("samp.dll") + 0x9C0A0, (void*)4, 0x0008C2); патч срабатывал, Но игра крашилась
был вариант
WriteMemory(GetModuleHandleA("samp.dll") + 0x9C0A0, (uint8_t*)0x0008C2, 4); нихера не срабатывало, а игра все равно крашилась
крч помогите плз💞
unsigned long sampGetBase = reinterpret_cast<unsigned long>(GetModuleHandleA("samp.dll"));
unsigned long data = 0x000008C2;
WriteProcessMemory(GetCurrentProcess(), reinterpret_cast<void*>(sampGetBase + 0x9C0A0), &data, 4, NULL);
ну как минимум я мог написать функцию с таким же названием, что собственно я и сделалкак ты вообще собрал это если вместо wpm у тебя луашная функция
тебе не в этот раздел, но все же:Вопрос:
The number 0x000008C2 in little-endian, represented as a string with a sequence of bytes. In memory, the little-endian number is arranged in reverse byte order. So it turns out that the number 00 00 08 C2 in memory has a sequence C2 08 00 00, which is represented as a string as "\xC2\x08\x00\x00"where from u got this string? i want to know
C++:const char raw[] = "\xC2\x08\x00\x00";
SF->getSAMP()->registerChatCommand("patch", [](std::string params) {
strcpy((char*)0x100D3A78, "SWWWWW CCCCCC the connection.");
AddChat(-1, "Наверное, пропатчилось...");
});
Адрес должен быть не 0x100D3A78, а 0xD3DA78, и ты не добавил GetModuleHandleA("samp.dll") к адресу. Так что игра думает что ты обращаешься к памяти ГТА, а не сампа.Решил немного залезть в реверс.
Открыл иду и в неё кинул samp.dll.
Решил пропатчить строку от сампа, нашёл её адрес в IDA (наверное), пытаюсь пропатчить, но, она не патчится. То есть, текст там изменить хочу, но, он не изменяется.
Посмотреть вложение 186387
C++:SF->getSAMP()->registerChatCommand("patch", [](std::string params) { strcpy((char*)0x100D3A78, "SWWWWW CCCCCC the connection."); AddChat(-1, "Наверное, пропатчилось..."); });
Посмотреть вложение 186388
// Функция для записи строки в память ( Автор вроде Скаут )
inline void writeString(char* memory,const char* str) {
DWORD NewProtection;
VirtualProtect(memory, sizeof(str), PAGE_EXECUTE_READWRITE, &NewProtection);
std::strcpy(memory, str);
VirtualProtect(memory, sizeof(str), NewProtection, &NewProtection);
}
// Сам патч
writeString((char*)GetModuleHandleA("samp") + 0xD3A78, "Сервер сдох нахуй")
Как найти функцию через IDA? К примеру, добавления сообщения в чат.
Пытаюсь, но, увы, не получается.
Прошу объяснить пошагово.
Открыл в IDA samp.dll, пытался по строкам найти функцию.
Посмотреть вложение 186389
Посмотреть вложение 186390
Посмотреть вложение 186391
В самп апи все естьМне надо не переменную найти, а функцию! 😕