2019年3月16日土曜日

How to know the current processor architecture from UWP app

Unfortunately, WinRT does not have such of API. We, in 2019,  need to use pinvoke.

--start--
--end--

You may noticed that this unfamiliar name "api-ms-win-core-sysinfo-l1-2-3.dll". This is a sort of "OneCore Umbrella library".

OneCore.lib umbrella library
https://docs.microsoft.com/ja-jp/windows/desktop/apiindex/umbrella-lib-onecore-alpha

I could not tell you how this works, but works. :) It's too difficult for me. For detail, this site may helps you.

Runtime DLL name resolution: ApiSetSchema - Quarkslab's blog
https://blog.quarkslab.com/runtime-dll-name-resolution-apisetschema-part-i.html
https://blog.quarkslab.com/runtime-dll-name-resolution-apisetschema-part-ii.html

The API Set Schema - Geoff Chappell
http://www.geoffchappell.com/studies/windows/win32/apisetschema/index.htm


Note - UWP Community toolkit have the System Helper API. By using this, you can get the propertry "SystemInformation.OperatingSystemArchitecture". The document tell that  this property is "Gets used processor architecture" but actually not. It just return the "target" architecture of the UWP app package.

SystemInformation - UWP Community Toolkit
https://docs.microsoft.com/ja-jp/windows/communitytoolkit/helpers/systeminformation

0 件のコメント:

コメントを投稿