Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling the AppServiceConnection's openAsync() method fails if the app is started with administrator privileges #591

Closed
L-proger opened this issue Apr 16, 2020 · 4 comments

Comments

@L-proger
Copy link

I wrote a UWP app (let's call it "server") with the UWP service inside it and a C++ desktop app (let's call it "client") that connects to the server's UWP service using the WinRT API.

The following code works as expected if the client application is run as a login user::

//Executed inside newly created thread
winrt::init_apartment();
connectionStatus = _appServiceConnection->OpenAsync().get();
winrt::uninit_apartment();

But this code doesn't work if I run the "client" application "as an administrator". (connectionStatus == AppServiceConnectionStatus::Unknown and I see "access denied" exception deeply inside windows libraries).

I don't need to use the WinRT API with admin rights, but other parts of the "client" app sometimes need to do this. Thus, the user should be able to run the "client" with or without administrator rights.

I have a separate thread dedicated to connecting to the UWP service and processing connection. I tried to drop the elevated rights of the thread security token, but was unsuccessful.

Do you have any suggestions?

@oldnewthing
Copy link
Member

This appears to be a question about AppServiceConnection, not C++/WinRT.

@L-proger
Copy link
Author

L-proger commented Apr 16, 2020

Sorry if I chose the wrong place for the question.

I understand that winrt::Windows::ApplicationModel::AppService::AppServiceConnection is just a part of C++ API projection, but I don't know where else to ask a question about my problem, because the "desktop" use of AppServiceConnection is closely related to the C++ WinRT library, and is not related to the clean world of UWP (using .NET), because there are no "Run as administrator" options for UWP apps, all of them are sandboxed and do not have this problem.

I found similar issue microsoft/DesktopBridgeToUWP-Samples#93

Please close my issue if it is not relevant.
Sorry for bother.

@oldnewthing
Copy link
Member

Not sure what you mean by "closely related to the C++/WinRT library". You can use UWP classes from .NET desktop apps too. You can follow the instructions on Windows developer support for platform support options. (Click "Forums and community".)

@L-proger
Copy link
Author

Thank you for your help, I will ask question there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants