shithub: choc

Download patch

ref: fee18df7912c307e1dbdb646655dfcbfe98c939f
parent: b4701b6c91a46f7818958bbb3ace85a41341ee43
author: Alex Mayfield <[email protected]>
date: Thu Mar 9 15:12:21 EST 2017

WriteFile requires 4th parameter

Fixes crashes on certain versions of Windows.

--- a/midiproc/main.c
+++ b/midiproc/main.c
@@ -161,8 +161,9 @@
     buffer[0] = (i >> 8) & 0xff;
     buffer[1] = i & 0xff;
 
+    DWORD bytes_written;
     WriteFile(midi_process_out, buffer, sizeof(buffer),
-        NULL, NULL);
+        &bytes_written, NULL);
 
     return true;
 }
--- a/src/i_midipipe.c
+++ b/src/i_midipipe.c
@@ -127,8 +127,9 @@
 //
 static boolean WritePipe(net_packet_t *packet)
 {
+    DWORD bytes_written;
     BOOL ok = WriteFile(midi_process_in_writer, packet->data, packet->len,
-        NULL, NULL);
+        &bytes_written, NULL);
 
     if (!ok)
     {