aboutsummaryrefslogtreecommitdiffstats
path: root/api/rundll32.h
diff options
context:
space:
mode:
Diffstat (limited to 'api/rundll32.h')
-rw-r--r--api/rundll32.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/api/rundll32.h b/api/rundll32.h
index 51ea321..2a2400f 100644
--- a/api/rundll32.h
+++ b/api/rundll32.h
@@ -306,11 +306,15 @@ cleanupArgv:
}
static WINTUN_STATUS
-DeleteDriverViaRundll32()
+DeletePoolDriverViaRundll32(_In_z_ WCHAR Pool[WINTUN_MAX_POOL], _Inout_ BOOL *RebootRequired)
{
LOG(WINTUN_LOG_INFO, L"Spawning native process");
- WCHAR Response[8 + 1];
- DWORD Result = ExecuteRunDll32(L"DeleteDriver", Response, _countof(Response));
+
+ WCHAR Arguments[17 + WINTUN_MAX_POOL + 1];
+ if (_snwprintf_s(Arguments, _countof(Arguments), _TRUNCATE, L"DeletePoolDriver %s", Pool) == -1)
+ return LOG(WINTUN_LOG_ERR, L"Command line too long"), ERROR_INVALID_PARAMETER;
+ WCHAR Response[8 + 1 + 8 + 1];
+ DWORD Result = ExecuteRunDll32(Arguments, Response, _countof(Response));
if (Result != ERROR_SUCCESS)
{
LOG(WINTUN_LOG_ERR, L"Error executing worker process");
@@ -318,13 +322,15 @@ DeleteDriverViaRundll32()
}
int Argc;
WCHAR **Argv = CommandLineToArgvW(Response, &Argc);
- if (Argc < 1)
+ if (Argc < 2)
{
LOG(WINTUN_LOG_ERR, L"Incomplete or invalid response");
Result = ERROR_INVALID_PARAMETER;
goto cleanupArgv;
}
Result = wcstoul(Argv[0], NULL, 16);
+ if (wcstoul(Argv[1], NULL, 16))
+ *RebootRequired = TRUE;
cleanupArgv:
LocalFree(Argv);
return Result;