Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weasel input method does not work as expected #892

Closed
norelmas opened this issue Jun 12, 2021 · 11 comments · Fixed by #3806
Closed

Weasel input method does not work as expected #892

norelmas opened this issue Jun 12, 2021 · 11 comments · Fixed by #3806
Labels
added in next build Added in the next Sandboxie version template request Possibly linked to template requests

Comments

@norelmas
Copy link

Installed an input method inside a sandbox, but can't input another language.

@isaak654
Copy link
Collaborator

isaak654 commented Jun 12, 2021

Do you use FakeAdminRights=y in the same sandbox?

@norelmas
Copy link
Author

Do you use FakeAdminRights=y in the same sandbox?

Some don't ask for elevation, e.g., https://github.com/rime/weasel

@isaak654
Copy link
Collaborator

isaak654 commented Jun 14, 2021

Do you use FakeAdminRights=y in the same sandbox?

Some don't ask for elevation, e.g., https://github.com/rime/weasel

See issue #801, you will find also a reference about Rime.

Please close this issue if it cleared your doubt, we're trying to avoid any duplicate.

@norelmas
Copy link
Author

See issue #801, you will find also a reference about Rime.

Why not release an app template?

@norelmas
Copy link
Author

See issue #801, you will find also a reference about Rime.

But my situation is IM is installed inside sandbox, not in host.

@norelmas norelmas changed the title to run input methods inside a sandbox input method is installed inside sandbox Jun 15, 2021
@isaak654
Copy link
Collaborator

isaak654 commented Jun 15, 2021

Not all programs can be installed inside the sandbox, also please provide the steps you tried in order to allow me to reproduce your issue (screenshots or videos would also help, especially about the installer part in chinese).

Why not release an app template?

Not everybody has the same user, so I think it's easier to write this at the bottom of the ini file:

[Template_Local_Rime]

Tmpl.Title=Rime
Tmpl.Class=Local
OpenPipePath=\Device\NamedPipe\WriteYourOwnUser\WeaselNamedPipe

or just copying the OpenPipePath line to the sandbox.

EDIT:
Anyway, if you can confirm that the following template below works fine with the %user% variable, I might consider to include it as official template:

[Template_Local_Rime]

Tmpl.Title=Rime
Tmpl.Class=Local
OpenPipePath=\Device\NamedPipe\%user%\WeaselNamedPipe

@isaak654 isaak654 added more info needed More information is needed to move forward template request Possibly linked to template requests labels Jun 15, 2021
@isaak654 isaak654 closed this as completed Feb 7, 2022
@isaak654 isaak654 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 26, 2022
@xWTF
Copy link

xWTF commented Apr 10, 2024

Dear @isaak654,
I can confirm the template works with %user% variable. However the IME become extremely laggy when typing.
Further investigation shows that it's trying to load fonts from localappdata and keeps failing, therefore the following ReadFilePath rule is required:

Tmpl.Title=Weasel (Rime)
Tmpl.Class=Local
OpenPipePath=\Device\NamedPipe\%user%\WeaselNamedPipe
ReadFilePath=%localappdata%\Microsoft\Windows\Fonts

A simple way to probe rime would be checking the existence of WeaselServer.exe process. BTW Rime for Windows should be called "Weasel" instead of "Rime".

@isaak654
Copy link
Collaborator

isaak654 commented Apr 10, 2024

...
A simple way to probe rime would be checking the existence of WeaselServer.exe process.

Here it is a list of Scan methods:

CString scan;
ini.GetText(SectionName, L"Tmpl.Scan", scan);
BOOL scanIpc = (scan.Find(L'i') != -1);
BOOL scanWin = (scan.Find(L'w') != -1);
BOOL scanSvc = (scan.Find(L's') != -1);
if (! (scanIpc || scanWin || scanSvc))
return FALSE;
CStringList keys, files;
while (! settings.IsEmpty()) {
CString setting = settings.RemoveHead();
CStringList *list = NULL;
if (scanIpc && setting.CompareNoCase(L"OpenIpcPath") == 0)
list = &m_objects;
else if (scanWin && setting.CompareNoCase(L"OpenWinClass") == 0)
list = &m_classes;
else if (scanSvc && setting.CompareNoCase(L"Tmpl.ScanService") == 0)
list = &m_services;
else if (scanSvc && setting.CompareNoCase(L"Tmpl.ScanWinClass") == 0)
list = &m_classes;
else if (scanSvc && setting.CompareNoCase(L"Tmpl.ScanProduct") == 0)
list = &m_products;
else if (scanSvc && setting.CompareNoCase(L"Tmpl.ScanIpc") == 0)
list = &m_objects;
else if (scanSvc && setting.CompareNoCase(L"Tmpl.ScanKey") == 0)
list = &keys;
else if (scanSvc && setting.CompareNoCase(L"Tmpl.ScanFile") == 0)
list = &files;

So you may want to test:

Tmpl.Scan=s
Tmpl.ScanFile=

or

Tmpl.Scan=s
Tmpl.ScanKey=

Further examples are available in Templates.ini.

@isaak654 isaak654 reopened this Apr 10, 2024
@xWTF
Copy link

xWTF commented Apr 10, 2024

Based on the examples, I think I'm supposed to use the following scan config ([reference](https://github.com/rime/weasel/blob/e9010244032be1233729736316bd58ee3fd608b8/WeaselSetup/WeaselSetup.cpp#L67-L69)):
Tmpl.Scan=s
Tmpl.ScanKey=\REGISTRY\USER\%sid%\Software\Rime\Weasel

However I'm not sure how can I test if the scan succeeded. The template does not show up in App Compatibility section after I added these keys :(

Edit: I just checked the code and obviously this will not work since the ScanKey does not expand the variable.

@isaak654
Copy link
Collaborator

Edit: I just checked the code and obviously this will not work since the ScanKey does not expand the variable.

If no other Scan options can be applied for this template, you could open a new feature request and in the meantime open a new pull request with the suggested template.

If anyone wants to know how to check the template detection in App Compatibility:

If you want to test the template detection in App Compatibility, you should add the template in Templates.ini, remembering to put [Template_Weasel] before Tmpl.Title=Weasel (Rime) in your code here.

Please note that to speed up detection, it is recommended to exit/restart Sandboxie. If detection still does not occur, it means that the chosen Scan options are not working.

@xWTF
Copy link

xWTF commented Apr 10, 2024

Since Weasel does not create a key in HKLM (which hindered the key scan cuz it's not easy to access HKCU with NtOpenKey), nor does it use a consistent installation path (the path contains version number), I assume the proper way to detect it is to scan the class registration (ref):

[Template_Weasel]
Tmpl.Title=Weasel (Rime)
Tmpl.Class=Desktop
Tmpl.Scan=s
Tmpl.ScanKey=\REGISTRY\MACHINE\SOFTWARE\Classes\CLSID\{A3F4CDED-B1E9-41EE-9CA6-7B4D0DE6CB0A}
OpenPipePath=\Device\NamedPipe\%user%\WeaselNamedPipe
ReadFilePath=%localappdata%\Microsoft\Windows\Fonts

image

I used the same technique found in the 7z template, since I can't get Tmpl.ScanWinClass working (not really familiar with these APIs):

[Template_7zipShellEx]
Tmpl.Title=7-Zip Shell Extension
Tmpl.Class=Desktop
Tmpl.Url=http://www.7-zip.org/
Tmpl.Scan=s
Tmpl.ScanKey=\REGISTRY\MACHINE\SOFTWARE\Classes\CLSID\{23170F69-40C1-278A-1000-000100020000}
OpenIpcPath=*\BaseNamedObjects*\7zCompressMapping*
OpenIpcPath=*\BaseNamedObjects*\7zMap*

Since it's a relatively small change, would you please commit this directly, or should I open a PR for it?

isaak654 added a commit that referenced this issue Apr 10, 2024
@isaak654 isaak654 removed the more info needed More information is needed to move forward label Apr 10, 2024
@isaak654 isaak654 added the added in next build Added in the next Sandboxie version label Apr 10, 2024
isaak654 referenced this issue Apr 10, 2024
Add a Tmpl.Url reference and improve Tmpl.Title in the Weasel template.
@isaak654 isaak654 changed the title input method is installed inside sandbox Weasel input method does not work as expected Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added in next build Added in the next Sandboxie version template request Possibly linked to template requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants