forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help with Calling Functions

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Sat Jan 10, 2004 7:56 pm    Post subject: Help with Calling Functions Reply with quote

Can anyone help with this:

Code:
Declare Function GetIfTable Lib "iphlpapi.dll" _
 (ByRef pIfTable As PMIB_IFTABLE, ByRef pdwSize As Long, ByVal border As Long )
 As Long



Private Declare Function GetTcpStatistics Lib "iphlpapi.dll" (pStats As MIB_TCPSTATS) As Long




I am looking to retreive the Bytes send and recevied by a Network Adapter, i do not want to use netstat and @pipe() because it keeps meshing up, and is not reilable if you are trying to call the command every 1 to 2 seconds.

ANy help would be great

Nathan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sat Jan 10, 2004 10:41 pm    Post subject: Reply with quote

Well I started to experiment with it but every time I executed any code
the IDE would quit.

Careful - this exits the VDS IDE
Code:
# CAREFUL -- this crashes the VDS IDE -- but it's a starting point
loadlib iphlpapi.dll
%A = @lib(iphlpapi,GetTcpStatistics,NIL:)
freelib iphlpapi.dll
info %A

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Sun Jan 11, 2004 2:18 am    Post subject: Reply with quote

I don't have that dll but I would like to ask :
1. Is it a windows dll ?
2. Is it a 32 bit dll (win32 dll) ?
3. Does the dll use stdcall calling convention or not ?

If answer to any one of above is NO then I doubt you can call that dll from VDS.
Other than that even if the dll has a small error in the loading functions VDS won't tolerate unlike other advanced languages as I have seen sometimes but this is very rare.

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sun Jan 11, 2004 8:32 am    Post subject: Reply with quote

Maybe you should do something with this? Make a pointer or something:

pStats As MIB_TCPSTATS

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Sun Jan 11, 2004 4:19 pm    Post subject: Reply with quote

I didn't see that :
As Skit said MIB_TCPSTATS and PMIB_IFTABLE looks like structs.
You need to refer to the documentationa and convert it to appropriate VDS syntax using @BINARY() command and pass it's address to the function.
You need to to fill the struct S by appropriate members else the dll is bound to crash.
Pseudocode:
Code:
  %S = @BINARY(DWROD,<something>)@BINARY(DWROD,<something>) 
%A = @lib(iphlpapi,GetTcpStatistics,int:,@ADDR("%S"))
  freelib iphlpapi.dll
  info %A

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Rubes_sw
Valued Contributor
Valued Contributor


Joined: 11 Jun 2001
Posts: 625
Location: Northern Ireland

PostPosted: Sun Jan 11, 2004 4:46 pm    Post subject: Reply with quote

Does this shed any light?


Microsoft Knowledge Base Article - 193059 wrote:
Comments?
Provide us with feedback on this article

Support Centres
Platform SDK
Windows 98

General Info
Contact Microsoft
Support Options, Phone Numbers, and Online Support

Support Webcasts
Online Presentations, Live and Recorded, on Microsoft Products by Microsoft Experts


Page Options
Send
Print


INFO: IP Helper APIs Add Net Config and Stat Info to Win32 Apps
Applies To
This article was previously published under Q193059
SUMMARY
The IP Helper API (IPHLPAPI) is a public API that provides Windows network configuration and statistics information to Windows 32-bit applications. The API is available for Windows NT 4.0 Service Pack 4 and later, and for Windows 98 and Windows 2000. Not all IP Helper APIs are available for Windows NT 4.0 and Windows 98 platforms.
MORE INFORMATION
This article provides a brief description of the IP Helper APIs available, grouped by the task they perform or the object they operate on. Additional information for the IP Helper APIs, including sample code, will be available on the Windows NT 5.0 Beta 2 Platform SDK release and later.
Interface Class
This class allows applications to retrieve network adapter characteristic information. The IP Helper APIs available for Windows NT 4.0 Service Pack 4 are listed below:
GetIfTable: Retrieves all network adapters physical characteristics.
GetIfEntry: Retrieves specific adapter characteristics.
SetIfEntry: Updates a specific adapter's operating status, such as describing whether an interface is up, down, or in a testing mode.
SetIpTTL: Allows applications to modify the Time to Live (TTL) field for all IP packets sent from your system.
IP Address Class
This class allows applications to modify and retrieve IP configuration information. However, most of these APIs are not supported on Windows NT 4.0 Service Pack 4. The IP Helper APIs available for Windows NT 4.0 SP 4 are listed below:
GetIpAddrTable: Allows an application to retrieve IP address information.
ARP Table Class
This class provides access to the address resolution protocol (ARP) entries by mapping from an IP address to a physical address. The IP Helper APIs available for Windows NT 4.0 Service Pack 4 are listed below:
GetIpNetTable: Retrieves address resolution table information.
SetIpNetEntry: Adds entry to the ARP table.
DeleteIpNetEntry: Deletes entry from the ARP table.
Route Table Class
This class allows applications to retrieve IP routing information and permits applications to make modifications to route entries in the table. Routing is the selection of the next hop address from a routing table over which a packet is sent. The IP Helper APIs available for Windows NT 4.0 Service Pack 4 are listed below:
GetIpForwardTable: Retrieves routing table information.
SetIpForwardEntry: Adds a route table entry.
DeleteIpForwardEntry: Deletes a route table entry.
GetRTTAndHopCount: Provides approximated round trip time information to a specific IP destination and also provides the hop count to that destination.
Statistics Class
This class provides information on various kinds of packet/connection statistics information on a local computer. The IP Helper APIs available for Windows NT 4.0 Service Pack 4 are listed below:
GetIpStatistics: Retrieves Internet Protocol (IP) packet statistics.
GetIcmpStatistics: Retrieves Internet Control Message Protocol (ICMP) statistics.
GetTcpStatistics: Retrieves Transmission Control Protocol (TCP) statistics.
GetUdpStatistics: Retrieves User Datagram Protocol (UDP) statistics.
IP Helper API Conventions
Interfaces are addressed by index, which is a large DWORD number. For applications that expect friendly interface numbers (for example, MIB, UI), use GetFriendlyIndex() for one-way conversion into friendly index.

Functions that return an array of structures take in/out size parameter pSize. The user initializes pSize so it points to the size of the buffer passed to the function. After a successful call, this parameter holds the actual size of the data returned. If the function fails because the buffer is too small, pSize points to the buffer size required to hold all available data and the function returns a Win32 error status. Most of these IP Helper APIs return ERROR_INSUFFICIENT_BUFFER; the exception is that the GetNetworkParams() and GetAdaptersInfo() APIs return ERROR_BUFFER_OVERFLOW.
The information in this article applies to:
Microsoft Win32 Software Development Kit (SDK), when used with:
the operating system: Microsoft Windows NT
Microsoft Windows 98
the operating system: Microsoft Windows 2000Last Reviewed: 5/10/2003 (2.0)
Keywords: kbAPI kbFEA kbinfo kbIPHelp kbnetwork KB193059



I have the file in my windows\system32\ dir

Nathan
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group