#Include <WinAPI.au3>
Global Const $sExe = @ScriptDir & '\MyProg.exe'
Global Const $sRar = @ScriptDir & '\MyData.rar'
Global Const $iBuf = 80 * 1024 * 1024 ; 80 Мб (можно и больше)
Global $iBytes
$tData = DllStructCreate('byte[' & $iBuf & ']')
$pData = DllStructGetPtr($tData)
$tSize = DllStructCreate('dword', $pData)
$iSize = FileGetSize($sRar)
$iMod = Mod($iSize, $iBuf)
$iPart = ($iSize - $iMod) / $iBuf
$hData = _WinAPI_CreateFile($sRar, 2, 2)
$hFile = _WinAPI_CreateFile($sExe, 2, 4)
_WinAPI_SetFilePointer($hFile, 0, $FILE_END)
For $i = 1 To $iPart + 1
If $i > $iPart Then
_WinAPI_ReadFile($hData, $pData, $iMod, $iBytes)
Else
_WinAPI_ReadFile($hData, $pData, $iBuf, $iBytes)
EndIf
If @error Then
; ???
EndIf
If $i > $iPart Then
_WinAPI_WriteFile($hFile, $pData, $iMod, $iBytes)
Else
_WinAPI_WriteFile($hFile, $pData, $iBuf, $iBytes)
EndIf
If @error Then
; ???
EndIf
Next
DllStructSetData($tSize, 1, $iSize)
_WinAPI_WriteFile($hFile, $pData, 4, $iBytes)
If @error Then
; ???
EndIf
_WinAPI_CloseHandle($hFile)
_WinAPI_CloseHandle($hData)
$tData = 0