1.1 --- a/Hardware/ThreadAffinity.cs Tue Dec 30 22:47:39 2014 +0000
1.2 +++ b/Hardware/ThreadAffinity.cs Tue Dec 30 22:49:32 2014 +0000
1.3 @@ -4,7 +4,7 @@
1.4 License, v. 2.0. If a copy of the MPL was not distributed with this
1.5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
1.6
1.7 - Copyright (C) 2010 Michael Möller <mmoeller@openhardwaremonitor.org>
1.8 + Copyright (C) 2010-2014 Michael Möller <mmoeller@openhardwaremonitor.org>
1.9
1.10 */
1.11
1.12 @@ -29,9 +29,15 @@
1.13 ref mask) != 0)
1.14 return 0;
1.15 return result;
1.16 - } else { // Windows
1.17 - return (ulong)NativeMethods.SetThreadAffinityMask(
1.18 - NativeMethods.GetCurrentThread(), (UIntPtr)mask);
1.19 + } else { // Windows
1.20 + UIntPtr uIntPtrMask;
1.21 + try {
1.22 + uIntPtrMask = (UIntPtr)mask;
1.23 + } catch (OverflowException) {
1.24 + throw new ArgumentOutOfRangeException("mask");
1.25 + }
1.26 + return (ulong)NativeMethods.SetThreadAffinityMask(
1.27 + NativeMethods.GetCurrentThread(), uIntPtrMask);
1.28 }
1.29 }
1.30