Add support for old and new kext together

This commit is contained in:
Vladimir Stoilov
2024-02-18 17:59:15 +02:00
parent b5195797d1
commit ddec8010d4
4 changed files with 123 additions and 58 deletions

View File

@@ -18,14 +18,14 @@ import (
)
type VersionInfo struct {
major uint8
minor uint8
revision uint8
build uint8
Major uint8
Minor uint8
Revision uint8
Build uint8
}
func (v *VersionInfo) String() string {
return fmt.Sprintf("%d.%d.%d.%d", v.major, v.minor, v.revision, v.build)
return fmt.Sprintf("%d.%d.%d.%d", v.Major, v.Minor, v.Revision, v.Build)
}
// Handler transforms received packets to the Packet interface.

View File

@@ -9,6 +9,7 @@ import (
"github.com/safing/portbase/log"
"github.com/safing/portmaster/network"
"github.com/vlabo/portmaster_windows_rust_kext/kext_interface"
"golang.org/x/sys/windows"
)
// Package errors
@@ -49,6 +50,14 @@ func Start() error {
return nil
}
func GetKextHandle() windows.Handle {
return kextFile.GetHandle()
}
func GetKextServiceHandle() windows.Handle {
return service.GetHandle()
}
// Stop intercepting.
func Stop() error {
// Prepare kernel for shutdown
@@ -129,10 +138,10 @@ func GetVersion() (*VersionInfo, error) {
}
version := &VersionInfo{
major: data[0],
minor: data[1],
revision: data[2],
build: data[3],
Major: data[0],
Minor: data[1],
Revision: data[2],
Build: data[3],
}
return version, nil
}