Modify

#961 closed Bug (Fixed)

RegDelete fails to to delete reg key containing sub keys

Reported by: Starboy Owned by: Jon
Milestone: 3.3.5.2 Component: AutoIt
Version: 3.3.0.0 Severity: None
Keywords: Cc:

Description

This issue only happens when using a 32bit exe on a 64bit OS. Trying to delete a key containing sub keys fails in the 64bit nod and the 32bit nod but only while using a 32bit exe. Using the same code on a 32bit OS works fine or the same code on a 64bit OS compiled as a 64bit exe.

I have only been able to test it on 2003 Server 64bit.

;This tests is for bug with deleting 32bit keys on a 64bit OS using a 32bit exe

; Write a single REG_SZ value and another subkey
RegWrite("HKLM\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test")
RegWrite("HKLM\SOFTWARE\Test\test2", "TestKey", "REG_SZ", "Hello this is the second test")

MsgBox(4096, "", "Check for the new keys then click OK" & @CR & "then check to see if it was deleted.")

; Delete the previously created key
RegDelete("HKLM\SOFTWARE\Test")
;This tests is for bug with deleting 64bit keys on a 64bit OS using 32bit exe

; Write a single REG_SZ value and another subkey
RegWrite("HKLM64\SOFTWARE\Test", "TestKey", "REG_SZ", "Hello this is a test")
RegWrite("HKLM64\SOFTWARE\Test\test2", "TestKey", "REG_SZ", "Hello this is the second test")

MsgBox(4096, "", "Check for the new keys then click OK" & @CR & "then check to see if it was deleted.")

; Delete the previously created key and subkey
RegDelete("HKLM64\SOFTWARE\Test")

Attachments (0)

Change History (12)

comment:1 by Jpm, on May 16, 2009 at 4:58:22 PM

Resolution: Works For Me
Status: newclosed

I am surprised that you can create a key under HKLM.
I can't under the standard Vista which have a similar code as 2003 Server 64-bit
I change HKLM to HKCU and everything is fine under Vista 64-Bit

in reply to:  1 comment:2 by anonymous, on May 16, 2009 at 8:12:21 PM

Replying to Jpm:

I am surprised that you can create a key under HKLM.
I can't under the standard Vista which have a similar code as 2003 Server 64-bit
I change HKLM to HKCU and everything is fine under Vista 64-Bit

Strange I tried what you suggested and it does work under HKCU. Interesting that we can create keys under HKLM and not be able to delete them when they contain subkeys. You can however delete value names or a key that does not contain subkeys under HKLM.

Thanks

comment:3 by Jpm, on May 17, 2009 at 10:31:20 AM

I can't create under HKLM under Vista 32 or 64 bit. Seems some changes from MS to protect the registry as HKLM\SOFTWARE

in reply to:  3 ; comment:4 by anonymous, on May 17, 2009 at 4:49:45 PM

Replying to Jpm:

I can't create under HKLM under Vista 32 or 64 bit. Seems some changes from MS to protect the registry as HKLM\SOFTWARE

Actually that sounds like a bug as well then considering that most apps store setting under HKLM\Software for global use by all users. I would be surprised that AutoIt would not be able to do the same since most apps read/write to this location. Even AutoIt stores some information in this location "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt" stored under the 32bit nod (Wow6432Node) though since it is a 32bit app. I will do more research on this later today when I should have access to a Vista64 and or a Windows7 64 system.

Thanks

in reply to:  4 comment:5 by Valik, on May 17, 2009 at 5:41:32 PM

Replying to anonymous:

Even AutoIt stores some information in this location "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt" stored under the 32bit nod (Wow6432Node) though since it is a 32bit app.

This is not true. AutoIt stores all it's information in HKCU. The information you see in HKLM is added by the installer which was likely run with elevated rights which means it had full write access to HKLM.

comment:6 by Emiel Wieldraaijer, on Jan 31, 2010 at 11:51:19 PM

Hi,

I noticed the same problem om Windows 7 64 Bits with AutoIt 3.3.4.0, so i searched the BugTRacker and found someone with a similar problem.

I create a Key in HKCR and it created .. but on 64 Bits W7 it cannot be deleted .. the same exe on 32 Bits W7 removes the Key.

Check the following Key :

(Yes we need HKCR64 for 64Bits)

Create a Key in the Desktop Context Menu "HKCR\DesktopBackground\Shell\Something" and it can be deleted

Create a Key in the MyComputer Context Menu "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\Shell\Something" and it can NOT be deleted

Thanks

Emiel

comment:7 by Valik, on Feb 1, 2010 at 2:26:16 AM

Resolution: Works For Me
Status: closedreopened

I'm going to re-open this so Jon can have a look and see if he can come up with a suitable explanation for the problem.

comment:8 by Jon, on Feb 5, 2010 at 11:25:35 PM

Something weird going on here. This used to work but now this does nothing on x64:

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\jonTest")

comment:9 by Jon, on Feb 6, 2010 at 10:47:48 AM

Ah, ignore that. Some keys in CLSID are not writable by non-admins so of course my initial test failed (Windows 7 with UAC enabled). This works correctly on Win7 x64 using AutoIt_x64.exe

#requireadmin
RegWrite("HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\Shell\Something")
RegDelete("HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\Shell\Something")

So as far as I can that part works OK.

comment:10 by Jon, on Feb 6, 2010 at 11:00:57 AM

Ok, so the 2nd script from the initial bug report creates Test/test2 but then only deletes the subkey test2 so there is some sort of bug there.

comment:11 by Jon, on Feb 6, 2010 at 11:36:54 AM

Really odd bug. Every other registry operation takes the key handle you give it and honours the fact that you want to use HKLM64. But it seems that when deleting a key you have to use the ...Ex() version and manually respecify the HKLM64 sam access. Weird. But fixed now.

comment:12 by Jon, on Feb 6, 2010 at 11:37:42 AM

Milestone: 3.3.5.2
Owner: set to Jon
Resolution: Fixed
Status: reopenedclosed

Fixed by revision [5658] in version: 3.3.5.2

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.