Modify

Opened 5 weeks ago

Last modified 9 hours ago

#3744 new Bug

_Crypt_DestroyKey() does not increment DLL handles

Reported by: KaFu Owned by:
Milestone: Component: Standard UDFs
Version: 3.3.14.5 Severity: None
Keywords: Cc:

Description (last modified by mLipok)

The _Crypt_DestroyKey() contains a call to _Crypt_Shutdown(), decreasing DLL handles, but no call to _Crypt_Startup() to increase it in the first place.

#include <Crypt.au3>

Local $Res = _Crypt_DestroyKey_Ex(1)
ConsoleWrite($Res & @tab & @error & @TAB & @extended & @tab & _WinAPI_GetLastErrorMessage() & @crlf)

Local $Res = _Crypt_DestroyKey(1)

Func _Crypt_DestroyKey_Ex($hCryptKey)
        _Crypt_Startup()
        Local $aRet = DllCall(__Crypt_DllHandle(), "bool", "CryptDestroyKey", "handle", $hCryptKey)
        Local $iError = @error, $iExtended = @extended
        If Not $aRet[0] Then $iExtended = _WinAPI_GetLastError()
        _Crypt_Shutdown()
        If $iError Or Not $aRet[0] Then
                Return SetError($iError + 10, $iExtended, False)
        Else
                Return True
        EndIf
EndFunc   ;==>_Crypt_DestroyKey

Attachments (0)

Change History (3)

comment:1 Changed 5 weeks ago by mLipok

  • Description modified (diff)

comment:2 Changed 4 weeks ago by Jpm

As The key must have been created with _Crypt_DeriveKey() I Don't understand the purpose of the request
Cheers

comment:3 Changed 9 hours ago by KaFu

Because the current behavior crashes the whole script if the key does not exist. Instead it should return an error.

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 new The ticket will remain with no owner.
Author


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

 
Note: See TracTickets for help on using tickets.