Thread: Question about Win32 registry programming

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    42

    Question about Win32 registry programming

    Hi you guys, I want to implement a function that can monitor changes of some key's value in registry real time. Who know are there any Win32 APIs can do this job whatever the APIs are documented or undocumented. If there are no actual APIs exist, does any other ways can do the job?

    Thanks a lot.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    There is no API function to monitor a registry key.

    The easiest way to accomplish what you are trying to do is to check the registry value every couple seconds to see if its value has changed.

    If you want to know anytime a value is changed without polling the values, then you would have to write a hook which captures all calls to RegSetValue(), and RegSetValueEx().

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    42
    hook.....

    which way will be more effective? I can't make sure the actual frequency of data's change.

    1. Write all changeable data to a file, and use Win32 API to monitor the file's change.
    2. Write a hook to capture all calls to RegSetVlaue() and RegSetValueEx().

  4. #4
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    I'm writting (quite finished) a program that opens a popup with

    "Allow the applicationX to start at startup?"

    YES NO

    or

    "Allow the applicationY to modify the antivirus or firewall?"

    YES NO

    for every modification involved in Auto Startup. (reg keys and files)
    It also looks and takes care about antivirus and firewall databases.
    The program it is supposed to help ppl against virus, worms and spywares that tryes to modify av and fw and to auto startup.

    I've wrote about 1000 code lines and 'm at 60%. (it works great!!)

    I've used both of "your" ideas..for reg mod you can use RegNotifyChangeKeyValue... (quite an hook for reg modifications..), then I compare the files I've created as buffer and backup
    Last edited by BianConiglio; 10-15-2004 at 02:59 AM.
    This forum is the best one I've ever seen. Great ppl, great coders

  5. #5
    Registered User
    Join Date
    Jun 2004
    Posts
    42
    thanks a lot.

    RegNotifyChangeKeyValue is similar with ReadDirectoryChangeW

  6. #6
    Registered User
    Join Date
    Jun 2004
    Posts
    42
    P.S. ppl is what ? I'm curious......

  7. #7
    Registered User
    Join Date
    Mar 2004
    Posts
    161
    ppl = people
    This forum is the best one I've ever seen. Great ppl, great coders

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using standard C fscanf function with win32 save dialog
    By korbitz in forum Windows Programming
    Replies: 1
    Last Post: 04-08-2004, 03:31 PM
  2. Problem with the registry
    By neandrake in forum Windows Programming
    Replies: 1
    Last Post: 03-03-2004, 06:41 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. opengl DC question
    By SAMSAM in forum Game Programming
    Replies: 6
    Last Post: 02-26-2003, 09:22 PM
  5. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM