none
why Kernel Driver can not update registry value when it throw an exception? RRS feed

  • Question

  • This a test KMDF project. it's function is read and write registry.

    Test Case1:

    step1.read a registry value and write a value to registry

    step2.Check registry in windows, value updated.

    Test Case2:

    setp1.read a registry value and write a value to registry, add exception at end. BSOD happens when boot windows

    step2.remove exception, boot windows, check registry, value is not updated.

    These are the exception code i use.

        void GoException()
        {
        PDRIVER_OBJECT obj = NULL;
        obj->DeviceObject->CurrentIrp = NULL;
        }
    

    I have try two registry path.

    HKEY_LOCAL_MACHINE\SOFTWARE\DELL\test (normal path)

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TEST (service path)

    Monday, March 27, 2017 2:26 AM

Answers

  • Well you can't access HKLM\SOFTWARE at boot time at all.  On why things are not saved in the registry, until the system gets to a certain point in the boot nothing is saved.  Part of this is the consequence that the registry is saved in files in the file system, so until that is fully functional you don't have a place to save things.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Monday, March 27, 2017 11:53 AM

All replies

  • Well you can't access HKLM\SOFTWARE at boot time at all.  On why things are not saved in the registry, until the system gets to a certain point in the boot nothing is saved.  Part of this is the consequence that the registry is saved in files in the file system, so until that is fully functional you don't have a place to save things.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Monday, March 27, 2017 11:53 AM
  • thanks, Bon Burn

    both registry value can be updated without the exception.

    the reason is what you said, it need to get to a certain point to save changes.

    Tuesday, March 28, 2017 1:25 AM