Eryk Sun <eryk...@gmail.com> added the comment:

> Also all those files are 0 bytes - even the working ones.

The files should have no data, just appexec links. It's just an empty file if 
there's no link set.

> Since I cannot even run the actual executable there seems to be 
> an issue with the executables on top of the broken appexec link.

The executable under "%ProgramFiles%\WindowsApps" can only be executed 
unconditionally by processes that are running as SYSTEM, LOCAL SERVICE, or 
NETWORK SERVICE. Otherwise it requires an access token that contains a 
WIN://SYSAPPID security attribute that contains the package name. When 
executing an appexec link from the user's local "WindowsApps", CreateProcessW() 
uses the information in the link to construct this access token, and the call 
basically becomes CreateProcessAsUserW(hToken, ...). The EXEs and DLLs in the 
package can be executed from within the app itself. For example, 
subprocess.call('python') directly spawns the app's "python.exe". 

FYI, an access token is a kernel object that defines a security context, 
including the user, groups, privileges, capabilities, integrity level, trust 
level, security attributes, claim attributes, default owner, default 
permissions, associated logon session, and associated Windows session. Every 
process must have a primary token, which is permanently associated with the 
process. Each thread within a process may have an impersonation token, which is 
temporarily associated with the thread until it's replaced or removed.

> That didn't work. The link is wrong on the disk and that 
> setting just controls the usage of it not the creation.

Yes, the links in the app's subdirectory of the local "WindowsApps" are the 
basis for the ones that get created in the local WindowsApps when the alias is 
enabled. The system reads the source reparse point via FSCTL_GET_REPARSE_POINT 
and sets it on an empty file via FSCTL_SET_REPARSE_POINT. If the source appexec 
link is wrong or missing, then disabling and enabling the alias won't help. 

>From the end user's perspective, the simplest solution is to uninstall the 
>app; make sure its subdirectory is removed from the local "WindowsApps" (e.g. 
>"%LocalAppData%\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0");
> and install the app again.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45789>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to