Valhalla Legends Archive

Programming => General Programming => C/C++ Programming => Topic started by: Sargera on September 14, 2004, 02:38 PM

Title: System/Winsock Functions
Post by: Sargera on September 14, 2004, 02:38 PM
What functions (for Windows NT 5.0+) are there for getting system information such as amount of memory, type of processor, etc.?  Additionally, what functions are there for getting information on a current connection on a socket (Winsock) such as connection uptime, packets sent/received, etc..  I know that some of this information I'd like to get from functions could be done logically with just basic code, but I'd like to know if there are actual functions for getting this information, and information related to it.
Title: Re:System/Winsock Functions
Post by: Sargera on September 14, 2004, 02:40 PM
Hmm, found this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/system_information_functions.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/system_information_functions.asp)

But if there are any other functions that you know of, please submit them here.  I still don't see functions for getting the amount of memory on the computer, or what kind of processor the system is running.
Title: Re:System/Winsock Functions
Post by: UserLoser. on September 14, 2004, 04:44 PM
For system information, and things like amount of memory, see: GetSystemInfo, GlobalMemoryStatus. AFAIK, there are no Winsock API functions which keep track of the amount of data sent/received, along with the uptime of the connection.  Also, Depends on what you want to know about the connection, few examples which retrieve information about the connection: if you want to get your local ip, use getsockname(), if you want to get the remote host ip, use getpeername().  Much much more information on here (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/winsock_reference.asp)
Title: Re:System/Winsock Functions
Post by: dxoigmn on September 14, 2004, 04:55 PM
Google is your friend.

http://www.codeproject.com/internet/BytesSentReceived.asp (http://www.codeproject.com/internet/BytesSentReceived.asp)
http://support.microsoft.com/default.aspx?scid=kb;en-us;161151 (http://support.microsoft.com/default.aspx?scid=kb;en-us;161151)

I'm sure you can convert that last one from VB to C++
Title: Re:System/Winsock Functions
Post by: K on September 14, 2004, 05:33 PM
you can get all sorts of information about the system using WMI (http://msdn.microsoft.com/library/en-us/wmisdk/wmi/using_wmi.asp), but I've never tried to implement it in C/C++ -- it looks tedious and difficult.
Title: Re:System/Winsock Functions
Post by: Skywing on September 14, 2004, 09:04 PM
Quote from: K on September 14, 2004, 05:33 PM
you can get all sorts of information about the system using WMI (http://msdn.microsoft.com/library/en-us/wmisdk/wmi/using_wmi.asp), but I've never tried to implement it in C/C++ -- it looks tedious and difficult.

WMI is definitely designed for access from scripting languages (or languages with extensive built-in COM support).

You can usually get whatever WMI can give you from other sources, so in most cases it's a good idea to avoid using WMI from C/C++.
Title: Re:System/Winsock Functions
Post by: Sargera on September 14, 2004, 11:00 PM
What method is used to get the processor brand, model, and speed?
Title: Re:System/Winsock Functions
Post by: dxoigmn on September 14, 2004, 11:51 PM
Quote from: Sargera on September 14, 2004, 11:00 PM
What method is used to get the processor brand, model, and speed?

Google told me: http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html (http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html)
Title: Re:System/Winsock Functions
Post by: UserLoser. on September 15, 2004, 01:51 PM
Quote from: dxoigmn on September 14, 2004, 11:51 PM

Google told me: http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html (http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html)

Perhaps you should share a suscription login to that website, since it's quite usless and just shows somebody asking a question
Title: Re:System/Winsock Functions
Post by: K on September 15, 2004, 02:19 PM
Quote from: UserLoser. on September 15, 2004, 01:51 PM
Quote from: dxoigmn on September 14, 2004, 11:51 PM

Google told me: http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html (http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html)



Perhaps you should share a suscription login to that website, since it's quite usless and just shows somebody asking a question

Scroll down past the ads.  ::)
Title: Re:System/Winsock Functions
Post by: dxoigmn on September 15, 2004, 02:26 PM
Quote from: K on September 15, 2004, 02:19 PM
Scroll down past the ads.  ::)

Indeed ;)
Title: Re:System/Winsock Functions
Post by: UserLoser. on September 15, 2004, 02:29 PM
Quote from: K on September 15, 2004, 02:19 PM
Quote from: UserLoser. on September 15, 2004, 01:51 PM
Quote from: dxoigmn on September 14, 2004, 11:51 PM

Google told me: http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html (http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_20305588.html)



Perhaps you should share a suscription login to that website, since it's quite usless and just shows somebody asking a question

Scroll down past the ads.  ::)

I went ther twice or so, and didn't  bother to keep scrolling after i saw ads/other stuff, oops.
Title: Re: System/Winsock Functions
Post by: thetempest on October 13, 2004, 10:00 AM
hey,

long time since i've been here.  But this is a program that i've been using for a long time, its like netstat, but it tells you what programs are bound to what ports and what not.

It's called, FPORT, and its by foundstone Inc.  I thought they released the source, but i guess i got them confused with someone else.

Perhaps you can look at the Import Address Table to see what API functions they use, if any.

Just thought i'd let you know,
http://www.foundstone.com/index.htm?subnav=resources/navigation.htm&subcontent=/resources/proddesc/fport.htm