Move remote deployment to a vendored source bundle built on the target host via Docker so redeploys no longer require local cross-compilation or host Go installation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
//go:build windows
|
|
|
|
package wintoast
|
|
|
|
import (
|
|
"unsafe"
|
|
|
|
"github.com/go-ole/go-ole"
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
var (
|
|
// Define procs that go-ole doesn't provide. This is how we register our Go-implemented
|
|
// COM objects.
|
|
modcombase = windows.NewLazySystemDLL("combase.dll")
|
|
procRegisterClassObject = modcombase.NewProc("CoRegisterClassObject")
|
|
)
|
|
|
|
// registerClassFactory teaches the Windows Runtime about our factory that can allocate
|
|
// instances of our ActivationCallback.
|
|
func registerClassFactory(factory *IClassFactory) error {
|
|
// cookie is used as a handle to this class. It is used when calling CoRevokeClassObject
|
|
// which unregisters the class. We don't need it until we plan to revoke this registration
|
|
// for some reason.
|
|
var cookie int64
|
|
hr, _, _ := procRegisterClassObject.Call(
|
|
uintptr(unsafe.Pointer(GUID_ImplNotificationActivationCallback)),
|
|
uintptr(unsafe.Pointer(factory)),
|
|
uintptr(ole.CLSCTX_LOCAL_SERVER),
|
|
uintptr(1), /* REGCLS_MULTIPLEUSE */
|
|
uintptr(unsafe.Pointer(&cookie)),
|
|
)
|
|
if hr != ole.S_OK {
|
|
return ole.NewError(hr)
|
|
}
|
|
return nil
|
|
}
|