registry

accessing HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData

心已入冬 提交于 2019-12-17 20:47:16
问题 Can anyone tell me why I can't access the registry key of "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData" ? if I query the GetSubKeysNames of "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer" it only returns one value being "Secure" ----> Where are all the other subkeys? Thanks. 回答1: High odds that you are running your program on the 64-bit version of Windows and it is forced to run in 32-bit mode. The registry redirector will make you

Early Binding of a C# COM library in VBA

半世苍凉 提交于 2019-12-17 20:25:44
问题 Although this is a long question the coding and testing part should be really easy to reproduce. I have created two separate Class Libraries in C# and I think I am running into a name collision problem caused by existing registry keys from my previous projects and trials. Here are my two classes: using System; using System.Runtime.InteropServices; namespace Test { [InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("ED5D264B-1D80-4A5D-9C14-8297D90B7037")] public interface ITest { // body }

How Can I Get My File Association to Open Multiple Files in a Single Program Instance?

泄露秘密 提交于 2019-12-17 19:59:23
问题 I have set up a file extension in the Registry for my program as Windows requires. In the Registry, under shell/open/command, I've got: "C:\MyProgramPath\MyProgram.exe" "%1" This works fine for me. When someone clicks on one or more files associated with my application, my application correctly opens the file(s) but each one is opened in a separate program instance. Is there any way I can do this and open up all files in one program instance? 回答1: You can when using DDE. See http://cc

Check if application is installed in registry

China☆狼群 提交于 2019-12-17 19:34:09
问题 Right now I use this to list all the applications listed in the registry for 32bit & 64. I have seen the other examples of how to check if an application is installed without any luck. string registryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"; RegistryKey key = Registry.LocalMachine.OpenSubKey(registryKey); if (key != null) { foreach (String a in key.GetSubKeyNames()) { RegistryKey subkey = key.OpenSubKey(a); Console.WriteLine(subkey.GetValue("DisplayName")); } } registryKey

How to decide where to store per-user state? Registry? AppData? Isolated Storage?

有些话、适合烂在心里 提交于 2019-12-17 18:08:09
问题 When should the Windows Registry be used for per-user state, and when should we use the filesystem, particularly the user's AppData folder? (eg, C:\Users\USERNAME\AppData). Where does Isolated Storage come in? Is there a pretty firm rule, or is it just a fuzzy thing, like "use the registry until it becomes too much data to store in the registry". or "use whatever you feel like using." Are there Windows logo requirements that affect the decision? If I use the AppData directory, how do I choose

Edit registry key of other user

痞子三分冷 提交于 2019-12-17 16:07:15
问题 How to change or edit registry values of other user than the current user? I know the credentials of that other user. 回答1: You can impersonate the user and then change the registry for that current context. Here are a couple of resources on C# and Impersonation: Windows Impersonation using C# Windows Impersonation from C# What you want to do is something like this (pseudo): using(var impersonation = new Impersonate(username,password)) { ChangeRegistry(keys, values); } And when the

Why is RegOpenKeyEx() returning error code 2 on Vista 64bit?

梦想与她 提交于 2019-12-17 16:01:14
问题 I was making the following call: result = RegOpenKeyEx(key, s, 0, KEY_READ, &key); (C++, Visual Studio 5, Vista 64bit). It is failing with error code 2 ("File not found") even though " regedit " shows that the key exists. This code has always worked on 32bit XP. Why is it "file not found" when it clearly is there? 回答1: I discovered that I could solve my problem using the flag: KEY_WOW64_64KEY , as in: result = RegOpenKeyEx(key, s, 0, KEY_READ|KEY_WOW64_64KEY, &key); For a full explanation: 32

Where to store program settings instead of HKEY_LOCAL_MACHINE?

那年仲夏 提交于 2019-12-17 15:37:36
问题 I have some program settings that are currently stored in HKEY_LOCAL_MACHINE. Due to Vista and locked down users, some users don't have permission to HKEY_LOCAL_MACHINE, and those values don't really belong to HKEY_LOCAL_USER either (it has to be the same for all users), what's the best alternative location for storing these? Majority of settings are stored in the DB already, but there are some that the program needs to know about before connecting to the DB. Ideally I'll like a way to

Reliable way to get Windows Version from registry

白昼怎懂夜的黑 提交于 2019-12-17 12:21:12
问题 I'm checking the windows version in an installer (made with NSIS) by checking the following registry key: HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "CurrentVersion" According to this post and this page from MSDN, the currentVersion number for Windows 10 should be 10.0. I just installed the Windows 10 Pro Insider Preview and the version number given in the registry is still 6.3, instead of 10.10 as it should. Is there another reliable way in registry to detect Windows 10? 回答1:

Read a Registry Key

六月ゝ 毕业季﹏ 提交于 2019-12-17 10:46:32
问题 I have a web application which is importing DLLs from the bin folder. const string dllpath = "Utility.dll"; [DllImport(dllpath)] Now what I want to do is first import the DLLs from a folder not in the current project but at some different location. The path of that folder is stored in a registry key. How should I do this? Edit : Why can't I work this out??? public partial class Reports1 : System.Web.UI.Page { RegistryKey registryKey = Registry.CurrentUser.OpenSubKey(@"Software\xyz"); string