Registry and dWord values
-
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.
-
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.
-
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
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.
-
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.
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 -
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.
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
-
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 SongPaul 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.
-
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
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.
-
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.
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