Visual Basic .NET 2008 registry GetValue exception - what wrong?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QW5kcmUgS2xpbW92?=

    Visual Basic .NET 2008 registry GetValue exception - what wrong?

    Hi!

    Situation:

    simple code read registry value (OpenSubKey -GetValue, as usual).
    Requested value exists in registry and has type DWORD, read into the
    variable UInt32, access rights granted.

    When value's data is in interval &H0 - &H7FFFFFFF - it's works fine. When
    value's data has "sign bit rised" (&HF0000000 - &HFFFFFFFF) - arithmetic
    operation exception occurs (overflow).

    Question is: is it a bug in Microsoft.Visua lBasic.dll or just stupid error
    in registry usage?


    WBR, Andre Klimov
    Aladdin Knowledge Systems
    Israel

    PS
    VS2008 Team Suite v9.0.21022.8 RTM (MSDN downloaded), standard installation

    PPS
    Sorry for simple question - I'm beginner and start use VB.NET only 3 days
    before...
  • Bill McCarthy

    #2
    Re: Visual Basic .NET 2008 registry GetValue exception - what wrong?

    It's actually a problem in the .NET framework When the registry key type is
    REG_DWORD they use an Int32
    in RegistryKey.Int ernalGetValue

    So you need to use an Int32 (aka Integer), not an unsigned one.



    "Andre Klimov" <Andre Klimov@discussi ons.microsoft.c omwrote in message
    news:96C04A04-9808-4EDD-AEFE-806109BCDC28@mi crosoft.com...
    Hi!
    >
    Situation:
    >
    simple code read registry value (OpenSubKey -GetValue, as usual).
    Requested value exists in registry and has type DWORD, read into the
    variable UInt32, access rights granted.
    >
    When value's data is in interval &H0 - &H7FFFFFFF - it's works fine. When
    value's data has "sign bit rised" (&HF0000000 - &HFFFFFFFF) - arithmetic
    operation exception occurs (overflow).
    >
    Question is: is it a bug in Microsoft.Visua lBasic.dll or just stupid error
    in registry usage?
    >
    >
    WBR, Andre Klimov
    Aladdin Knowledge Systems
    Israel
    >
    PS
    VS2008 Team Suite v9.0.21022.8 RTM (MSDN downloaded), standard
    installation
    >
    PPS
    Sorry for simple question - I'm beginner and start use VB.NET only 3 days
    before...

    Comment

    • =?Utf-8?B?QW5kcmUgS2xpbW92?=

      #3
      Re: Visual Basic .NET 2008 registry GetValue exception - what wron

      Thank you very much!

      WBR,

      "Bill McCarthy" wrote:
      It's actually a problem in the .NET framework When the registry key type is
      REG_DWORD they use an Int32
      in RegistryKey.Int ernalGetValue
      >
      So you need to use an Int32 (aka Integer), not an unsigned one.
      >
      >

      Comment

      Working...