registry

RegistrySecurity Access is denied. C#

对着背影说爱祢 提交于 2020-02-15 07:30:53
问题 I'm currently having an issue when writing an app to set permissions on some Legacy keys. Legacy keys are quite locked down and to actually modify them in regedit you have to take ownership and then add yourself with full control. When trying to replicate this in code i cannot get the key for write with the error "Access is denied". Example code: RegistrySecurity rs = new RegistrySecurity(); rs.AddAccessRule(new RegistryAccessRule("Administrators", RegistryRights.FullControl,

How can I find the upgrade code for an installed application in C#?

雨燕双飞 提交于 2020-02-09 10:17:13
问题 I am using the C# wrapper for the Windows Installer API from the WIX Toolset. I use the ProductInstallation class to get information about the installed products such as the product code and product name. For example Product Name - "My Test Application" Product Code - {F46BA620-C027-4E68-9069-5D5D4E1FF30A} Product Version - 1.4.0 Internally this wrapper uses the MsiGetProductInfo function. Unfortunately this function does not return the product's upgrade code. How can I retrieve the upgrade

Registry in .NET: DeleteSubKeyTree says the subkey does not exists, but hey, it does!

旧时模样 提交于 2020-02-02 02:54:06
问题 Trying to delete a subkey tree: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.hdr . .hdr subkey has one subkey, no values. So I use this code: RegistryKey FileExts = Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts"); RegistryKey faulty = FileExts.OpenSubKey(".hdr"); Debug.Assert (faulty != null && faulty.SubKeyCount != 0); faulty.Close(); FileExts.DeleteSubKeyTree(".hdr"); And I get the ArgumentException with

COM Exception - TYPE_E_CANTLOADLIBRARY?

时光怂恿深爱的人放手 提交于 2020-01-28 10:47:05
问题 I am using a COM dll in my .Net web application. This works fine on multiple different machines. However on one particular machine I get the following error: Unable to cast COM object of type 'CServer.CApplicationClass' to interface type 'CServer.ICApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CF0DFA28-046B-4C7D-8AA9-F4B7477D8CAE} ' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT

Add a firefox webextension when installing the native host application

别等时光非礼了梦想. 提交于 2020-01-24 19:35:07
问题 I have created a firefox webextension that communicates with a native host application. I also have created an installer for the native host application. Is there a way to enable the extension on the firefox when installing the native host application, via windows registry maybe. Thanks in advance. 回答1: You can install using the registry, as documented at: https://developer.mozilla.org/en-US/Add-ons/Adding_extensions_using_the_Windows_registry For general instructions that include platforms

netsh acl setting (need alternative method - registry settings?)

南楼画角 提交于 2020-01-24 14:33:27
问题 I am using inno-setup to install a program that needs to unblock port 4326 on Win7 (permit acl access) so that GET operations can be done over HTTP to port 4326. I have a powershell script that an admin can run to unblock the port. But this does not work as an inno-setup [run] command (because the local machine usually disables scripts from running). (i.e powershell.exe -nowait & script.ps1) Is there some registry keys in the target machine that I can set that will unblock the port? That I

Setting windows system PATH in Registry via Python winreg

不问归期 提交于 2020-01-24 14:17:29
问题 I've written a program to add directories to the PATH variable via the registry, either the HKCU(user) or HKLM(system) path, depending on an input option. It works fine when using the User path. However, when setting the path for the System, Windows acts as if the path variable is empty, e.g. 'notepad' is not recognized as an internal or external command.... However, echo %path% prints everything out appropriately, without any syntax errors. Similarly, if I view the variable in the System

Create a registry key/string with Go

ぐ巨炮叔叔 提交于 2020-01-24 14:05:07
问题 I was following this document to create a key/string in windows registry with this code snippet: package main import ( "golang.org/x/sys/windows/registry" "log" ) func main() { k, err := registry.OpenKey(registry.CURRENT_USER, `Software\Microsoft\Windows\CurrentVersion\Audio`, registry.QUERY_VALUE) if err != nil { log.Fatal(err) } k.SetStringValue("xyz", "blahblah") err = k.Close() if err != nil { log.Fatal(err) } } but nothing happens, without any errors. Edit (clarification): It doesn't

Long path \\?\ workaround not working on some installs

£可爱£侵袭症+ 提交于 2020-01-24 04:03:33
问题 The app I'm working on needs to handle files with very long file/path names. It's a .Net 4.6 application so I've implemented the pre-4.6.2 workaround to allow the \\?\ syntax as outlined here and here. This is the code I'm using to enable the feature (I can't modify the app.config so this has to be set in code): var type = Type.GetType("System.AppContext"); if (type != null) { AppContext.SetSwitch("Switch.System.IO.UseLegacyPathHandling", false); AppContext.SetSwitch("Switch.System.IO

Long path \\?\ workaround not working on some installs

与世无争的帅哥 提交于 2020-01-24 04:03:23
问题 The app I'm working on needs to handle files with very long file/path names. It's a .Net 4.6 application so I've implemented the pre-4.6.2 workaround to allow the \\?\ syntax as outlined here and here. This is the code I'm using to enable the feature (I can't modify the app.config so this has to be set in code): var type = Type.GetType("System.AppContext"); if (type != null) { AppContext.SetSwitch("Switch.System.IO.UseLegacyPathHandling", false); AppContext.SetSwitch("Switch.System.IO