Skip to content

Commit

Permalink
IMMNotificationClient.OnDeviceStateChanged map dwNewState proper
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadijs committed Jul 9, 2024
1 parent e179e0c commit 8430a8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/wca/IMMNotificationClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type IMMNotificationClientCallback struct {
OnDefaultDeviceChanged func(flow EDataFlow, role ERole, pwstrDeviceId string) error
OnDeviceAdded func(pwstrDeviceId string) error
OnDeviceRemoved func(pwstrDeviceId string) error
OnDeviceStateChanged func(pwstrDeviceId string, dwNewState uint64) error
OnDeviceStateChanged func(pwstrDeviceId string, dwNewState uint32) error
OnPropertyValueChanged func(pwstrDeviceId string, key uint64) error
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/wca/IMMNotificationClient_func.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func mmncOnDeviceRemoved(this uintptr, pwstrDeviceId uintptr) int64 {
return ole.E_NOTIMPL
}

func mmncOnDeviceStateChanged(this uintptr, pwstrDeviceId uintptr, dwNewState uintptr) int64 {
func mmncOnDeviceStateChanged(this uintptr, pwstrDeviceId uintptr, dwNewState uint32) int64 {
return ole.E_NOTIMPL
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/wca/IMMNotificationClient_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func mmncOnDeviceRemoved(this uintptr, pwstrDeviceId uintptr) int64 {
return ole.S_OK
}

func mmncOnDeviceStateChanged(this uintptr, pwstrDeviceId uintptr, dwNewState uintptr) int64 {
func mmncOnDeviceStateChanged(this uintptr, pwstrDeviceId uintptr, dwNewState uint32) int64 {
mmnc := (*IMMNotificationClient)(unsafe.Pointer(this))

if mmnc.callback.OnDeviceStateChanged == nil {
Expand All @@ -106,7 +106,7 @@ func mmncOnDeviceStateChanged(this uintptr, pwstrDeviceId uintptr, dwNewState ui
// device := syscall.UTF16ToString(*(*[]uint16)(unsafe.Pointer(pwstrDeviceId)))
device := LPCWSTRToString(pwstrDeviceId, 1024)

err := mmnc.callback.OnDeviceStateChanged(device, 0)
err := mmnc.callback.OnDeviceStateChanged(device, dwNewState)

if err != nil {
return ole.E_FAIL
Expand Down

0 comments on commit 8430a8f

Please sign in to comment.