mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
windows/svc: align ctlHandler parameters
ctlHandler is passed to RegisterServiceCtrlHandlerEx as a callback function. But all ctlHandler parameters have to be uintptr aligned regardless of their type. Adjust ctlHandler parameters, so they are aligned accordingly. Also uncomment part of TestExample that verifies passing of ChangeRequest.Context. Fixes golang/go#25660 Change-Id: Ie96fa5c78b911ad9df6775f5c49e7f6d56464f6b Reviewed-on: https://go-review.googlesource.com/c/158698 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
@@ -315,8 +315,8 @@ func Run(name string, handler Handler) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ctlHandler := func(ctl uint32, evtype uint32, evdata uintptr, context uintptr) uintptr {
|
||||
e := ctlEvent{cmd: Cmd(ctl), eventType: evtype, eventData: evdata, context: context}
|
||||
ctlHandler := func(ctl, evtype, evdata, context uintptr) uintptr {
|
||||
e := ctlEvent{cmd: Cmd(ctl), eventType: uint32(evtype), eventData: evdata, context: context}
|
||||
// We assume that this callback function is running on
|
||||
// the same thread as Run. Nowhere in MS documentation
|
||||
// I could find statement to guarantee that. So putting
|
||||
|
||||
@@ -127,8 +127,7 @@ func TestExample(t *testing.T) {
|
||||
}
|
||||
want := strings.Join(append([]string{name}, args...), "-")
|
||||
// Test context passing (see servicemain in sys_386.s and sys_amd64.s).
|
||||
// TODO(brainman): Uncomment next line once issue #25660 is fixed.
|
||||
//want += "-123456"
|
||||
want += "-123456"
|
||||
if !strings.Contains(string(out), want) {
|
||||
t.Errorf("%q string does not contain %q", string(out), want)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user