EMPHYRIO'S Bits & Bolts | Goodies

 

About the Author

Emphyrio is a alias choosen by
Onsia Patrick after a novel
by Jack Vance.

Patrick lives in Belgium, Mechelen and his native language is Dutch...
» Read More

Emphyrio

Onsia Patrick

 


Meta

Goodies... <next>

This space gonna be filled as time goes by....

 

Web building
W3C Validator Convert PNG > ICO HTML Colors
CSS Tab Designer    
   

Varia
ConTEXT Convert PNG > ICO HTML Colors
The Gimp Gliffy PhraseExpress
Icon Finder NuciaDev * YUMI
Dev Center Windows HelpNDoc PortableApps.com
Productivity Power Tools
Set "Alligntool" off, because it clashes with [
Sysinternals Suite Sandcastle Help File Builder
Handle v3.5 command prompt has been disabled Verbs and File Associations
   

Pogramming
PASTEBIN Log Parser 2.2 Log Parser examples
Tlbimp.exe Updating the registry using .NET and LogParser ColorPic
UAC Elevation Official C# Site Weblog Define permissions
USB Devices C# Documenting and Commenting Problems with listing registry values C#
Generic C# function for reading a value from registry .Net Compilation, registry accessing and application deployment for both x86 and x64 environments How to read the 32 bit part (Wow6432Node) of the registry from a x86 or x64 C# .net 3.5 application
CheckedListBox Class LINQPad Execute a Command in C#
Application Delete Changing Language Open Help file on F1
Mark folders for deletion Copy Directory in .Net C# including sub-folders DotNetZip - Zip and Unzip in C#, VB, any .NET language
Converting BBCode into HTML ReSharper Web Help C# Webclient downloading multiple files
Product Key Activation System C# Reference SW Rules to Better Windows Forms Applications
Visual C# Kicks How can I add a context menu to a ListBoxItem? How to Sign and Verify the signature with .NET and a certificate
Using the Visual C# Development Environment Find installed browser version from Registry Accessing alternative data-streams of files on an NTFS volume
How I can to protect my work in the freelance world?    
   

 

Registry

 

.NET app compiled for "x86":
Always 32-bit
On 32-bit platforms, accesses 32-bit registry
On 64-bit platforms, accesses 32-bit registry (inside Wow6432Node)
64-bit registry inaccessible (without doing something weird)

.NET app compiled for "x64"
:
Always 64 bit
On 32-bit platforms, won't run
On 64-bit platforms, accesses 64-bit registry (not inside Wow6432Node)
If you want to get to the 32-bit registry, you need to do something weird

.NET app compiled for "AnyCpu"
Either 32 or 64 bit depending on platform
On 32-bit platforms, accesses 32-bit registry
On 64-bit platforms, accesses 64-bit registry (not inside Wow6432Node)

NET 4.0 has updated mscorlib to include the "Microsoft.Win32.RegistryView" enum which includes:
Registry.Default, Registry.Registry32, Registry.Registry64.

This eliminates the need to call the unmanaged RegOpenKeyEx in advapi32.dll via P/Invoke; thus, the process is now managed.
The Registry.Default will obviously use the RegistryView for the bitness of the .exe it is running in - NOT the bitness of the OS.
Remember that if you compile to "AnyCPU" and run on x64, your inherently using Registry64.

A sample of how to use this follows:

// Use the default bitness of the .exe
var registryBase = RegistryKey.OpenBaseKey( RegistryHive.LocalMachine, RegistryView.Default );

// Use the 32-bit (WOW) registry
var registryBase32 = RegistryKey.OpenBaseKey( RegistryHive.LocalMachine, RegistryView.Registry32 );

// Use the 64-bit registry
var registryBase64 = RegistryKey.OpenBaseKey( RegistryHive.LocalMachine, RegistryView.Registry64 );

Registry.Registry32 will navigate to "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node".
Note that you can access Registry.Registry32 from a 64-bit app if necessary.
However, access to Registry.64 is NOT permitted from a 32-bit app!

 

This website and all of his contents are under copyricht by Emphyrio © 2012
Nothing may be used in any form without permission of the Webmaster.
Back to Top