App modules: add additional app properties such as app path, immersive process, and app architecture#8644
Conversation
|
Hi, I'll ask for a review once appArchitecture property is implemented and tested. Thanks. |
| These include Windows store apps on Windows 8 and 8.1, and Universal Windows Platform (UWP) apps on Windows 10. | ||
| @rtype: bool | ||
| """ | ||
| if winVersion.winVersion.major and winVersion.winVersion.minor == (6, 1): |
There was a problem hiding this comment.
This line is wrong. It should be:
if (winVersion.winVersion.major, winVersion.winVersion.minor) == (6, 1):
I prefer
if (winVersion.winVersion.major, winVersion.winVersion.minor) < (6, 2):
|
Hi, the reason for checking for equality was because we support Windows 7 SP1 and higher. I’ll edit this to make it clearer. Thanks.
|
09fff58 to
c4d12d4
Compare
|
What about Version fields such major, minor and revision? |
|
Hi, not quite possible due to so many versioning schemes in use (for example, major.minor, year.major, major.minor.build, major.minor.revision, etc). Thanks.
|
|
Hello @josephsl,
Anyway, it can be nice to have such features, regardless the version scheme used by the application. Repeating code to parse the actual version of the running application for every app module that requires it is not a good way to do. Another thing to consider is that the scheme major.minor is a standard under windows and it is relatively safe to add major and minor. Cheers, |
|
Hi, technically, it is possible to obtain this information. But imagine a case where a user may wish to find out NVDA’s own version via app module methods. Although it is possible to use versionInfo module for this, at first glance, due to the way version string is constructed, major.minor isn’t obvious. Also, note that what is considered major.minor could be year.major i.e. for NVDA, appModule.major will be reported as 2019 instead of 2, for instance. Not that I’m against this idea – I want to see various cases discussed before proceeding with this (by the way, I have suspended work on a PR for this due to high priority work at the moment).
|
|
Hi, technically, it is possible to obtain this information. But imagine
a case where a user may wish to find out NVDA’s own version via app
module methods. Although it is possible to use versionInfo module for
this, at first glance, due to the way version string is constructed,
major.minor isn’t obvious. Also, note that what is considered
major.minor could be year.major i.e. for NVDA, appModule.major will be
reported as 2019 instead of 2, for instance. Not that I’m against this
idea – I want to see various cases discussed before proceeding with this
(by the way, I have suspended work on a PR for this due to high priority
work at the moment).
What about naming these "first", "mid" and "last" or something like? I
think that these three parts are the most widely queried.
Probably the best approach is to implement a new lightweight class to
store these values, constructed from a plain string such productVersion
ones, replacing it by this hypothetical structure.
Sorry for the private responses, I was missing to respond to Github
notification email.
|
| chooseNVDAObjectOverlayClasses._isBase = True | ||
|
|
||
| def _get_appPath(self): | ||
| """Returns the full path for the executable e.g. 'C:\\Windows\\explorer.exe' for Explorer. |
There was a problem hiding this comment.
Sorry but I don't see the utility of this under an appModule.
|
Hi, Version class: this can be fetched easily for immersive apps as all that's required will be parsing the user mode app model structure. Regarding first, mid, last: there are three issues with this:
Thanks. |
|
Hi, Actually, yes there is a utility for appPath: virtual machine hosts, executable path for immersive apps, and eventually, for running unit tests. Thanks. |
a7e0c01 to
90e5d60
Compare
029715c to
aef37aa
Compare
8547b4a to
6ea4767
Compare
|
Hi, There is a related issue that was discovered while working on Windows 10 Calculator app module: no product info for certain universal apps, and I'm testing a potential solution. Because that issue is different from this PR, an issue/PR pair will be created that will reference this pull request. Thanks. |
|
Hi, Update on Windows Store app property: originally it asked user32::IsImmersiveProcess and answered "yes" or "no" depending on return value (1 or 0, respectively). However, this method isn't complete because:
A more accurate way is probing for app package info structure that ships with a Store package. Based on an app model XML, this structure records the following information:
This structure is returned by kernel32::GetPackageFullName function as a string representation (see #10108 for more details). Every Store package (native or managed, including Store version of NVDA) will return this structure despite immersive process function returning values that do not fully reflect what the underlying package is. There might be a use case for IsImmersiveProcess - perhaps looking to see if we're dealing with a managed application. Note that the above remark is irrelevant on Windows 7 as it does not come with package info functions nor immersive process checker routine. Thanks. |
6ea4767 to
9a5b082
Compare
|
Hi, Suspended until further notice in light of #11006. Thanks. |
|
@josephsl I understand #11006 addresses new pull requests, not already existing pull requests. If we don't continue work on existing pull requests, then we run into the same issue later on. |
|
Hi, the reason for suspending it for now is to let higher priority PR’s to get a chance to get reviewed. Although this PR is important, it isn’t a high priority work. Thanks.
|
…re also supported. Re nvaccess#7894. Add appModuleHandler.AppModule.appPath property used to obtain the full path for the executable (e.g. C:\Windows\explorer.exe). Also, in app module docstring, clarify that app module packages (appmodname/__init__.py) are also supported.
AppModule.isWindowsStoreApp will call user32.dll::IsImmersiveProcess to determine if the app is hosted inside a Windows RT container. This is useful for dealing with universla apps on Windows 10.
appModule.appArchitecture will return the architecture for which the app is written. It can be x86 (32-bit app on 32-bit Windows), AMD64 (x64 app), or ARM64 (64-bit ARM app). This is accomplished by use of kernel32.dll's IsWow64Process2 (available on Windows 10 build 10586 and later).
appModule.isWindowsStoreApp: check if it is below Windows 8, also fixed tuple syntax. appModule.appArchitecture: variable renames to make it clear.
…. re nvaccess#7894. Thanks to work on ARM64 detection in appModule.is64BitProcess: use kernel32::isWow64Process2 directly and obtain either AMD64 or ARM64, falling back to AMD64 if that Windows API function isn't present (the function is present in Windows 10 Version 1511 (build 10586) and later).
…on of 32-bit ARM apps. Re nvaccess#7894. Windows 10 Version 1903 includes foundatoins to support 32-bit ARM apps. Because this means two 32-bit architectures must be handled, rewrite app architecture method to: 1. Record architecture to arch names inside a map. 2. Call kernel32::IsWow64Process2 first and obtain arch name fromthe arch values map. 3. If IsWow64process2 fails for some reason (Windows 7 through 10 Version 1507), return appropriate architecture name based on 64-bit process status.
Fixes include inline comments and spaces around dictionary operator.
… info for Microsoft Store apps. Re nvaccess#7894. User32.dll::IsImmersiveProcess won't quite cut it for Store apps: * File Explorer is seen as an immersive app but it is not really a Store application. * Converted desktop apps are seen as not immersive but they are Store apps. The more accurate way to determine this information is looking for app package info, which can be done by calling kernel32.dll::GetPackageFullName. This returns a string representation of app name, version, architecture, language, and app ID (the first two are used in nvaccess#4259). Every Store app comes with app model XML file that provides data for this structure (Store version of NVDA is no exception). Thus use this method, which is now part of a private function in the base app module so not only product name and version setter can use it, but also Store app property can call this method.
…fo function. Re nvaccess#7894. Use the dedicated package info function for obtaining product name and version: * If the package info is a string, info will be parsed. * If it is None, executable file info will be fetched.
…nderlying process is a Windows Store app. Re nvaccess#7894. User32.dll::IsImmersiveProcess won't work all the way, but package info fetching will (on Windows 8 and later). Therefore use the package info method to determine if a given process is a Windows Store app.
…ndowsversion(). Re nvaccess#7894.
386e220 to
e827cfc
Compare
|
Hi, The PR is trivial enough for a fast forward review, but I imagine there might be scenarios where testing might be required. Even then, I think there are PR's that are more urgent than this one (depends on PR tags). Thanks. |
Please continue to work on this PR. #11006 requests no new PR's. This PR already exists and is thus in the backlog of PR's that we want to address before accepting new ones. We are trying to stop PR's from going stale, and then becoming hard to merge. Forgive me for replying to you multiple times, I want to avoid the community being mislead. |
|
Rebasing was successful, so it is ready for review again.
|
| # Others such as Store version of Office are not truly hosted apps but are distributed via Store. | ||
| length = ctypes.c_uint() | ||
| buf = ctypes.windll.kernel32.GetPackageFullName(self.processHandle, ctypes.byref(length), None) | ||
| packageFullName = ctypes.create_unicode_buffer(buf) |
There was a problem hiding this comment.
The argument to create_unicode_buffer should be length, not buf I believe?
According to https://docs.microsoft.com/en-us/windows/win32/api/appmodel/nf-appmodel-getpackagefullname
GetPackageFullname returns ERROR_SUCCESS or an error code. The needed length is written to the length parameter.
|
Hi, you’re right. Thanks for clarifying this.
|
…er to obtain actual package info length (addressing review action). Re nvaccess#7894.
Link to issue number:
Fixes #7894
Summary of the issue:
Adds additional app properties such as path, immersive process, and architecture (WoW64).
Description of how this pull request fixes the issue:
Adds the following properties:
Testing performed:
Tested with various apps, both Win32 desktop apps and universal apps.
Known issues with pull request:
None
Change log entry:
Changes for developers:
Additional properties were added to app modules, including path for the executable (appPath), is a Windows Store app (isWindowsStoreApp), and machine architecture for the app (appArchitecture). (#7894)