473,394 Members | 1,640 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

GetIfEntry from ip helper

Hi - I need to implement the GetIfEntry function from the Ip Helper API and
am having some real problems converting the MIB_IFROW structure to C# - In
particluar I cannot fiqure out how to declare it properly. I realise that it
requires some additional parameters on some of its members attributes (like
Charset=Unicode etc). So can anyone please fill me in on the declaration
side of the MIB_IFROW structure please - layout and other attributes -
thanks

JJ
Nov 15 '05 #1
3 4405
James,

Try this:

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
struct MIB_IFROW
{

[MarshalAs(UnmanagedType.ByValTStr,SizeConst=MAX_IN TERFACE_NAME_LEN)]
public string wszName;
public uint dwIndex, dwType, dwMtu, dwSpeed, dwPhysAddrLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=MAXLEN_PHYSADDR)]
public byte[] bPhysAddr;
public uint dwAdminStatus, dwOperStatus, dwLastChange;
public uint dwInOctets, dwInUcastPkts, dwInNUcastPkts;
public uint dwInDiscards, dwInErrors, dwInUnknownProtos;
public uint dwOutOctets, dwOutUcastPkts, dwOutNUcastPkts;
public uint dwOutDiscards, dwOutErrors, dwOutQLen, dwDescrLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=MAXLEN_IFDESCR)]
public byte[] bDescr;
}

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2

"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl...
James,

Try this:

[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
struct MIB_IFROW
{

[MarshalAs(UnmanagedType.ByValTStr,SizeConst=MAX_IN TERFACE_NAME_LEN)]
public string wszName;
public uint dwIndex, dwType, dwMtu, dwSpeed, dwPhysAddrLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=MAXLEN_PHYSADDR)]
public byte[] bPhysAddr;
public uint dwAdminStatus, dwOperStatus, dwLastChange;
public uint dwInOctets, dwInUcastPkts, dwInNUcastPkts;
public uint dwInDiscards, dwInErrors, dwInUnknownProtos;
public uint dwOutOctets, dwOutUcastPkts, dwOutNUcastPkts;
public uint dwOutDiscards, dwOutErrors, dwOutQLen, dwDescrLen;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=MAXLEN_IFDESCR)]
public byte[] bDescr;
}

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


Thanks - Sorry if I sound ignorant - but what are the CONST values shown?

thanks
James Jenkins
Nov 15 '05 #3
Thanks - Sorry if I sound ignorant - but what are the CONST values shown?


MAX_INTERFACE_NAME_LEN = 256
MAXLEN_PHYSADDR = 8
MAXLEN_IFDESCR = 256

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Robert Ferrell | last post by:
I have a style question. I have a class with a method, m1, which needs a helper function, hf. I can put hf inside m1, or I can make it another method of the class. The only place hf should ever...
3
by: Keith | last post by:
Hello, all. I need to do a bit of plug-in detection on Netscape 4.76/Linux. A user may have nppdf.so installed, but decide (for some reason) to pass off PDF to a helper application (acroread,...
3
by: Andrew Mayo | last post by:
(note: reason for posting here; browser helper object is written in C++; C++ developers tend to know the intricacies of message handling; this looks like a Windows messaging issue) Microsoft...
4
by: Rahul Anand | last post by:
Getting SQL Exception when trying to implement Connection based Trasaction using SQL Helper class. I am using the follwing function to execute my stored procs: -=-=-=- ExecuteScalar(ByVal...
8
by: Joe Johnston | last post by:
I need a Browser Helper object written in VB.NET Please point me at a good example. Joe MCPx3 ~ Hoping this MSDN ng three day turnaround is true. Additional info: What is a BHO? In its...
2
by: WB | last post by:
Hi, How can I access Server and Trace within a helper class? I have a webform that allows user to select a PDF file (on the web server) and render a jpeg image of that PDF file. The helper...
1
by: Tran Hong Quang | last post by:
Hello, What is helper function concept? I am new to C. Thanks Tran Hong Quang
1
by: shaun roe | last post by:
When should a function be a private member, and when simply a standalone function in the .cpp file? I'm in the middle of writing a class which bridges between two packages, and so I need some...
6
by: mailforpr | last post by:
Suppose you have a couple of helper classes that are used by 2 client classes only. How can I hide these helper classes from other programmers? Do you think this solution is a good idea?: class...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.