Skip to content

App modules/product name and version: use kernel32::GetPackageFullName to obtain product info for immersive (hosted) apps#10114

Merged
michaelDCurran merged 4 commits into
nvaccess:masterfrom
josephsl:immersiveAppNameAndVersion
Sep 10, 2019
Merged

App modules/product name and version: use kernel32::GetPackageFullName to obtain product info for immersive (hosted) apps#10114
michaelDCurran merged 4 commits into
nvaccess:masterfrom
josephsl:immersiveAppNameAndVersion

Conversation

@josephsl

@josephsl josephsl commented Aug 18, 2019

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #4259
Fixes #10108

Summary of the issue:

Product information for immersive (hosted) apps (including those hosted by WWAHost) are incorrect or seen by NVDA as nonexistent. In some cases, converted desktop apps do not expose correct app info.

Description of how this pull request fixes the issue:

On Windows 8 and later, some apps can run inside a container. This is the case for WinRT/UWP apps, some web apps hosted by WWAHost, and converted desktop apps (such as Microsoft Office 365 downloaded from Microsoft Store). For these apps, kernel32.dll::GetPackageFullName returns the 'real' product info such as name and version. Because it'll be returned in a serialized string representation, parse the first two values (name and version).

To accomodate this change, the former method of obtaining product name and version via file version info has been moved to an internal function inside product info setter method. This function will be invoked if:

  • This is Windows 7/Server 2008 R2 (no support for containers yet).
  • An immersive app that is really a native app (such as File Explorer).
  • Converted desktop apps that will not expose version info via file version info structure (such as Notepad in 20H1 Preview build 18963 and later).

For consistency with immersive app info structure, the modified function will return a 2-tuple that records product name and version in that order.

Testing performed:

Tested with native and hosted apps, including NVDA from source, Outlook 365, Windows 10 Calculator and Store, Twitter web app and many others (also tested via Windows 10 App Essentials add-on). On Windows 8.1, WWAHost apps were used.

Known issues with pull request:

For some converted desktop apps, there will be product info conflict: file version info says one thing and package name says something else. This is most prominent in Office 365 apps (package version starts with 16051 but file info says 16.0), but can be worked around by modifying app modules to favor one approach over another.

Change log entry:

Changes:

On Windows 8 and later, NVDA will now report product name and version information for hosted apps such as apps downloaded from Microsoft Store using information provided by the app. (#4259, #10108)

Thanks.

@josephsl josephsl requested a review from feerrenrut August 18, 2019 17:27
@josephsl

Copy link
Copy Markdown
Contributor Author

Hi,

If he is willing, CC @michaelDCurran

@josephsl

Copy link
Copy Markdown
Contributor Author

Hi,

A bit about platform_version attribute from winVersion.winVersion tuple: new in Python 3.7. This returns major, minor, and build and is intended to find out the actual platform version rather than the emulated one Python gets. In terms of using that attribute everywhere, not this year, but perhaps for 2020.1.

Thanks.

…ve (hosted) apps via kernel32::GetPackageFullName function. Re nvaccess#10108.

On Windows 8 and later, some apps can run inside a container. This is the case for WinRT/UWP apps, some web apps, and converted desktop apps (such as Microsoft Office 365 downloaded from Microsoft Store). For these apps, kernel32.dll::GetPackageFullName returns the 'real' product info such as name and version. Because it'll be returned in a serialized string representation, parse the first two values (name and version).
To accomodate this change, the former method of obtaining product name and version via file version info has been moved to an internal function inside product info setter method. This function will be invoked if:
* This is Windows 7/Server 2008 R2 (no support for containers yet).
* An immersive app that is really a native pap (such as File Explorer).
* Converted desktop apps that will not expose version info via file version info structure (such as Notepad in 20H1 Preview build 18963 and later).
For consistency with immersive app info structure, the modified function will return a 2-tuple that records product name and version in that order.
@josephsl josephsl force-pushed the immersiveAppNameAndVersion branch from 3632189 to 9c536bd Compare September 8, 2019 02:16
@josephsl

josephsl commented Sep 8, 2019

Copy link
Copy Markdown
Contributor Author

Hi,

Another note on platform version tuple: in Version 1909, it'll say (10, 0, 18362). Note that this minor deviation does not affect this PR.

Also, the PR is ready for review.

Thanks.

Comment thread source/appModuleHandler.py Outdated
# Some apps such as File Explorer says it is an immersive process but error 15700 is shown.
# Therefore resort to file version info behavior becuase it is not a hosted app.
# Others such as Store version of Office are not truly hosted apps,
# yet reutnrs an internal version anyway.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Comment thread source/appModuleHandler.py Outdated
# which returns major, minor, build.
if winVersion.winVersion.platform_version >= (6, 2, 9200):
# Some apps such as File Explorer says it is an immersive process but error 15700 is shown.
# Therefore resort to file version info behavior becuase it is not a hosted app.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Comment thread source/appModuleHandler.py Outdated
# This is needed in case immersive app package returns an error,
# dealing with a native app, or a converted desktop app.

def _executableFileInfo():

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename this to _getExecutableFileInfo()

@josephsl

josephsl commented Sep 8, 2019 via email

Copy link
Copy Markdown
Contributor Author

…getExecutableFileInfo. Re nvaccess#10108.

Reviewed by Mick Curran (NV Access): because of what the internal function does, it is better to give it a more descriptive name than just 'executable file info'.
Comment thread source/appModuleHandler.py Outdated
# This is needed in case immersive app package returns an error,
# dealing with a native app, or a converted desktop app.

def _getExecutableFileInfo():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would prefer this to be a private appModule method instead of an internal function to _setProductInfo.

@josephsl

josephsl commented Sep 9, 2019 via email

Copy link
Copy Markdown
Contributor Author

@LeonarddeR

LeonarddeR commented Sep 9, 2019 via email

Copy link
Copy Markdown
Collaborator

@josephsl

josephsl commented Sep 9, 2019 via email

Copy link
Copy Markdown
Contributor Author

…ts own method in base pap module. Re nvaccess#10108.

Suggested by Leonard de Ruijter (Babbage): transform executable file info function from an internal one to a private method in base app module for ease of future maintenance.
@michaelDCurran michaelDCurran merged commit e02b548 into nvaccess:master Sep 10, 2019
@nvaccessAuto nvaccessAuto added this to the 2019.3 milestone Sep 10, 2019
michaelDCurran added a commit that referenced this pull request Sep 11, 2019
@josephsl josephsl deleted the immersiveAppNameAndVersion branch September 16, 2019 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants