[service] Fix module failure when dll is missing

This commit is contained in:
Vladimir Stoilov
2024-12-02 14:02:49 +02:00
parent ef0995b1f7
commit 2a9d75433f
5 changed files with 60 additions and 22 deletions

View File

@@ -14,7 +14,7 @@ import (
)
type ETWSession struct {
i integration.ETWFunctions
i *integration.ETWFunctions
shutdownGuard atomic.Bool
shutdownMutex sync.Mutex
@@ -23,7 +23,10 @@ type ETWSession struct {
}
// NewSession creates new ETW event listener and initilizes it. This is a low level interface, make sure to call DestorySession when you are done using it.
func NewSession(etwInterface integration.ETWFunctions, callback func(domain string, result string)) (*ETWSession, error) {
func NewSession(etwInterface *integration.ETWFunctions, callback func(domain string, result string)) (*ETWSession, error) {
if etwInterface == nil {
return nil, fmt.Errorf("etw interface was nil")
}
etwSession := &ETWSession{
i: etwInterface,
}
@@ -47,7 +50,7 @@ func NewSession(etwInterface integration.ETWFunctions, callback func(domain stri
// Initialize session.
err := etwSession.i.InitializeSession(etwSession.state)
if err != nil {
return nil, fmt.Errorf("failed to initialzie session: %q", err)
return nil, fmt.Errorf("failed to initialize session: %q", err)
}
return etwSession, nil