can't delete USB registry items...

Discussion in 'Windows Vista Drivers' started by Daniel Miller, Feb 22, 2005.

  1. I suspect that this is not quite the correct group for this question.
    Unfortunately, it is the only MSDN Managed group which is related to the
    DDK, so I'm stuck here; I hope someone from MS will assist me.

    My specific issue that I have is this: we have a USB tester which can
    operate on 12 USB devices at a time. Typically the user will start with
    a raw part which will have vendor/product ID, but no other internal data.
    They then perform a low-level format on the part, which assigns a device
    serial number and other SCSI data. The problem is this:

    Every time a USB device is inserted in a Windows machine, several
    registry entries are created... at a minimum, there are:

    HLKM:SYSTEM\CurrentControlSet\Enum\USB entries
    HLKM:SYSTEM\CurrentControlSet\Enum\USBSTOR entries
    HLKM:SYSTEM\CurrentControlSet\Control\DeviceClasses\{deviceClassGUID}
    entries

    and several others. Each of these is hundreds of bytes in size.

    This will create one set of data before the low-level format, and
    *another* full set after the format, because the device now is recognized
    by its serial number instead of its physical address.

    Now, this is all just for ONE device. In a fully-operational production
    environment, the user can put 15000 parts/day through the machine.

    Just think of what the registry will look like after a week or two of
    this, let alone a couple of years... the machine quickly starts slowing
    down, and we know that eventually, when the registry gets too bloated,
    Windows just stops functioning.

    So I need to develop some method of stripping out old registry entries,
    once I manage to determine all of the entries that I need to be concerned
    about. I tried doing this with the registry management functions,
    including either SHDeleteKey or RegDeleteKey, but I have two sets of
    problems with this; the first is permissions, the second is that even
    after I change the permissions, the delete-key functions still fail,
    though I can manually delete the keys using RegEdit.

    I've found that reg.exe can even delete these items, at least once I've
    changed the permissions for Everyone; is there some way I can either get
    source code for reg.exe, or at least find out how it is doing this??

    Dan Miller
     
    Daniel Miller, Feb 22, 2005
    #1
    1. Advertising

  2. Daniel Miller

    cristalink Guest

    > I've found that reg.exe can even delete these items, at least once I've
    > changed the permissions for Everyone; is there some way I can either get
    > source code for reg.exe, or at least find out how it is doing this??


    RegDeleteKey cannot delete a key with subkeys. Try SHDeleteKey instead or
    call RegDeleteKey recursively.

    --
    http://www.firestreamer.com - NTBackup to DVD and DV


    "Daniel Miller" <> wrote in message
    news:Xns960595E7EDB68dancarddupercom@207.46.248.16...
    >I suspect that this is not quite the correct group for this question.
    > Unfortunately, it is the only MSDN Managed group which is related to the
    > DDK, so I'm stuck here; I hope someone from MS will assist me.
    >
    > My specific issue that I have is this: we have a USB tester which can
    > operate on 12 USB devices at a time. Typically the user will start with
    > a raw part which will have vendor/product ID, but no other internal data.
    > They then perform a low-level format on the part, which assigns a device
    > serial number and other SCSI data. The problem is this:
    >
    > Every time a USB device is inserted in a Windows machine, several
    > registry entries are created... at a minimum, there are:
    >
    > HLKM:SYSTEM\CurrentControlSet\Enum\USB entries
    > HLKM:SYSTEM\CurrentControlSet\Enum\USBSTOR entries
    > HLKM:SYSTEM\CurrentControlSet\Control\DeviceClasses\{deviceClassGUID}
    > entries
    >
    > and several others. Each of these is hundreds of bytes in size.
    >
    > This will create one set of data before the low-level format, and
    > *another* full set after the format, because the device now is recognized
    > by its serial number instead of its physical address.
    >
    > Now, this is all just for ONE device. In a fully-operational production
    > environment, the user can put 15000 parts/day through the machine.
    >
    > Just think of what the registry will look like after a week or two of
    > this, let alone a couple of years... the machine quickly starts slowing
    > down, and we know that eventually, when the registry gets too bloated,
    > Windows just stops functioning.
    >
    > So I need to develop some method of stripping out old registry entries,
    > once I manage to determine all of the entries that I need to be concerned
    > about. I tried doing this with the registry management functions,
    > including either SHDeleteKey or RegDeleteKey, but I have two sets of
    > problems with this; the first is permissions, the second is that even
    > after I change the permissions, the delete-key functions still fail,
    > though I can manually delete the keys using RegEdit.
    >
    > I've found that reg.exe can even delete these items, at least once I've
    > changed the permissions for Everyone; is there some way I can either get
    > source code for reg.exe, or at least find out how it is doing this??
    >
    > Dan Miller
    >
     
    cristalink, Feb 22, 2005
    #2
    1. Advertising

  3. Right... I used SHDeleteKey on the top-level key, and and I used
    RegDeleteKey recursively. They both failed, in the manner that I
    described in my message below.

    Dan

    "cristalink" <> wrote in
    news::

    >> I've found that reg.exe can even delete these items, at least once
    >> I've changed the permissions for Everyone; is there some way I can
    >> either get source code for reg.exe, or at least find out how it is
    >> doing this??

    >
    > RegDeleteKey cannot delete a key with subkeys. Try SHDeleteKey instead
    > or call RegDeleteKey recursively.
    >

    --
    http://www.firestreamer.com - NTBackup to DVD and DV


    "Daniel Miller" <> wrote in message
    news:Xns960595E7EDB68dancarddupercom@207.46.248.16...
    >I suspect that this is not quite the correct group for this question.
    > Unfortunately, it is the only MSDN Managed group which is related to
    > the DDK, so I'm stuck here; I hope someone from MS will assist me.
    >
    > My specific issue that I have is this: we have a USB tester which can
    > operate on 12 USB devices at a time. Typically the user will start
    > with a raw part which will have vendor/product ID, but no other
    > internal data. They then perform a low-level format on the part, which
    > assigns a device serial number and other SCSI data. The problem is
    > this:
    >
    > Every time a USB device is inserted in a Windows machine, several
    > registry entries are created... at a minimum, there are:
    >
    > HLKM:SYSTEM\CurrentControlSet\Enum\USB entries
    > HLKM:SYSTEM\CurrentControlSet\Enum\USBSTOR entries
    > HLKM:SYSTEM\CurrentControlSet\Control\DeviceClasses\{deviceClassGUID}
    > entries
    >
    > and several others. Each of these is hundreds of bytes in size.
    >
    > This will create one set of data before the low-level format, and
    > *another* full set after the format, because the device now is
    > recognized by its serial number instead of its physical address.
    >
    > Now, this is all just for ONE device. In a fully-operational
    > production environment, the user can put 15000 parts/day through the
    > machine.
    >
    > Just think of what the registry will look like after a week or two of
    > this, let alone a couple of years... the machine quickly starts
    > slowing down, and we know that eventually, when the registry gets too
    > bloated, Windows just stops functioning.
    >
    > So I need to develop some method of stripping out old registry
    > entries, once I manage to determine all of the entries that I need to
    > be concerned about. I tried doing this with the registry management
    > functions, including either SHDeleteKey or RegDeleteKey, but I have
    > two sets of problems with this; the first is permissions, the second
    > is that even after I change the permissions, the delete-key functions
    > still fail, though I can manually delete the keys using RegEdit.
    >
    > I've found that reg.exe can even delete these items, at least once
    > I've changed the permissions for Everyone; is there some way I can
    > either get source code for reg.exe, or at least find out how it is
    > doing this??
    >
    > Dan Miller
    >
     
    Daniel Miller, Feb 22, 2005
    #3
  4. Daniel Miller

    cristalink Guest

    > They both failed, in the manner that I described in my message below.

    Sorry, I could not find the description of "the manner" in your post.

    I used SHDeleteKey and RegDeleteKey without any problem, as long as the
    proper permissions are set for the Enum key. Other keys' permissions don't
    need to be changed. What does GetLastError() say? What are the exact names
    of the keys you are trying to delete? Did you try your code on any other key
    to make sure it works at all?

    --
    http://www.firestreamer.com - NTBackup to DVD and DV


    "Daniel Miller" <> wrote in message
    news:Xns96059957C19B2dancarddupercom@207.46.248.16...
    > Right... I used SHDeleteKey on the top-level key, and and I used
    > RegDeleteKey recursively. They both failed, in the manner that I
    > described in my message below.
    >
    > Dan
    >
    > "cristalink" <> wrote in
    > news::
    >
    >>> I've found that reg.exe can even delete these items, at least once
    >>> I've changed the permissions for Everyone; is there some way I can
    >>> either get source code for reg.exe, or at least find out how it is
    >>> doing this??

    >>
    >> RegDeleteKey cannot delete a key with subkeys. Try SHDeleteKey instead
    >> or call RegDeleteKey recursively.
    >>

    > --
    > http://www.firestreamer.com - NTBackup to DVD and DV
    >
    >
    > "Daniel Miller" <> wrote in message
    > news:Xns960595E7EDB68dancarddupercom@207.46.248.16...
    >>I suspect that this is not quite the correct group for this question.
    >> Unfortunately, it is the only MSDN Managed group which is related to
    >> the DDK, so I'm stuck here; I hope someone from MS will assist me.
    >>
    >> My specific issue that I have is this: we have a USB tester which can
    >> operate on 12 USB devices at a time. Typically the user will start
    >> with a raw part which will have vendor/product ID, but no other
    >> internal data. They then perform a low-level format on the part, which
    >> assigns a device serial number and other SCSI data. The problem is
    >> this:
    >>
    >> Every time a USB device is inserted in a Windows machine, several
    >> registry entries are created... at a minimum, there are:
    >>
    >> HLKM:SYSTEM\CurrentControlSet\Enum\USB entries
    >> HLKM:SYSTEM\CurrentControlSet\Enum\USBSTOR entries
    >> HLKM:SYSTEM\CurrentControlSet\Control\DeviceClasses\{deviceClassGUID}
    >> entries
    >>
    >> and several others. Each of these is hundreds of bytes in size.
    >>
    >> This will create one set of data before the low-level format, and
    >> *another* full set after the format, because the device now is
    >> recognized by its serial number instead of its physical address.
    >>
    >> Now, this is all just for ONE device. In a fully-operational
    >> production environment, the user can put 15000 parts/day through the
    >> machine.
    >>
    >> Just think of what the registry will look like after a week or two of
    >> this, let alone a couple of years... the machine quickly starts
    >> slowing down, and we know that eventually, when the registry gets too
    >> bloated, Windows just stops functioning.
    >>
    >> So I need to develop some method of stripping out old registry
    >> entries, once I manage to determine all of the entries that I need to
    >> be concerned about. I tried doing this with the registry management
    >> functions, including either SHDeleteKey or RegDeleteKey, but I have
    >> two sets of problems with this; the first is permissions, the second
    >> is that even after I change the permissions, the delete-key functions
    >> still fail, though I can manually delete the keys using RegEdit.
    >>
    >> I've found that reg.exe can even delete these items, at least once
    >> I've changed the permissions for Everyone; is there some way I can
    >> either get source code for reg.exe, or at least find out how it is
    >> doing this??
    >>
    >> Dan Miller
    >>

    >
    >
    >
     
    cristalink, Feb 22, 2005
    #4
  5. "cristalink" <> wrote in
    news:#:

    >> They both failed, in the manner that I described in my message below.

    >
    > Sorry, I could not find the description of "the manner" in your post.
    >
    > I used SHDeleteKey and RegDeleteKey without any problem, as long as
    > the proper permissions are set for the Enum key. Other keys'
    > permissions don't need to be changed. What does GetLastError() say?
    > What are the exact names of the keys you are trying to delete? Did you
    > try your code on any other key to make sure it works at all?
    >

    Whoops!!! I got SHDeleteKey to work!!
    I was passing the full registry path+entry name to SHDeleteKey (which I
    read was required for RegDeleteKey, and assumed was necessary for
    SHDeleteKey as well). I had tried RegDeleteKey both ways, but hadn't tried
    both with SHDeleteKey...

    So, I was putting a test case together to respond to your previous message,
    and SHDeleteKey works, if I pass *just* the name that was returned
    previously by RegEnumKeyEx... how odd...

    Thank you for your responses and questions, CristaLink!!

    Dan Miller
     
    Daniel Miller, Feb 23, 2005
    #5
  6. Never try to delete the registry entries yourself.
    There are SetupDi functions to uninstall the device.

    The easiest solution is to use a Mac or Linux.
    Windows is not really suited for USB development or testing.
    Check if a Mac mini with a USB hub is usable.
     
    Robert Marquardt, Feb 23, 2005
    #6
  7. > So I need to develop some method of stripping out old registry entries,

    Using image backup and rolling back is a great idea.

    --
    Maxim Shatskih, Windows DDK MVP
    StorageCraft Corporation

    http://www.storagecraft.com
     
    Maxim S. Shatskih, Feb 24, 2005
    #7
  8. Daniel Miller

    Pavel A. Guest

    "Maxim S. Shatskih" wrote:
    > Using image backup and rolling back is a great idea.


    I's a great last resort to get a broken system back working...

    We once made the following solution for this.
    Printed the serial numbers as barcode on the QC routing slip.
    Got a barcode scanner and *before* plugging next device, scanned it's serial
    number into the testing app.
    This program patched the serial into the enum registry key (duh!) - so when
    the device was plugged in, it was detected as already installed.
    Result: zero setup overhead and zero registry garbage.
    Probably this idea can be adapted to case of multiple devices at once.

    My 10 ag.,
    --PA
     
    Pavel A., Feb 25, 2005
    #8
  9. Pavel A. wrote:

    > I's a great last resort to get a broken system back working...
    >
    > We once made the following solution for this.
    > Printed the serial numbers as barcode on the QC routing slip.
    > Got a barcode scanner and *before* plugging next device, scanned it's serial
    > number into the testing app.
    > This program patched the serial into the enum registry key (duh!) - so when
    > the device was plugged in, it was detected as already installed.
    > Result: zero setup overhead and zero registry garbage.
    > Probably this idea can be adapted to case of multiple devices at once.


    That is definitely idiotic. Why not use another OS?
    Even Microsoft buys Macs once in a while.
     
    Robert Marquardt, Feb 25, 2005
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rees2007

    Email - Cannot delete items from Deleted Items folder

    Rees2007, Apr 3, 2007, in forum: Windows Vista Mail
    Replies:
    25
    Views:
    601
    Brink
    Apr 21, 2009
  2. Laura Lezlie Rice

    Can't delete items from the deleted items folder

    Laura Lezlie Rice, Nov 11, 2007, in forum: Windows Vista Mail
    Replies:
    1
    Views:
    356
    brink
    Nov 11, 2007
  3. Retired Seaman

    Can delete items in "Deleted Items" in MS Mail

    Retired Seaman, Jan 3, 2009, in forum: Windows Vista Mail
    Replies:
    2
    Views:
    203
    Gary VanderMolen
    Jan 3, 2009
  4. doublerainbow

    Cannot open or delete items in "sent items"

    doublerainbow, Jun 3, 2009, in forum: Windows Live Mail
    Replies:
    3
    Views:
    449
    Gary VanderMolen
    Jun 3, 2009
  5. CJSnet
    Replies:
    2
    Views:
    222
    CJSnet
    Dec 19, 2005
Loading...

Share This Page