Niki
Niki

Reputation: 15867

Find out running on XP embedded

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.

Upvotes: 1

Views: 1290

Answers (1)

Mark Rushakoff
Mark Rushakoff

Reputation: 258188

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.

Upvotes: 3

Related Questions