Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FileCopy("myfile.dll", "myfile.dll.bak");
- $sInFile = @ScriptDir & "\myfile.dll"
- Local $aFind[7] = [ _
- "strin1g", _
- "strin2g", _
- "strin3g", _
- "strin4g", _
- "strin5g", _
- "strin6g", _
- "strin7g"]
- $0 = Chr(0) ; Получить Null
- $sReplace = $0 & $0 & $0 & $0 & $0 & $0 & $0 ; Типа 7 раз Null
- $sOutFile = @ScriptDir & "\myfile.dll.tmp"
- _Replace($sInFile, $aFind, $sReplace, $sOutFile)
- Func _Replace($sInFile, $aFind, $sReplace, $sOutFile)
- Local $FO, $FR
- $FR = FileRead($sInFile)
- For $i = 0 To UBound($aFind) - 1
- $FR = StringReplace($FR, $aFind[$i], $sReplace, 1)
- Next
- ; $FR = StringRegExpReplace($FR, 'strin[1-7]g', $sReplace) ; Вариант взамен цикла
- $FO = FileOpen($sOutFile, 2)
- FileWrite($FO, $FR)
- FileClose($FO)
- EndFunc
- FileMove("myfile.dll.tmp", "myfile.dll", 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement