mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
tweaks to mule_peb_trample
This commit is contained in:
@@ -110,9 +110,9 @@ if "%mule_main%"=="1" del vc*.pdb mule*.pdb && %compile_release
|
||||
if "%mule_module%"=="1" %compile% ..\src\mule\mule_module.cpp %compile_link% %link_dll% %out%mule_module.dll || exit /b 1
|
||||
if "%mule_hotload%"=="1" %compile% ..\src\mule\mule_hotload_main.c %compile_link% %out%mule_hotload.exe & %compile% ..\src\mule\mule_hotload_module_main.c %compile_link% %link_dll% %out%mule_hotload_module.dll || exit /b 1
|
||||
if "%mule_peb_trample%"=="1" (
|
||||
if exist mule_peb_trample_old.exe del mule_peb_trample_old.exe
|
||||
if exist mule_peb_trample.exe move mule_peb_trample.exe mule_peb_trample_old.exe
|
||||
%compile% ..\src\mule\mule_peb_trample.c %compile_link% %out%mule_peb_trample.exe || exit /b 1
|
||||
if exist mule_peb_trample.exe move mule_peb_trample.exe mule_peb_trample_old_%random%.exe
|
||||
%compile% ..\src\mule\mule_peb_trample.c %compile_link% %out%mule_peb_trample_new.exe || exit /b 1
|
||||
move mule_peb_trample_new.exe mule_peb_trample.exe
|
||||
)
|
||||
popd
|
||||
|
||||
|
||||
@@ -32,22 +32,23 @@ HideModuleFromWindowsReload(HMODULE ModuleToFlush)
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(dllexport) void
|
||||
__declspec(dllexport) int
|
||||
loop_iteration(int it)
|
||||
{
|
||||
printf("foobar iteration #%i\n", it);
|
||||
return it*it;
|
||||
}
|
||||
|
||||
int main(int argument_count, char **arguments)
|
||||
{
|
||||
char *exe_name = arguments[0];
|
||||
HANDLE last_module = GetModuleHandle(0);
|
||||
void (*loop_iteration_function)(int it) = (void (*)(int))GetProcAddress(last_module, "loop_iteration");
|
||||
int (*loop_iteration_function)(int it) = (int (*)(int))GetProcAddress(last_module, "loop_iteration");
|
||||
FILETIME last_filetime = {0};
|
||||
int should_exit = 0;
|
||||
for(int it = 0; !should_exit; it += 1)
|
||||
{
|
||||
loop_iteration_function(it);
|
||||
int result = loop_iteration_function(it);
|
||||
printf("%i\n", result);
|
||||
Sleep(50);
|
||||
FILETIME current_filetime = {0};
|
||||
HANDLE current_exe_file = CreateFile(exe_name, 0, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
|
||||
@@ -56,9 +57,8 @@ int main(int argument_count, char **arguments)
|
||||
if(it != 0 && CompareFileTime(&last_filetime, ¤t_filetime) < 0)
|
||||
{
|
||||
HideModuleFromWindowsReload(last_module);
|
||||
//last_module = LoadLibrary(arguments[0]);
|
||||
last_module = LoadLibrary("foobar.exe");
|
||||
loop_iteration_function = (void (*)(int))GetProcAddress(last_module, "loop_iteration");
|
||||
last_module = LoadLibrary(arguments[0]);
|
||||
loop_iteration_function = (int (*)(int))GetProcAddress(last_module, "loop_iteration");
|
||||
}
|
||||
last_filetime = current_filetime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user