Update ooo320-m1
[ooovba.git] / sal / osl / w32 / pipeimpl.h
blobcff98b9eb540b1aedf42d42406bbfcda3e2fad3e
1 #ifndef _PIPEIMPL_H_
2 #define _PIPEIMPL_H_
4 #ifndef _WINDOWS_
5 # ifdef _MSC_VER
6 # pragma warning(push,1) /* disable warnings within system headers */
7 # endif
8 # include <windows.h>
9 # ifdef _MSC_VER
10 # pragma warning(pop)
11 # endif
12 #endif
14 #ifndef _INC_MALLOC
15 # include <malloc.h>
16 #endif
18 #ifndef _INC_TCHAR
19 # ifdef UNICODE
20 # define _UNICODE
21 # endif
22 # include <tchar.h>
23 #endif
25 #define EXPORT_PIPE_API
27 //============================================================================
28 // Helper functions
29 //============================================================================
31 // Because the value of an invalid HANDLE returned by API functions differs
32 // between different functions and differs on different Windows platforms,
33 // this function checks wether the handle has a meaningfull value.
34 #ifndef __cplusplus
36 #define IsValidHandle( handle ) ((DWORD)(handle) + 1 > 1)
38 #else
40 inline bool IsValidHandle( HANDLE handle )
42 return INVALID_HANDLE_VALUE != handle && NULL != handle;
45 extern "C" {
47 #endif // __cplusplus
50 EXPORT_PIPE_API HANDLE WINAPI CreateSimplePipeA( LPCSTR lpName );
51 EXPORT_PIPE_API HANDLE WINAPI CreateSimplePipeW( LPCWSTR lpName );
53 #ifdef UNICODE
54 #define CreateSimplePipe CreateSimplePipeW
55 #else
56 #define CreateSimplePipe CreateSimplePipeA
57 #endif
59 EXPORT_PIPE_API HANDLE WINAPI OpenSimplePipeA( LPCSTR lpName );
60 EXPORT_PIPE_API HANDLE WINAPI OpenSimplePipeW( LPCWSTR lpName );
62 #ifdef UNICODE
63 #define OpenSimplePipe OpenSimplePipeW
64 #else
65 #define OpenSimplePipe OpenSimplePipeA
66 #endif
68 EXPORT_PIPE_API HANDLE WINAPI AcceptSimplePipeConnection( HANDLE hPipe );
70 EXPORT_PIPE_API BOOL WINAPI WaitForSimplePipeA( LPCSTR lpName, DWORD dwTimeOut );
71 EXPORT_PIPE_API BOOL WINAPI WaitForSimplePipeW( LPCWSTR lpName, DWORD dwTimeOut );
73 #ifdef UNICODE
74 #define WaitForSimplePipe WaitForSimplePipeW
75 #else
76 #define WaitForSimplePipe WaitForSimplePipeA
77 #endif
80 EXPORT_PIPE_API BOOL WINAPI WriteSimplePipe( HANDLE hPipe, LPCVOID lpBuffer, DWORD dwBytesToWrite, LPDWORD lpBytesWritten, BOOL bWait );
81 EXPORT_PIPE_API BOOL WINAPI ReadSimplePipe( HANDLE hPipe, LPVOID lpBuffer, DWORD dwBytesToRead, LPDWORD lpBytesRead, BOOL bWait );
82 EXPORT_PIPE_API BOOL WINAPI CloseSimplePipe( HANDLE hPipe );
84 #ifdef __cplusplus
85 } // extern "C"
86 #endif
88 #endif // _PIPEIMPL_H_