<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: A Registry Viewer in C#</title>
	<atom:link href="http://codehill.com/2009/03/a-registry-viewer-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://codehill.com/2009/03/a-registry-viewer-in-c/</link>
	<description>A blog for geeks</description>
	<lastBuildDate>Thu, 11 Mar 2010 14:02:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Jan</title>
		<link>http://codehill.com/2009/03/a-registry-viewer-in-c/comment-page-1/#comment-2677</link>
		<dc:creator>Jan</dc:creator>
		<pubDate>Sat, 04 Jul 2009 14:02:10 +0000</pubDate>
		<guid isPermaLink="false">http://codehill.com/?p=603#comment-2677</guid>
		<description>Thanks for the article.

If have made a view changes to get to all levels.

private void UpdateTree()
{
	TreeNode currentUserNode = new TreeNode(Registry.CurrentUser.Name, 0, 1);
    string[] currentUserSubKeys = Registry.CurrentUser.GetSubKeyNames();

	this.ReadRegistry(currentUserNode, &quot;&quot;, currentUserSubKeys);

	registryTreeView.Nodes.Add(currentUserNode);
}

private void ReadRegistry(TreeNode Node, string Key, string[] SubKeys)
{
	string TotaalPad = Key;
		if (TotaalPad.Length &gt; 0)
			TotaalPad += @&quot;\&quot;;

	foreach (string key in SubKeys)
	{
		//get a list of the next level sub keys and their values
		TreeNode node = new TreeNode(key, 0, 1);
		string[] subKeys = new string[0];
		try
		{
			subKeys = Registry.CurrentUser.OpenSubKey(TotaalPad + key).GetSubKeyNames();
		}
		catch
		{
		}

		if (subKeys.Length &gt; 0)
		{
			this.label1.Text = TotaalPad + key + &quot;  subKeys: &quot; + subKeys.Length.ToString();
			this.label1.Update();

			this.ReadRegistry(node, TotaalPad + key, subKeys);
		}

		try
		{
			GetValuesAndData(Registry.CurrentUser.OpenSubKey(TotaalPad + key), node);
		}
		catch
		{
		}

		node.Name = node.Text;

		Node.Nodes.Add(node);
	}
}</description>
		<content:encoded><![CDATA[<p>Thanks for the article.</p>
<p>If have made a view changes to get to all levels.</p>
<p>private void UpdateTree()<br />
{<br />
	TreeNode currentUserNode = new TreeNode(Registry.CurrentUser.Name, 0, 1);<br />
    string[] currentUserSubKeys = Registry.CurrentUser.GetSubKeyNames();</p>
<p>	this.ReadRegistry(currentUserNode, &#8220;&#8221;, currentUserSubKeys);</p>
<p>	registryTreeView.Nodes.Add(currentUserNode);<br />
}</p>
<p>private void ReadRegistry(TreeNode Node, string Key, string[] SubKeys)<br />
{<br />
	string TotaalPad = Key;<br />
		if (TotaalPad.Length &gt; 0)<br />
			TotaalPad += @&#8221;\&#8221;;</p>
<p>	foreach (string key in SubKeys)<br />
	{<br />
		//get a list of the next level sub keys and their values<br />
		TreeNode node = new TreeNode(key, 0, 1);<br />
		string[] subKeys = new string[0];<br />
		try<br />
		{<br />
			subKeys = Registry.CurrentUser.OpenSubKey(TotaalPad + key).GetSubKeyNames();<br />
		}<br />
		catch<br />
		{<br />
		}</p>
<p>		if (subKeys.Length &gt; 0)<br />
		{<br />
			this.label1.Text = TotaalPad + key + &#8221;  subKeys: &#8221; + subKeys.Length.ToString();<br />
			this.label1.Update();</p>
<p>			this.ReadRegistry(node, TotaalPad + key, subKeys);<br />
		}</p>
<p>		try<br />
		{<br />
			GetValuesAndData(Registry.CurrentUser.OpenSubKey(TotaalPad + key), node);<br />
		}<br />
		catch<br />
		{<br />
		}</p>
<p>		node.Name = node.Text;</p>
<p>		Node.Nodes.Add(node);<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amgad Suliman</title>
		<link>http://codehill.com/2009/03/a-registry-viewer-in-c/comment-page-1/#comment-1208</link>
		<dc:creator>Amgad Suliman</dc:creator>
		<pubDate>Wed, 29 Apr 2009 07:35:21 +0000</pubDate>
		<guid isPermaLink="false">http://codehill.com/?p=603#comment-1208</guid>
		<description>Ryan I think this would do the trick:

RegistryKey demoKey = Registry.CurrentUser.OpenSubKey(&quot;CodeHill&quot;);
            demoKey.SetValue(&quot;TestValue&quot;, 0, RegistryValueKind.DWord);</description>
		<content:encoded><![CDATA[<p>Ryan I think this would do the trick:</p>
<p>RegistryKey demoKey = Registry.CurrentUser.OpenSubKey(&#8220;CodeHill&#8221;);<br />
            demoKey.SetValue(&#8220;TestValue&#8221;, 0, RegistryValueKind.DWord);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://codehill.com/2009/03/a-registry-viewer-in-c/comment-page-1/#comment-1180</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Tue, 28 Apr 2009 13:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://codehill.com/?p=603#comment-1180</guid>
		<description>Iv got my code working after a few hours of tinkering i found that when i set the (default) to &quot;&quot; it doesn&#039;t  change it truly to null. if you look in the binary it has some zeros in there when its truly null it says (value not set) in the data field and if you check the binary it will only have 0000 so my question is how would you delete or set the default values data to (value not set ) making it null?

thank you for your time really appreciate it.
-Summey</description>
		<content:encoded><![CDATA[<p>Iv got my code working after a few hours of tinkering i found that when i set the (default) to &#8220;&#8221; it doesn&#8217;t  change it truly to null. if you look in the binary it has some zeros in there when its truly null it says (value not set) in the data field and if you check the binary it will only have 0000 so my question is how would you delete or set the default values data to (value not set ) making it null?</p>
<p>thank you for your time really appreciate it.<br />
-Summey</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amgad Suliman</title>
		<link>http://codehill.com/2009/03/a-registry-viewer-in-c/comment-page-1/#comment-1173</link>
		<dc:creator>Amgad Suliman</dc:creator>
		<pubDate>Tue, 28 Apr 2009 04:32:53 +0000</pubDate>
		<guid isPermaLink="false">http://codehill.com/?p=603#comment-1173</guid>
		<description>Hi Ryan, a value in registry terms means the variable name. And the default values in a registry key are the ones without names. I checked for default variables in the function GetValuesAndData using the following code: 

//Display the data of the value. The conditional operatore is  
//needed because the default value has no name  
node.Nodes.Add(value, (value == &quot;&quot; ? &quot;Default&quot; : value) +  &quot;: &quot; + stringData, 2, 2);  

This just displays the word Default when the value has no name. I hope this answered your question.</description>
		<content:encoded><![CDATA[<p>Hi Ryan, a value in registry terms means the variable name. And the default values in a registry key are the ones without names. I checked for default variables in the function GetValuesAndData using the following code: </p>
<p>//Display the data of the value. The conditional operatore is<br />
//needed because the default value has no name<br />
node.Nodes.Add(value, (value == &#8220;&#8221; ? &#8220;Default&#8221; : value) +  &#8220;: &#8221; + stringData, 2, 2);  </p>
<p>This just displays the word Default when the value has no name. I hope this answered your question.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan</title>
		<link>http://codehill.com/2009/03/a-registry-viewer-in-c/comment-page-1/#comment-1156</link>
		<dc:creator>Ryan</dc:creator>
		<pubDate>Mon, 27 Apr 2009 18:30:18 +0000</pubDate>
		<guid isPermaLink="false">http://codehill.com/?p=603#comment-1156</guid>
		<description>How would i check to see if the data is in a default value? 

if default value dosnt have any data ok if not would you like to remove it.

www.summeylabs.com/images/reg.jpg

thats what im trying to check

my if statement dosnt work if i have data in that value it still say its empty etc...

thank you for your time.
below is my code.






static void Main(string[] args)
        {

      

                RegistryKey MyReg = Registry.LocalMachine.OpenSubKey
                    (&quot;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\setup.exe&quot;, true);
                    
            
                    
                string IsVal = (string)MyReg.GetValue(&quot;Default&quot;,&quot;&quot;);
              


                if (MyReg.GetValue(IsVal) != null)
                {
                    Console.WriteLine(&quot;empty&quot;);
                   
                    MyReg.Flush();

                    MyReg.Close();


                }

                else

                {


                    Console.WriteLine(MyReg.GetValue(IsVal).ToString());
                    Console.WriteLine(&quot;removing value now&quot;);
                  
                    MyReg.SetValue(&quot;&quot;,&quot;DefaultValue&quot;);
                    MyReg.Flush();
                    MyReg.Close();



                  
                    
                }</description>
		<content:encoded><![CDATA[<p>How would i check to see if the data is in a default value? </p>
<p>if default value dosnt have any data ok if not would you like to remove it.</p>
<p><a href="http://www.summeylabs.com/images/reg.jpg" rel="nofollow">http://www.summeylabs.com/images/reg.jpg</a></p>
<p>thats what im trying to check</p>
<p>my if statement dosnt work if i have data in that value it still say its empty etc&#8230;</p>
<p>thank you for your time.<br />
below is my code.</p>
<p>static void Main(string[] args)<br />
        {</p>
<p>                RegistryKey MyReg = Registry.LocalMachine.OpenSubKey<br />
                    (&#8220;SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\setup.exe&#8221;, true);</p>
<p>                string IsVal = (string)MyReg.GetValue(&#8220;Default&#8221;,&#8221;");</p>
<p>                if (MyReg.GetValue(IsVal) != null)<br />
                {<br />
                    Console.WriteLine(&#8220;empty&#8221;);</p>
<p>                    MyReg.Flush();</p>
<p>                    MyReg.Close();</p>
<p>                }</p>
<p>                else</p>
<p>                {</p>
<p>                    Console.WriteLine(MyReg.GetValue(IsVal).ToString());<br />
                    Console.WriteLine(&#8220;removing value now&#8221;);</p>
<p>                    MyReg.SetValue(&#8220;&#8221;,&#8221;DefaultValue&#8221;);<br />
                    MyReg.Flush();<br />
                    MyReg.Close();</p>
<p>                }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DotNetShoutout</title>
		<link>http://codehill.com/2009/03/a-registry-viewer-in-c/comment-page-1/#comment-340</link>
		<dc:creator>DotNetShoutout</dc:creator>
		<pubDate>Sun, 29 Mar 2009 19:27:15 +0000</pubDate>
		<guid isPermaLink="false">http://codehill.com/?p=603#comment-340</guid>
		<description>&lt;strong&gt;A Registry Viewer in C# &#124; CodeHill...&lt;/strong&gt;

Thank you for submitting this cool story - Trackback from DotNetShoutout...</description>
		<content:encoded><![CDATA[<p><strong>A Registry Viewer in C# | CodeHill&#8230;</strong></p>
<p>Thank you for submitting this cool story &#8211; Trackback from DotNetShoutout&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
