6

I have a universal app that uses PlayReady DRM protected videos. The problem with PlayReady is that it only work if the application build architecture matches the CPU architecture (e.g: ARM build on ARM, x64 on 64bit CPU, x86 on 32bit CPU). This is by design (for some reason).

So the problem is, if a user has a 64bit CPU and runs a 32bit OS. In this case, he gets the x86 build from the store (because of 32bit OS) but PlayReady will not work because of the 64bit CPI vs X86 build mismatch. In this case, I want to display a message (instead of just failing to play the video).

I can detect easily detect x86 build (by adding a conditional symbol), but how do I detect if the CPU is 64bit? There is nothing like System.Environment.Is64BitOperatingSystem from the full .NET.

Igor Kulman
  • 16,211
  • 10
  • 57
  • 118
  • http://stackoverflow.com/questions/767613/identifying-the-cpu-architecture-type-using-c-sharp see the answer about using P/Invoke to get the processor architecture – Ron Beyer Apr 21 '15 at 12:38
  • I doubt this is a real problem, it goes only wrong on your machine. Whomever downloads the app from the Store automatically gets the appropriate version. – Hans Passant Apr 21 '15 at 16:20
  • @HansPassant nope. Imagine you have a tablet with 64bit Atom and Windows 8.1 32bit. The store will give you a X86 built and PlayReady will not work for you. – Igor Kulman Apr 21 '15 at 20:13
  • Hmm, no, Windows 8.1 32bit does not have a 64bit version of PlayReady. – Hans Passant Apr 21 '15 at 20:33

1 Answers1

2

You are allowed to P/Invoke Win32's GetNativeSystemInfo in Windows Store apps (more info on the P/Invoke signature here); it returns a structure that includes the processor architecture.
I can't find any information about what it returns in an x86 Windows on x64 machine scenario, and I don't have such a machine on hand to test it, but it's worth a try.

Solal Pirelli
  • 1,199
  • 9
  • 21