Modify

Opened 10 years ago

Closed 9 years ago

#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 follow-up: Changed 10 years ago by Jpm

  • Resolution set to Works For Me
  • Status changed from new to closed

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

comment:2 in reply to: ↑ 1 Changed 10 years ago by anonymous

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 follow-up: Changed 10 years ago by 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

comment:4 in reply to: ↑ 3 ; follow-up: Changed 10 years ago by anonymous

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

comment:5 in reply to: ↑ 4 Changed 10 years ago by Valik

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 Changed 9 years ago by Emiel Wieldraaijer

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 Changed 9 years ago by Valik

  • Resolution Works For Me deleted
  • Status changed from closed to reopened

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 Changed 9 years ago by Jon

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

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\jonTest")

comment:9 Changed 9 years ago by Jon

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 Changed 9 years ago by Jon

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 Changed 9 years ago by Jon

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 Changed 9 years ago by Jon

  • Milestone set to 3.3.5.2
  • Owner set to Jon
  • Resolution set to Fixed
  • Status changed from reopened to closed

Fixed by revision [5658] in version: 3.3.5.2

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jon.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.