Advertisement
AZJIO

проверь

Jul 9th, 2014
800
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.84 KB | None | 0 0
  1. FileCopy("myfile.dll", "myfile.dll.bak");
  2.  
  3. $sInFile = @ScriptDir & "\myfile.dll"
  4. Local $aFind[7] = [ _
  5. "strin1g", _
  6. "strin2g", _
  7. "strin3g", _
  8. "strin4g", _
  9. "strin5g", _
  10. "strin6g", _
  11. "strin7g"]
  12.  
  13. $0 = Chr(0) ; Получить Null
  14. $sReplace = $0 & $0 & $0 & $0 & $0 & $0 & $0 ; Типа 7 раз Null
  15.  
  16. $sOutFile = @ScriptDir & "\myfile.dll.tmp"
  17.  
  18.  
  19. _Replace($sInFile, $aFind, $sReplace, $sOutFile)
  20.  
  21. Func _Replace($sInFile, $aFind, $sReplace, $sOutFile)
  22.     Local $FO, $FR
  23.     $FR = FileRead($sInFile)
  24.     For $i = 0 To UBound($aFind) - 1
  25.         $FR = StringReplace($FR, $aFind[$i], $sReplace, 1)
  26.     Next
  27.     ; $FR = StringRegExpReplace($FR, 'strin[1-7]g', $sReplace) ; Вариант взамен цикла
  28.     $FO = FileOpen($sOutFile, 2)
  29.     FileWrite($FO, $FR)
  30.     FileClose($FO)
  31. EndFunc
  32.  
  33. FileMove("myfile.dll.tmp", "myfile.dll", 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement