mirror of
https://github.com/safing/portmaster
synced 2025-04-12 15:09:09 +00:00
[windows_kext] Fix minor problems
This commit is contained in:
parent
89657123ec
commit
2e3304809f
4 changed files with 10 additions and 4 deletions
service/firewall/interception/windowskext2
windows_kext
|
@ -39,7 +39,11 @@ func Start() error {
|
|||
}
|
||||
|
||||
// Start service and open file
|
||||
service.Start(true)
|
||||
err = service.Start(true)
|
||||
if err != nil {
|
||||
log.Errorf("failed to start service: %s", err)
|
||||
}
|
||||
|
||||
kextFile, err = service.OpenFile(1024)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open driver: %w", err)
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/safing/portmaster/base/log"
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
|
@ -221,7 +222,7 @@ func CreateKextService(driverName string, driverPath string) (*KextService, erro
|
|||
// Check if there is an old service.
|
||||
service, err := windows.OpenService(manager, &driverNameU16[0], windows.SERVICE_ALL_ACCESS)
|
||||
if err == nil {
|
||||
fmt.Println("kext: old driver service was found")
|
||||
log.Warning("kext: old driver service was found")
|
||||
oldService := &KextService{handle: service, driverName: driverName}
|
||||
oldService.Stop(true)
|
||||
err = oldService.Delete()
|
||||
|
@ -234,7 +235,7 @@ func CreateKextService(driverName string, driverPath string) (*KextService, erro
|
|||
}
|
||||
|
||||
service = winInvalidHandleValue
|
||||
fmt.Println("kext: old driver service was deleted successfully")
|
||||
log.Warning("kext: old driver service was deleted successfully")
|
||||
}
|
||||
|
||||
driverPathU16, err := syscall.UTF16FromString(driverPath)
|
||||
|
|
|
@ -22,6 +22,7 @@ func TestRustInfoFile(t *testing.T) {
|
|||
for {
|
||||
info, err := RecvInfo(file)
|
||||
// First info should be with invalid size.
|
||||
// This tests if invalid info data is handled properly.
|
||||
if first {
|
||||
if !errors.Is(err, ErrUnexpectedInfoSize) {
|
||||
t.Errorf("unexpected error: %s\n", err)
|
||||
|
|
|
@ -441,7 +441,7 @@ fn generate_test_info_file() -> Result<(), std::io::Error> {
|
|||
for _ in 0..selected.capacity() {
|
||||
selected.push(enums.choose(&mut rng).unwrap().clone());
|
||||
}
|
||||
// Write wrong size data.
|
||||
// Write wrong size data. To make sure that mismatches between kext and portmaster are handled properly.
|
||||
let mut info = connection_info_v6(
|
||||
1,
|
||||
2,
|
||||
|
|
Loading…
Add table
Reference in a new issue