GodlessSinner Posted January 30, 2009 Posted January 30, 2009 Help me. _____________________________________________________________________________
Developers Jos Posted January 30, 2009 Developers Posted January 30, 2009 what did you try that didn't work? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Authenticity Posted January 30, 2009 Posted January 30, 2009 (edited) _WinAPI_ReadFile($hFile, $pBuffer, $iToRead, ByRef $iRead[, $pOverlapped = 0])From the help file, set $iToRead to 256...Edit: stupid, mistake... keep it as it was. Edited January 30, 2009 by Authenticity
GodlessSinner Posted January 30, 2009 Author Posted January 30, 2009 (edited) Global $sFile, $hFile, $sText, $nBytes, $tBuffer, $Copy, $hCopy $sFile = @ScriptDir & '\dmaster.exe' $Copy = @ScriptDir & '\dmaster2.exe' $tBuffer = DLLStructCreate("byte[256]") $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_SetFilePointer($hFile, 0) _WinAPI_ReadFile($hFile, DLLStructGetPtr($tBuffer), 256, $nBytes) _WinAPI_CloseHandle($hFile) $sText = DLLStructGetData($tBuffer, 1) $hCopy = _WinAPI_CreateFile($Copy, 1, 4) _WinAPI_WriteFile($hCopy, DLLStructGetPtr($tBuffer), 256, $nBytes) --------------- Its copying 256 bytes from one file to another. Can I give, says, 134th element of DllStructure? Edited January 30, 2009 by Vitas _____________________________________________________________________________
Authenticity Posted January 30, 2009 Posted January 30, 2009 Yes, $byte = DllStructGetData($sText, 1, 134)
PsaltyDS Posted January 30, 2009 Posted January 30, 2009 Global $sFile, $hFile, $sText, $nBytes, $tBuffer, $Copy, $hCopy $sFile = @ScriptDir & '\dmaster.exe' $Copy = @ScriptDir & '\dmaster2.exe' $tBuffer = DLLStructCreate("byte[256]") $hFile = _WinAPI_CreateFile($sFile, 2, 2) _WinAPI_SetFilePointer($hFile, 0) _WinAPI_ReadFile($hFile, DLLStructGetPtr($tBuffer), 256, $nBytes) _WinAPI_CloseHandle($hFile) ConsoleWrite('2) ' & $buffer & @LF) $sText = DLLStructGetData($tBuffer, 1) $hCopy = _WinAPI_CreateFile($Copy, 1, 4) _WinAPI_WriteFile($hCopy, DLLStructGetPtr($tBuffer), 256, $nBytes) --------------- Its copying 256 bytes from one file to another. Can I give, says, 134th element of DllStructure? Seems like you are over-thinking this a bit: Global $sSrc = @ScriptDir & '\dmaster.exe', $hSrc, $binData, $binByte134 Global $sDest = @ScriptDir & '\dmaster2.exe', $hDest $hSrc = FileOpen($sSrc, 16) $binData = FileRead($hSrc, 256) FileClose($hSrc) $binByte134 = BinaryMid($binData, 134, 1) $hDest = FileOpen($sDest, 16 + 2) FileWrite($hDest, $binData) FileClose($hDest) $sByte134 = "0x" & Hex($binByte134, 2) MsgBox(64, "134th Byte", "The 134th byte was: " & $sByte134) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
GodlessSinner Posted January 30, 2009 Author Posted January 30, 2009 Thanks, @PsaltyDS! Its a most right way. _____________________________________________________________________________
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now