For security reasons the UI module for my application runs with a high
mandatory integrity level. Everything in it works great, except one thing. For compatibility with older versions I need to be able to let users issue command line calls to the UI module.
At the moment this mechanism works as such:
The shortcut from Windows Explorer calls my module, say as such:
path-to-module\module.exe -op="a, s, r"
When
module.exe
process parses this command line it then locates the running copy of UI module (or another copy of self) using FindWindow by its unique class name. It then sends it a registered message using PostMessage API.Then the running UI module (with
high
integrity level), when it receives the message, processes it accordingly.
The problem is that because the running copy of UI module has high
integrity level, it cannot receive messages from a lower integrity level, or the copy of the module when it's run by the Windows Explorer to parse a shortcut command, which makes it run with medium
integrity level.
To address this I found this UIAccess
flag (see here, and scroll down to where it says "UIAccess for UI automation applications".)
So my assumptions were that if I set this flag and code-sign my UI module:
it will be able to bypass the UIPI restriction I described above.
It runs just fine:
But what I see is that PostMessage
API in the algorithm I described above still fails with ERROR_ACCESS_DENIED when I call it from the module running with medium
integrity level.
What have I missed there?