MicrosoftEdge / MicrosoftEdge/WebView2Feedback

0x80070002 on CreateCoreWebView2EnvironmentWithOptions API whe user is logged off

Open
#3,437 2 comments 1 reaction 1 assignee View on GitHub

@LiangTheDev is already working on this.

Since Apr 28, 2023.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Hi all,
i got some situations that i would to debug better, maybe it's bug.
I have to launch my WebView2-base app from a service with Administrator privileges and it's not possibile, i know. To accomplish that, my application before build the WebView enviroment, check if itself is Administrator and re-launch itself with a less priviliged user ( CreateProcessAsUser API ).

The complete context is:

  1. A windows service run in a machine on wich i can interact with command remotly. On that machine a user could be generally be logged or not.
  2. A command create my WebView2 app, that being child of the service, that has Administrator privileges
  3. App can realize that, and create an identical process but with another well know user ( user that resides on the service machine obv )
  4. App run, get some statistic ad network analitycs e close itself

If all this process is executed when a user is logged on the service machne, it completes successfully. But when i got no user logged the api CreateCoreWebView2EnvironmentWithOptions fails with code 0x80070002 (Cannot find the specified file ).

I call CreateCoreWebView2EnvironmentWithOptions whit a custom UserDataFolder but it's an absolute path ad even with nullptr it fails.

I expected trouble with the CreateProcessAsAuser API in that context, but it creates the process fine. What could it be? Which file search the CreateCoreWebView2EnvironmentWithOptions? Can i have some hint on how to debug it? I can't realize why a file or directory can be found when a user logged instead of not.

PS: The fact of carrying out this procedure with a non logged in user was a constraint that I knew I had since the beginning of the project ( about 6 months ago ).
I seem to remember getting it to work but I don't remember the evergreen runtime versions... could something have changed?

Version
Browser Version 112.0.1722.48
WebView Version 1.0.1722.45
Framework: Win32
OS: Win10

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.