dictation-toolbox / natlink

Natlink provides the interface between Dragon and python
Other
25 stars 17 forks source link

Setup: missing permissions for restricted user accounts #166

Closed tripfish closed 11 months ago

tripfish commented 1 year ago

When running natlink setup (with a local administrator account), users with restricted permissions do not get access to the "c:\Program Files (x86)\Natlink\site-packages\" directory.

This results in the familiar {dd990001-bb89-11d2-b031-0060088dc929} message when Dragon starts.

It must be ensured during the installation that "computername\Users" also get permissions to the directory. Otherwise, no user with restricted permissions will be able to use natlink.

Reproduction steps:

The message {dd990001-bb89-11d2-b031-0060088dc929} appears. All users with restricted permissions do not have access to the "c:\Program Files (x86)\Natlink\site-packages\" directory.

quintijn commented 12 months ago

I was thinking, that setting permissions in the inno setup file could solve this. I am not familiar with restricted permissions though.

But an adaptation to the file inno-setup-natlink.iss in the directory installersource of the natlink repository should possibly work.

quintijn commented 12 months ago

Everything seems to be installed correct. Only the .pyd file cannot be started (or maybe found) by Dragon.

In my first try, eventually I got the Messages window all right. I could not reproduce how I did this.

In my second try, nothing seems to help.

tripfish commented 12 months ago

Yes, everything will be installed correctly. However, it must be ensured that when creating the directory "c:\Program Files (x86)\Natlink" that all subdirs and files get Users read and execute permission.

Normally that can be done at iss with "Permissions: users-readexec". However, the directory or files do not appear to be created through the normal installation process. I couldn't find the right location, but I also don't have a working development or build environment to test it.

dougransom commented 11 months ago

from Sept 3 telegram chat:

https://github.com/dictation-toolbox/natlink/blob/dea86ad6b185cc5d23ec61ecd49103773927e98c/NatlinkSource/COM/appsupp.cpp#L78

Aaron, [2023-09-03 3:01 AM] That's my theory. Is there a read access permission error to the PYD.

Quintijn Hoogenboom, [2023-09-03 3:03 AM] after renaming the HKLM/Natlink section

Aaron, [2023-09-03 3:04 AM] Does debug view provide anymore information?

Quintijn Hoogenboom, [2023-09-03 3:05 AM] So indeed the error is with finding/starting the python interpreter.

Quintijn Hoogenboom, [2023-09-03 3:05 AM] Maybe the Dragon log file?

Aaron, [2023-09-03 3:06 AM] HKEY_LOCAL_MACHINE

Aaron, [2023-09-03 3:06 AM] Technically this error happens before ever starting to try launching the interpreter

Aaron, [2023-09-03 3:07 AM] See

Aaron, [2023-09-03 3:07 AM] https://github.com/dictation-toolbox/natlink/blob/dea86ad6b185cc5d23ec61ecd49103773927e98c/NatlinkSource/COM/appsupp.cpp#L78

Aaron, [2023-09-03 3:08 AM] I know function fires early in the python initialization but it doesn't even get that far because it fails to read from the registry.

Aaron, [2023-09-03 3:15 AM] https://nsis-dev.github.io/NSIS-Forums/html/t-357148.html

Quintijn Hoogenboom, [2023-09-03 3:16 AM] I was trying to change the rights of the natlink-5.5.5.dist-info folder. The folder natlink I did, but this dist-info folder fails.

Doug Ransom, [2023-09-13 10:12 AM] https://learn.microsoft.com/en-us/azure/ai-services/speech-service/how-to-develop-custom-commands-application

Quintijn Hoogenboom, [2023-09-17 7:57 AM] Doug, I would have some time tomorrow or tuesday to discuss the situation with the Unimacro PR and the privileges problem when starting Dragon/Natlink.

Doug Ransom, [2023-09-17 7:58 AM] Ok, not sure which will work for me yet. probably tuesday.

dougransom commented 11 months ago

I'll investigate further. Makes sense that the folder created by pip may not have permissions required for non-privileged users.

dougransom commented 11 months ago

https://documentation.help/Inno-Setup/topic_dirssection.htm

This optional section defines any additional directories Setup is to create besides the application directory the user chooses, which is created automatically. Creating subdirectories underneath the main application directory is a common use for this section.

Thinkin we just need to use this feature to make the subfolders of natlink install dir read and executable by all users.

dougransom commented 11 months ago

@quintijn confirmed changing the permissions on subfolders fixed the problem. I'll work on fixing the installer.

dougransom commented 11 months ago

with Inno:setup, Even if attempting to create folder with user permissions for read and execute for site-packages/natlink,
pip changes the privileges.

Also there is an pycache folder in site-packages/natlink. I don't think that will be an issue but who knows.

quintijn commented 11 months ago

Tried the installer you sent me, but no luck. No permissions propagating. Language settings all to English (Canada).