Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. recursively search the registry and delete text found.

recursively search the registry and delete text found.

Scheduled Pinned Locked Moved C#
windows-adminhelpquestion
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Derek Smigelski
    wrote on last edited by
    #1

    I would like some help. I need source code that will recursively search the registry and delete text found. It would need to work on 95/98/NT/XP/2000. Any ideas? Any help is appreciated. Thank You, Derek

    S L 2 Replies Last reply
    0
    • D Derek Smigelski

      I would like some help. I need source code that will recursively search the registry and delete text found. It would need to work on 95/98/NT/XP/2000. Any ideas? Any help is appreciated. Thank You, Derek

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      I am not sure anyone is willing to share any code like that. Have you figured out that if you don't use safely and properly such code, you could break the entire operating system of end-users ?


      Back to real work : D-17.

      D 1 Reply Last reply
      0
      • S Stephane Rodriguez

        I am not sure anyone is willing to share any code like that. Have you figured out that if you don't use safely and properly such code, you could break the entire operating system of end-users ?


        Back to real work : D-17.

        D Offline
        D Offline
        Derek Smigelski
        wrote on last edited by
        #3

        Yes, but in my partular case the people that willo be using this are not end users, and are Microsoft Certified individuals, so That is not an issue. Any idea where such code could be found?

        L 1 Reply Last reply
        0
        • D Derek Smigelski

          Yes, but in my partular case the people that willo be using this are not end users, and are Microsoft Certified individuals, so That is not an issue. Any idea where such code could be found?

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          Derek Smigelski wrote: are Microsoft Certified individuals, so That is not an issue. Are you sure about that? :laugh: The ten finger virus can infect anyone, but being MCP's they should be comfortable with the registry editor already! :) "I dont have a life, I have a program."

          1 Reply Last reply
          0
          • D Derek Smigelski

            I would like some help. I need source code that will recursively search the registry and delete text found. It would need to work on 95/98/NT/XP/2000. Any ideas? Any help is appreciated. Thank You, Derek

            L Offline
            L Offline
            leppie
            wrote on last edited by
            #5

            Im sure it should be easy with the Registry and RegistryKey classes...and a bit of recursion. I wont test it though... :) "I dont have a life, I have a program."

            D 2 Replies Last reply
            0
            • L leppie

              Im sure it should be easy with the Registry and RegistryKey classes...and a bit of recursion. I wont test it though... :) "I dont have a life, I have a program."

              D Offline
              D Offline
              Derek Smigelski
              wrote on last edited by
              #6

              I'm new. Can you provide anyhelp or code? I will test it.

              L 1 Reply Last reply
              0
              • D Derek Smigelski

                I'm new. Can you provide anyhelp or code? I will test it.

                L Offline
                L Offline
                leppie
                wrote on last edited by
                #7

                OK, I suggest you register and get all the benefits of being a CP'ian :) but here you go. The FindKey method will print the location of a specified key name (not value, but thats easy too).

                private static void FindKey(RegistryKey key, string keyname)
                {
                string[] values = key.GetValueNames();
                for (int j = 0; j < key.ValueCount; j++)
                {
                if (values[j] == keyname) Console.WriteLine(key.Name);
                }
                string[] subkeys = key.GetSubKeyNames();
                for (int i = 0; i < key.SubKeyCount; i++)
                {
                try
                {
                FindKey(key.OpenSubKey(subkeys[i]), keyvalue);
                }
                catch (System.Security.SecurityException){}
                }
                }

                public static void Main(string[] args)
                {
                FindKey(Registry.CurrentUser, "LeppieRules");
                }

                It shouldnt be a problem to go from there. Remeber USE AT OWN RISK, I TAKE NO RESPONSIBILITY AT ALL. "I dont have a life, I have a program."

                1 Reply Last reply
                0
                • L leppie

                  Im sure it should be easy with the Registry and RegistryKey classes...and a bit of recursion. I wont test it though... :) "I dont have a life, I have a program."

                  D Offline
                  D Offline
                  Derek Smigelski
                  wrote on last edited by
                  #8

                  Will the code you provided find all text that I hardcode? From the top of the registry through the bottom, Dwords, text, values.. any text I find, I want to do an action.

                  D 1 Reply Last reply
                  0
                  • D Derek Smigelski

                    Will the code you provided find all text that I hardcode? From the top of the registry through the bottom, Dwords, text, values.. any text I find, I want to do an action.

                    D Offline
                    D Offline
                    Derek Smigelski
                    wrote on last edited by
                    #9

                    I'm looking to return a list (perhaps in a list box) of all keys (ALL TEXT) that were found. If that Text appears anywhere in registry I want it added to my list. Then I can select/deselect what I wish and then delete the selected items. Allow someone to highlight and delete specific ones.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups