From: Owen Smith Date: Tue, 25 Jul 2017 12:47:37 +0000 (+0100) Subject: Pass data through pipe X-Git-Tag: 9.0.0-rc1~42 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ffe6201fd45cb34a73d843e42d7669c5ae87e542;p=pvdrivers%2Fwin%2Fxencons.git Pass data through pipe All data read during the DeviceThread will be passes to all named pipes. All data read from any named pipe will be passed to the device. Signed-off-by: Owen Smith --- diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c index ca27562..c2ae38c 100644 --- a/src/monitor/monitor.c +++ b/src/monitor/monitor.c @@ -432,6 +432,8 @@ PipeThread( LeaveCriticalSection(&Context->CriticalSection); for (;;) { + DWORD Written; + (VOID) ReadFile(Pipe->Pipe, Buffer, sizeof(Buffer), @@ -453,7 +455,11 @@ PipeThread( ResetEvent(Overlapped.hEvent); - // Length bytes of Buffer have been read + WriteFile(Context->Device, + Buffer, + Length, + &Written, + NULL); } EnterCriticalSection(&Context->CriticalSection); @@ -725,6 +731,8 @@ DeviceThread( goto fail2; for (;;) { + PLIST_ENTRY ListEntry; + (VOID) ReadFile(Device, Buffer, sizeof(Buffer), @@ -746,7 +754,23 @@ DeviceThread( ResetEvent(Overlapped.hEvent); - // Length bytes of Buffer have been read + EnterCriticalSection(&Context->CriticalSection); + + for (ListEntry = Context->ListHead.Flink; + ListEntry != &Context->ListHead; + ListEntry = ListEntry->Flink) { + PMONITOR_PIPE Instance; + DWORD Written; + + Instance = CONTAINING_RECORD(ListEntry, MONITOR_PIPE, ListEntry); + + WriteFile(Instance->Pipe, + Buffer, + Length, + &Written, + NULL); + } + LeaveCriticalSection(&Context->CriticalSection); } CloseHandle(Device);