Skip to content

Commit 30a459b

Browse files
author
dmex
committed
NetAdaptersPlugin: fixed XP imports; fixed function prototype;
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@5730 21ef857c-d57f-4fe0-8362-d861dc6d29cd
1 parent f7b1624 commit 30a459b

File tree

1 file changed

+12
-11
lines changed
  • 2.x/trunk/plugins-extra/NetAdaptersPlugin

1 file changed

+12
-11
lines changed

2.x/trunk/plugins-extra/NetAdaptersPlugin/graph.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ static BOOLEAN NetworkAdapterQuerySupported(
9292
}
9393

9494
static BOOLEAN NetworkAdapterQueryNdisVersion(
95-
_In_ HANDLE DeviceHandle,
96-
_Out_ PUINT MajorVersion,
97-
_Out_ PUINT MinorVersion
95+
_Inout_ PPH_NETADAPTER_SYSINFO_CONTEXT Context
9896
)
9997
{
10098
NDIS_OID opcode;
@@ -105,7 +103,7 @@ static BOOLEAN NetworkAdapterQueryNdisVersion(
105103
opcode = OID_GEN_DRIVER_VERSION;
106104

107105
if (NT_SUCCESS(NtDeviceIoControlFile(
108-
DeviceHandle,
106+
Context->DeviceHandle,
109107
NULL,
110108
NULL,
111109
NULL,
@@ -117,8 +115,8 @@ static BOOLEAN NetworkAdapterQueryNdisVersion(
117115
sizeof(versionResult)
118116
)))
119117
{
120-
*MajorVersion = HIBYTE(versionResult);
121-
*MinorVersion = LOBYTE(versionResult);
118+
Context->NdisMajorVersion = HIBYTE(versionResult);
119+
Context->NdisMinorVersion = LOBYTE(versionResult);
122120

123121
return TRUE;
124122
}
@@ -785,7 +783,7 @@ static BOOLEAN NetAdapterSectionCallback(
785783
&context->DeviceHandle,
786784
PhaFormatString(L"\\\\.\\%s", context->AdapterEntry->InterfaceGuid->Buffer)->Buffer,
787785
FILE_GENERIC_READ,
788-
FILE_ATTRIBUTE_NORMAL, // FILE_ATTRIBUTE_DEVICE
786+
FILE_ATTRIBUTE_NORMAL,
789787
FILE_SHARE_READ | FILE_SHARE_WRITE,
790788
FILE_OPEN,
791789
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT
@@ -796,7 +794,7 @@ static BOOLEAN NetAdapterSectionCallback(
796794
if (NetworkAdapterQuerySupported(context->DeviceHandle))
797795
{
798796
NetworkAdapterQueryMediaType(context);
799-
NetworkAdapterQueryNdisVersion(context->DeviceHandle, &context->NdisMajorVersion, &context->NdisMinorVersion);
797+
NetworkAdapterQueryNdisVersion(context);
800798
}
801799
else
802800
{
@@ -806,10 +804,13 @@ static BOOLEAN NetAdapterSectionCallback(
806804
}
807805
}
808806

809-
if ((context->IphlpHandle = LoadLibrary(L"iphlpapi.dll")))
807+
if (WindowsVersion > WINDOWS_VISTA)
810808
{
811-
context->GetIfEntry2_I = (_GetIfEntry2)GetProcAddress(context->IphlpHandle, "GetIfEntry2");
812-
context->GetInterfaceDescriptionFromGuid_I = (_GetInterfaceDescriptionFromGuid)GetProcAddress(context->IphlpHandle, "NhGetInterfaceDescriptionFromGuid");
809+
if ((context->IphlpHandle = LoadLibrary(L"iphlpapi.dll")))
810+
{
811+
context->GetIfEntry2_I = (_GetIfEntry2)GetProcAddress(context->IphlpHandle, "GetIfEntry2");
812+
context->GetInterfaceDescriptionFromGuid_I = (_GetInterfaceDescriptionFromGuid)GetProcAddress(context->IphlpHandle, "NhGetInterfaceDescriptionFromGuid");
813+
}
813814
}
814815

815816
PhInitializeCircularBuffer_ULONG64(&context->InboundBuffer, PhGetIntegerSetting(L"SampleCount"));

0 commit comments

Comments
 (0)