Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Anyone can help me convert this structure to VB.net data values?
Im having troubles specially with the last value.

C++
typedef struct _MIB_TCPROW_OWNER_MODULE {
  DWORD         dwState;
  DWORD         dwLocalAddr;
  DWORD         dwLocalPort;
  DWORD         dwRemoteAddr;
  DWORD         dwRemotePort;
  DWORD         dwOwningPid;
  LARGE_INTEGER liCreateTimestamp;
  ULONGLONG     OwningModuleInfo[TCPIP_OWNING_MODULE_SIZE];
}MIB_TCPROW_OWNER_MODULE, *PMIB_TCPROW_OWNER_MODULE;



TCPIP_OWNING_MODULE_SIZE should be 16, but not sure how to use that.
Posted
Comments
Sergey Alexandrovich Kryukov 25-Feb-11 20:50pm    
Sorry for you :-)
--SA

So your situation probably is:
1. Have working code
2. Written in a readable language
3. lots of nice tools available to deal with MIB, ASN.1 and so on

And you want to
1. rewrite code in vb.net, something you are somewhat comfortable with, but you have no knowledge about System.Runtime.InteropServices[^] - so you are probably going to spend lots of time getting it right.
2. I find VB harder to read than c,c#,c++,java,actionscript - I'm probably not alone
3. There isn't that many tools available to deal with MIB, ASN.1 and so on for .Net

So if you want to have .Net integration, my advice would be to take a long look at C++/CLI, as this will help you to get the job done using the original code.

Regards
Espen Harlinn
 
Share this answer
 
Comments
creizlein 26-Feb-11 6:29am    
Guess you made too many assumptions too fast, but its up to you, they are all wrong, except for 2.2
There is no original code, just the struct definition documented in msdn.
Questioning why or what for i need a piece of code is not part of the help process.
Espen Harlinn 26-Feb-11 7:08am    
1. I gave you a pointer to interop - if you really want to do this in VB, you have to use interop.
2. This is my personal opinion about VB - I do find the code harder to read :)
3. I would have though that sticking with a language supported by a wide range of tools was infinitely better than the alternative.

C++/CLI works amazingly well when it comes to integrating the platform API with .Net - interop requires a *lot* more work, but be my guest.

>> Questioning why or what for i need a piece of code is not part of the help process
Say that slowly, and repeat the procedure until you realize how ****** it sounds.

When we don’t know what you are trying to accomplish, we are certainly going to have to make some assumptions, and if you don’t realize it: this is a voluntary, free effort.
Abhinav S 26-Feb-11 10:27am    
Good comments.
Abhinav S 26-Feb-11 10:27am    
No idea why you got univoted. Fixed.
Espen Harlinn 26-Feb-11 10:35am    
Thank you Abhinav!
You can see vb variable types in the following link ...

http://msdn.microsoft.com/en-us/library/s2dy91zy.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900