Detecting if a processor occupies 64 bits in a universal application (Windows)

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

Thus, the problem is that the user has a 64-bit processor and has a 32-bit OS. In this case, it gets the x86 assembly from the store (due to the 32-bit OS), but PlayReady will not work due to the mismatch between the 64-bit CPI and X86 builds. In this case, I want to display a message (instead of just not playing the video).

I can easily detect the x86 assembly (by adding a conditional character), but how do I determine if the processor is 64-bit? There is nothing better than System.Environment.Is64BitOperatingSystem from full .NET.

+6
source share
1 answer

You are allowed P / Invoke Win32 GetNativeSystemInfo in Windows Store applications (more information about 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 x86 Windows, in a scenario with an x64 machine, and I don’t have such a machine at hand to test it, but it's worth a try.

+2
source

Source: https://habr.com/ru/post/985598/


All Articles