﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2085	DllStructGetData crash with char array	anonymous		"DllStructGetData seems to verify or fetch whole data of structs created from string pointers. Comment out the first region to see a work-around.

{{{
Local $sA = ""String A"", $xA = StringToBinary($sA) & ""00""
Local $sB = ""String B"", $xB = StringToBinary($sB) & ""00""
; A binary string that contains the null delimited strings
Local $xAB = $xA & StringTrimLeft($xB, 2)

; Verify data
ConsoleWrite($xA & @LF & $xB & @LF & $xAB & @LF & @LF)

Local $tBuffer = DllStructCreate(""byte["" & BinaryLen($xAB) & ""]"")
Local $pBuffer = DllStructGetPtr($tBuffer)
DllStructSetData($tBuffer, 1, $xAB)

; Verify data
ConsoleWrite(DllStructGetData($tBuffer, 1) & @LF)

#region >_<
; Create a dllstruct used for getting strings of max size
Local $tPath = DllStructCreate(""char[1048576]"", $pBuffer)
ConsoleWrite(DllStructGetData($tPath, 1) & @LF) ; crash
#endregion

#region Q(0_0 Q)
Local $iSize = _StrLen($pBuffer)
ConsoleWrite($iSize & @LF)
Local $tPath = DllStructCreate(""char["" & $iSize & ""]"", $pBuffer)
ConsoleWrite(DllStructGetData($tPath, 1) & @LF)
#endregion

Func _StrLen(Const $pString)
	Local $aResult = DllCall(""msvcrt.dll"", ""int:cdecl"", ""strlen"", ""ptr"", $pString)
	Return $aResult[0]
EndFunc
}}}

P.S.
I don't need an array that is that big. It happens even with smaller arrays.

P.S. 2
If, for some reason, it doesn't crash even with 1 MB, try a bigger one."	Bug	closed		AutoIt	3.3.8.0	None	No Bug		
