api: do not require RebootRequired
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
ffab1eabe3
commit
17bd620a36
@ -1689,10 +1689,13 @@ WintunCreateAdapter(
|
|||||||
_In_z_count_c_(MAX_ADAPTER_NAME) const WCHAR *Name,
|
_In_z_count_c_(MAX_ADAPTER_NAME) const WCHAR *Name,
|
||||||
_In_opt_ const GUID *RequestedGUID,
|
_In_opt_ const GUID *RequestedGUID,
|
||||||
_Out_ WINTUN_ADAPTER **Adapter,
|
_Out_ WINTUN_ADAPTER **Adapter,
|
||||||
_Out_ BOOL *RebootRequired)
|
_Out_opt_ BOOL *RebootRequired)
|
||||||
{
|
{
|
||||||
if (!ElevateToSystem())
|
if (!ElevateToSystem())
|
||||||
return LOG(WINTUN_LOG_ERR, L"Failed to impersonate SYSTEM user"), ERROR_ACCESS_DENIED;
|
return LOG(WINTUN_LOG_ERR, L"Failed to impersonate SYSTEM user"), ERROR_ACCESS_DENIED;
|
||||||
|
BOOL DummyRebootRequired;
|
||||||
|
if (!RebootRequired)
|
||||||
|
RebootRequired = &DummyRebootRequired;
|
||||||
*RebootRequired = FALSE;
|
*RebootRequired = FALSE;
|
||||||
DWORD Result = ERROR_SUCCESS;
|
DWORD Result = ERROR_SUCCESS;
|
||||||
#ifdef MAYBE_WOW64
|
#ifdef MAYBE_WOW64
|
||||||
@ -1848,11 +1851,14 @@ cleanupArgv:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
WINTUN_STATUS WINAPI
|
WINTUN_STATUS WINAPI
|
||||||
WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _In_ BOOL ForceCloseSessions, _Out_ BOOL *RebootRequired)
|
WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _In_ BOOL ForceCloseSessions, _Out_opt_ BOOL *RebootRequired)
|
||||||
{
|
{
|
||||||
if (!ElevateToSystem())
|
if (!ElevateToSystem())
|
||||||
return LOG(WINTUN_LOG_ERR, L"Failed to impersonate SYSTEM user"), ERROR_ACCESS_DENIED;
|
return LOG(WINTUN_LOG_ERR, L"Failed to impersonate SYSTEM user"), ERROR_ACCESS_DENIED;
|
||||||
|
|
||||||
|
BOOL DummyRebootRequired;
|
||||||
|
if (!RebootRequired)
|
||||||
|
RebootRequired = &DummyRebootRequired;
|
||||||
*RebootRequired = FALSE;
|
*RebootRequired = FALSE;
|
||||||
DWORD Result;
|
DWORD Result;
|
||||||
#ifdef MAYBE_WOW64
|
#ifdef MAYBE_WOW64
|
||||||
|
@ -111,10 +111,10 @@ WintunCreateAdapter(
|
|||||||
_In_z_count_c_(MAX_ADAPTER_NAME) const WCHAR *Name,
|
_In_z_count_c_(MAX_ADAPTER_NAME) const WCHAR *Name,
|
||||||
_In_opt_ const GUID *RequestedGUID,
|
_In_opt_ const GUID *RequestedGUID,
|
||||||
_Out_ WINTUN_ADAPTER **Adapter,
|
_Out_ WINTUN_ADAPTER **Adapter,
|
||||||
_Out_ BOOL *RebootRequired);
|
_Out_opt_ BOOL *RebootRequired);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc WINTUN_DELETE_ADAPTER_FUNC
|
* @copydoc WINTUN_DELETE_ADAPTER_FUNC
|
||||||
*/
|
*/
|
||||||
WINTUN_STATUS WINAPI
|
WINTUN_STATUS WINAPI
|
||||||
WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _In_ BOOL ForceCloseSessions, _Out_ BOOL *RebootRequired);
|
WintunDeleteAdapter(_In_ const WINTUN_ADAPTER *Adapter, _In_ BOOL ForceCloseSessions, _Out_opt_ BOOL *RebootRequired);
|
||||||
|
@ -40,7 +40,7 @@ typedef void *WINTUN_ADAPTER_HANDLE;
|
|||||||
* @param Adapter Pointer to a handle to receive the adapter handle. Must be released with
|
* @param Adapter Pointer to a handle to receive the adapter handle. Must be released with
|
||||||
* WintunFreeAdapter.
|
* WintunFreeAdapter.
|
||||||
*
|
*
|
||||||
* @param RebootRequired Pointer to a boolean flag to be set to TRUE in case SetupAPI suggests a reboot.
|
* @param RebootRequired Optional pointer to a boolean flag to be set to TRUE in case SetupAPI suggests a reboot.
|
||||||
*
|
*
|
||||||
* @return ERROR_SUCCESS on success; Win32 error code otherwise.
|
* @return ERROR_SUCCESS on success; Win32 error code otherwise.
|
||||||
*/
|
*/
|
||||||
@ -49,7 +49,7 @@ typedef WINTUN_STATUS(WINAPI *WINTUN_CREATE_ADAPTER_FUNC)(
|
|||||||
_In_z_count_c_(MAX_ADAPTER_NAME) const WCHAR *Name,
|
_In_z_count_c_(MAX_ADAPTER_NAME) const WCHAR *Name,
|
||||||
_In_opt_ const GUID *RequestedGUID,
|
_In_opt_ const GUID *RequestedGUID,
|
||||||
_Out_ WINTUN_ADAPTER_HANDLE *Adapter,
|
_Out_ WINTUN_ADAPTER_HANDLE *Adapter,
|
||||||
_Out_ BOOL *RebootRequired);
|
_Out_opt_ BOOL *RebootRequired);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a Wintun adapter.
|
* Deletes a Wintun adapter.
|
||||||
@ -60,14 +60,14 @@ typedef WINTUN_STATUS(WINAPI *WINTUN_CREATE_ADAPTER_FUNC)(
|
|||||||
* with extreme care, as this is resource intensive and may put processes into an undefined
|
* with extreme care, as this is resource intensive and may put processes into an undefined
|
||||||
* or unpredictable state. Most users should set this to FALSE.
|
* or unpredictable state. Most users should set this to FALSE.
|
||||||
*
|
*
|
||||||
* @param RebootRequired Pointer to a boolean flag to be set to TRUE in case SetupAPI suggests a reboot.
|
* @param RebootRequired Optional pointer to a boolean flag to be set to TRUE in case SetupAPI suggests a reboot.
|
||||||
*
|
*
|
||||||
* @return ERROR_SUCCESS on success or the adapter was not found; Win32 error code otherwise.
|
* @return ERROR_SUCCESS on success or the adapter was not found; Win32 error code otherwise.
|
||||||
*/
|
*/
|
||||||
typedef WINTUN_STATUS(WINAPI *WINTUN_DELETE_ADAPTER_FUNC)(
|
typedef WINTUN_STATUS(WINAPI *WINTUN_DELETE_ADAPTER_FUNC)(
|
||||||
_In_ WINTUN_ADAPTER_HANDLE Adapter,
|
_In_ WINTUN_ADAPTER_HANDLE Adapter,
|
||||||
_In_ BOOL ForceCloseSessions,
|
_In_ BOOL ForceCloseSessions,
|
||||||
_Out_ BOOL *RebootRequired);
|
_Out_opt_ BOOL *RebootRequired);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by WintunEnumAdapters for each adapter in the pool.
|
* Called by WintunEnumAdapters for each adapter in the pool.
|
||||||
|
Loading…
Reference in New Issue
Block a user