wails
wails copied to clipboard
[Windows] Can't open wails executable with elevated access from standard user
Description
If you build an executable which needs elevated access to be ran, and try to run it from a standard(not admin) user, it fails because of this error: "Microsoft Edge can't read and write to it's data directory. C:\Users{admin-account}\AppData\Roaming{wails-app-name}.exe\EBWebView"(see image). Now the standard users doesn't have access to the admin %APPDATA% folder but the app is running with elevated access. I tried to give the user permissions in that admin %APPDATA% folder but that didn't work. I also tried setting the WebviewUserDataPath to the standard users' %APPDATA% folder but that didn't work either. The same error doesn't show anymore but the app automatically closes. I logged the error and I got this:
"DEB | Using go webview2loader
2023/09/18 20:54:58 Creating controller failed with 80010108: The object invoked has disconnected from its clients.
[0918/205458.240:ERROR:window_impl.cc(119)] Failed to unregister class Chrome_WidgetWin_0. Error = 0"
To Reproduce
- Create an executable with elevated access. To do this you need to add this to wails.exe.manifest:
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedPrivileges> <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </trustInfo> - Run the app from a standard account(not admin). The app will ask for admin credentials.
- App will show this error:
Expected behaviour
App should open normally as it should from admin account.
Screenshots
No response
Attempted Fixes
Tried giving the standard user permission to the admin %APPDATA%{wails-app}.exe folder but that didn't work. The previous error didn't pop-up anymore but the app just doesn't open. Logs provided in image below.
Same thing happened when I tried the
[WebviewBrowserPath](https://wails.io/docs/reference/options/#webviewuserdatapath) to the standard users' %APPDATA% folder
System Details
# System
OS | Windows 10 Pro
Version | 2009 (Build: 22621)
ID | 22H2
Go Version | go1.20.2
Platform | windows
Architecture | amd64
# Wails
Version | v2.4.1
# Dependencies
Dependency | Package Name | Status | Version
WebView2 | N/A | Installed | 117.0.2045.31
npm | N/A | Installed | 6.13.6
*upx | N/A | Available |
*nsis | N/A | Available |
* - Optional Dependency
# Diagnosis
Your system is ready for Wails development!
Additional context
No response