locked
Windows Registry Problem RRS feed

  • Question

  • Hi! Recently i wrote a program that modifies the registry value mainly related to network configuration(for instance, some keys of HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\{[a service name here]} ). However after running this program, i can no longer config the ip address. In Vsita and Windows 7, it would cause a BlueScreen, in XP, it reports the address is illegal(while i am sure it is a correct one), and then Explorer stops responding... Later i found some keys' value(such as "IPAdress", "Gateway" of the key above) are attached with unkown characters, which are NOT generated by my program.
    Who knows why? Thanks for your help!
    Friday, August 7, 2009 5:19 AM

Answers

  • Hi ZQq_Eric,

    Thanks. Glad if it helped you in any way :).

    Unless you are you making your modifications from a driver or in kernel mode (or otherwise are working an an elevated IRQ level)? then you should not be experiencing memory syncronisation issues as the Registry API deals with such things (unless the machine itself is fundimentally misconfigured in some fashion).

    If you are working on accessing the registry from a driver or kernel component then make sure your operating at the correct request level to permit registry access and make sure you lock the registry using the appropriate calls before making changes (and unlock immidiately after completing the changes and don't make too many changes in one lock for system performance).
    • Marked as answer by ZQq_Eric Friday, September 18, 2009 10:18 AM
    Friday, September 18, 2009 6:25 AM

All replies

  • The problems you've caused are somewhat odd (e.g. BlueScreen in XP..  its hard to cause those by minor changes in the registry).

    Firstly, I have to state that your application should be interacting with the Windows API for configuring TCP/IP and not directly modifying the windows registry!

    That aside, I think it sounds like your problem might be your "string termination" in your application. You might be passing a string value which is not properly zero terminated (meaning you will be writing junk memory following your value to the registry in your application).

    KVK Consultancy's product "Registry Manager 2008" can help you inspect what you have written to the registry and you can then make a visual inspection to see if there is any unwanted data following your value (http://www.kvkconsultancy.co.uk/).

    Hope this helps,
    Kind Regards,

    V

    Thursday, September 17, 2009 7:43 PM
  • Thanks for your help! I do think I should not modify the registry directly.  However, I am sure that the string value was zero terminated after I debugged the program carefully. Maybe it is caused by the synchronization problem between the Regsitry and memory, which is suggested by some friends in another forum. I am not so sure anyway because it has referrence to the underlying mechanism of Windows Registry.
    Thank you, and your "Registry Manager 2008"!
    Friday, September 18, 2009 2:13 AM
  • Hi ZQq_Eric,

    Thanks. Glad if it helped you in any way :).

    Unless you are you making your modifications from a driver or in kernel mode (or otherwise are working an an elevated IRQ level)? then you should not be experiencing memory syncronisation issues as the Registry API deals with such things (unless the machine itself is fundimentally misconfigured in some fashion).

    If you are working on accessing the registry from a driver or kernel component then make sure your operating at the correct request level to permit registry access and make sure you lock the registry using the appropriate calls before making changes (and unlock immidiately after completing the changes and don't make too many changes in one lock for system performance).
    • Marked as answer by ZQq_Eric Friday, September 18, 2009 10:18 AM
    Friday, September 18, 2009 6:25 AM
  • Hi, KVK! I really appreciate your help!
    Well, my program is in fact a rather simple one that just invoke some APIs to modify the Registry. To tell the truth, I still got no clues why that would happen. And I think i will get to know the reason one day, as i am and will be learning the system or something alike, and that I get knowledge from the friends just like you on the Internet.
    So at this moment, I shall do more tries on a virtual machine.
    Thanks, sincerely.
    Friday, September 18, 2009 10:19 AM
  • Your most welcome Eric. Thanks :).
    Friday, September 18, 2009 10:27 AM