Skip to content

OverflowException when converting 64-bit IntPtr to Int32 #30

Closed

Description

@RobBie1221

In WindowChromeWorker, in the following function:

private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool handled)

The input parameter lParam is converted using Utility.GET_X_LPARAM and Utility.GET_Y_LPARAM. This function performs a ToInt32() on the pointer.

When running on 64-bit, the pointer value can be larger than Int32.MaxValue and in that case, the "ToInt32" is throwing an OverflowException.

On my mouse, I have a scroll button which I can tilt. For some reason, when I tilt the scroll button the "lParam" input get's crazy high values, larger than Int32.MaxValue. This triggers an OverflowException and crashes my app.

Activity

  1. batzen commented on Aug 18, 2017

    @batzen
    Member

    Have you tried using the latest preview?
    The code already uses Utility.GetPoint(lParam) which uses int64 or in32 depending of process bitness.

  2. RobBie1221 commented on Aug 19, 2017

    @RobBie1221
    Author

    I haven't yet. I did do that just now, the issue seems solved (which is expected based on the code behind it).

    I'm also using Fluent.Ribbon, while updating ControlzEx to 3.0.1-dev0030 it also updates Fluent.Ribbon to 6.0.0-dev0087 (previous was 5.0.1.10, it won't work with that). Do you have a rough estimation of when you want to release both new versions?

    I'm actually in the process of finishing my work, and last-minute changing of these items to a new version was not really on my list. Currently I patched ControlzEx 2.2.0.4 myself to fix this pointer conversion.

  3. batzen commented on Aug 19, 2017

    @batzen
    Member

    ControlzEx 3 is currently done. Still waiting if MahApps/MahApps.Metro#3021 reveals any issues.
    Fluent.Ribbon should also be done right now, just waiting for feedback on the items still open for version 6 https://github.com/fluentribbon/Fluent.Ribbon/milestone/18.

  4. added this to the 3.0.0 milestone on Aug 28, 2017
  5. self-assigned this
    on Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions