aboutsummaryrefslogtreecommitdiffstats
path: root/api/adapter.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-10-14 05:27:13 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2021-10-14 05:28:09 +0000
commit80aab77c1987788561c3d60cb8eb7f7fe8dac829 (patch)
treed45ee52bf2caa594e6c821281f4fc168b67ef35e /api/adapter.c
parentdownlevelshim: remove in preparation for full WHQL (diff)
downloadwintun-80aab77c1987788561c3d60cb8eb7f7fe8dac829.tar.xz
wintun-80aab77c1987788561c3d60cb8eb7f7fe8dac829.zip
api: adapter: handle cases explicitly in dev query callback
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--api/adapter.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/api/adapter.c b/api/adapter.c
index 6aa6c21..ab79f0c 100644
--- a/api/adapter.c
+++ b/api/adapter.c
@@ -418,15 +418,20 @@ WaitForInterfaceCallback(
_In_ const DEV_QUERY_RESULT_ACTION_DATA *ActionData)
{
WAIT_FOR_INTERFACE_CTX *Ctx = Context;
- Ctx->LastError = ERROR_SUCCESS;
- if (ActionData->Action == DevQueryResultStateChange)
+ DWORD Ret = ERROR_SUCCESS;
+ switch (ActionData->Action)
{
+ case DevQueryResultStateChange:
if (ActionData->Data.State != DevQueryStateAborted)
return;
- Ctx->LastError = ERROR_DEVICE_NOT_AVAILABLE;
- }
- else if (ActionData->Action == DevQueryResultRemove)
+ Ret = ERROR_DEVICE_NOT_AVAILABLE;
+ case DevQueryResultAdd:
+ case DevQueryResultUpdate:
+ break;
+ default:
return;
+ }
+ Ctx->LastError = Ret;
SetEvent(Ctx->Event);
}