23 #include <winpr/file.h>
24 #include <winpr/winpr.h>
25 #include <winpr/error.h>
26 #include <winpr/handle.h>
27 #include <winpr/wtypes.h>
31 #define PIPE_UNLIMITED_INSTANCES 0xFF
33 #define PIPE_ACCESS_INBOUND 0x00000001
34 #define PIPE_ACCESS_OUTBOUND 0x00000002
35 #define PIPE_ACCESS_DUPLEX 0x00000003
37 #define FILE_FLAG_FIRST_PIPE_INSTANCE 0x00080000
38 #define FILE_FLAG_WRITE_THROUGH 0x80000000
39 #define FILE_FLAG_OVERLAPPED 0x40000000
41 #define PIPE_CLIENT_END 0x00000000
42 #define PIPE_SERVER_END 0x00000001
44 #define PIPE_TYPE_BYTE 0x00000000
45 #define PIPE_TYPE_MESSAGE 0x00000004
47 #define PIPE_READMODE_BYTE 0x00000000
48 #define PIPE_READMODE_MESSAGE 0x00000002
50 #define PIPE_WAIT 0x00000000
51 #define PIPE_NOWAIT 0x00000001
53 #define PIPE_ACCEPT_REMOTE_CLIENTS 0x00000000
54 #define PIPE_REJECT_REMOTE_CLIENTS 0x00000008
56 #define NMPWAIT_USE_DEFAULT_WAIT 0x00000000
57 #define NMPWAIT_NOWAIT 0x00000001
58 #define NMPWAIT_WAIT_FOREVER 0xFFFFFFFF
69 WINPR_API BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe,
70 LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
76 WINPR_ATTR_MALLOC(CloseHandle, 1)
77 WINPR_API HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode,
78 DWORD nMaxInstances, DWORD nOutBufferSize,
79 DWORD nInBufferSize, DWORD nDefaultTimeOut,
80 LPSECURITY_ATTRIBUTES lpSecurityAttributes);
82 WINPR_ATTR_MALLOC(CloseHandle, 1)
83 WINPR_API HANDLE CreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode,
84 DWORD nMaxInstances, DWORD nOutBufferSize,
85 DWORD nInBufferSize, DWORD nDefaultTimeOut,
86 LPSECURITY_ATTRIBUTES lpSecurityAttributes);
88 WINPR_API BOOL ConnectNamedPipe(HANDLE hNamedPipe,
LPOVERLAPPED lpOverlapped);
90 WINPR_API BOOL DisconnectNamedPipe(HANDLE hNamedPipe);
92 WINPR_API BOOL PeekNamedPipe(HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize,
93 LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail,
94 LPDWORD lpBytesLeftThisMessage);
96 WINPR_API BOOL TransactNamedPipe(HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize,
97 LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead,
100 WINPR_API BOOL WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut);
101 WINPR_API BOOL WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut);
103 WINPR_API BOOL SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode,
104 LPDWORD lpMaxCollectionCount,
105 LPDWORD lpCollectDataTimeout);
107 WINPR_API BOOL ImpersonateNamedPipeClient(HANDLE hNamedPipe);
109 WINPR_API BOOL GetNamedPipeClientComputerNameA(HANDLE Pipe, LPCSTR ClientComputerName,
110 ULONG ClientComputerNameLength);
111 WINPR_API BOOL GetNamedPipeClientComputerNameW(HANDLE Pipe, LPCWSTR ClientComputerName,
112 ULONG ClientComputerNameLength);
115 #define CreateNamedPipe CreateNamedPipeW
116 #define WaitNamedPipe WaitNamedPipeW
117 #define GetNamedPipeClientComputerName GetNamedPipeClientComputerNameW
119 #define CreateNamedPipe CreateNamedPipeA
120 #define WaitNamedPipe WaitNamedPipeA
121 #define GetNamedPipeClientComputerName GetNamedPipeClientComputerNameA