Update ooo320-m1
[ooovba.git] / sal / osl / os2 / pipeimpl.h
blob400a8b3f2d65742e246c0fa53f80a89c6c25a152
1 #ifndef _PIPEIMPL_H_
2 #define _PIPEIMPL_H_
4 #ifndef _WINDOWS_
5 # include <windows.h>
6 #endif
8 #ifndef _INC_MALLOC
9 # include <malloc.h>
10 #endif
12 #ifndef _INC_TCHAR
13 # ifdef UNICODE
14 # define _UNICODE
15 # endif
16 # include <tchar.h>
17 #endif
19 #define EXPORT_PIPE_API
21 //============================================================================
22 // Helper functions
23 //============================================================================
25 // Because the value of an invalid HANDLE returned by API functions differs
26 // between different functions and differs on different Windows platforms,
27 // this function checks wether the handle has a meaningfull value.
28 #ifndef __cplusplus
30 #define IsValidHandle( handle ) ((DWORD)(handle) + 1 > 1)
32 #else
34 inline bool IsValidHandle( HANDLE handle )
36 return INVALID_HANDLE_VALUE != handle && NULL != handle;
39 extern "C" {
41 #endif // __cplusplus
44 EXPORT_PIPE_API HANDLE WINAPI CreateSimplePipeA( LPCSTR lpName );
45 EXPORT_PIPE_API HANDLE WINAPI CreateSimplePipeW( LPCWSTR lpName );
47 #ifdef UNICODE
48 #define CreateSimplePipe CreateSimplePipeW
49 #else
50 #define CreateSimplePipe CreateSimplePipeA
51 #endif
53 EXPORT_PIPE_API HANDLE WINAPI OpenSimplePipeA( LPCSTR lpName );
54 EXPORT_PIPE_API HANDLE WINAPI OpenSimplePipeW( LPCWSTR lpName );
56 #ifdef UNICODE
57 #define OpenSimplePipe OpenSimplePipeW
58 #else
59 #define OpenSimplePipe OpenSimplePipeA
60 #endif
62 EXPORT_PIPE_API HANDLE WINAPI AcceptSimplePipeConnection( HANDLE hPipe );
64 EXPORT_PIPE_API BOOL WINAPI WaitForSimplePipeA( LPCSTR lpName, DWORD dwTimeOut );
65 EXPORT_PIPE_API BOOL WINAPI WaitForSimplePipeW( LPCWSTR lpName, DWORD dwTimeOut );
67 #ifdef UNICODE
68 #define WaitForSimplePipe WaitForSimplePipeW
69 #else
70 #define WaitForSimplePipe WaitForSimplePipeA
71 #endif
74 EXPORT_PIPE_API BOOL WINAPI WriteSimplePipe( HANDLE hPipe, LPCVOID lpBuffer, DWORD dwBytesToWrite, LPDWORD lpBytesWritten, BOOL bWait );
75 EXPORT_PIPE_API BOOL WINAPI ReadSimplePipe( HANDLE hPipe, LPVOID lpBuffer, DWORD dwBytesToRead, LPDWORD lpBytesRead, BOOL bWait );
76 EXPORT_PIPE_API BOOL WINAPI CloseSimplePipe( HANDLE hPipe );
78 #ifdef __cplusplus
79 } // extern "C"
80 #endif
82 #endif // _PIPEIMPL_H_