-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Overview
It can be tough to get the Libki client configured so it loads after user (auto) login, but before the user shell starts. It would be nice if there were a cleaner way to start the Libki client between those two events. I think userinit may be a decent solution to consider and, based on my testing, it seems to work well as-is.
Problem
The shell replacement option in the installer doesn't work well in some cases. It looks like Libki client is running explorer.exe to launch the shell. This StackOverflow question describes some of the conditions that need to be met to get that to work. Specifically:
Explorer must see it is the actual shell - hence you need to replace that value before launching explorer.exe (could change it back a few seconds later)
One of the other answers in that StackOverflow question claims that C:\Windows\explorer.exe will always launch the shell, but that's incorrect based on my testing. It doesn't change anything.
The above is saying that HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon must have Shell=explorer.exe for the normal shell to launch when running explorer.exe. Based on my testing, that's correct. With that value set to C:\Program Files (x86)\Libki\libkiclient.exe the normal shell won't launch when explorer.exe is run. Based on my testing all that happens is the file manager launches.
I tried updating the run_on_login option in the Libki client .ini config with a script that would modify the above registry value prior to launching explorer.exe, but I ran into two issues.
- The value needs to be set back to
libkiclient.exe. This isn't impossible and would probably be tolerable if it were the only drawback. - It doesn't work with guest accounts. The user logging in needs to have permission to edit
HKEY_LOCAL_MACHINEand guest accounts don't.
Solution
Based on my testing, the Userinit value in that same registry key may be a better solution. I've only tested the use case that fits my needs, but it seems to work really well as-is. This is what I did.
Prep PC
Create two user accounts; an administrator named Tech and a guest (aka limited) account.
Install Libki Client
Install the client. When prompted for Client Information:
- Run only for this user: Leave this blank.
- Run for all users but this one:
Tech(or the name of the admin account).
When prompted for Startup Mode:
- Do not start Libki client automatically.
Post Install Config
As the administrator, open a PowerShell prompt and run the following command to modify the Userinit registry value.
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name 'Userinit' -Value 'C:\Program Files (x86)\Libki\libkiclient.exe,C:\Windows\system32\userinit.exe,'Explanation
I couldn't find much documentation for Userinit, so this is based on what I've observed. I think the programs run sequentially and the first one (libkiclient.exe) will block the second one (userinit.exe) from running. I'm basing that on the way it behaves when I login. The guest account blocks with the Libki client UI until a successful authentication occurs. The administrator account continues right away. I assume that's exiting here because of the Run for all users but this one option.
I don't know enough about C++ and QT to step my way through the rest of the client to see how / where it exits. I assume the main process needs to exit before userinit.exe will run, but I don't know for sure. It's worth paying attention to because the current startup behavior seems to be good as-is and, since libkiclient.exe is running before userinit.exe, care would need to be taken to ensure nothing is ever changed in a way that blocks userinit.exe from loading.