﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2376	Function fails to return a value properly	NullSchritt		"The following block of code works perfectly fine in the release version of autoit, but not in the beta, i much prefer to compile my scripts with the new betas as they seem to be the best coutnermeasure against unauthorized decompiling. I'm not sure exactly what goes wrong, but the following function returns a null string in the beta release


{{{
Func _GDIPlus_SaveImage2Binary($hBitmap, $iQuality = 60) ;Coded by Andreik, modified by UEZ
    Local $sImgCLSID = _GDIPlus_EncodersGetCLSID(""jpg"")
    Local $tGUID = _WinAPI_GUIDFromString($sImgCLSID)
    Local $pEncoder = DllStructGetPtr($tGUID)
    Local $tParams = _GDIPlus_ParamInit(1)
    Local $tData = DllStructCreate(""int Quality"")
    DllStructSetData($tData, ""Quality"", $iQuality) ;quality 0-100
    Local $pData = DllStructGetPtr($tData)
    _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData)
    Local $pParams = DllStructGetPtr($tParams)
    Local $hStream = DllCall(""ole32.dll"", ""uint"", ""CreateStreamOnHGlobal"", ""ptr"", 0, ""bool"", True, ""ptr*"", 0)
    $hStream = $hStream[3]
    DllCall($ghGDIPDll, ""uint"", ""GdipSaveImageToStream"", ""ptr"", $hBitmap, ""ptr"", $hStream, ""ptr"", $pEncoder, ""ptr"", $pParams)
;~  _GDIPlus_BitmapDispose($hBitmap)
    Local $hMemory = DllCall(""ole32.dll"", ""uint"", ""GetHGlobalFromStream"", ""ptr"", $hStream, ""ptr*"", 0)
    $hMemory = $hMemory[2]
    Local $iMemSize = _MemGlobalSize($hMemory)
    Local $pMem = _MemGlobalLock($hMemory)
    $tData = DllStructCreate(""byte["" & $iMemSize & ""]"", $pMem)
    Local $bData = DllStructGetData($tData, 1)
    Local $tVARIANT = DllStructCreate(""word vt;word r1;word r2;word r3;ptr data;ptr"")
    DllCall(""oleaut32.dll"", ""long"", ""DispCallFunc"", ""ptr"", $hStream, ""dword"", 8 + 8 * @AutoItX64, ""dword"", 4, ""dword"", 23, ""dword"", 0, ""ptr"", 0, ""ptr"", 0, ""ptr"", DllStructGetPtr($tVARIANT))
    _MemGlobalFree($hMemory)
    Return $bData
EndFunc   ;==>__GDIPlus_SaveImage2Binary
}}}"	Bug	closed		AutoIt	3.3.9.14	None	Works For Me	bmp to jpeg gdi plus	
