mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 03:21:32 +08:00
[v2, windows] Fix WebView2 minimum runtime version check (#1456)
* [v2, windows] CompareBrowserVersions needs a int32 pointer Otherwise 4294967295 will be returned instead of -1 and the minimum version check can't detect an older version. So an older version than the minimum might be used and will result in AccessViolationExceptions. * [v2, windows] Use the correct minimum runtime version for SDK 1.0.992.28 The Webview2Loader.dll are already at version 1.0.992.28 for all platforms.
This commit is contained in:
parent
1e54eb2eaf
commit
884773a218
@ -1,8 +1,9 @@
|
||||
package edge
|
||||
|
||||
import (
|
||||
"golang.org/x/sys/windows"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
// ICoreWebviewSettings is the merged settings class
|
||||
@ -27,17 +28,17 @@ type _ICoreWebViewSettingsVtbl struct {
|
||||
PutIsZoomControlEnabled ComProc
|
||||
GetIsBuiltInErrorPageEnabled ComProc
|
||||
PutIsBuiltInErrorPageEnabled ComProc
|
||||
GetUserAgent ComProc
|
||||
GetUserAgent ComProc // ICoreWebView2Settings2: SDK 1.0.864.35
|
||||
PutUserAgent ComProc
|
||||
GetAreBrowserAcceleratorKeysEnabled ComProc
|
||||
GetAreBrowserAcceleratorKeysEnabled ComProc // ICoreWebView2Settings3: SDK 1.0.864.35
|
||||
PutAreBrowserAcceleratorKeysEnabled ComProc
|
||||
GetIsPasswordAutosaveEnabled ComProc
|
||||
GetIsPasswordAutosaveEnabled ComProc // ICoreWebView2Settings4: SDK 1.0.902.49
|
||||
PutIsPasswordAutosaveEnabled ComProc
|
||||
GetIsGeneralAutofillEnabled ComProc
|
||||
PutIsGeneralAutofillEnabled ComProc
|
||||
GetIsPinchZoomEnabled ComProc
|
||||
GetIsPinchZoomEnabled ComProc // ICoreWebView2Settings5: SDK 1.0.902.49
|
||||
PutIsPinchZoomEnabled ComProc
|
||||
GetIsSwipeNavigationEnabled ComProc
|
||||
GetIsSwipeNavigationEnabled ComProc // ICoreWebView2Settings6: SDK 1.0.992.28
|
||||
PutIsSwipeNavigationEnabled ComProc
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,10 @@ const (
|
||||
)
|
||||
|
||||
// CompareBrowserVersions will compare the 2 given versions and return:
|
||||
// -1 = v1 < v2
|
||||
// 0 = v1 == v2
|
||||
// 1 = v1 > v2
|
||||
// Less than zero: v1 < v2
|
||||
// zero: v1 == v2
|
||||
// Greater than zero: v1 > v2
|
||||
func CompareBrowserVersions(v1 string, v2 string) (int, error) {
|
||||
|
||||
_v1, err := windows.UTF16PtrFromString(v1)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@ -43,16 +42,16 @@ func CompareBrowserVersions(v1 string, v2 string) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
var result int
|
||||
var result int32
|
||||
_, _, err = memCompareBrowserVersions.Call(
|
||||
uint64(uintptr(unsafe.Pointer(_v1))),
|
||||
uint64(uintptr(unsafe.Pointer(_v2))),
|
||||
uint64(uintptr(unsafe.Pointer(&result))))
|
||||
|
||||
if err != windows.ERROR_SUCCESS {
|
||||
return result, err
|
||||
return 0, err
|
||||
}
|
||||
return result, nil
|
||||
return int(result), nil
|
||||
}
|
||||
|
||||
// GetInstalledVersion returns the installed version of the webview2 runtime.
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"github.com/wailsapp/wails/v2/pkg/options/windows"
|
||||
)
|
||||
|
||||
const MinimumRuntimeVersion string = "91.0.992.28"
|
||||
const MinimumRuntimeVersion string = "94.0.992.31" // Webview2 SDK 1.0.992.28
|
||||
|
||||
type installationStatus int
|
||||
|
||||
@ -35,7 +35,7 @@ func Process(appoptions *options.App) (string, error) {
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
updateRequired := compareResult == -1
|
||||
updateRequired := compareResult < 0
|
||||
// Installed and does not require updating
|
||||
if !updateRequired {
|
||||
return installedVersion, nil
|
||||
|
Loading…
Reference in New Issue
Block a user