Page 1 of 1

[SOLVED]Network adapter data

Posted: Tue Feb 16, 2021 10:48 am
by jpl
Hi,

I would like to know where the data about the network adapters is obtained, that is, when executing the BridgeDeviceList command, an id that represents the adapter is shown, where does it come from?

Is there any way to use the BridgeCreate command using the actual name of the network adapter? (BridgeCreate hubname /DEVICE:X)

Re: Network adapter data

Posted: Wed Feb 17, 2021 7:54 am
by rashawn
This procedure can't identify the adapter if there's no driver installed. If you need the latest driver, choose your Windows version from the Drivers and Software list. These downloads cover most Intel® Ethernet Adapters and install the latest drivers when you run them. 2 player games

Re: Network adapter data

Posted: Wed Feb 17, 2021 8:15 am
by jpl
Firstly thanks for repliying!
I have installed a Microsoft KM-TEST Loopback Adapter and I have the latest drivers updated, however when i try to create a Local Bridge using BridgeCreate command in vpncmd I can´t identify the network adapter with the name I have assigned in the control panel of windows. The real name of the network adapter is ETH0 but when i execute BridgeDeviceList to check the name that SoftEther uses to identify it, it is shown as "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)", so i wanted to know where does this name come from.

Re: Network adapter data

Posted: Wed Feb 17, 2021 11:03 pm
by hjyuk
If you need the latest driver, choose your Windows version from the Drivers and Software list. 192.168.100.1 192.168.1.1

Re: Network adapter data

Posted: Thu Feb 18, 2021 6:54 am
by jpl
I dont need the latest diver.
What I need is to know how SoftEther generates the name of the network adapters in windows. Exmp: "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)"

Re: Network adapter data

Posted: Sat Feb 20, 2021 10:34 pm
by MikeL
Are you asking how to query the system programmatically to access network adapter data? If so the following vbscript shows you how to do it.

SET WshShell = WScript.CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject(_
"winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapter")

For Each objItem in colItems
WScript.Echo objItem.Description
WScript.Echo objItem.NetConnectionID
Next

For a full list of properties that about the adapter you can refer to this link

https://docs.microsoft.com/en-us/window ... orkadapter

Now SoftEther is not written in vbscript but there are mechanisms in other programming languages to get the same information from Windows.

Is this the kind of information you were looking for?

Mike

Re: Network adapter data

Posted: Sun Feb 21, 2021 9:46 am
by solo
jpl wrote:
Thu Feb 18, 2021 6:54 am
an id that represents the adapter is shown, where does it come from?
...
how SoftEther generates the name of the network adapters in windows. Exmp: "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)"
Here are the SoftEther steps to generate ID=x:
  1. call the "EnumEthernet" method of RPC API
  2. get GUID of Network Adapter
  3. hash it
You can generate it manually yourself:
get GUID: netsh lan show interfaces
compile this short code from SoftEther's BridgeWin32.c

Code: Select all

// Generate an ID from GUID
UINT Win32EthGenIdFromGuid(char *guid)
{
	char tmp[MAX_SIZE];
	UCHAR hash[SHA1_SIZE];
	UINT i;
	// Validate arguments
	if (guid == NULL)
	{
		return 0;
	}

	StrCpy(tmp, sizeof(tmp), guid);
	Trim(tmp);
	StrUpper(tmp);

	HashSha1(hash, tmp, StrLen(tmp));

	Copy(&i, hash, sizeof(UINT));

	i = Endian32(i);

	if (i == 0)
	{
		i = 1;
	}

	return i;
}

Re: Network adapter data

Posted: Mon Feb 22, 2021 4:03 pm
by jpl
solo wrote:
Sun Feb 21, 2021 9:46 am
jpl wrote:
Thu Feb 18, 2021 6:54 am
an id that represents the adapter is shown, where does it come from?
...
how SoftEther generates the name of the network adapters in windows. Exmp: "MS NDIS 6.0 LoopBack Driver (ID=XXXXXXXXXX)"
Here are the SoftEther steps to generate ID=x:
  1. call the "EnumEthernet" method of RPC API
  2. get GUID of Network Adapter
  3. hash it
You can generate it manually yourself:
get GUID: netsh lan show interfaces
compile this short code from SoftEther's BridgeWin32.c

Code: Select all

// Generate an ID from GUID
UINT Win32EthGenIdFromGuid(char *guid)
{
	char tmp[MAX_SIZE];
	UCHAR hash[SHA1_SIZE];
	UINT i;
	// Validate arguments
	if (guid == NULL)
	{
		return 0;
	}

	StrCpy(tmp, sizeof(tmp), guid);
	Trim(tmp);
	StrUpper(tmp);

	HashSha1(hash, tmp, StrLen(tmp));

	Copy(&i, hash, sizeof(UINT));

	i = Endian32(i);

	if (i == 0)
	{
		i = 1;
	}

	return i;
}
Thank you very much, this was what I was looking for!