Gurmit Teotia

Hello,

I need to start and close the osk.exe from my application. Once I start it, I'm not able to close it by PostMessage(hWnd,WM_QUIT,0,0). It's returning "Access Denied" error because of different IL. My application runs at medium integrity level. "OSK.EXE" is always running at high integrity level. I tried to start "osk.exe" at low or medium integrity level but it was giving the error "requested operation require elevation". If I run my application at high integrity level using "run as administrator" then it works fine. I don't think it is going to be a good experience if everytime user start my application from "run as administartor" menu.

I'd appreciate if someone can suggest the solution to above problem.

Regards,

Gurmit



Re: Security for Applications in Windows Vista Closing osk.exe from other application

Gurmit Teotia

God, not a single repsonse. Is this list alive Another strange thing is osk.exe by default start in high integrity level and it is not even asking for user confirmation.



Re: Security for Applications in Windows Vista Closing osk.exe from other application

AndyCadley

osk.exe presumably has UIAccess=true, which is why you can't control it from a medium integrity process (as that would allow you to subvert the entire UIPI mechanism).

I'm not sure this is a great design, what happens if a user already has the on screen keyboard enabled for their own accessibilty needs and your app shuts it down unexpectedly





Re: Security for Applications in Windows Vista Closing osk.exe from other application

Gurmit Teotia

Thanks for your response Andy. We've a button (both software and hardware) to toggle the keyboard. So it would not be unexpected when user is explicity closing the keyboard.

I'm also wondering why osk.exe is starting in high integrity level without user confirmation. Can we start a process in high integrity level without user's confirmation If yes then how and if not then how is osk.exe doing it





Re: Security for Applications in Windows Vista Closing osk.exe from other application

AndyCadley

Gurmit Teotia wrote:

I'm also wondering why osk.exe is starting in high integrity level without user confirmation. Can we start a process in high integrity level without user's confirmation If yes then how and if not then how is osk.exe doing it.

It doesn't, it has the requestedExecutionLevel set to asInvoker (you can verify this by extracting the manifest using mt.exe). However, because it has UIAccess=true and meets all the necessary conditions (digitally signed, installed in a trusted location etc), it sits the other side of UIPI which means that it can send messages to high integrity applications but also prevents medium/low integrity processes from sending messages to it.





Re: Security for Applications in Windows Vista Closing osk.exe from other application

Gurmit Teotia

I've verified that osk.exe is starting in high integrity level from process explorer and my code. True, it has requestedExecutionLevel set to asInvoker and my application in medium integrity level, still my application starts it and it never ask for user confirmation. Can a medium integrity level process start a new process in high integrity level That is exactly happening with me and you can also verify that.





Re: Security for Applications in Windows Vista Closing osk.exe from other application

AndyCadley

If a process if flagged with UIAccess=true and meets all the necessary requirements, then it will have a high integrity token so that it can send UI messages to high integrity processes. Note that it still won't have Administrative rights if you do this, which is why it doesn't trigger a UAC prompt.



Re: Security for Applications in Windows Vista Closing osk.exe from other application

Gurmit Teotia

Thanks for your repsone Andy. What are the requirements for a process to start in high integrity level without showing the UAC prompt I even digitally sign my application. I also want to start my application in high integrity level without UAC prompt.

Gurmit





Re: Security for Applications in Windows Vista Closing osk.exe from other application

AndyCadley

From: Windows Vista Application Development Requirements for User Account Control Compatibility

"Important

Applications with the uiAccess flag set to true must be Authenticode signed to start properly. In addition, the application must reside in a protected location in the file system. \Program Files\ and \Windows\System32\ are currently the two allowable protected locations."





Re: Security for Applications in Windows Vista Closing osk.exe from other application

AndyCadley

Also note that if you want to get Logo certification, you'd need to apply for a waiver if you set uiaccess=true. Usually this is reserved for accessibility tools.



Re: Security for Applications in Windows Vista Closing osk.exe from other application

Gurmit Teotia

Excellent, I was able to solve it. Link was very useful.

Thank you.

Gurmiot