We are developing a SwiftUI application that will run on MacOS ( no iOS ). The application works with a Python library via PytonKit. Unfortunately the library expects user input via console to authenticate i.e. on start is asks the user name and password and reads them from the console. Is there a way to handle it somehow form SwiftUI ? Maybe it is possible to temporarely display the console but I could not figure out how.
Related
a newbie question.
I want to make it easy for users to create a shortcut to use Siri with a watchKit app. The app runs as a companion to an iOS version.
Where I've gotten so far: Users can successfully use Siri to make a voice request for each of the watchKit and iOS apps via intent extensions that I’ve created. That is, they can do so after a shortcut is available (e.g. “Hey Siri, jot myself”).
I would love to programmatically help users create both of these shortcuts. I’m stuck on the watchKit side, though.
The closest I’ve been able to get to make it easy for users to create shortcuts is:
On the iOS app, as part of the app's onboarding, provide an “Add to Siri” button. (This works fine)
Then, ask the user to go into Shortcuts in iOS, find the shortcut, look at its “Details” and toggle “Show on Apple Watch”. (This seems like it would be hard for users and I’m afraid asking them to do it will lose them.)
Is there a better way to help users set up the watchKit shortcut? Advice appreciated.
I am trying to create a service which does following:
Logging in as a user with specified username/password
Running an application on the desktop of logged in user of step 1
Note: before step 1, user is not logged on. (something like right after machine is rebooted)
The expected result is, the user should be able to see the UI of launched app at step 2 if user logged onto the desktop with the user account logged on at step
I found this article, but this code will launch the app on current desktop (let's say, currently logged on as userA. Using username/password of userB, the app is still be launched on userA desktop, but using userB's account).
https://support.microsoft.com/en-ca/help/165194/createprocessasuser-windowstations-and-desktops
Please let me know what's the correct way to achieve my goal.
IDE: Visual Studio 2015 C++ on Windows.
Let me answer to my question.
The bottom line is:
I cannot launch a process on a desktop of not-logged-on user by programmatically logging in.
Reason:
Calling certain function such as LogOnUser, I can login and access to resources related to user's account.
However, the logon session is different from a Session which will be created when user logs on from login screen.
Because of security reason, once a process is launched, we cannot move the process to another Session. So, UI will never be able to show on the desktop after the user logs on from login screen.
Alternative solution:
Use auto-logon
Redesign app, and split UI and its data. So, a process with data can run as service, and UI can launch later on a desktop.
The details explanation of how Windows Session, Window Station, and Desktop works:
https://brianbondy.com/blog/100/understanding-windows-at-a-deeper-level-sessions-window-stations-and-desktops
Thank you very much for Harry Johnston for detailed explanation in the comment.
There is an application that we used for testing our IOS app with Facebook integration. It works fine.
We've created a new Facebook application to use as a production one but faced problems in IOS app.
After user have entered login/password, gives the app permissions and press okey - safari show the following error: Safari cannot open the page because the address is invalid
Before run the app please make sure in the plist.
you are enter correct
1.FacebookAppId
2.URLSchemas
I need to run my app (some kind of on-screen keyboard) on login screen (before login, to help enter password). I can sign code when needed.
EDIT: I prefer to schedule app running from my manager app code.
The relevant search term is "Input Method Editor" or IME. Microsoft has released guidelines how these should work, and then it is possible to choose them from the login screen.
I'm currently using ShellExecute "open" to open a URL in the user's browser, but running into a bit of trouble in Win7 and Vista because the program runs elevated as a service.
When ShellExecute opens the browser, it seems to read the "Local Admin" profile instead of the user's. So for example, if the user at the keyboard has Firefox as his default browser, it may open IE (which is the admin's default).
I know that the "runas" verb can be used to elevate, but how do you do it the other way around? Is there a way to open a URL in the default browser on a standard user's desktop from a service?
ShellExecute will execute the program in the context of the same session and same user as the process you are running.
If you'd like to use a different session or user token you can use the CreateProcessAsUser Win32 API.
There are several ways to obtain a user token, for example you can call the Win32 API:
LogonUser if you know the username and password
WTSQueryUserToken for any given session ID.
OpenProcessToken if you have another process handle
After a while of testing, the best way to determine the default browser is the following:
NOTE: It is strange but it's true...
It has nothing to say that an application is the default application for
some file type or web protocol like 'http'. What matters to determine the default
web browser is just what is registered in the start menu entry (see reg key below).
So forget all the HKCR\http, HKCU\Software\Classes\http, HKLM\Software\Classes\http and their friends.
read from "HKEY_CURRENT_USER\Software\Clients\StartMenuInternet"
read command line from "HKEY_LOCAL_MACHINE\Software\Clients\StartMenuInternet\\shell\open\command"
truncate the command line after ".exe"
Of course you need to impersonate as the logged on user first.
If this solution does not work (like with w2k), use the handler for the http protocol.
To actually start the default browser from a service we use an extra process which is within the service using the logged on user-context. This process starts the above commandline (using ShellExecute on platforms >= Vista). Be sure to use same integrity level (medium) as a default user (else IE won't work because it uses DDE).
HTH.
Aaron Margosis has a seven-step native code example at http://blogs.msdn.com/aaron_margosis/archive/2009/06/06/faq-how-do-i-start-a-program-as-the-desktop-user-from-an-elevated-app.aspx. Won't help you from your service if that is what you have - I agree your service shouldn't be trying to launch an app as the logged in user, especially since there might not be one.