-
Notifications
You must be signed in to change notification settings - Fork 7
Description
During porting of the loader to Go for Wails, I've encountered some inconsistency between the implementation and the official documentation.
In the official docs of CreateCoreWebView2EnvironmentWithOptions Microsoft states:
pass a null or empty string to browserExecutableFolder. In this scenario, the API tries to find a compatible version of the WebView2 Runtime that is installed on the user machine (first at the machine level, and then per user) using the selected channel preference.
But currently OpenWebView2Loader first tries to load at user level and then machine level:
OpenWebView2Loader/Source/WebView2Loader.cpp
Lines 751 to 761 in fb3a168
for (int i = 0; i < kNumChannels; i++) { | |
channel = | |
preference == WebView2ReleaseChannelPreference::kCanary ? 4 - i : i; | |
GetInstallKeyPathForChannel(channel, &lpSubKey); | |
if (FindInstalledClientDllForChannel(lpSubKey.String(), false, versionStr, | |
clientPath)) { | |
break; | |
} | |
if (FindInstalledClientDllForChannel(lpSubKey.String(), true, versionStr, | |
clientPath)) { | |
break; |
OpenWebView2Loader/Source/WebView2Loader.cpp
Lines 708 to 718 in fb3a168
int FindInstalledClientDllForChannel(PCWSTR lpSubKey, bool system, | |
WString* versionStr, WString* clientPath) { | |
HKEY phkResult; | |
DWORD cbPath = MAX_PATH; | |
UINT32 version[4]; | |
wchar_t path[MAX_PATH]; | |
if (RegOpenKeyExW(system ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, lpSubKey, | |
0, KEY_READ | KEY_WOW64_32KEY, &phkResult)) { | |
return false; | |
} |
@jchv do you possibly remember what the behaviour of the original loader was?