.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

Windows 7 64bit Registry access using x86 assembly

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :.NET Framework
Hi guys, I have an assembly that is complied in x86 release mode. The assembly tries to access  a particular registry key in Win7 the key is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion  -> ProductID(tried to read this value) As the assembly is in x86 it tries to look for the key in SysWow64 node HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion -> ProductID(tried to read this value) When i went through the registry i found that the string "ProductID" is missing (!) .. (may be because i have trial version of windows 7 x64)? I just wanted to ask , is there a way to read registry key (not in wow6432node ) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion  -> ProductID  in x86 mode? Im using the following  code RegistryKey regkey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", false); //reads in wow6432Node for x86 assembly string strProductID = string.empty; if (((regkey != null))) { // Get key Value of ProductId. strProductID = (string)regkey.GetValue("ProductId"); if ((string.IsNullOrEmpty(strProductID))) { //try reading another path for "ProductID" } } return strProductID ; PS:When i complie the same assembly as "Any Cpu" , the above code returns corr

View Complete Post

More Related Resource Links

Access Control: Understanding Windows File And Registry Permissions


Understanding the ACLs that govern permissions and rights before an operation is allowed to proceed is critical to enhancing security.

John R. Michener

MSDN Magazine November 2008

Using windows authentication to access SQL when using ASP.NET 4.0 via COM+


I am using SQL Server 2008 under windows authentication, front end is ASP.NET which uses COM+ to access database.

COM+ components are configured to run as domain user.

When looking through the logs (SQL Profiler), I can see the login name as the configured identity instead of windows indentity.

I have got Website running under "Intergrated Windows Authentication" and database is running locally on webserver.

Web configure contains entry for <identity impersonate="true"/>.

My connection string is

connectionString="data source=db01\test01;initial catalog=test; integrated security=SSPI;persist security info=False; Trusted_Connection=Yes"

Any ideas?




Safety in Windows: Manage Access to Windows Objects with ACLs and the .NET Framework


Until now, Microsoft did not provide explicit support in the .NET Framework for manipulating security settings. With the .NET Framework 1.x, access can only be granted to users via a series of cumbersome P/Invoke calls. By introducing the concepts of security objects and rules, the .NET Framework 2.0 allows developers to manipulate security settings of objects in a few easy steps using managed code. Want to know more? Read on.

Mark Novak

MSDN Magazine November 2004

Windows 2000 Registry: Latest Features and APIs Provide the Power to Customize and Extend Your Apps


The Windows registry as it is recognized today first appeared in Windows 95. Its introduction simplified the storage of initialization information and made that data more secure. This article covers the history of the registry, the form it took in the early days, and its current incarnation in Windows 2000. Practical tips for managing data in the registry are outlined, along with descriptions of special keys, functions, and file types. Manipulation of the registry to customize both application behavior and certain features in Windows is discussed. Also covered are future directions of the registry, including the use of XML to store registry information in a hierarchical fashion.

Dino Esposito

MSDN Magazine November 2000

Programmatic access to Assembly Version in Product Properties?

Using VS2008 and would like to get programmatic access to the Assembly Version property in my Project Properties but I can't seem to find a way to do this. Any suggestions? The project is a .dll and I want to expose this version information to the caller in my interface section as a string.

gdi32.dll + unsafe code on 32+64Bit Windows

Which target cpu should I use to compile a .NET 3.5 app (developed on a 32 Bit System) that contains an assembly which uses [DllImport("gdi32.dll")] static extern IntPtr CopyEnhMetaFile(IntPtr hemfSrc, IntPtr hNULL); and which also has the option checked: "Allow unsafe code" because of the following code: ((byte*) dst.Scan0.ToPointer())[(dst.Stride*y) + x] =... so that the app is able to run both on 32 and 64 Bit Windows ? If the answer is "x86", does it mean that all referenced assemblies of the app have to be compiled with "x86" or just the "app.exe" ? Thanks.

The condition of creating assembly for external access permission?

To create an EXTERNAL_ACCESS or UNSAFE assembly in SQL Server, one of the following two conditions must be met: 1. The assembly is strong name signed or Authenticode signed with a certificate. This strong name (or certificate) is created inside SQL Server as an asymmetric key (or certificate), and has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission (for external access assemblies) or UNSAFE ASSEMBLY permission (for unsafe assemblies). 2. The database owner (DBO) has EXTERNAL ACCESS ASSEMBLY (for EXTERNAL ACCESS assemblies) or UNSAFE ASSEMBLY (for UNSAFE assemblies) permission, and the database has the TRUSTWORTHY Database Property set to ON. The two conditions listed above are also checked at assembly load time (which includes execution). At least one of the conditions must be met in order to load the assembly. This is a explanation on msdn.I think if only one of these condition is met,it will work. But after I do the first condition,I still can not create an assembly with EXTERNAL_ACCESS permission except SET TRUSTWORTHY on. should the two condition be met?  

Remote access to SQL-Server 2008 R2 on Windows Server 2008 denied

Hello, after successful installation of SQLServer 2008 R2 and providing my account as a 'sysadmin' I failed to access the server from a management studio of a SQL-Server 2005 release installation. The TCP/IP access is enabled and the server is configured to allow access from remote connections.  The error message reads a follows: ' A network-related or instance-specific error occured while establishing a connection to SQL Server. The server was not found or was not accessible. Verify ... (Provider: Named Pipes Provider, error 40 - Could not open a connection to SQL Server)(Microsoft SQL Server, Error:2)' Accessing the SQL-Server by the management studio from the local host works fine but trying to acces by command line using the '-E' parameter fails. Is there any additional configuration on the operation system level needed to open a SQL-Server 2008 instance to be selected by other members of  domain groups from the non-local host? Thank you for the answer  

Why windows service Looks for "Classlibrary2.resources Version=" assembly in resolver eve

In a simple Windows Service project, I have got below code. namespace WindowsService1 {     static class Program     {         /// <summary>         /// The main entry point for the application.         /// </summary>         static void Main()         {             System.Diagnostics.Debugger.Launch();             AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);             ClassLibrary2.Class1.Hello();         }         private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)         {             return null;         }     } } Here "ClassLibrary2" is a simple class library project with couple resources and single class. No other settings are set. After installing WindowsService1, on starting the s

Migration of DSN use for SQL Server access from Windows SP-3 clients to Windows 7 64 bit client

We have numerous apps which use a named DSN using SQLSRV32.dll for an ODBC connection from our Windows XP-Pro SP3 32 bit machines client access to remote windows 2003 based SQL servers (mix of 2005 and 2008).  On migrating to Windows 7, this dll will not allow the apps to use the newly constructed DSN (using SQLSRV32.dll with ODBC), even though a test connection is sucessful (abbeit much slower than seen on the XP-Pro machines).  What must I use on the Windows 7 64 bit machine to allow a DSN to be used by the migrated apps?  - I have descerned through Google that WDAC is now the tool to use, but I am cluless how to use it. - The expectations from the app on the Windows XP-Pro and on the Windows 7 64 bit machines is to use a DSN to connect to SQL servers on Windows 2003. I would appreciate any advice, and thanks!

is SQL 2000 32 bit supported on Windows 2008 R2 64bit?

Question as stated. Could anyone provide an official source from MS, wether is supported or not supported. Really appreciate it.

The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:\WINDOWS\assembly\GAC_MSIL\

Dear, I have vs2005 and vs2008 in server machine. everything is fine. but when i want creating crystal report in vs2008 i got this problem. i have no CrystalDecisions.Web.dll in webs bin directory. and no multiple version in web.config file. how can i solve this. plz reply quick.   Jewel

How to access RAM above 32gb on Windows 2003 Server Standard x64?

My employers went and maxed out their database server for RAM to 64gb from 32gb. It's running SQL Server 2005 x64 on Windows 2003 Server Standard x64. As far as i'm aware of, 32gb is the RAM limit for the OS but does sql server have the ability to see beyond this limit? I'm about to ship the RAM back... Any insights would be greatly appreciated!

Error while trying to register DLLs for Microsoft Jet on Windows Server 2008 R2 64bit

Hello! I'm having issues with importing Excel spreadsheets into Microsoft SQL Server 2005 on a Windows Server 2008 R2 64bit server.  After browsing the web, it appears that the problem is with the DLL's used by Microsoft Jet.  I've thus attempted to re-register these DLL's.  However, I am receiving the following results. c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjetoledb40.dllSuccessful c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjet40.dllSuccessful c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjint40.dllThe module "msjint40.dll" was loaded but the entry-point DLLRegisterServer was not found c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjter40.dllThe module "msjter40.dll" was loaded but the entry-point DLLRegisterServer was not found c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\msjtes40.dllSuccessful c:\Windows\SysWOW64> regsvr32 c:\Windows\SysWOW64\mswstr10.dllThe module "mswstr10.dll" was loaded but the entry-point DLLRegisterServer was not found I've set the application pool for this site to use 32bit.  Please note that due to my role on the team, other options such as using ACE are not available to me, unless I can prove that I've exhausted all other options. Thoughts? Thanks,Mike

Query crashes in MSAccess 2007 and 2010 on Windows 7 64bit, but works on 32 bit

Hello. I have a prepared a Database that contains 2 tables, and a Query. If you execte the query (Just a very simple join with a few where statments) Windows 7 crashes in 64 bit, but not on a 32 bit platform. Unfortunatly the Database has 300MB and is to big to be uploaded here. So if there is anyone interested at MS to get my Database, please feel free to contact me serge.dornseiffer@sdna.lu

The performance counter registry hive is corrupted on Windows 2008 R2 Foundation 64Bits

Hello, I know we have a few posts about this but not exactly about this windows version. I tried: http://support.microsoft.com/kb/300956 But nothing!... :( Could someone help me? Thanks, Renato
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