static void win_chr_readfile(CharDriverState *chr)

{

    WinCharState *s = chr->opaque;

    int ret, err;

    uint8_t buf[1024];

    DWORD size;



    ZeroMemory(&s->orecv, sizeof(s->orecv));

    s->orecv.hEvent = s->hrecv;

    ret = ReadFile(s->hcom, buf, s->len, &size, &s->orecv);

    if (!ret) {

        err = GetLastError();

        if (err == ERROR_IO_PENDING) {

            ret = GetOverlappedResult(s->hcom, &s->orecv, &size, TRUE);

        }

    }



    if (size > 0) {

        qemu_chr_read(chr, buf, size);

    }

}

static void win_chr_readfile(CharDriverState *chr)

{

    WinCharState *s = chr->opaque;

    int ret, err;

    uint8_t buf[1024];

    DWORD size;



    ZeroMemory(&s->orecv, sizeof(s->orecv));

    s->orecv.hEvent = s->hrecv;

    ret = ReadFile(s->hcom, buf, s->len, &size, &s->orecv);

    if (!ret) {

        err = GetLastError();

        if (err == ERROR_IO_PENDING) {

            ret = GetOverlappedResult(s->hcom, &s->orecv, &size, TRUE);

        }

    }



    if (size > 0) {

        qemu_chr_read(chr, buf, size);

    }

}

static void FUNC_0(CharDriverState *VAR_0)

{

    WinCharState *s = VAR_0->opaque;

    int VAR_1, VAR_2;

    uint8_t buf[1024];

    DWORD size;



    ZeroMemory(&s->orecv, sizeof(s->orecv));

    s->orecv.hEvent = s->hrecv;

    VAR_1 = ReadFile(s->hcom, buf, s->len, &size, &s->orecv);

    if (!VAR_1) {

        VAR_2 = GetLastError();

        if (VAR_2 == ERROR_IO_PENDING) {

            VAR_1 = GetOverlappedResult(s->hcom, &s->orecv, &size, TRUE);

        }

    }



    if (size > 0) {

        qemu_chr_read(VAR_0, buf, size);

    }

}

static void FUNC_0(CharDriverState *VAR_0)
{ WinCharState *s = VAR_0->opaque; int VAR_1, VAR_2; uint8_t buf[1024]; DWORD size; ZeroMemory(&s->orecv, sizeof(s->orecv)); s->orecv.hEvent = s->hrecv; VAR_1 = ReadFile(s->hcom, buf, s->len, &size, &s->orecv); if (!VAR_1) { VAR_2 = GetLastError(); if (VAR_2 == ERROR_IO_PENDING) { VAR_1 = GetOverlappedResult(s->hcom, &s->orecv, &size, TRUE); } } if (size > 0) { qemu_chr_read(VAR_0, buf, size); } }