Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Registry and dWord values

Registry and dWord values

Scheduled Pinned Locked Moved C#
comwindows-adminhelp
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    codeweenie
    wrote on last edited by
    #1

    I found this artical and it's been a great help. Only thing is I need to set dWord values greater than 2,147,483,647! I am sure that somebody has found a way around this. Here is my code: RegistryKey regKey = Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\nsunicast\Parameters\Virtual Roots\/"+eId); regKey.SetValue("MaxBandwidth", 4294967295); // if I change this to below the number above it will set as a dWord all day long. Any examples, or ideas would rock. Thanks, Bill K.

    L 1 Reply Last reply
    0
    • C codeweenie

      I found this artical and it's been a great help. Only thing is I need to set dWord values greater than 2,147,483,647! I am sure that somebody has found a way around this. Here is my code: RegistryKey regKey = Registry.LocalMachine.CreateSubKey(@"SYSTEM\CurrentControlSet\Services\nsunicast\Parameters\Virtual Roots\/"+eId); regKey.SetValue("MaxBandwidth", 4294967295); // if I change this to below the number above it will set as a dWord all day long. Any examples, or ideas would rock. Thanks, Bill K.

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      DWORD = UInt32; //all day long (what ever you meant be that) ;P I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

      C 1 Reply Last reply
      0
      • L leppie

        DWORD = UInt32; //all day long (what ever you meant be that) ;P I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

        C Offline
        C Offline
        codeweenie
        wrote on last edited by
        #3

        leppie wrote: DWORD = UInt32; I am not exactly sure how to use that? I did try this and I got no compile errors. I did however still get a string in the reg and not a dword as desired? UInt32 maxValue = 4294967295; regKey.SetValue("MaxBandwidth", maxValue); Thanks, Bill K.

        P L 2 Replies Last reply
        0
        • C codeweenie

          leppie wrote: DWORD = UInt32; I am not exactly sure how to use that? I did try this and I got no compile errors. I did however still get a string in the reg and not a dword as desired? UInt32 maxValue = 4294967295; regKey.SetValue("MaxBandwidth", maxValue); Thanks, Bill K.

          P Offline
          P Offline
          Paul Riley
          wrote on last edited by
          #4

          codeweenie wrote: I did however still get a string in the reg and not a dword as desired? I don't think you can create anything else using the .NET Registry handlers. Either use Interop to get at the API registry functions or convert to and from a string using SetValue. Paul We all will feed the worms and trees
          So don't be shy
          - Queens of the Stone Age, Mosquito Song

          C 1 Reply Last reply
          0
          • C codeweenie

            leppie wrote: DWORD = UInt32; I am not exactly sure how to use that? I did try this and I got no compile errors. I did however still get a string in the reg and not a dword as desired? UInt32 maxValue = 4294967295; regKey.SetValue("MaxBandwidth", maxValue); Thanks, Bill K.

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            Try this perhaps: UInt32 maxValue = 4294967295; regKey.SetValue("MaxBandwidth", maxValue.ToString("X")); //??? or maybe add a byte[], I cant really see what you can do from the docs. I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

            C 1 Reply Last reply
            0
            • P Paul Riley

              codeweenie wrote: I did however still get a string in the reg and not a dword as desired? I don't think you can create anything else using the .NET Registry handlers. Either use Interop to get at the API registry functions or convert to and from a string using SetValue. Paul We all will feed the worms and trees
              So don't be shy
              - Queens of the Stone Age, Mosquito Song

              C Offline
              C Offline
              codeweenie
              wrote on last edited by
              #6

              Paul Riley wrote: Either use Interop to get at the API registry functions or convert to and from a string using SetValue. Can you show me an example? I am not following you. Thing is the value that I am writing into the registry is a value that Windows Media Streaming server needs. This is not for a program of my own. I am trying to automate some stuff so converting it to or from a string is not really the answer, I don't think. I am able to feed the value in as a dword value as long as I keep it below that 2147483647 number and do it like this: regKey.SetValue("MaxBandwidth", 2147483647); However if I try to do this, the number gets converted to a string: regKey.SetValue("MaxBandwidth", 4294967295); So then I tried this: UInt32 maxValue = 4294967295; regKey.SetValue("MaxBandwidth", maxValue); This also gets converted to a string. Thanks, Bill K.

              P 1 Reply Last reply
              0
              • L leppie

                Try this perhaps: UInt32 maxValue = 4294967295; regKey.SetValue("MaxBandwidth", maxValue.ToString("X")); //??? or maybe add a byte[], I cant really see what you can do from the docs. I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

                C Offline
                C Offline
                codeweenie
                wrote on last edited by
                #7

                leppie wrote: regKey.SetValue("MaxBandwidth", maxValue.ToString("X")); //??? I tried this, and I get "FFFFFFFF" as my value in the reg. It's a string value of course. Not sure how to employ the byte[] stuff. From the docs and what I can't find on MSDN's site, I agree, this is getting to be a real problem. I can't understand why M$ would have one of their servers expect a value that can't be set via another program, that just does not make sense to me. There has to be a way to set this. I can't believe that somebody has not created a work around for it. I am just to new to C# to know how to do it just yet. :| Thanks, Bill K.

                1 Reply Last reply
                0
                • C codeweenie

                  Paul Riley wrote: Either use Interop to get at the API registry functions or convert to and from a string using SetValue. Can you show me an example? I am not following you. Thing is the value that I am writing into the registry is a value that Windows Media Streaming server needs. This is not for a program of my own. I am trying to automate some stuff so converting it to or from a string is not really the answer, I don't think. I am able to feed the value in as a dword value as long as I keep it below that 2147483647 number and do it like this: regKey.SetValue("MaxBandwidth", 2147483647); However if I try to do this, the number gets converted to a string: regKey.SetValue("MaxBandwidth", 4294967295); So then I tried this: UInt32 maxValue = 4294967295; regKey.SetValue("MaxBandwidth", maxValue); This also gets converted to a string. Thanks, Bill K.

                  P Offline
                  P Offline
                  Paul Riley
                  wrote on last edited by
                  #8

                  codeweenie wrote: This is not for a program of my own. I am trying to automate some stuff so converting it to or from a string is not really the answer, I don't think. You are correct, so you need to use Interop. This is slightly complicated at first but once you get the hang of it, it's quite easy (that's the story of everything .NET, in my experience). This[^] is a fair introduction to Interop. Other than that, you can search for DllImport/DllImportAttribute here and on MSDN and find more detailed examples. Once you understand that, it's just a case of looking up the API registry calls: RegOpenKeyEx and RegSetValueEx. If you run into any more problems, come back and ask. :-D Paul We all will feed the worms and trees
                  So don't be shy
                  - Queens of the Stone Age, Mosquito Song

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups