• Marc-André Lureau's avatar
    win32: use overlapped events for streams · 23d80a04
    Marc-André Lureau authored
    Any file handle created with FLAG_OVERLAPPED must have
    ReadFile()/WriteFile() called with an OVERLAPPED structure.
    Failing to do so will give unspecified results, invalid read/write or
    corruption.
    
    Without FLAG_OVERLAPPED, it is not possible to read and write
    concurrently, even with two seperate threads, created by 2 input and
    output gio streams. Also, only with FLAG_OVERLAPPED may an IO
    operation be asynchronous and thus be cancellable.
    
    We may want to call ReOpenFile() to make sure the FLAG is set, but
    this API is only available since Vista+.
    
    According to MSDN doc, adding the OVERLAPPED argument for IO operation
    on handles without FLAG_OVERLAPPED is allowed, and indeed the existing
    test still passes.
    
    v2:
    - update GetLastError() after _g_win32_overlap_wait_result ()
    - split the unrelated ERROR_MORE_DATA handling
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679288
    23d80a04
gwin32outputstream.c 10.1 KB