Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Inserting string into the beginning

$
0
0
I've used code submitted earlier on this forum:
#Include <EditConstants.au3>
#Include <WinAPI.au3>
#Include <WindowsConstants.au3>
Global $sFile, $hFile, $iSize, $sData, $tData, $iRead
$sFile = @WindowsDir & '\regedit.exe'
$iSize = FileGetSize($sFile)
$tData = DllStructCreate('byte[' & $iSize & ']')
$hFile = _WinAPI_CreateFile($sFile, 2, 2, 2)
_WinAPI_ReadFile($hFile, DllStructGetPtr($tData), $iSize, $iRead)
_WinAPI_CloseHandle($hFile)
MsgBox(0, '', Hex(DllStructGetData($tData, 1, 1), 2) & Hex(DllStructGetData($tData, 1, 2), 2) & ' (' & Chr(DllStructGetData($tData, 1, 1)) & Chr(DllStructGetData($tData, 1, 2)) & ') - signature for EXE fies.')
$sData = ''
For $i = 1 To $iSize
$sData &= Hex(DllStructGetData($tData, 1, $i), 2)
If Mod($i, 16) = 0 Then
	 $sData &= @CRLF
Else
	 $sData &= ' '
EndIf
Next
$sData = StringTrimRight($sData, 2)
Global $Edit
GUICreate('MyGUI', 422, 526)
$Edit = GUICtrlCreateEdit('', 10, 10, 402, 506, BitOR($ES_READONLY, $WS_VSCROLL, $WS_HSCROLL))
GUICtrlSetFont(-1, 8.5, 400, 0, 'Courier')
GUICtrlSetData($Edit, $sData)
GUISetState()
Do
Until GUIGetMsg() = -3


and it's working great! But I need to get the data in reversed order therefore I used
$sData = Hex(DllStructGetData($tData, 1, $i), 2) & $sData


It is working, but obviously it's painfully slow.
Does anyone have any ideas how to make the process quicker. I'd really gratefull.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>