Func _Encoding_Base64Decode($sData)
Local $struct = DllStructCreate("int")
$a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
"str", $sData, _
"int", 0, _
"int", 1, _
"ptr", 0, _
"ptr", DllStructGetPtr($struct, 1), _
"ptr", 0, _
"ptr", 0)
If @error Or Not $a_Call[0] Then
Return SetError(1, 0, "")
EndIf
Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")
$a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
"str", $sData, _
"int", 0, _
"int", 1, _
"ptr", DllStructGetPtr($a), _
"ptr", DllStructGetPtr($struct, 1), _
"ptr", 0, _
"ptr", 0)
If @error Or Not $a_Call[0] Then
Return SetError(2, 0, "")
EndIf
Return BinaryToString(DllStructGetData($a, 1))
EndFunc