Code: Select all
Structure MIB_IFROW_STRUCT
wszName.u[256] ;#MAX_INTERFACE_NAME_LEN];
dwIndex.l
dwType.l
dwMtu.l
dwSpeed.l
dwPhysAddrLen.l
bPhysAddr.a[8] ;MAXLEN_PHYSADDR
dwAdminStatus.l
dwOperStatus.l
dwLastChange.l
dwInOctets.l
dwInUcastPkts.l
dwInNUcastPkts.l
dwInDiscards.l
dwInErrors.l
dwInUnknownProtos.l
dwOutOctets.l
dwOutUcastPkts.l
dwOutNUcastPkts.l
dwOutDiscards.l
dwOutErrors.l
dwOutQLen.l
dwDescrLen.l
bDescr.a[256] ;MAXLEN_IFDESCR
EndStructure
Structure MIB_IFROW
Row.MIB_IFROW_STRUCT[0] ;access the memory with the pattern of the structure, has no size it's just a pattern
EndStructure
Structure MIB_IFTABLE1
dwNumEntries.l
;followed by a dynamicly sized table.MIB_IFROW
EndStructure
Define *MIB_IFTABLE.MIB_IFTABLE1, *MIB_IFROW.MIB_IFROW, lSize
lSize = SizeOf(MIB_IFROW_STRUCT);default size or return from GetIfTable_()
*MIB_IFTABLE.MIB_IFTABLE1 = AllocateMemory(SizeOf(MIB_IFTABLE1) + lSize)
If *MIB_IFTABLE
*MIB_IFROW.MIB_IFROW = *MIB_IFTABLE + SizeOf(MIB_IFTABLE1)
Else
;handle low memory condition
End
EndIf
lErrors = GetIfTable_(*MIB_IFTABLE, @lSize, 0)
If lErrors = 122 ;ERROR_INSUFFICIENT_BUFFER
Define *new = ReAllocateMemory(*MIB_IFTABLE, SizeOf(MIB_IFTABLE1) + lSize)
If *new
*MIB_IFTABLE = *new
*MIB_IFROW = *MIB_IFTABLE + SizeOf(MIB_IFTABLE1)
*new = 0
EndIf
lErrors = GetIfTable_(*MIB_IFTABLE, @lSize, 0)
Debug *MIB_IFTABLE\dwNumEntries
;display entries
EndIf