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

  • SEARCH
  • Home
  • 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 105915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:30:52+00:00 2026-05-11T01:30:52+00:00

Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not

  • 0

Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE_FLAG_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure.

  • 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. 2026-05-11T01:30:52+00:00Added an answer on May 11, 2026 at 1:30 am

    Here is an implementation for an anonymous pipe function with the possibility to specify FILE_FLAG_OVERLAPPED:

    /******************************************************************************\ *       This is a part of the Microsoft Source Code Samples.  *       Copyright 1995 - 1997 Microsoft Corporation. *       All rights reserved.  *       This source code is only intended as a supplement to  *       Microsoft Development Tools and/or WinHelp documentation. *       See these sources for detailed information regarding the  *       Microsoft samples programs. \******************************************************************************/  /*++ Copyright (c) 1997  Microsoft Corporation Module Name:     pipeex.c Abstract:     CreatePipe-like function that lets one or both handles be overlapped Author:     Dave Hart  Summer 1997 Revision History: --*/  #include <windows.h> #include <stdio.h>  static volatile long PipeSerialNumber;  BOOL APIENTRY MyCreatePipeEx(     OUT LPHANDLE lpReadPipe,     OUT LPHANDLE lpWritePipe,     IN LPSECURITY_ATTRIBUTES lpPipeAttributes,     IN DWORD nSize,     DWORD dwReadMode,     DWORD dwWriteMode     )  /*++ Routine Description:     The CreatePipeEx API is used to create an anonymous pipe I/O device.     Unlike CreatePipe FILE_FLAG_OVERLAPPED may be specified for one or     both handles.     Two handles to the device are created.  One handle is opened for     reading and the other is opened for writing.  These handles may be     used in subsequent calls to ReadFile and WriteFile to transmit data     through the pipe. Arguments:     lpReadPipe - Returns a handle to the read side of the pipe.  Data         may be read from the pipe by specifying this handle value in a         subsequent call to ReadFile.     lpWritePipe - Returns a handle to the write side of the pipe.  Data         may be written to the pipe by specifying this handle value in a         subsequent call to WriteFile.     lpPipeAttributes - An optional parameter that may be used to specify         the attributes of the new pipe.  If the parameter is not         specified, then the pipe is created without a security         descriptor, and the resulting handles are not inherited on         process creation.  Otherwise, the optional security attributes         are used on the pipe, and the inherit handles flag effects both         pipe handles.     nSize - Supplies the requested buffer size for the pipe.  This is         only a suggestion and is used by the operating system to         calculate an appropriate buffering mechanism.  A value of zero         indicates that the system is to choose the default buffering         scheme. Return Value:     TRUE - The operation was successful.     FALSE/NULL - The operation failed. Extended error status is available         using GetLastError. --*/  {   HANDLE ReadPipeHandle, WritePipeHandle;   DWORD dwError;   UCHAR PipeNameBuffer[ MAX_PATH ];    //   // Only one valid OpenMode flag - FILE_FLAG_OVERLAPPED   //    if ((dwReadMode | dwWriteMode) & (~FILE_FLAG_OVERLAPPED)) {     SetLastError(ERROR_INVALID_PARAMETER);     return FALSE;   }    //   //  Set the default timeout to 120 seconds   //    if (nSize == 0) {     nSize = 4096;   }    sprintf( PipeNameBuffer,            '\\\\.\\Pipe\\RemoteExeAnon.%08x.%08x',            GetCurrentProcessId(),            InterlockedIncrement(&PipeSerialNumber)          );    ReadPipeHandle = CreateNamedPipeA(                        PipeNameBuffer,                        PIPE_ACCESS_INBOUND | dwReadMode,                        PIPE_TYPE_BYTE | PIPE_WAIT,                        1,             // Number of pipes                        nSize,         // Out buffer size                        nSize,         // In buffer size                        120 * 1000,    // Timeout in ms                        lpPipeAttributes                        );    if (! ReadPipeHandle) {     return FALSE;   }    WritePipeHandle = CreateFileA(                       PipeNameBuffer,                       GENERIC_WRITE,                       0,                         // No sharing                       lpPipeAttributes,                       OPEN_EXISTING,                       FILE_ATTRIBUTE_NORMAL | dwWriteMode,                       NULL                       // Template file                     );    if (INVALID_HANDLE_VALUE == WritePipeHandle) {     dwError = GetLastError();     CloseHandle( ReadPipeHandle );     SetLastError(dwError);     return FALSE;   }    *lpReadPipe = ReadPipeHandle;   *lpWritePipe = WritePipeHandle;   return( TRUE ); } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 133k
  • Answers 133k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer PHP has an easy way to set how long a… May 12, 2026 at 6:36 am
  • Editorial Team
    Editorial Team added an answer And so I finally got some time and worked out… May 12, 2026 at 6:36 am
  • Editorial Team
    Editorial Team added an answer You can't do it with just macros, but you can… May 12, 2026 at 6:36 am

Related Questions

I created a class that handles serial port asynchronously. I use it to communicate
I want to use Vim's soft wrap capability ( :set wrap ) to wrap
Can I affect the process? I have an application built in .NET 3.5 /
I working on a distributed mediaplayer that uses the windows media player component. Now

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.