Menu

#51 WindowsDeviceNotifier.OnDeviceChange throws OverflowException on 64 Bit machines.

v2.2.8
open
nobody
None
5
2016-01-05
2016-01-05
JasonG
No

I ran into crashes on the call to WindowsDeviceNotifier.OnDeviceChange on when using 64 bit machines. The issue is that IntPtr.LParam.ToInt32() returns a 64 bit number and throws an OverflowException as described in https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k%28System.IntPtr.ToInt32%29;k%28TargetFrameworkMoniker-.NETFramework

Line 115 should be changed from:
if (m.LParam.ToInt32() != 0)
to
if (m.LParam != IntPtr.Zero)

This fixes it right up as far as my limited testing can tell. I built with VS 2015 using .NET 4.6.1.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.