mirror of
https://gitlab.com/Monsterovich/lanemu.git
synced 2024-07-07 06:01:16 +02:00
Use the registry value (TapDriver) to set the driver for Windows
This commit is contained in:
parent
6101c61988
commit
4988009e74
|
@ -30,11 +30,9 @@
|
|||
|
||||
#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
|
||||
#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
|
||||
#ifdef USE_TAPV9
|
||||
#define TAP_COMPONENT_ID "root\\tap0901"
|
||||
#else
|
||||
#define TAP_COMPONENT_ID "tapoas"
|
||||
#endif
|
||||
#define APP_KEY "SOFTWARE\\Lanemu"
|
||||
#define TAP_OAS_COMPONENT_ID "tapoas"
|
||||
#define TAP_V9_COMPONENT_ID "root\\tap0901"
|
||||
|
||||
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
|
||||
#define TAPSUFFIX ".tap"
|
||||
|
@ -68,7 +66,20 @@ int findTapDevice(char *deviceID, int deviceIDLen, char *deviceName, int deviceN
|
|||
char keyI[1024];
|
||||
char keyName[1024];
|
||||
HKEY key;
|
||||
|
||||
const char *tapComponentId = TAP_OAS_COMPONENT_ID;
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, APP_KEY, 0, KEY_READ, &key);
|
||||
|
||||
if (status == ERROR_SUCCESS) {
|
||||
DWORD tapDriver;
|
||||
len = sizeof(tapDriver);
|
||||
status = RegQueryValueEx(key, "TapDriver", NULL, NULL, (LPBYTE)&tapDriver, &len);
|
||||
if (status == ERROR_SUCCESS && tapDriver) {
|
||||
tapComponentId = TAP_V9_COMPONENT_ID;
|
||||
}
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, ADAPTER_KEY, 0, KEY_READ, &adapterKey);
|
||||
|
||||
if (status != ERROR_SUCCESS) {
|
||||
|
@ -98,7 +109,7 @@ int findTapDevice(char *deviceID, int deviceIDLen, char *deviceName, int deviceN
|
|||
|
||||
len = sizeof(componentId);
|
||||
status = RegQueryValueEx(key, "ComponentId", NULL, NULL, componentId, &len);
|
||||
if (status == ERROR_SUCCESS && strcmp(componentId, TAP_COMPONENT_ID) == 0) {
|
||||
if (status == ERROR_SUCCESS && strcmp(componentId, tapComponentId) == 0) {
|
||||
if (skip < 1) {
|
||||
len = deviceIDLen;
|
||||
RegQueryValueEx(key, "NetCfgInstanceId", NULL, NULL, deviceID, &len);
|
||||
|
|
Loading…
Reference in a new issue