WriteFile函数与组装调试(同步) [英] WriteFile function with assembly debugging (syncing)

查看:165
本文介绍了WriteFile函数与组装调试(同步)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,这个问题是基于我的最后一个问题在这里:阅读控制台缓冲器/输出C ++

我有一个编译成可执行的二进制文件。它有一些产出,我想将其重定向到其他程序,处理该行什么。我成功地发现那里的输出被发送出去,我把它修改为标准输出。问题是,当我使用它,如:

I have a compiled executable binary file. It has some outputs, what I would like to redirect it to an other program, that handles the lines. I successfully found where the output is sent, and I modified it to STDOUT. The problem is that, when I use it like:

./jampDed.exe | stdout.exe

则输出不同步。我每次1000-2000字节后的内容。

then the output is not synced. I got the content after every 1000-2000 bytes.

stdout.cpp

#include <iostream>

int main() {
    std::string s;
    while (std::getline(std::cin, s, '\n')) {
        std::cout << s << std::endl;
    }

    return 0;
}

我还创建了一个有关装配的修改,其中使用默认Kernel32.WriteFile功能的图片。

I also created a picture about assembly modification, where Kernel32.WriteFile function was used by default.

所以现在的问题是,我怎样才能使它同步?如何尽快让每一个行,因为它发生在专用服务器上?

So the question is that, how can I make it synced? How to get every line as soon as it happens on the dedicated server?

推荐答案

某处在它建立可执行标准输出是无缓冲输出选项位。只需设置(或清除)该位。然后每次调用写的是无延迟传输。这增加了显著的执行时间和I / O系统的努力,该计划,但可能是好这一点。

Somewhere in the executable where it establishes stdout is an option bit for unbuffered output. Just set (or clear) that bit. Then every call to write is transferred without delay. This adds significant execution time and i/o system effort to that program but is probably okay for this.

这将处理输出(输入),程序应缓冲区满线,因为该计划是不可能做到全线输出本身。

The program which processes that output (as input) should buffer full lines because the program is unlikely to do full line output itself.

这篇关于WriteFile函数与组装调试(同步)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆