00001 /* wcecompat: Windows CE C Runtime Library "compatibility" library. 00002 * 00003 * Copyright (C) 2001-2002 Essemer Pty Ltd. All rights reserved. 00004 * http://www.essemer.com.au/ 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 00022 #ifndef __wcecompat__pipe_h__ 00023 #define __wcecompat__pipe_h__ 00024 00025 00026 #include <windows.h> 00027 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 00034 typedef struct Pipe 00035 { 00036 // bool hasChannels; // true if channelNum and data length should preceed each transmission 00037 // BYTE channelNum; // number to preceed each transmission 00038 HANDLE hReadableEvent; // manual-reset event to signal other end of pipe that data is available for reading 00039 HANDLE hWriteableEvent;// manual-reset event to signal other end of pipe that buffer has room for writing 00040 HANDLE hMutex; // mutex for synchronising access to shared memory buffer 00041 HANDLE hFileMapping; // handle of shared memory mapping 00042 char* pBuffer; // pointer to shared memory buffer 00043 DWORD bufferLength; // length of buffer 00044 } Pipe; 00045 00046 00047 // dwCreationDisposition can be one of the following values from CreateFile: 00048 // CREATE_NEW Fail if the pipe already exists 00049 // OPEN_EXISTING Fail if the pipe does not exist 00050 Pipe* createPipe(const TCHAR* name, DWORD dwCreationDisposition); 00051 00052 void closePipe(Pipe* pipe); 00053 00054 //void setPipeChannelNum(Pipe* pipe, unsigned char channelNum); 00055 //Pipe* createPipeChannel(Pipe* pipe, unsigned char channelNum); 00056 00057 bool pipeReadable(Pipe* pipe); 00058 00059 int pipeRead(Pipe* pipe, unsigned char* data, int max_len); 00060 //int pipeReadChannel(Pipe* pipe, unsigned char* data, int max_len, unsigned char* channelNum); 00061 int pipeWrite(Pipe* pipe, unsigned char* data, int length); 00062 00063 #ifdef __cplusplus 00064 } 00065 #endif 00066 00067 00068 #endif /* __wcecompat__pipe_h__ */