]> xenbits.xensource.com Git - pvdrivers/win/xencons.git/commitdiff
Pass data through pipe
authorOwen Smith <owen.smith@citrix.com>
Tue, 25 Jul 2017 12:47:37 +0000 (13:47 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 25 Jul 2017 12:47:37 +0000 (13:47 +0100)
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 <owen.smith@citrix.com>
src/monitor/monitor.c

index ca27562d323cd615a61a9f767a9e0f3e6ad389a8..c2ae38c0d847a986400db169f6bcb2f01481b641 100644 (file)
@@ -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);