Re: How does chromium simulate keyboard events using CGEventPost in pre login agent?
Re: How does chromium simulate keyboard events using CGEventPost in pre login agent?
- Subject: Re: How does chromium simulate keyboard events using CGEventPost in pre login agent?
- From: Sai Prasanna <email@hidden>
- Date: Thu, 05 Jan 2017 20:09:45 +0000
Not according to apple documentation.
btw our agent is properly code signed.
https://developer.apple.com/library/content/technotes/tn2083/_index.htmlPre-Login
Trust Issues
If, in Mac OS X 10.5 and later, you see a message like that shown in Listing
9 you might mistakenly think that the solution is to get the system to
'trust' your application, perhaps via code signing.
Listing 9 Pre-Login Trust Message
Untrusted apps are not allowed to connect to or launch Window Server
before login.
However, this isn't the case (r. 5544764 <rdar://problem/5544764>) . This
message is really telling you is that you're trying to connect to the
window server from the wrong context. You see this message if you try to
connect to the global window server service from outside of the pre-login
context before the user has logged in; typically this means that you're
trying to use the window server from a daemon.
On Fri, 6 Jan 2017 at 1:35 AM, Doug Hill <email@hidden> wrote:
> It’s possible “untrusted” means not code-signed.
>
>
>
>
>
> > On Jan 4, 2017, at 11:36 PM, Sai Prasanna <email@hidden>
> wrote:
>
> >
>
> > I have created a pre-login agent which uses CGEventPost for simulating
>
> > keyboard. FYI I am developing a remote control app similar to teamviewer.
>
> >
>
> > Keyboard (I tried other event sources too)
>
> >
>
> > CGEventRef keyEvent = CGEventCreateKeyboardEvent( NULL, keyCode, down ) ;
>
> > CGEventPost( kCGHIDEventTap, keyEvent ) ;
>
> > CFRelease( keyEvent ) ;
>
> >
>
> > Mouse
>
> >
>
> > CGEventRef event = CGEventCreateMouseEvent(eventSource, eventType,
>
> > mouseLocation, mouseButton );
>
> > CGEventPost(kCGHIDEventTap, event);
>
> > CFRelease(event);
>
> >
>
> > Pre-login launch agent
>
> >
>
> > <?xml version="1.0" encoding="UTF-8"?>
>
> > <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
>
> > "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>
> > <plist version="1.0">
>
> > <dict>
>
> > <key>Label</key>
>
> > <string>my app label</string>
>
> > <key>LimitLoadToSessionType</key>
>
> > <string>LoginWindow</string>
>
> > <key>RunAtLoad</key>
>
> > <true/>
>
> > <key>WorkingDirectory</key>
>
> > <string>My app directory</string>
>
> > <key>ProgramArguments</key>
>
> > <array>
>
> > <string>app absolute path</string>
>
> > <string>service</string>
>
> > <string>myservice</string>
>
> > </array>
>
> > <key>KeepAlive</key>
>
> > <true/>
>
> > </dict>
>
> > </plist>
>
> >
>
> > CGEventPost is not working, I get the following in the Console logs after
>
> > login
>
> >
>
> > Untrusted apps are not allowed to connect to
>
> > Window Server before login.
>
> >
>
> > I have searched o chromium's remote control (which has keyboard and mouse
>
> > simulation working) source code. They use CGEventPost for keyboard, but
> it
>
> > works in login window.
>
> >
>
> > https://cs.chromium.org/chromium/src/remoting/host/
>
> > input_injector_mac.cc?rcl=0&l=42
>
> >
>
> > They seem to use a sh file in privileged helper tools directory and use
> to
>
> > to load the service, I tried putting our service in privileged helpers
>
> > tool, but still the event handling fails.
>
> >
>
> > The Deprecated API CGPostMouseEvent, CGPostKeyBoardEvent work without
>
> > problem , but would really like to know how non deprecated keyboard API
>
> > works in chromium.
>
>
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden