Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4257608
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:32:07+00:00 2026-05-21T05:32:07+00:00

I’m currently working on an IPC mechanism based on named pipes using a IO

  • 0

I’m currently working on an IPC mechanism based on named pipes using a IO completion port.

Unfortunately I have some troubles with the msdn documentation because it’s quite unclear to me in which cases calls to ReadFile/WriteFile result in a completion packet.

The case when FALSE is returned with ERROR_IO_PENDING is clear, but what about the apparently possible case, when ERROR_MORE_DATA is returned? Will there be a completion packet in this case? Moreover, what if other errors are returned?
In which cases do i have to handle the result and free resources directly and not in the completion handler?

Another case would be if ReadFile/WriteFile even succeed, which apparently is possible, too.
MSDN is thankfully pretty clear about this here:

Further, the WriteFile function will sometimes return TRUE with a GetLastError value of ERROR_SUCCESS, even though it is using an asynchronous handle (which can also return FALSE with ERROR_IO_PENDING). … In this example, the recommendation would be to allow the completion port routine to be solely responsible for all freeing operations for such resources.

Is this recommendation correct in all cases, and the result of an ReadFile/WriteFile operation for handles assigned to a completion port could (and should) in fact be ignored completely, because a packet is sent to the port anyways?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:32:08+00:00Added an answer on May 21, 2026 at 5:32 am

    There will be an IO completion item queued for an IO operation whenever the IO operation is able to start. Regardless of whether an error is encountered or not after the IO operation starts, a completion item will be queued to the completion port.

    There is a mapping problem between the NTSTATUS codes returned by the IO system and Win32 error codes that makes it hard to tell what statuses are errors and which are just informational. NTSTATUS, which is used by the kernel and the native API, has four levels of severity: success, information, warning and error. Anything but an error code would indicate that the IO operation was able to start. Win32 only has one severity (ERROR_*), so the success, information and warning codes had to be mapped alongside the error codes.

    • ERROR_IO_PENDING – STATUS_PENDING is a success status
    • ERROR_MORE_DATA – STATUS_BUFFER_OVERFLOW a warning or STATUS_MORE_ENTRIES a success status

    You can ignore any non-error codes that ReadFile or WriteFile return and expect a queued completion item, but determining which is which can be a bit of a pain. It would be nice if the Win32 error codes were better organized, but Microsoft does provide a mapping from NTSTATUS to Win32 error codes: http://support.microsoft.com/kb/113996. See ntstatus.h in the platform SDK or your VS installation to determine what severity a NTSTATUS code is.

    It is possible for the IO operation to be completed when the original API call returns, e.g. a read request that was just copied out of the cache (nothing to wait on asynchronously). A completion message will still be queued in such cases for consistency’s sake.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have some data like this: 1 2 3 4 5 9 2 6
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I have a JSP page retrieving data and when single or double quotes are
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.