Leaderboard
Popular Content
Showing content with the highest reputation on 01/31/2017 in all areas
-
FModMem UDF build 2019-11-24
argumentum and 2 others reacted to UEZ for a topic
Hi, I created a FMOD UDF (x86 / x64 compatible) whereas the DLL calls are done from memory directly! Credits to trancexx for the Subrogation functions! Supported formats: - .MOD (protracker/fasttracker modules) - .S3M (screamtracker 3 modules) - .XM (fasttracker 2 modules) - .IT (impulse tracker modules) - .MID (MIDI files) - .RMI (MIDI files) - .SGT (DirectMusic segment files) - .FSB (FMOD Sample Bank files) - .MP3 - .OGG - .WAV - .MP2 - .RAW Current added function list (sum = 70): FMUSICMEM_FreeSong FMUSICMEM_GetBPM FMUSICMEM_GetGlobalVolume FMUSICMEM_GetMasterVolume FMUSICMEM_GetName FMUSICMEM_GetNumChannels FMUSICMEM_GetNumInstruments FMUSICMEM_GetNumOrders FMUSICMEM_GetNumPatterns FMUSICMEM_GetNumSamples FMUSICMEM_GetOrder FMUSICMEM_GetPaused FMUSICMEM_GetRow FMUSICMEM_GetSpeed FMUSICMEM_GetTime FMUSICMEM_GetType FMUSICMEM_IsFinished FMUSICMEM_LoadSong FMUSICMEM_LoadSongEx FMUSICMEM_OptimizeChannels FMUSICMEM_PlaySong FMUSICMEM_SetMasterVolume FMUSICMEM_SetOrder FMUSICMEM_SetPaused FMUSICMEM_StopAllSongs FMUSICMEM_StopSong FSOUNDMEM_Close FSOUNDMEM_DSP_Create FSOUNDMEM_DSP_Free FSOUNDMEM_DSP_GetActive FSOUNDMEM_DSP_GetFFTUnit FSOUNDMEM_DSP_GetSpectrum FSOUNDMEM_DSP_SetActive FSOUNDMEM_DSP_SetPriority FSOUNDMEM_GetAmplitude FSOUNDMEM_GetChannelsPlaying FSOUNDMEM_GetCPUUsage FSOUNDMEM_GetCurrentLevels FSOUNDMEM_GetError FSOUNDMEM_GetFrequency FSOUNDMEM_GetGetSurround FSOUNDMEM_GetMaxChannels FSOUNDMEM_GetPan FSOUNDMEM_GetPaused FSOUNDMEM_GetVolume FSOUNDMEM_Init FSOUNDMEM_SetPaused FSOUNDMEM_SetSpeakerMode FSOUNDMEM_SetSurround FSOUNDMEM_SetVolume FSOUNDMEM_SetVolumeAbsolute FSOUNDMEM_Stream_Close FSOUNDMEM_Stream_FindTagField FSOUNDMEM_Stream_GetLength FSOUNDMEM_Stream_GetLengthMs FSOUNDMEM_Stream_GetNumTagFields FSOUNDMEM_Stream_GetOpenState FSOUNDMEM_Stream_GetPosition FSOUNDMEM_Stream_GetTagField FSOUNDMEM_Stream_GetTime FSOUNDMEM_Stream_Net_GetStatus FSOUNDMEM_Stream_Net_SetMetadataCallback FSOUNDMEM_Stream_Net_SetProxy FSOUNDMEM_Stream_Open FSOUNDMEM_Stream_Play FSOUNDMEM_Stream_PlayEx FSOUNDMEM_Stream_SetLoopCount FSOUNDMEM_Stream_SetPosition FSOUNDMEM_Stream_SetTime FSOUNDMEM_Stream_Stop In the zip archive you can find 6 examples. Download: FModMem UDF build 2019-11-24.zip If you have created additional examples, feel free to post it here.3 points -
Version 0.10
2,006 downloads
; #INDEX# ======================================================================================================================= ; Title .........: UDF for "Debenu Quick PDF Library" ; AutoIt Version : 3.3.10.2++ ; Language ......: English ; Description ...: A collection of functions for Debenu Quick PDF Library ; Author(s) .....: mLipok ; Modified ......: ; =============================================================================================================================== Release note: Erratum v0.7: Forum link:1 point -
Because you probably declared it into another function. You have to declare it as a global variable (at the beginning)1 point
-
Update : added functions to create/remove LPR printer ports.1 point
-
Shouldn't be that hard... something like: #include<date.au3> Local $PrevMonth = @MON-1 if @MON=1 then $PrevMonth = 12 Local $sPrevLongMonthName = _DateToMonth($PrevMonth) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sPrevLongMonthName = ' & $sPrevLongMonthName & @CRLF & '>Error code: ' & @error & @CRLF) Jos1 point
-
This is not such easy, as nobody before do this in AutoIt (as far as I know). Here are some reference/usefull link to use: https://msdn.microsoft.com/en-us/library/windows/desktop/ff486015(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/hh768373(v=vs.85).aspx https://blogs.msdn.microsoft.com/murrays/2008/09/15/richedits-nested-table-facility/ https://msdn.microsoft.com/en-us/library/windows/desktop/hh768371(v=vs.85).aspx https://blogs.msdn.microsoft.com/murrays/2012/04/22/richedit-8-0-tom-table-interfaces/ http://stackoverflow.com/questions/22689517/using-tables-in-richedit-in-delphi https://msdn.microsoft.com/en-us/library/windows/desktop/ff486017(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/hh768760(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/hh768761(v=vs.85).aspx And here are some attempts: https://www.codeproject.com/Messages/3689018/Re-Table.aspx richTextBox1.SelectedText = "hehehe"; String table = @"\trowd\trgaph108\trleft-108\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx2844\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx5796\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx8748\pard\intbl\ltrpar\nowidctlpar\f1 \cell\row"; richTextBox1.Rtf = richTextBox1.Rtf.Replace("hehehe", table);1 point
-
TCP Receive problem
FrancescoDiMuro reacted to Melba23 for a topic
Rimoun, This looks very much like a rewrite of this previously locked thread. You do realise that the Forum rules prohibit: So your server script is also illegal and hence this thread gets locked too. Do NOT start a third - our patience has limits. M23 P.S. If you want to argue the point (not that it will do any good) please use the PM system, not the report button like you did last time.1 point -
Instead of using QRyXX for the keys, you can use a syntax like this : SWQuery = %Query1% Or %Q2% Or %query_03% And %Qry04% and a code like this : $sSWQueryUpdate = StringRegExpReplace($sSWQueryUpdate, "%([^%]+)%", 'Execute(IniRead("test.ini", "Queries", "$1", ""))')1 point
-
This ? Local $sSWQueryUpdate = IniRead("test.ini", "Upgrade Software Name", "SWQuery", "error") Local $sSWQueryInstall = IniRead("test.ini", "Install Software Name", "SWQuery", "error") $sSWQueryUpdate = StringRegExpReplace($sSWQueryUpdate, "\b(Qry\d+)\b", 'Execute(IniRead("test.ini", "Queries", "$1", ""))') ConsoleWrite($sSWQueryUpdate & @CRLF) Local $bRresult = Execute($sSWQueryUpdate) MsgBox(0, "", "Result for update: " & $bRresult) $sSWQueryInstall = StringRegExpReplace($sSWQueryInstall, "\b(Qry\d+)\b", 'Execute(IniRead("test.ini", "Queries", "$1", ""))') ConsoleWrite($sSWQueryInstall & @CRLF) $bRresult = Execute($sSWQueryInstall) MsgBox(0, "", "Result for install : " & $bRresult)1 point
-
biatu, F.W.I.W. This code monitors a log file and reports (email) errors found. You may be interested in the _scan_file() routine. It processes lines added since the last scan run... HotKeySet('`', '_start_monitor') ; "`" to initiate manual scan HotKeySet('{ESC}', '_exit') ; ESC to stop script #include <array.au3> #include <date.au3> #include <File.au3> Local $file_monitored = @ScriptDir & '\log.log' ; file to monitor Local $monitor_interval = 1 ; minute(s) between file check Local $bMonitor = False ; switch to start monitor local $oMyRet[2] ; array for error message from mail routine local $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; error routine ; routine to start scan AdlibRegister('_start_monitor', $monitor_interval * 60 * 1000) ; main loop, will only initiate scan when the adlib routine sets the switch While 1 If $bMonitor = True Then _scan_file() $bMonitor = False EndIf Sleep(500) WEnd ; scan routine and mail formatter Func _scan_file() Local $sTMP = '' local static $FilePos = 0 ConsoleWrite(_Now() & ' >>>> Start scan' & @CRLF) ;read log file entries added since the last scan local $fl = fileopen($file_monitored) if $fl = -1 then exit msgbox(0,'','File open failed') if not filesetpos($fl,$FilePos,0) then exit msgbox(0,'ERROR','FileSetPos failed') local $mon_file = fileread($fl) $FilePos = filegetpos($fl) fileclose($fl) ; detect lines with the word "failure" and return the entire line ; format output for email If StringRegExp($mon_file, 'failure') Then $aTMP = StringRegExp($mon_file, '(.*?failure.*)\R', 3) $sTMP &= 'The following failures were found:' & @crlf for $2 = 0 to ubound($aTMP) - 1 if $aTMP[$2] = '' then continueloop $sTMP &= ' ' & $aTMP[$2] & @crlf next EndIf ; if failures were found then send the email if $sTMP then ConsoleWrite($sTMP & @CRLF) ConsoleWrite('+ Sending mail...') _mailer($sTMP) ConsoleWrite(@error ? @crlf & '! Error sending mail = ' & $oMyRet[1] & @crlf : 'Send complete' & @CRLF) Else ConsoleWrite('No failures found' & @CRLF) endif ConsoleWrite(_Now() & ' >>>> Scan Complete' & @CRLF) EndFunc ;==>_scan_file ; adlib to set switch that initiates scan Func _start_monitor() $bMonitor = True EndFunc ;==>_start_monitor Func _exit() Exit EndFunc ;==>_exit ; wrapper to set variables used in _INetSmtpMailCom Func _mailer($str) Local $SmtpServer = 'the.gmail.smtp.server' ; name of the yahoo/gmail smtp server Local $FromName = 'Me' ; what you want to appear in you inbox "From" column Local $FromAddress = 'name.of.your.gmail.account' ; name of your yahoo account Local $ToAddress = 'who.to.send.it.to' ; who you are sending the mail to Local $Subject = "Log File Exception Warning" ; title Local $Body = $str ; the body of the email Local $AttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed Local $CcAddress = "" ; address for cc - leave blank if not needed Local $BccAddress = "" ; address for bcc - leave blank if not needed Local $Importance = "Normal" ; Send message priority: "High", "Normal", "Low" Local $Username = 'same.as.$fromaddress' ; account username as known to the smtp server Local $Password = 'password' ; password for the above account Local $IPPort = 465 ; GMAIL / YAHOO port used for sending the mail Local $ssl = 1 ; GMAIL / YAHOO enables/disables secure socket layer sending - put to 1 if using httpS $rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl) If @error Then return seterror(1) EndFunc ;==>_mailer Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0) Local $objEmail = ObjCreate("CDO.Message") $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress Local $i_Error = 0 Local $i_Error_desciption = "" If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then $objEmail.HTMLBody = $as_Body Else $objEmail.Textbody = $as_Body & @CRLF EndIf If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) ;~ ConsoleWrite('@@ Debug : $S_Files2Attach[$x] = ' & $S_Files2Attach[$x] & @LF & '>Error code: ' & @error & @LF) ;### Debug Console If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) SetError(1) Return 0 EndIf Next EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf If $ssl Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True EndIf ;Update settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then SetError(2) Return $oMyRet[1] EndIf $objEmail = "" EndFunc ;==>_INetSmtpMailCom Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) $oMyRet[0] = $HexNumber $oMyRet[1] = StringStripWS($oMyError.description, 3) ;ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF) SetError(1); something to check for when this function returns Return EndFunc ;==>MyErrFunc kylomas1 point
-
I told you - it doesnt work like this. You have to start the CMD from the script with run and then it will work. You cant attach to manually started CMD. I found and old topic where this was implemented , but i cant make it work with the new AutoIt. It is here:1 point
-
There was a time when I was thinking that nothing works..... And today I find this: http://www.wsusoffline.net/docs/ but the biggest suprise you can find here: If you are curious and impatient, simply scroll to 08:40 What I can say is:1 point
-
I needed a way to HexEdit / Patch a file to repair a common file corruption problem in a software package my company uses. I first used the AutoIt core FileOpen / FileWrite functions but this method required me to open the whole file into memory. The files I work with can be several hundred megabytes in size and easily cause out of memory errors. So, After searching / hacking I came up with this solution. I hope someone finds it useful #include <WinAPI.au3> _Demo() Func _Demo() Local Const $TestFile_Path = @ScriptDir & "\Test.Bin" Local $TestFile_ID, $bData, $Offset ;## Hex offsets / lengths of the data stored in the file. Local Const $Offset_Phone[2] = [0x012, 4] Local Const $Offset_NewToy[2] = [0x1b6, 18] Local Const $Offset_Recycle[2] = [0x594, 24] ;## Binary string of the test file. Local Const $TestFile_Data = "0x" & _ "42494E000000000000000000000000000000867530900000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000446F6E27742054617A65206D" & _ "652042726F21000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000536F796C656E742067726565" & _ "6E2069732070656F706C6521000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" & _ "000000000000000000000000" ;## Create Test File $TestFile_ID = FileOpen($TestFile_Path, 14) FileWrite($TestFile_ID, Binary($TestFile_Data)) FileClose($TestFile_ID) ;## Read the Recycle Value $bData = _HexRead($TestFile_Path, $Offset_Recycle[0], $Offset_Recycle[1]) ;## Convert data to a string and display. MsgBox(4096, Default, "Recycle:" & @CRLF & BinaryToString($bData)) ;## Change the recycle value $bData = StringToBinary("It Tastes like chicken!!") _HexWrite($TestFile_Path, $Offset_Recycle[0], $bData) ;## Read the Recycle Value $bData = _HexRead($TestFile_Path, $Offset_Recycle[0], $Offset_Recycle[1]) ;## Convert data to a string and display. MsgBox(4096, Default, "Recycle:" & @CRLF & BinaryToString($bData)) ;## Search for a specific value and display $Offset = _HexSearch($TestFile_Path, $bData) MsgBox(4096, "HexSearch Function", "Search performed to locate data stream: " & @CRLF & @TAB & $bData & @CRLF & "Result = 0x" & Hex($Offset, 3)) EndFunc #Region ;**** HexEdit Functions Func _HexWrite($FilePath, $Offset, $BinaryValue) Local $Buffer, $ptr, $bLen, $fLen, $hFile, $Result, $Written ;## Parameter Checks If Not FileExists($FilePath) Then Return SetError(1, @error, 0) $fLen = FileGetSize($FilePath) If $Offset > $fLen Then Return SetError(2, @error, 0) If Not IsBinary($BinaryValue) Then Return SetError(3, @error, 0) $bLen = BinaryLen($BinaryValue) If $bLen > $Offset + $fLen Then Return SetError(4, @error, 0) ;## Place the supplied binary value into a dll structure. $Buffer = DllStructCreate("byte[" & $bLen & "]") DllStructSetData($Buffer, 1, $BinaryValue) If @error Then Return SetError(5, @error, 0) $ptr = DllStructGetPtr($Buffer) ;## Open File $hFile = _WinAPI_CreateFile($FilePath, 2, 4, 0) If $hFile = 0 Then Return SetError(6, @error, 0) ;## Move file pointer to offset location $Result = _WinAPI_SetFilePointer($hFile, $Offset) $err = @error If $Result = 0xFFFFFFFF Then _WinAPI_CloseHandle($hFile) Return SetError(7, $err, 0) EndIf ;## Write new Value $Result = _WinAPI_WriteFile($hFile, $ptr, $bLen, $Written) $err = @error If Not $Result Then _WinAPI_CloseHandle($hFile) Return SetError(8, $err, 0) EndIf ;## Close File _WinAPI_CloseHandle($hFile) If Not $Result Then Return SetError(9, @error, 0) EndFunc Func _HexRead($FilePath, $Offset, $Length) Local $Buffer, $ptr, $fLen, $hFile, $Result, $Read, $err, $Pos ;## Parameter Checks If Not FileExists($FilePath) Then Return SetError(1, @error, 0) $fLen = FileGetSize($FilePath) If $Offset > $fLen Then Return SetError(2, @error, 0) If $fLen < $Offset + $Length Then Return SetError(3, @error, 0) ;## Define the dll structure to store the data. $Buffer = DllStructCreate("byte[" & $Length & "]") $ptr = DllStructGetPtr($Buffer) ;## Open File $hFile = _WinAPI_CreateFile($FilePath, 2, 2, 0) If $hFile = 0 Then Return SetError(5, @error, 0) ;## Move file pointer to offset location $Pos = $Offset $Result = _WinAPI_SetFilePointer($hFile, $Pos) $err = @error If $Result = 0xFFFFFFFF Then _WinAPI_CloseHandle($hFile) Return SetError(6, $err, 0) EndIf ;## Read from file $Read = 0 $Result = _WinAPI_ReadFile($hFile, $ptr, $Length, $Read) $err = @error If Not $Result Then _WinAPI_CloseHandle($hFile) Return SetError(7, $err, 0) EndIf ;## Close File _WinAPI_CloseHandle($hFile) If Not $Result Then Return SetError(8, @error, 0) ;## Return Data $Result = DllStructGetData($Buffer, 1) Return $Result EndFunc Func _HexSearch($FilePath, $BinaryValue, $StartOffset = Default) Local $Buffer, $ptr, $hFile, $Result, $Read, $SearchValue, $Pos, $BufferSize = 2048 ;## Parameter Defaults If $StartOffset = Default Then $StartOffset = 0 ;## Parameter Checks If Not FileExists($FilePath) Then Return SetError(1, @error, 0) $fLen = FileGetSize($FilePath) If $StartOffset > $fLen Then Return SetError(2, @error, 0) If Not IsBinary($BinaryValue) Then Return SetError(3, @error, 0) If Not IsNumber($StartOffset) Then Return SetError(4, @error, 0) ;## Prep the supplied binary value for search $SearchValue = BinaryToString($BinaryValue) ;## Define the dll structure to store the data. $Buffer = DllStructCreate("byte[" & $BufferSize & "]") $ptr = DllStructGetPtr($Buffer) ;## Open File $hFile = _WinAPI_CreateFile($FilePath, 2, 2, 1) If $hFile = 0 Then Return SetError(5, @error, 0) ;## Move file pointer to offset location $Result = _WinAPI_SetFilePointer($hFile, $StartOffset) $err = @error If $Result = 0xFFFFFFFF Then _WinAPI_CloseHandle($hFile) Return SetError(5, $err, 0) EndIf ;## Track the file pointer's position $Pos = $StartOffset ;## Start Search Loop While True ;## Read from file $Read = 0 $Result = _WinAPI_ReadFile($hFile, $ptr, $BufferSize, $Read) $err = @error If Not $Result Then _WinAPI_CloseHandle($hFile) Return SetError(6, $err, 0) EndIf ;## Prep read data for search $Result = DllStructGetData($Buffer, 1) $Result = BinaryToString($Result) ;## Search the read data for first match $Result = StringInStr($Result, $SearchValue) If $Result > 0 Then ExitLoop ;## Test for EOF and return -1 to signify value was not found If $Read < $BufferSize Then _WinAPI_CloseHandle($hFile) Return -1 EndIf ;## Value not found, Continue Tracking file pointer's position $Pos += $Read WEnd ;## Close File _WinAPI_CloseHandle($hFile) If Not $Result Then Return SetError(7, @error, 0) ;## Calculate the offset and return $Result = $Pos + $Result - 1 Return $Result EndFunc Func _WinAPI_SetFilePointer($hFile, $nDistance, $nMethod = 0) Local $nRet $nRet = DllCall("kernel32.dll", "dword", "SetFilePointer", "ptr", $hFile, "long", $nDistance, "ptr", 0, "dword", $nMethod) Return $nRet[0] EndFunc #EndRegion ** UPDATES ** Added new function: _HexSearch()1 point