4

Using WinRT can I determine if the current OS is:

  1. Windows RT
  2. Windows 8 Core
  3. Windows 8 Pro
  4. Windows 8 Ent

Is it possible?

Note, the question (http://stackoverflow.com/questions/10125324/get-os-version-in-winrt-metro-app-c-sharp) appears to be a duplicate but it is a pre-release question. Much of the API was changed throughout the releases. The answer to that question was that it was not possible. Is that still true? Surely not.

Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233

4 Answers4

1

If it can be done, it's not easy and it will have to be inferred from data you can get about the running system. The docs are very unclear about this unfortunately. For example, the GetNativeSystemInfo function is allowed under a Metro style app. See this list.

However, the docs for GetNativeSystemInfo link to an example on how to get the OS Version that uses several APIs that are not on the list for Metro style apps, but the example is still under the Metro docs. It is also unclear what the response from GetNativeSystemInfo will be on an ARM processor.

The bottom line is that this is a bad approach and bound to cause fragility in your code. My advice is to avoid trying to do this.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
JP Alioto
  • 44,864
  • 6
  • 88
  • 112
0

You can get the OS version number with some risk that it might not be correct by using the devices API to get the driver version number for a low-level system component like the HAL.

http://attackpattern.com/2013/03/device-information-in-windows-8-store-apps/ has more information and sample code (disclosure, I wrote that post & code)

DamienG
  • 6,575
  • 27
  • 43
0

Yes, using the webview seems to be a reliable and pretty quick way to get the processor you are running on. To determine pro versus, enterprise. No. I can't find a way.

But if you are interested in how to determine the processor and go from there? Check out my answer here: https://stackoverflow.com/a/16996176/265706

Community
  • 1
  • 1
Jerry Nixon
  • 31,313
  • 14
  • 117
  • 233
-1

Take a look at this:

http://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.packageid.architecture.aspx

var architecture = packageId.architecture;


var package = Windows.ApplicationModel.Package.current;
var packageId = package.id;
var version = packageId.version;

var output = [ "Name: \"" + packageId.name + "\"",
           "Version: " + version.major + "." + version.minor + "." 
                       + version.build + "." + version.revision,
           "Architecture: " + packageId.architecture,
           "ResourceId: \"" + packageId.resourceId + "\"",
           "Publisher: \"" + packageId.publisher + "\"",
           "PublisherId: \"" + packageId.publisherId + "\"",
           "FullName: \"" + packageId.fullName + "\"",
           "FamilyName: \"" + packageId.familyName + "\"",
           "IsFramework: " + package.isFramework ];