.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Bug? Writing to 64/32 bit Registry Keys

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :WPF

I had been searching for a way to write to the 64 and 32bit (WOW6432Node) registry keys becuase it's hard to predict where external processes I'm working with will be reading from.

.net 4 has a great new way of pointing explicitly to the keys with the RegistryKey.OpenBaseKey method.  It works fine until I point at:


RegistryKey RegCUBase32 = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32);


This should (In my mind) Push me to the HKCU\Software\WOW6432Node when I try to write to the HKCU\Software  (that's how things work in HKLM)
-but it does not

See the following code:


using System;
using Microsoft.Win32;

  public static void test()
   String regPath = "SOFTWARE\\Test"; ;
   RegistryKey TestKey;

   //works fine:
   RegistryKey RegLMBase64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
   TestKey = RegLMBase64.CreateSubKey(regPath);

View Complete Post

More Related Resource Links

What registry keys are responsible for file extension association?

I'm trying to associate file extension to start some type of files with my application. Which registry keys I have to modify to be sure, that when user double click at file it opens with my application. And how get delete/modify permisions to key "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>\UserChoice"? This key created after setting default program by "Open with" dialog. I've tried: string ext=".eee"; RegistryKey r = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\"+ext); RegistryPermission f = new RegistryPermission(RegistryPermissionAccess.Write, r.Name); f.Assert(); r.OpenSubKey("UserChoice", true); //at this step "Requested registry access is not allowed." exception occured

How to use (add, read, change, delete) registry keys with vb.net

Find this tutorial on Dot Net SourceReason of this project:This is the next part of the previous tutorial. We'll learn here how to add, change, read, delete registry keys and values using vb.net.I included a sample that contains all those functionality.Project details:1- How to add a registry key/value2- How to read a registry value3- How to delete a key or a value4- Changing a value or a key5- Hints to use registry with VB.net6- The registry reader (VB.net)1- How to add a registry key/valueOne thing that I think I forget to notice. A folder in the registry is name "key" and the elements in this key are named "values".There's a description of each value type in the 5th tutorialNow we'll see how to add a key or a value.Probably you have thought where we'll put it and whether it's a key or a value.So we have 2 things to notice.Visual Basic will automatically show you the hives (they are stored in).You'll have only to choose the needed one.To do that paste the following line. My.Computer.Registry.CurrentUser.CreateSubKey("TestKey")This line will create a key in the HKEY_CURRENT_USER hive and will be named "testkey"Now let's move on to see how to set a value.For the value we'll need three things: Value path, Value name and value value. We can also precise the value type if not Visual Basic will try to assign the value type depending o

Consistency validation for SQL Server registry keys


I cannot get past this support rule when I attempt to install SQL Server 2008 RC0.  When I attempt to drill into the failure the popup states "The SQL Server registry keys from a prior installation cannot be modified.  To continue, see SQL Server Setup documentation about how to fix registry keys."


First off, why would the SQL Server 2008 RC0 install attempt to modify registry keys from a prior installation if I am attempting to install it side-by-side with a prior install of SQL Server 2005 Developer Edition?  


Second, can anyone point me to the SQL Server Setup documentation that walks me through how to go about fixing these registry keys?


Any help would be greatly appreciated.  Thanks in advance for your help.


Wendell G


Issue reading x64 Registry keys


I have a C# console app compiled with .Net 2.0 in 32 bit machine. This app run fine in 32bit machine. But when I run in x64 machine I get some issues.

I figured out that the information about app was installed correctly on HKLM\SOFTWARE\Wow6432Node\MyCompany\MyApp\ registry key.

But in my code I have hard coded the following string "SOFTWARE\MyCompany\MyApp"

I thought that WOW64 could translate correctly from "SOFTWARE\MyCompany\MyApp" to SOFTWARE\Wow6432Node\MyCompany\MyApp. I am using the class RegistryKey from the Framework. I know that all is correct because it works in 32bit but seems that I am missing something with x64. I got a look at Registry Redirection and Reflection but could not see a solution. Any idea?





Create registry keys on X64 registry during X86 app installation.


My applications is built with X86 target platform.

I’m creating the registry keys in HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon for auto-login to windows during my app installation. For this I’m executing a .reg file.

This process works in any X86 machines normally.

When I install this in X64 machine, all my registry keys were created under WOW6432Node (HKLM\Software\WOW6432Node\Microsoft\Windows NT\ CurrentVersion \WinLogon). Due to this issue auto-login not happening upon machine reboots.

How to create the registry keys under HKLM\Software\Microsoft\Windows NT\ CurrentVersion \WinLogon during installation?

Thanks in advance.


Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

Writing custom MembershipProvider

ASP.NET Membership mechanism allows to use the build-in server tables to store and retrieve user data. By default, this mechanism can only be used with SQL Server database to which Microsoft provides suitable MembershipProvider class.
Inheriting from this abstract class, developer can use his own table(-es) from any database and use any database engine other than SQL Server, like Oracle, DB2 etc.

10 Tips for Writing High-Performance Web Applications

Writing a Web application with ASP.NET is unbelievably easy. So easy, many developers don't take the time to structure their applications for great performance. In this article, I'm going to present 10 tips for writing high-performance Web apps. I'm not limiting my comments to ASP.NET applications because they are just one subset of Web applications. This article won't be the definitive guide for performance-tuning Web applications-an entire book could easily be devoted to that. Instead, think of this as a good place to start.

Writing Custom Web Parts for SharePoint 2007

As I mentioned in an earlier blog post, SharePoint 2007 is built on top of ASP.NET 2.0, which means you can now use ASP.NET 2.0 features (Forms Authentication, Master Pages, Membership, Site Navigation, New Data Controls, etc) when building SharePoint sites. This is true for both the new Windows SharePoint Services 3.0 version (which will be a free download) as well as Microsoft Office SharePoint Server 2007 (which costs money).

Visual Studio Shortcut Keys

The following tables describe the shortcut keys in the Microsoft Dynamics AX Debugger.

Reading and Writing Images From a Windows Mobile Database using UltraLite 10(C#)

Periodically I get a request for information on how to read and write binary data to a database running on Windows Mobile. If you search the Internet you can typically find examples that are available on Windows Desktops or allow you to read and write to a local file system. The problem is that it can take a bit of work to get this code to work on Windows Mobile accessing a database.

Ultimately you might be asking, why would I want to store and image in a database? Well in an environment where you synchronizing data between a local mobile database and a consolidated (central) database this can be extremely useful. Imagine if an insurance adjuster went to an accident scene, took a picture of a damaged car, loaded it into his Windows Mobile database and then replicated that image up to the Insurance headquarters for approval. All of this could be done in a very short period of time when using images in the database. Another good example might be a doctor who was waiting for a patient chart to become available. If you could store the image in a database this chart could be sent down to the doctor's device once it became available.

For this article I am not going to get into how to synchronize the images to and from a remote and central database as this is typically fairly straightforward when using a data synchronization technologies like MobiLink

XML Reading and Writing

We learned to process XML files using the Document Object Model as implemented by the XmlDocument class. To go further and make XML friendlier, the .NET Framework provides many other classes for different purposes, allowing you to create and manage nodes from custom .NET classes.
Besides the XmlDocument and the derived classes of XmlNode, the .NET Framework provides the XmlTextWriter class, which is derived from XmlWriter. The XmlTextWriter class works in a top-down approach to create, or deal with, the contents of an XML file. This class writes an XML node and moves down without referring

Writing Http Handlers and Modules in IIS 7.5

This article describes how Http modules and handlers are to be written and configured in IIS 7.5. The concept of a handler and module remains same, so dose there programming model. In this section we start off with the concept of a Http module and a Http handler, then talk about how to code them and finally describe the two methods available to configure them.

file upload in chunks or not buffering in memory before writing to disk?


What are the options for handling file uploads to reduce the memory footprint?  Is there a way to upload in chunks?  Is there a way to stream upload directly to disk instead of loading entire file in server memory?


Writing codes using three tier architecture.


Hello all.

I am a beginner in c#.I heard that writing program with three tier architecture are easy and maintainable.

I just wanted to know with a small example on how to write three tier architecture programs.

Thanks :-)

Robotics: Writing and Testing VPL Services for Serial Communication


VPL, part of Robotics Developer Studio is intended for novice programmers, but is also useful for testing and prototyping. We write a simple serial port service that allows you to send and receive data.

Trevor Taylor

MSDN Magazine February 2010

Foundations: Writing More Efficient ItemsControls


Here Charles Petzold explains several techniques for improving the performance of ItemsControls.

Charles Petzold

MSDN Magazine March 2009

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend