delreg section in INF not truly deleting registry entry

Discussion in 'Windows Vista Drivers' started by Bill McKenzie, Oct 11, 2007.

  1. I have a heisenbug I could use help on.

    I have service that creates several registry keys. The service has an
    associated INF file which has a DefaultUninstall section which is called by
    our product's installer when removing the service. The DefaultUninstall
    section calls out a delreg section which deletes about 20 keys from the
    registry. All but one of these keys gets deleted correctly.

    Now for the heisenberg portion of the bug. The installer prompts the user
    for a reboot at then end of the removal process. If I pull up regedit
    before saying yes to the reboot, the key in question is indeed not in the
    registry any longer and is not when the system comes back from reboot. If I
    do not pull up regedit and just reboot, the key is still present when the
    system comes back from reboot. Obviously, regedit is causing the change to
    be permanent in some way.

    Is there some lazy write problem here? Is there a way from the INF I can
    flush or commit the reg changes?


    Bill M.
    Bill McKenzie, Oct 11, 2007
    1. Advertisements

  2. Maybe regedit blocks the attempts of other processes to delete its
    current-under-cursor key?
    Maxim S. Shatskih, Oct 11, 2007
    1. Advertisements

  3. Intuitively I would have felt the same way, i.e. if some process has a
    registry key open then the key might not be deleteable, even though there's
    no intentional locking built into the registry.

    However, if you reread the original posting, you'll see that the actual
    problem is exactly the opposite. Any ideas of how that came about?
    Norman Diamond, Oct 12, 2007
  4. It seems the service had some type of hold on the key. I originally assumed
    this could not be the case as the delreg directive is called out in and
    uninstall section which also uninstalls the service. Then when I saw the
    key removed from regedit it seemed to confirm that the service was not
    holding the key. This was wrong. If I set the flag to stop the service in
    the delservice section I can remove the key. I can't do this in practice
    with this particular service though. Anyway, now that I know what is going
    on I have a way around it. This is still weird though...don't know why
    opening and viewing the key with regedit changed the behavior....that
    doesn't really make sense to me still.

    Bill M.
    Bill McKenzie, Oct 15, 2007
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.