views:

218

answers:

1

Is there a way to find out if my program is running on XP embedded? I've tried .NET System.Environment.OSVersion, but the version information looks like that of a "normal" Windows XP, except for the minor version number, and relying on that seems to fragile to me.

+2  A: 

A Microsoft eMVP (Bing Chen) on Egg Head Cafe suggests GetVersionEx and a particular version registry key...

1. Call API

BOOL GetVersionEx(LPOSVERSIONINFO lpVersionInfo);

OSVERSIONINFOEX structure (which is the output of this call)

One of the members is wSuiteMask (a WORD variable).

Check the VER_SUITE_EMBEDDEDNT (0x00000040) flag in this variable.

2. Query value in Registry

 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Product-Options]
Key Name:   ProductSuite Type:
MULTI_SZ Value: EmbeddedNT
(In XP Pro, it seems that no content in this key)

While Helen Elcock suggests looking for the FBA registry value:

I check for for the DWORD registery value

[HKEY_LOCAL_MACHINE\SYSTEM\FBA]

You only get first boot assistant on embedded.

GetVersionEx seems like the more stable approach, because someone might remove the FBA key in an effort to save another couple bytes, but I'm not sure if removing that key would cause the FBA to run again anyway. You'll probably be fine with either approach.

Mark Rushakoff
Don't look for the FBA key - it's not going to be there for the Win7-based Windows Embedded (Quebec). Use the `VER_SUITE_EMBEDDEDNT` flag from `GetVersionEx()` - that's what `GetVersionEx()` is for.
Michael Burr