Parcheador De Archivos Game Source:
#include
#include
#include
#include
#include
#include
#include
#include
#Region - HexEdit
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 Hex2Dec($iN)
Local $aN, $ihex = 0
$aN = StringSplit(StringTrimLeft($iN, 2), "", 1)
For $x = 1 To UBound($aN) - 1
$ihex += Dec($aN[$x]) * (16 ^ (UBound($aN) - 1 - $x))
Next
Return $ihex
EndFunc
Func Dec2Hex($iN)
Local $ihex = ""
Do
$ihex = Hex(Mod($iN, 16), 1) & $ihex
$iN = Floor($iN / 16)
;ConsoleWrite($iN & " " & $ihex & @CRLF)
Until $iN = 0
Return $ihex
EndFunc ;==>Dec2Hex
#EndRegion
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Dif-Apply-Tool-thingerymababer by iMer", 553, 207, 192, 124)
$dif = GUICtrlCreateInput(".dif File", 16, 24, 121, 21)
$file = GUICtrlCreateInput("File to Apply", 16, 72, 121, 21)
$file_button = GUICtrlCreateButton("Durchsuchen..,", 152, 72, 83, 25, 0)
$dif_button = GUICtrlCreateButton("Durchsuchen..,", 152, 24, 83, 25, 0)
$state = GUICtrlCreateEdit("", 272, 24, 265, 169, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
$go = GUICtrlCreateButton("Go!", 88, 152, 91, 41, 0)
$safe = GUICtrlCreateCheckbox("Sicherheitskopie erstellen?", 16, 112, 185, 17)
$ignore = GUICtrlCreateCheckbox("Bytes überprüfen?", 16, 136, 105, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg(1)
Switch $nMsg[0]
Case $GUI_EVENT_CLOSE
Exit
Case $dif_button
$auswahl = FileOpenDialog("Durchsuchen..",@ScriptDir,"(*.dif)")
If $auswahl <> "" then GUICtrlSetData($dif,$auswahl)
Case $file_button
$auswahl = FileOpenDialog("Durchsuchen..",@ScriptDir,"(*)")
If $auswahl <> "" then GUICtrlSetData($file,$auswahl)
Case $go
$datei = GUICtrlRead($file)
$dif_datei = GUICtrlRead($dif)
If Not FileExists($datei) or Not FileExists($dif_datei) Then
MsgBox(48,"Fehler","Die Datei existiert nicht!")
Else
apply($datei,$dif_datei,GUICtrlRead($safe),GUICtrlRead($ignore))
EndIf
EndSwitch
Sleep(10)
WEnd
Func apply($datei,$dif_datei,$kopie,$ignore)
$lines = _FileCountLines($dif_datei)
$line = 0
If $kopie = 1 Then
FileCopy($datei,$datei&".copy")
GUICtrlSetData($state,"Erstelle Sicherheitskopie!")
EndIf
While ($line
Fuente: ElitePvpers
Pd: El source esta en hecho en Autoit