A little intro. If you know how to use the regedit(Registry Editor) you can browse this key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\Root\NET". If the key "NET" doesn't exist that means you don't have TAP driver installed else you will see all the virtual network adapters available or installed in your system. They are divided in subkeys starting from 0000, 0001, 0002 and so on. That's our meal.
So we now know where to check the adapters manually in the registry, now let's start building our code to check it programmatically. First we need to import the following so that we can use the Registry Class which we will be needing to access the registry key mentioned above.
Imports Microsoft.Win32
Then the nice part...
'Variable declaration Dim regTap As RegistryKey Dim tap0901 As Boolean = False Dim regTmp As RegistryKey Dim regTmpVal As String 'Let's try to open the "NET" key regTap = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\Root\\NET", False) 'Does "NET" key exist? If regTap Is Nothing Then 'If it doesn't then... GoTo NoTap Else 'If it does then... 'Each virtual adapters are placed inside a key and are named starting from 0000(0001,0002, on so on). Let's read each subkey inside "NET" key so we can check if there's a TAP installed. For Each x As String In regTap .GetSubKeyNames 'Open each subkey. regTmp = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\Root\\NET\\" & x.Trim, False) 'Our main interest is "HardwareID" the value of it will serve as our keyword if the subkey being checked is a TAP driver or not regTmpVal = regTmp.GetValue("HardwareID")(0) 'tap0901 by default is false If tap0901 = False Then 'if "HardwareID" is equals to "tap0901" which is the ID of TAP then set our v ariable tap0901 to true :) If regTmpVal = "tap0901" Then tap0901 = True End If End If regTmpVal = "" Next End If NoTap: 'Some codes here
FIN :D
[Vb.Net] Openvpn Gui 101: Tap Adapter Detection ~ Code Monkey >>>>> Download Now
ReplyDelete>>>>> Download Full
[Vb.Net] Openvpn Gui 101: Tap Adapter Detection ~ Code Monkey >>>>> Download LINK
>>>>> Download Now
[Vb.Net] Openvpn Gui 101: Tap Adapter Detection ~ Code Monkey >>>>> Download Full
>>>>> Download LINK MD