logo
down
shadow

Custom action cannot access registry key for read


Custom action cannot access registry key for read

By : DesertCamel
Date : November 22 2020, 03:01 PM
wish help you to fix your issue If there is not a Key then prnKey = null so, if it is not a permision problem, then it should that key is not available there. What you shoul aware of build with x86 and run it on a x64 may gives you some trouble. Because the path is not same. either you have to build for correct configuration or Try explicit open
code :
RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64)


Share : facebook icon twitter icon
Custom action in a msp fails to add to registry (UAC restricts executions of some parts of custom action)

Custom action in a msp fails to add to registry (UAC restricts executions of some parts of custom action)


By : pattinson.kelvin
Date : March 29 2020, 07:55 AM
should help you out This isn't a problem with UAC, this is a problem with poor installation authoring. If you used the Registry table you wouldn't have this problem.
Custom actions must be scheduled in the install execute sequence between InstallInitialize and InstallFinalize with the options of Deferred in the System Context (No Impersonation ) to be properly elevated.
How to add really long hexadecimal registry in custom action in wix installer?

How to add really long hexadecimal registry in custom action in wix installer?


By : atomicbee
Date : March 29 2020, 07:55 AM
around this issue Try this code. This is the correct way to write to registries from wix.
code :
 <RegistryKey Root="HKCU"
                 Key="SOFTWARE\Intel\Display\igfxcui\HotKeys">
        <RegistryValue Name="9530"
                       Action="write"
                       Value="LONG HEXADECIMAL VALUE"
                       Type="binary"
                       KeyPath="yes" />
      </RegistryKey>
Unable to read registry: System.Security.SecurityException, Requested registry access is not allowed

Unable to read registry: System.Security.SecurityException, Requested registry access is not allowed


By : Andy Nobes
Date : March 29 2020, 07:55 AM
it helps some times There is an overload of the OpenSubKey(..)-Method that allows to add a third parameter. You could try passing RegistryRights.ReadKey with that one and see if that solves the issue.
code :
baseReg.OpenSubKey(
    RegKey, 
    RegistryKeyPermissionCheck.ReadSubTree
    RegistryRights.ReadKey);
baseReg.OpenSubKey(RegKey, false); 
Installer custom action can't read all registry values

Installer custom action can't read all registry values


By : user5203804
Date : March 29 2020, 07:55 AM
I wish this help you After a ton of research and work on this, I believe I figured out the issue.
Apparently, any custom actions built in a setup project in Visual Studio run as a generic SYSTEM account. So, the HKCU registry hive is that of the SYSTEM account and not the currently logged in user. It is possible, however, to circumvent this behavior.
code :
// CustomAction_Impersonate.js <msi-file>
// Performs a post-build fixup of an msi to change all deferred custom actions to Impersonate
// Constant values from Windows Installer
var msiOpenDatabaseModeTransact = 1;

var msiViewModifyInsert         = 1
var msiViewModifyUpdate         = 2
var msiViewModifyAssign         = 3
var msiViewModifyReplace        = 4
var msiViewModifyDelete         = 6

var msidbCustomActionTypeInScript       = 0x00000400;
var msidbCustomActionTypeNoImpersonate  = 0x00000800

if (WScript.Arguments.Length != 1)
{
       WScript.StdErr.WriteLine(WScript.ScriptName + " file");
       WScript.Quit(1);
}

var filespec = WScript.Arguments(0);
var installer = WScript.CreateObject("WindowsInstaller.Installer");
var database = installer.OpenDatabase(filespec, msiOpenDatabaseModeTransact);

var sql
var view
var record

try
{
       sql = "SELECT `Action`, `Type`, `Source`, `Target` FROM `CustomAction`";
       view = database.OpenView(sql);
       view.Execute();
       record = view.Fetch();
    //Loop through all the Custom Actions
       while (record)
       {
           if (record.IntegerData(2) & msidbCustomActionTypeInScript)
           {
               //We must flip the msidbCustomActionTypeNoImpersonate bit only for deferred custom actions
               record.IntegerData(2) = record.IntegerData(2) & ~msidbCustomActionTypeNoImpersonate;
              view.Modify(msiViewModifyReplace, record);
           }
        record = view.Fetch();
       }

       view.Close();
       database.Commit();
}
catch(e)
{
       WScript.StdErr.WriteLine(e);
       WScript.Quit(1);
}
How to read certain registry key from Wix managed bootstrapper or custom action?

How to read certain registry key from Wix managed bootstrapper or custom action?


By : c.wilson
Date : March 29 2020, 07:55 AM
I wish this help you Debugging Managed Code Custom Actions: Not quite clear what the problem is? The read does not work as a custom action? Try showing a message box from the custom action and then attach the debugger to the rundll32.exe process running managed code. Then you can step through the code using Visual Studio in normal "debug fashion". Here is a nice video from Advanced Installer showing you how to do this: Debug C# Custom Actions.
Registry Read: Once you have debugability, it should be possible to work out what the cause is of whatever problem it is that you are seeing.
shadow
Privacy Policy - Terms - Contact Us © voile276.org