Fixed an OverflowException when trying to use (unsupported) 64-bit thread affinity masks on 32-bit systems. default
authormoel.mich
Tue, 30 Dec 2014 22:49:32 +0000
changeset 4327b859a06eecb
parent 431 0e46e3ca812a
child 433 090259cfd699
Fixed an OverflowException when trying to use (unsupported) 64-bit thread affinity masks on 32-bit systems.
Hardware/ThreadAffinity.cs
Properties/AssemblyVersion.cs
     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    
     2.1 --- a/Properties/AssemblyVersion.cs	Tue Dec 30 22:47:39 2014 +0000
     2.2 +++ b/Properties/AssemblyVersion.cs	Tue Dec 30 22:49:32 2014 +0000
     2.3 @@ -10,5 +10,5 @@
     2.4  
     2.5  using System.Reflection;
     2.6  
     2.7 -[assembly: AssemblyVersion("0.7.0.0")]
     2.8 -[assembly: AssemblyInformationalVersion("0.7.0 Beta")]
     2.9 \ No newline at end of file
    2.10 +[assembly: AssemblyVersion("0.7.1.0")]
    2.11 +[assembly: AssemblyInformationalVersion("0.7.1 Beta")]
    2.12 \ No newline at end of file