Modify

#4104 new Bug

A bug in _WinAPI_RegDeleteKey()

Reported by: tukangusil7@… Owned by:
Milestone: Component: AutoIt
Version: 3.3.18.0 Severity: None
Keywords: Cc:

Description

According to my test, _WinAPI_RegDeleteKey() returns True if its DllCall to RegDeleteKeyExW() returns non-zero, whereas it should returns False. I think I’ve found a bug in the implementation of _WinAPI_RegDeleteKey():

Line 
1Func _WinAPI_RegDeleteKey($vKey, $sSubKey = '', $iSamDesired = Default)
2 If $iSamDesired = Default Then
3 If @AutoItX64 Then
4 $iSamDesired = $KEY_WOW64_64KEY
5 Else
6 $iSamDesired = $KEY_WOW64_32KEY
7 EndIf
8 EndIf
9
10 $vKey = __WinAPI_RegConvHKey($vKey, $sSubKey)
11 If @error Then Return SetError(@error + 10, @extended, 0)
12
13 Local $aCall = DllCall('advapi32.dll', 'long', 'RegDeleteKeyExW', 'handle', $vKey, 'wstr', $sSubKey, 'dword', $iSamDesired, 'dword', 0)
14 If @error Then Return SetError(@error, @extended, 0)
15 If $aCall[0] Then Return SetError(10, $aCall[0], _WinAPI_GetLastError())
16
17 Return 1
18EndFunc ;==>_WinAPI_RegDeleteKey

The line

Line 
15If $aCall[0] Then Return SetError(10, $aCall[0], _WinAPI_GetLastError())

should be

Line 
15If $aCall[0] Then Return SetError(10, $aCall[0], 0)

Attachments (0)

Change History (0)

Modify Ticket

Action
as new The ticket will remain with no owner.

Add Comment


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