Exemplo n.º 1
0
//------------------------------------------------------------------------------
void hooked_fprintf(const void* unused, const char* format, ...)
{
    char buffer[2048];
    va_list v;

    va_start(v, format);
    vsnprintf(buffer, sizeof_array(buffer), format, v);
    va_end(v);

    buffer[sizeof_array(buffer) - 1] = '\0';
    hooked_fwrite(buffer, (int)strlen(buffer), 1, NULL);
}
Exemplo n.º 2
0
//------------------------------------------------------------------------------
int hooked_fwrite(const void* data, int size, int count, void* unused)
{
    wchar_t buf[2048];
    size_t characters;
    DWORD written;

    size *= count;

#if 0
    if (*(char*)data == '\n')
    {
        static int i = 0;
        static const char b[] = "!@#$%^&*()_+|";
        hooked_fwrite(b + (i % sizeof_array(b)), 1, 1, 0);
        ++i;
    }
#endif
    
    characters = MultiByteToWideChar(
        CP_UTF8, 0,
        (const char*)data, size,
        buf, sizeof_array(buf)
    );

    characters = characters ? characters : sizeof_array(buf) - 1;
    buf[characters] = L'\0';

    if (g_alt_fwrite_hook)
    {
        g_alt_fwrite_hook(buf);
    }
    else
    {
        WriteConsoleW(
            GetStdHandle(STD_OUTPUT_HANDLE),
            buf,
            (DWORD)wcslen(buf),
            &written,
            NULL
        );
    }

    return size;
}
Exemplo n.º 3
0
//------------------------------------------------------------------------------
int hooked_putc(int c, void* unused)
{
    char buf[2] = { (char)c, '\0' };
    hooked_fwrite(buf, 1, 1, NULL);
    return 1;
}