views:

53

answers:

4

I need to make application which gathers basic data about system, like OS version, processor & memory type, data about installed programs... Application will be written in c and will work on Win Server 2000 and 2003. So first thing on my mind was WinApi, but i can not find any tutorials for these things, every tutorial i found is about UserInterfaces and i do not need that.

So any help would be appreciated.

EDIT: Couple of things are answered below, and i will use WMI with WinApi, but still i dont know how to get detailed properties from any .exe program on windows??

+1  A: 

This isn't covered by the Winapi, you need WMI (Windows Management Instrumentation). To get started on the kind of queries you can run, experiment with the WMI Code Creator tool. It can auto-generate the code you need. Not in C, you'll find that quite an awkward language for WMI.

Hans Passant
hmm, i need to create program similar to this, of course not code creator, similar in part where i can get all those data. Problem is that system on which app will be used have no .NET framework, or JVM. So i need to do it in C or C++.
shake
C++ is not a problem: http://msdn.microsoft.com/en-us/library/aa394558%28VS.85%29.aspx
Hans Passant
+2  A: 

WMI is likely what you need for some stuff. Not a fun API. The tool Hans refers to would be useful - even if you have to port the generated C# code back to C.

The following Win32 APIs are likely to help you:

OS Version: GetVersionEx and OSVERSIONINFOEX

CPU Info: cpuid (either write it in assembly, or call the compiler intrinsic)

Alternate CPU Info: Just look at the registry key in HKLM\Hardware\DESCRIPTION\System\CentralProcessor (1 subkey for each logical processor, each key is a cache of what cpuid returns + processor speed is listed as well).

Memory: GlobalMemoryStatusEx

selbie
Thanks a lot..last night I took some time to research WMI and it realy is not fun api to use but there is a lot of examples that will help..:)) But there is one more problem i have..Nor with WMI or WinApi a could not find how to get properties about installed programs. Those properties that can be found when right clicking on some .exe file -> properties -> details. If i find this i am ready to go. :))
shake
You can get all the binary details using these apis: http://msdn.microsoft.com/en-us/library/ff468915%28v=VS.85%29.aspx
selbie
well thank you a lot..i am really new with these things so it meant a lot..:))
shake
A: 

You probably also want to know about the book Windows Internals, from the same folk who make a wide range of cool utilities for poking under the hood.

RBerteig
A: 

For Processor Information call GetLogicalProcessorInformation.

Be Aware that this is not supported on all machines. So its better to call the DLL dynamically. Otherwise your program wont run on such machines. This example show how to do this

RED SOFT ADAIR