diff --git a/src/compat/internal.h b/src/compat/internal.h index 04f257e..29b73ab 100644 --- a/src/compat/internal.h +++ b/src/compat/internal.h @@ -24,9 +24,7 @@ #ifndef INTERNAL_H_ # define INTERNAL_H_ -# include "posix.h" - -# ifdef VANILLA_WIN32 +# if defined(_WIN32) && !defined(__CYGWIN__) # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # undef _WIN32_WINNT @@ -44,4 +42,6 @@ # include # endif +# include "posix.h" + #endif /* !INTERNAL_H_ */ diff --git a/src/compat/process.c b/src/compat/process.c index f196b8c..f5c03bc 100644 --- a/src/compat/process.c +++ b/src/compat/process.c @@ -140,8 +140,8 @@ struct wait_context { HANDLE proc_handle; }; -static void handle_child_terminated(PVOID lpParameter, - BOOLEAN TimerOrWaitFired) { +static void CALLBACK handle_child_terminated(PVOID lpParameter, + BOOLEAN TimerOrWaitFired) { assert(!TimerOrWaitFired); @@ -157,7 +157,8 @@ static void handle_child_terminated(PVOID lpParameter, memcpy(buf, &kind, sizeof (kind)); memcpy(buf + sizeof (kind), &ws, sizeof (ws)); - WriteFile(g_worker_pipe->fhs[1], buf, sizeof (buf), NULL, NULL); + DWORD written; + WriteFile(g_worker_pipe->fhs[1], buf, sizeof (buf), &written, NULL); HANDLE whandle = wctx->wait_handle; free(lpParameter); @@ -277,7 +278,9 @@ s_proc_handle *fork_process() { CloseHandle(sharedMem); struct wait_context *wctx = malloc(sizeof (struct wait_context)); - *wctx = {} + *wctx = (struct wait_context) { + .proc_handle = info.hProcess, + }; RegisterWaitForSingleObject( &wctx->wait_handle, diff --git a/src/compat/process.h b/src/compat/process.h index d38b995..2e26db4 100644 --- a/src/compat/process.h +++ b/src/compat/process.h @@ -25,7 +25,6 @@ # define COMPAT_PROCESS_H_ # include "criterion/types.h" -# include "compat/posix.h" # include "internal.h" struct proc_handle {