Initial commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
template <typename... T>
|
||||
void __log_monitor_call(void* ret_addr, const char* funcname, const char* format, T&&... arguments)
|
||||
{
|
||||
//
|
||||
// ignore calls from within our own image.
|
||||
//
|
||||
if (r5::is_within_self(ret_addr))
|
||||
return;
|
||||
|
||||
//
|
||||
// only log API calls outside of valid images.
|
||||
//
|
||||
if (util::file_header(ret_addr) != nullptr)
|
||||
return;
|
||||
|
||||
size_t length = 0;
|
||||
char cad[512];
|
||||
|
||||
length += LI_FN(wsprintfA).cached()(cad + length, _XS("MON_CALL @ #%p '%s' "), ret_addr, funcname);
|
||||
length += LI_FN(wsprintfA).cached()(cad + length, format, arguments...);
|
||||
length += LI_FN(wsprintfA).cached()(cad + length, _XS("\n"));
|
||||
|
||||
win_api::output_debug_string(cad);
|
||||
}
|
||||
|
||||
template <typename... T>
|
||||
void __log_monitor_call_nofilter(void* ret_addr, const char* funcname, const char* format, T&&... arguments)
|
||||
{
|
||||
//
|
||||
// ignore calls from within our own image.
|
||||
//
|
||||
if (r5::is_within_self(ret_addr))
|
||||
return;
|
||||
|
||||
//
|
||||
// only log API calls outside of valid images.
|
||||
//
|
||||
if (util::file_header(ret_addr) != nullptr)
|
||||
return;
|
||||
|
||||
size_t length = 0;
|
||||
char cad[512];
|
||||
|
||||
length += LI_FN(wsprintfA).cached()(cad + length, _XS("MON_CALL @ #%p '%s' "), ret_addr, funcname);
|
||||
length += LI_FN(wsprintfA).cached()(cad + length, format, arguments...);
|
||||
length += LI_FN(wsprintfA).cached()(cad + length, _XS("\n"));
|
||||
|
||||
win_api::output_debug_string(cad);
|
||||
}
|
||||
Reference in New Issue
Block a user