@@ -92,9 +92,7 @@ static BOOLEAN NetworkAdapterQuerySupported(
92
92
}
93
93
94
94
static BOOLEAN NetworkAdapterQueryNdisVersion (
95
- _In_ HANDLE DeviceHandle ,
96
- _Out_ PUINT MajorVersion ,
97
- _Out_ PUINT MinorVersion
95
+ _Inout_ PPH_NETADAPTER_SYSINFO_CONTEXT Context
98
96
)
99
97
{
100
98
NDIS_OID opcode ;
@@ -105,7 +103,7 @@ static BOOLEAN NetworkAdapterQueryNdisVersion(
105
103
opcode = OID_GEN_DRIVER_VERSION ;
106
104
107
105
if (NT_SUCCESS (NtDeviceIoControlFile (
108
- DeviceHandle ,
106
+ Context -> DeviceHandle ,
109
107
NULL ,
110
108
NULL ,
111
109
NULL ,
@@ -117,8 +115,8 @@ static BOOLEAN NetworkAdapterQueryNdisVersion(
117
115
sizeof (versionResult )
118
116
)))
119
117
{
120
- * MajorVersion = HIBYTE (versionResult );
121
- * MinorVersion = LOBYTE (versionResult );
118
+ Context -> NdisMajorVersion = HIBYTE (versionResult );
119
+ Context -> NdisMinorVersion = LOBYTE (versionResult );
122
120
123
121
return TRUE;
124
122
}
@@ -785,7 +783,7 @@ static BOOLEAN NetAdapterSectionCallback(
785
783
& context -> DeviceHandle ,
786
784
PhaFormatString (L"\\\\.\\%s" , context -> AdapterEntry -> InterfaceGuid -> Buffer )-> Buffer ,
787
785
FILE_GENERIC_READ ,
788
- FILE_ATTRIBUTE_NORMAL , // FILE_ATTRIBUTE_DEVICE
786
+ FILE_ATTRIBUTE_NORMAL ,
789
787
FILE_SHARE_READ | FILE_SHARE_WRITE ,
790
788
FILE_OPEN ,
791
789
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT
@@ -796,7 +794,7 @@ static BOOLEAN NetAdapterSectionCallback(
796
794
if (NetworkAdapterQuerySupported (context -> DeviceHandle ))
797
795
{
798
796
NetworkAdapterQueryMediaType (context );
799
- NetworkAdapterQueryNdisVersion (context -> DeviceHandle , & context -> NdisMajorVersion , & context -> NdisMinorVersion );
797
+ NetworkAdapterQueryNdisVersion (context );
800
798
}
801
799
else
802
800
{
@@ -806,10 +804,13 @@ static BOOLEAN NetAdapterSectionCallback(
806
804
}
807
805
}
808
806
809
- if (( context -> IphlpHandle = LoadLibrary ( L"iphlpapi.dll" )) )
807
+ if (WindowsVersion > WINDOWS_VISTA )
810
808
{
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
+ }
813
814
}
814
815
815
816
PhInitializeCircularBuffer_ULONG64 (& context -> InboundBuffer , PhGetIntegerSetting (L"SampleCount" ));
0 commit comments