views:

21

answers:

1

Hi!

I would like to get some information about the device, os etc. from the device running my app. I need to log this data so i can run some diagnostics later.

Now i think that this data is located in Microsoft.Win32.Registry but that means i need to know all the keys to access values.

Any idea?

+2  A: 

It depends on exactly what information you want, but you probably want to P/Invoke SystemParametersInfo with parameters like SPI_GETOEMINFO, SPI_GETPLATFORMMANUFACTURER, SPI_GETPLATFORMNAME, SPI_GETPLATFORMTYPE and SPI_GETPLATFORMVERSION.

MSDN has an example here.

EDIT

Here are some values for you:

#define SPI_GETPLATFORMTYPE 257
#define SPI_GETOEMINFO 258
#define SPI_GETPROJECTNAME 259
#define SPI_GETPLATFORMNAME 260
#define SPI_GETBOOTMENAME 261
#define SPI_GETPLATFORMMANUFACTURER 262
#define SPI_GETUUID 263
#define SPI_GETGUIDPATTERN 264

For the version I'd just pull Environment.OSVersion.Version and compare to this version list.

ctacke
thanx again ctacke! The only problem i have is getting SPI_GETPLATFORMVERSION. Maybe im thinking wrong but i need to get what version of OS is the client running. I have checked winuser.h file where this stuff is listed but i cant find anything that would get me the OS version. Any idea?
no9
i got the OS version with System.Environment.OSVersion.Version.ToString(); Thanx again ctacke!
no9