FreeRDP
TestPipeCreateNamedPipeOverlapped.c File Reference
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/pipe.h>
#include <winpr/file.h>
#include <winpr/tchar.h>
#include <winpr/winpr.h>
#include <winpr/wlog.h>
#include <winpr/print.h>
#include <winpr/synch.h>
#include <winpr/thread.h>

Macros

#define PIPE_BUFFER_SIZE   32
 
#define PIPE_TIMEOUT_MS   20000
 

Functions

static DWORD WINAPI named_pipe_client_thread (LPVOID arg)
 
static DWORD WINAPI named_pipe_server_thread (LPVOID arg)
 
int TestPipeCreateNamedPipeOverlapped (int argc, char *argv[])
 

Variables

static BYTE SERVER_MESSAGE [PIPE_BUFFER_SIZE]
 
static BYTE CLIENT_MESSAGE [PIPE_BUFFER_SIZE]
 
static BOOL bClientSuccess = FALSE
 
static BOOL bServerSuccess = FALSE
 
static HANDLE serverReadyEvent = NULL
 
static LPTSTR lpszPipeName = _T("\\\\.\\pipe\\winpr_test_pipe_overlapped")
 

Macro Definition Documentation

◆ PIPE_BUFFER_SIZE

#define PIPE_BUFFER_SIZE   32

◆ PIPE_TIMEOUT_MS

#define PIPE_TIMEOUT_MS   20000

Function Documentation

◆ named_pipe_client_thread()

static DWORD WINAPI named_pipe_client_thread ( LPVOID  arg)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ named_pipe_server_thread()

static DWORD WINAPI named_pipe_server_thread ( LPVOID  arg)
static

At this point if fConnected is FALSE, we have to check GetLastError() for: ERROR_PIPE_CONNECTED: client has already connected before we have called ConnectNamedPipe. this is quite common depending on the timings and indicates success ERROR_IO_PENDING: Since we're using ConnectNamedPipe asynchronously here, the function returns immediately and this error code simply indicates that the operation is still in progress. Hence we have to wait for the completion event and use GetOverlappedResult to query the actual result of the operation (note that the lpNumberOfBytesTransferred parameter is undefined/useless for a ConnectNamedPipe operation)

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TestPipeCreateNamedPipeOverlapped()

int TestPipeCreateNamedPipeOverlapped ( int  argc,
char *  argv[] 
)
Here is the call graph for this function:

Variable Documentation

◆ bClientSuccess

BOOL bClientSuccess = FALSE
static

◆ bServerSuccess

BOOL bServerSuccess = FALSE
static

◆ CLIENT_MESSAGE

BYTE CLIENT_MESSAGE[PIPE_BUFFER_SIZE]
static

◆ lpszPipeName

LPTSTR lpszPipeName = _T("\\\\.\\pipe\\winpr_test_pipe_overlapped")
static

◆ SERVER_MESSAGE

BYTE SERVER_MESSAGE[PIPE_BUFFER_SIZE]
static

◆ serverReadyEvent

HANDLE serverReadyEvent = NULL
static