Announcement

Collapse
No announcement yet.

How to get a file path from registry key for my uninstall program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get a file path from registry key for my uninstall program

    Im about to pull my hair out if I dont figure this out. How can I get the file path from a registry key then get the Icon to index it in my ListBoxEx plugin please help.

    ERROR AFTER ERROR!

    Code:
    [CODE]
    [/CODE]

    function FillProgramsList()
    ListBoxEx.DeleteItem("Plugin1",-1);
    ListBoxEx.SetUpdate("Plugin1", false);
    StatusDlg.Show();
    StatusDlg.SetTitle("Retrieving installed programs...");
    StatusDlg.SetMessage("");
    local tblKeys = Registry.GetKeyNames(HKEY_LOCAL_MACHINE,"SOFTWARE\ \Microsoft\\Windows\\CurrentVersion\\Uninstall");
    StatusDlg.SetMeterRange(1,Table.Count(tblKeys));
    local nCounter = 1;
    for i,Name in pairs(tblKeys) do
    StatusDlg.SetMessage(Name);
    StatusDlg.SetMeterPos(nCounter);

    -- Get the display name...
    local strDisplayName = GetItemForUninstallKey(Name,"DisplayName");


    if(strDisplayName ~= "")then
    --local tblKeys = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\"..strDisplayName, "InstallLocation", true);


    local strKeyName = Name;
    local strUninstallString = GetItemForUninstallKey(strKeyName,"DisplayName");

    local strPath = "";
    local strCmdLine = "";

    strPath, strCmdLine = SplitUninstallString(strUninstallString);
    -- An associative table (array)


    -- A numerically indexed table (array)



    for i, Path in pairs(Table.Count(strPath)) do
    Icon = GetIconIndex(Path);
    result = ListBoxEx.AddItem("Plugin1", strDisplayName, "", Name, "", Icon, LBXITEM_HTML, 0, nil, nil, nil);

    end


    else

    end;


    end

    nCounter = nCounter + 1;
    end
    StatusDlg.Hide();
    ListBoxEx.SetUpdate("Plugin1", true);
    Plugins:

    Bitmap (113 KB)

    ComboBoxEx (141 KB)

  • #2
    You should use code tags for posting code:

    PHP Code:
    [CODE] [/CODE
    This uses the Wow64 registry plugin but the AMS registry functions are nearly the same format:

    Code:
    --local Path = "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
    local Path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
    local X = Wow64.RegistryGetKeyNames(3,Path,0)
    for i,v in pairs(X) do
     local US = Wow64.RegistryGetValue(3,Path.."\\"..v,"UninstallString",true,0)
     if US ~= "" then
      local DN = Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayName",true,0)
      local PU = Wow64.RegistryGetValue(3,Path.."\\"..v,"Publisher",true,0)
      local DV = Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayVersion",true,0)
      local ID = Wow64.RegistryGetValue(3,Path.."\\"..v,"InstallDate",true,0)
      local IL = Wow64.RegistryGetValue(3,Path.."\\"..v,"InstallLocation",true,0)
      local VM = Wow64.RegistryGetValue(3,Path.."\\"..v,"VersionMajor",true,0)
      local VMI = Wow64.RegistryGetValue(3,Path.."\\"..v,"VersionMinor",true,0)
      local ES = Wow64.RegistryGetValue(3,Path.."\\"..v,"EstimatedSize",true,0)
      local DI = Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayIcon",true,0)
      -- do whatever here with the values.
     end
    end

    Comment


    • #3
      Thanks

      Thank you for the response this really helped but every time I refer to IL (install location) it returns nil error. NEW CODE:


      PHP Code:
      IL"";
      function 
      FillProgramsList()
          
      ListBoxEx.DeleteItem("ProgramsList",-1);
          
      ListBoxEx.SetUpdate("ProgramsList",false);
          
      StatusDlg.Show();
          
      StatusDlg.SetTitle("Initializing...");
          
      StatusDlg.SetMessage("");
          
      local tblKeys Registry.GetKeyNames(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
          
      StatusDlg.SetMeterRange(1,Table.Count(tblKeys));
          
      local nCounter 1;
          for 
      i,Name in pairs (tblKeys) do
              
      StatusDlg.SetMessage(Name);
              
      StatusDlg.SetMeterPos(nCounter);
      -- 
      Get the display name...
              
      local strDisplayName GetItemForUninstallKey(Name,"DisplayName");
              if(
      strDisplayName ~= "")then
      --local Path "SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
      str "";
      local Path "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
      local X Wow64.RegistryGetKeyNames(3,Path,0)
      for 
      i,v in pairs(X) do
       
      local US Wow64.RegistryGetValue(3,Path.."\\"..v,"UninstallString",true,0)
       if 
      US ~= "" then
        local DN 
      Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayName",true,0)
        
      local PU Wow64.RegistryGetValue(3,Path.."\\"..v,"Publisher",true,0)
        
      local DV Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayVersion",true,0)
        
      local ID Wow64.RegistryGetValue(3,Path.."\\"..v,"InstallDate",true,0)
        
      local IL Wow64.RegistryGetValue(3,Path.."\\"..v,"InstallLocation",true,0)
        
      local VM Wow64.RegistryGetValue(3,Path.."\\"..v,"VersionMajor",true,0)
        
      local VMI Wow64.RegistryGetValue(3,Path.."\\"..v,"VersionMinor",true,0)
        
      local ES Wow64.RegistryGetValue(3,Path.."\\"..v,"EstimatedSize",true,0)
        
      local DI Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayIcon",true,0)
        -- do 
      whatever here with the values.
        
      str IL..v.."\r\n";
        
      icon GetIconIndex(str);
       
       
      end
      end 
      Plugins:

      Bitmap (113 KB)

      ComboBoxEx (141 KB)

      Comment


      • #4
        Create a button and paste this on click:

        Code:
        local Path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
        local X = Wow64.RegistryGetKeyNames(3,Path,0)
        for i,v in pairs(X) do
         local US = Wow64.RegistryGetValue(3,Path.."\\"..v,"UninstallString",true,0)
         if US ~= "" then
          local DN = Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayName",true,0)
          local PU = Wow64.RegistryGetValue(3,Path.."\\"..v,"Publisher",true,0)
          local DV = Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayVersion",true,0)
          local ID = Wow64.RegistryGetValue(3,Path.."\\"..v,"InstallDate",true,0)
          local IL = Wow64.RegistryGetValue(3,Path.."\\"..v,"InstallLocation",true,0)
          local VM = Wow64.RegistryGetValue(3,Path.."\\"..v,"VersionMajor",true,0)
          local VMI = Wow64.RegistryGetValue(3,Path.."\\"..v,"VersionMinor",true,0)
          local ES = Wow64.RegistryGetValue(3,Path.."\\"..v,"EstimatedSize",true,0)
          local DI = Wow64.RegistryGetValue(3,Path.."\\"..v,"DisplayIcon",true,0)
          Dialog.Message("Details","Display Name: "..DN.."\nUninstall String: "..US.."\nIcon Path: "..DI.."\nInstall Date: "..ID)
         end
        end
        make sure the wow64 plugin is installed and activated from Project>Plugins then preview the project and press the button, you'll note it works just fine and if a value is not set you get a blank string so it wont error out.

        Post a sample project if you keep getting stuck.

        Comment


        • #5
          Ok

          Will do when I get around to trying it again. Right now im making some plugins for AutoPlay Media Studio finally some new plugins one should be done by tomorrow!
          Plugins:

          Bitmap (113 KB)

          ComboBoxEx (141 KB)

          Comment

          Working...
          X