GPI hat geschrieben:
index-als quad kann nicht sein. dann würde ein Index von 51539673088 bspw. rauskommen. das ist falsch...
aber kannst du bitte was anderes machen? Von der C-Structur ein Offset zu jeden punkt in der Liste?
Also:
+0 InterfaceLuid.q ; Ein Quad
+8 InterfaceIndex.l
+12 InterfaceGuid.b[4+2+2+8]
etc?
Dann könnte ich rausbekommen wo der fehler liegt.
Code:
0
8
12
542
1056
1056
1092
1124
1124
1128
1132
1136
1140
1144
1148
1152
1156
1160
1164
1168
1184
1192
1200
1208
1216
1224
1232
1240
1248
1256
1264
1272
1280
1288
1296
1304
1312
1320
1328
1336
1344
Generiert mit diesem Code in der main:
Code:
printf("%d\n", offsetof(MIB_IF_ROW2, InterfaceLuid));
printf("%d\n", offsetof(MIB_IF_ROW2, InterfaceIndex));
//
// Read-Only fields.
//
printf("%d\n", offsetof(MIB_IF_ROW2, InterfaceGuid));
printf("%d\n", offsetof(MIB_IF_ROW2, Alias[IF_MAX_STRING_SIZE + 1]));
printf("%d\n", offsetof(MIB_IF_ROW2, Description[IF_MAX_STRING_SIZE + 1]));
printf("%d\n", offsetof(MIB_IF_ROW2, PhysicalAddressLength));
printf("%d\n", offsetof(MIB_IF_ROW2, PhysicalAddress[IF_MAX_PHYS_ADDRESS_LENGTH]));
printf("%d\n", offsetof(MIB_IF_ROW2, PermanentPhysicalAddress[IF_MAX_PHYS_ADDRESS_LENGTH]));
printf("%d\n", offsetof(MIB_IF_ROW2, Mtu));
printf("%d\n", offsetof(MIB_IF_ROW2, Type)); // Interface Type.
printf("%d\n", offsetof(MIB_IF_ROW2, TunnelType)); // Tunnel Type, if Type = IF_TUNNEL.
printf("%d\n", offsetof(MIB_IF_ROW2, MediaType));
printf("%d\n", offsetof(MIB_IF_ROW2, PhysicalMediumType));
printf("%d\n", offsetof(MIB_IF_ROW2, AccessType));
printf("%d\n", offsetof(MIB_IF_ROW2, DirectionType));
printf("%d\n", offsetof(MIB_IF_ROW2, InterfaceAndOperStatusFlags));
printf("%d\n", offsetof(MIB_IF_ROW2, OperStatus));
printf("%d\n", offsetof(MIB_IF_ROW2, AdminStatus));
printf("%d\n", offsetof(MIB_IF_ROW2, MediaConnectState));
printf("%d\n", offsetof(MIB_IF_ROW2, NetworkGuid));
printf("%d\n", offsetof(MIB_IF_ROW2, ConnectionType));
//
// Statistics.
//
printf("%d\n", offsetof(MIB_IF_ROW2, TransmitLinkSpeed));
printf("%d\n", offsetof(MIB_IF_ROW2, ReceiveLinkSpeed));
printf("%d\n", offsetof(MIB_IF_ROW2, InOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, InUcastPkts));
printf("%d\n", offsetof(MIB_IF_ROW2, InNUcastPkts));
printf("%d\n", offsetof(MIB_IF_ROW2, InDiscards));
printf("%d\n", offsetof(MIB_IF_ROW2, InErrors));
printf("%d\n", offsetof(MIB_IF_ROW2, InUnknownProtos));
printf("%d\n", offsetof(MIB_IF_ROW2, InUcastOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, InMulticastOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, InBroadcastOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, OutOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, OutUcastPkts));
printf("%d\n", offsetof(MIB_IF_ROW2, OutNUcastPkts));
printf("%d\n", offsetof(MIB_IF_ROW2, OutDiscards));
printf("%d\n", offsetof(MIB_IF_ROW2, OutErrors));
printf("%d\n", offsetof(MIB_IF_ROW2, OutUcastOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, OutMulticastOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, OutBroadcastOctets));
printf("%d\n", offsetof(MIB_IF_ROW2, OutQLen));
Komischerweise kommt bei offsetof etwas widersprüchliches raus. Jedoch, wenn ich sizeof mit dem ersten Strukturelement mache komme ich auf 8, mit dem zweiten auf 16. Ich kanns noch so oft wiederholen

.