wintun/api/driver.h
Simon Rozman d04721dee6 api: test the temporary driver idea
1. Add driver to the store: SetupCopyOEMInfW()
2. Create the adapter using explicit path to .inf file: DI_ENUMSINGLEINF
3. Delete all Wintun drivers from the store.

This is a subject of further research:

- It appears those adapters survive a reboot. So, Windows must store the
  driver somewhere on the disk and the driver removal is not completed.
  If the driver removal is not completed until there are existing
  adapters, this is excellent, as it will provide a self-cleanup.

- Test multiple adapters with different driver versions. Which driver
  wins?

- Are other Wintun adapters interrupted when adding a new one?

- Test Windows 7 behaviour.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-10-30 16:51:00 +01:00

39 lines
932 B
C

/* SPDX-License-Identifier: GPL-2.0
*
* Copyright (C) 2018-2020 WireGuard LLC. All Rights Reserved.
*/
#pragma once
#include "api.h"
#include <Windows.h>
#define WINTUN_HWID L"Wintun"
/**
* Tests if any of the hardware IDs match ours.
*
* @param Hwids Multi-string containing a list of hardware IDs.
*
* @return TRUE on match; FALSE otherwise.
*/
BOOL
DriverIsOurHardwareID(_In_z_ const WCHAR *Hwids);
/**
* Tests if hardware ID or any of the compatible IDs match ours.
*
* @param DrvInfoDetailData Detailed information about a particular driver information structure.
*
* @return TRUE on match; FALSE otherwise.
*/
BOOL
DriverIsOurDrvInfoDetail(_In_ const SP_DRVINFO_DETAIL_DATA_W *DrvInfoDetailData);
/**
* Removes all Wintun drivers from the driver store.
*
* @return ERROR_SUCCESS on success or the adapter was not found; Win32 error code otherwise.
*/
WINTUN_STATUS DriverRemoveAllOurs(VOID);