Custom Query (3920 matches)
Results (382 - 384 of 3920)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #1260 | Fixed | Buffer overflow in _WinAPI_GetLastErrorMessage() | ||
| Description |
Func _WinAPI_GetLastErrorMessage()
Local $tText
$tText = DllStructCreate("char Text[4096]")
_WinAPI_FormatMessage($__WINAPCONSTANT_FORMAT_MESSAGE_FROM_SYSTEM, 0, _WinAPI_GetLastError(), 0, DllStructGetPtr($tText), 4096, 0)
Return DllStructGetData($tText, "Text")
EndFunc ;==>_WinAPI_GetLastErrorMessage
The 'nSize' parameter passed is not accounting for the terminating null character: it should be 4095, or the array size should be changed to 4097, according to MSDN's example code. Another solution (a more elegant one, in my view) is letting FormatMessage allocate the buffer. The attached file contains a implementation of this method. Thank you, Daniel |
|||
| #1272 | Fixed | Uninstall, beta, file WinAPIError.au3 still standing. | ||
| Description |
"C:\Program Files\AutoIt3\Beta\Include\winapierror.au3" After install/uninstall of beta 3.3.1.4 include file WinAPIError.au3 was not uninstalled. It's similar to older ticket #1121 |
|||
| #1273 | Fixed | _GuiCtrlRichEdit_SetCharColor - example save bad RTF | ||
| Description |
Example for _GuiCtrlRichEdit_SetCharColor() saves RTF file which should contain whole text of richedit control. But instead of "Paragraph 1" RTF file contains only "aph 1". Note: In this example parts of word was formatted differently So maybe this is more related (bug) in _GuiCtrlRichEdit_StreamToFile() but I'm not sure about the place where is cause of this bug. Example from helpfile: #AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Color.au3>
Opt('MustDeclareVars', 1)
Global $lblMsg, $hRichEdit
Main()
Func Main()
Local $hGui, $iMsg, $btnNext, $iStep = 0
$hGui = GUICreate("Example (" & StringTrimRight(@ScriptName,4) & ")", 320, 350, -1, -1)
$hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, _
BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
$lblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
$btnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30)
GUISetState()
_GuiCtrlRichEdit_SetText($hRichEdit, "Paragraph 1")
While True
$iMsg = GUIGetMsg()
Select
Case $iMsg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $iMsg = $btnNext
$iStep += 1
Switch $iStep
Case 1
Report("1. Initial setting")
Case 2
_GuiCtrlRichEdit_SetCharColor($hRichEdit, "304050")
Report("2. Setting is now")
Case 3
_GuiCtrlRichEdit_SetSel($hRichEdit, 1, 5)
_GuiCtrlRichEdit_SetCharColor($hRichEdit)
Report("3. Background of a few characters changed")
Case 4
_GuiCtrlRichEdit_SetSel($hRichEdit, 6, -1)
;~ _GuiCtrlRichEdit_Deselect($hRichEdit)
; Stream all text to the Desktop so you can look at settings in Word
_GuiCtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
Report("4. Saved to File")
GUICtrlSetState($btnNext, $GUI_DISABLE)
EndSwitch
EndSelect
WEnd
EndFunc ;==>Main
Func Report($sMsg)
Local $iColor = _GUICtrlRichEdit_GetCharColor($hRichEdit)
Local $sMixed = _Iif(@extended, "+", "~")
Local $aRet = _ColorGetRGB($iColor)
$sMsg = $sMsg & @CR & @CR & $aRet[0] & ";" & $aRet[1] & ";" & $aRet[2] & " Color=0x" & Hex($iColor) & ":" & $sMixed
GUICtrlSetData($lblMsg, $sMsg)
ControlFocus($hRichEdit, "", "")
EndFunc ;==>Report
|
|||
