Read Registry from PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pritipshah
    New Member
    • Sep 2007
    • 11

    Read Registry from PHP

    Hello All,

    I want to Access Registry from PHP script. I had sreach on net and I got Class for this which is as below.
    [code=php]
    <?php
    class Registry {
    private $vars = array();
    function set($key, $var) {
    if (isset($this->vars[$key]) == true) {
    throw new Exception('Unab le to set var `' . $key . '`. Already set.');
    }

    $this->vars[$key] = $var;
    return true;
    }

    function get($key) {
    if (isset($this->vars[$key]) == false) {
    return null;
    }

    return $this->vars[$key];
    }

    function remove($var) {
    unset($this->vars[$key]);
    }


    /*}*/
    }

    $registry = new Registry;

    //Set some data
    //$registry->set ('name', 'Priti Shah');

    //Get data, using get()
    echo $registry->get ('name');

    //Get data, using array access
    echo $registry['name'];



    ?>[/code]

    But this will just set KEY to Array and read it from Array. I want to read KEY from regedit.

    Please help me out soooon .........

    Regards,
  • Weisbartb
    New Member
    • Aug 2007
    • 36

    #2
    You would need to open the files were the windows registry is stored Ntuser.dat and Usrclass.dat as I remember. Then you would need to write a class that could read the binary steam from windows registry and turn it into a php array.

    I can't even point you in the right direction in order to find a place that would have documentation on how to decode those files. May be someone else here can.

    Comment

    • pritipshah
      New Member
      • Sep 2007
      • 11

      #3
      Thank you,

      But i can't event got what you say because i am very new for dealing with registry.so can you please explain me as simple as you can??? may be i can make some idea from that....

      Or please anyone who know sonlution for this HELP ME OUT...

      Regards,

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Heya, Pritipshah. Welcome to TSDN!

        Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.

        You may need to use an external program and call it using exec().

        Comment

        • Weisbartb
          New Member
          • Aug 2007
          • 36

          #5
          I found this http://www.robvanderwoude.com/regedit.html earlier today. It might help you with console output aswell as what to send to
          Code:
          exec();
          . I highly recommend against doing this as a security expert.
          ~
          Brian W.
          Last edited by Weisbartb; Sep 2 '07, 06:40 AM. Reason: forgot sig

          Comment

          Working...