|
|
|
@ -1,26 +1,26 @@
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
|
* warranty. In no event will the authors be held liable for any damages
|
|
|
|
|
* arising from the use of this software.
|
|
|
|
|
*
|
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
|
* including commercial applications, and to alter it and redistribute it
|
|
|
|
|
* freely, subject to the following restrictions:
|
|
|
|
|
*
|
|
|
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
|
* claim that you wrote the original software. If you use this software
|
|
|
|
|
* in a product, an acknowledgment in the product documentation would be
|
|
|
|
|
* appreciated but is not required.
|
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
|
* misrepresented as being the original software.
|
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
|
*------------------------------------------------------------------------------
|
|
|
|
|
* Shared object loaded by lokinet installer to properly detect the presence
|
|
|
|
|
* of the TAP v9 adapter
|
|
|
|
|
* -rick
|
|
|
|
|
*/
|
|
|
|
|
* Copyright (c)2018-2019 Rick V. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
|
* warranty. In no event will the authors be held liable for any damages
|
|
|
|
|
* arising from the use of this software.
|
|
|
|
|
*
|
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
|
* including commercial applications, and to alter it and redistribute it
|
|
|
|
|
* freely, subject to the following restrictions:
|
|
|
|
|
*
|
|
|
|
|
* 1. The origin of this software must not be misrepresented; you must not
|
|
|
|
|
* claim that you wrote the original software. If you use this software
|
|
|
|
|
* in a product, an acknowledgment in the product documentation would be
|
|
|
|
|
* appreciated but is not required.
|
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
|
* misrepresented as being the original software.
|
|
|
|
|
* 3. This notice may not be removed or altered from any source distribution.
|
|
|
|
|
*------------------------------------------------------------------------------
|
|
|
|
|
* Shared object loaded by lokinet installer to properly detect the presence
|
|
|
|
|
* of the TAP v9 adapter
|
|
|
|
|
* -rick
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
@ -41,10 +41,12 @@ reg_query_helper()
|
|
|
|
|
DWORD i, ret, len;
|
|
|
|
|
char *deviceid = NULL;
|
|
|
|
|
DWORD sub_keys = 0;
|
|
|
|
|
BOOL found = FALSE;
|
|
|
|
|
BOOL found = FALSE;
|
|
|
|
|
|
|
|
|
|
ret =
|
|
|
|
|
RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"), 0, KEY_READ, &adapters);
|
|
|
|
|
ret = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
|
|
|
|
TEXT("SYSTEM\\CurrentControlSet\\Control\\Class\\{"
|
|
|
|
|
"4D36E972-E325-11CE-BFC1-08002BE10318}"),
|
|
|
|
|
0, KEY_READ, &adapters);
|
|
|
|
|
if(ret != ERROR_SUCCESS)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
@ -70,7 +72,10 @@ reg_query_helper()
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Append it to NETWORK_ADAPTERS and open it */
|
|
|
|
|
snprintf(new_key, sizeof new_key, "%s\\%s", "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}", key);
|
|
|
|
|
snprintf(new_key, sizeof new_key, "%s\\%s",
|
|
|
|
|
"SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-"
|
|
|
|
|
"BFC1-08002BE10318}",
|
|
|
|
|
key);
|
|
|
|
|
ret =
|
|
|
|
|
RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT(new_key), 0, KEY_READ, &adapter);
|
|
|
|
|
if(ret != ERROR_SUCCESS)
|
|
|
|
@ -86,7 +91,7 @@ reg_query_helper()
|
|
|
|
|
goto clean;
|
|
|
|
|
}
|
|
|
|
|
/* If its a tap adapter, its all good */
|
|
|
|
|
/* We only support TAP 9.x, TAP 8.x users must upgrade. */
|
|
|
|
|
/* We only support TAP 9.x, TAP 8.x users must upgrade. */
|
|
|
|
|
if(strncmp(data, "tap0901", 7) == 0)
|
|
|
|
|
{
|
|
|
|
|
DWORD type;
|
|
|
|
|