Changeset 489 for tools/wow_patcher
- Timestamp:
- Sep 8, 2010, 10:10:56 PM (14 years ago)
- Location:
- tools/wow_patcher
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/wow_patcher/wowpatcher.lpi
r474 r489 2 2 <CONFIG> 3 3 <ProjectOptions> 4 <Version Value=" 7"/>4 <Version Value="9"/> 5 5 <General> 6 6 <Flags> 7 7 <MainUnitHasCreateFormStatements Value="False"/> 8 8 <MainUnitHasTitleStatement Value="False"/> 9 <UseDefaultCompilerOptions Value="True"/>10 9 </Flags> 11 <MainUnit Value="0"/>12 <TargetFileExt Value=""/>13 10 <Title Value="wowpatcher"/> 14 11 <ResourceType Value="res"/> 15 12 <UseXPManifest Value="True"/> 16 13 <Icon Value="0"/> 17 <Active EditorIndexAtStart Value="0"/>14 <ActiveWindowIndexAtStart Value="0"/> 18 15 </General> 19 16 <VersionInfo> 20 17 <Language Value=""/> 21 18 <CharSet Value=""/> 22 <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName=""ProductVersion=""/>19 <StringTable ProductVersion=""/> 23 20 </VersionInfo> 24 21 <PublishOptions> … … 34 31 </local> 35 32 </RunParams> 36 <Units Count=" 4">33 <Units Count="5"> 37 34 <Unit0> 38 35 <Filename Value="wowpatcher.pas"/> 39 36 <IsPartOfProject Value="True"/> 40 37 <UnitName Value="wowpatcher"/> 41 <CursorPos X="37" Y="168"/> 42 <TopLine Value="150"/> 38 <IsVisibleTab Value="True"/> 43 39 <EditorIndex Value="0"/> 44 <UsageCount Value="49"/> 45 <Loaded Value="True"/> 40 <WindowIndex Value="0"/> 41 <TopLine Value="123"/> 42 <CursorPos X="21" Y="134"/> 43 <UsageCount Value="50"/> 44 <Loaded Value="True"/> 45 <LoadedDesigner Value="True"/> 46 46 </Unit0> 47 47 <Unit1> 48 48 <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/syspchh.inc"/> 49 <EditorIndex Value="2"/> 50 <WindowIndex Value="0"/> 51 <TopLine Value="11"/> 49 52 <CursorPos X="10" Y="40"/> 50 <TopLine Value="11"/> 51 <EditorIndex Value="1"/> 52 <UsageCount Value="23"/> 53 <UsageCount Value="24"/> 53 54 <Loaded Value="True"/> 54 55 </Unit1> 55 56 <Unit2> 56 57 <Filename Value="/usr/share/fpcsrc/rtl/inc/stringsi.inc"/> 58 <EditorIndex Value="3"/> 59 <WindowIndex Value="0"/> 60 <TopLine Value="4"/> 57 61 <CursorPos X="23" Y="58"/> 58 <TopLine Value="4"/> 59 <EditorIndex Value="2"/> 60 <UsageCount Value="23"/> 62 <UsageCount Value="24"/> 61 63 <Loaded Value="True"/> 62 64 </Unit2> 63 65 <Unit3> 64 66 <Filename Value="/usr/share/fpcsrc/rtl/inc/genstr.inc"/> 67 <TopLine Value="98"/> 65 68 <CursorPos X="15" Y="224"/> 66 <TopLine Value="98"/>67 69 <UsageCount Value="7"/> 68 70 </Unit3> 71 <Unit4> 72 <Filename Value="/usr/share/fpcsrc/rtl/objpas/objpas.pp"/> 73 <UnitName Value="objpas"/> 74 <EditorIndex Value="1"/> 75 <WindowIndex Value="0"/> 76 <TopLine Value="9"/> 77 <CursorPos X="8" Y="28"/> 78 <UsageCount Value="11"/> 79 <Loaded Value="True"/> 80 </Unit4> 69 81 </Units> 70 <JumpHistory Count="30" HistoryIndex="2 9">82 <JumpHistory Count="30" HistoryIndex="28"> 71 83 <Position1> 72 84 <Filename Value="wowpatcher.pas"/> 73 <Caret Line="9 6" Column="17" TopLine="78"/>85 <Caret Line="95" Column="1" TopLine="76"/> 74 86 </Position1> 75 87 <Position2> 76 88 <Filename Value="wowpatcher.pas"/> 77 <Caret Line="9 5" Column="1" TopLine="76"/>89 <Caret Line="97" Column="1" TopLine="78"/> 78 90 </Position2> 79 91 <Position3> 80 92 <Filename Value="wowpatcher.pas"/> 81 <Caret Line="9 6" Column="1" TopLine="77"/>93 <Caret Line="98" Column="1" TopLine="79"/> 82 94 </Position3> 83 95 <Position4> 84 96 <Filename Value="wowpatcher.pas"/> 85 <Caret Line="9 5" Column="1" TopLine="76"/>97 <Caret Line="99" Column="1" TopLine="80"/> 86 98 </Position4> 87 99 <Position5> 88 100 <Filename Value="wowpatcher.pas"/> 89 <Caret Line="9 6" Column="1" TopLine="77"/>101 <Caret Line="98" Column="1" TopLine="79"/> 90 102 </Position5> 91 103 <Position6> 92 104 <Filename Value="wowpatcher.pas"/> 93 <Caret Line="9 5" Column="1" TopLine="76"/>105 <Caret Line="99" Column="1" TopLine="80"/> 94 106 </Position6> 95 107 <Position7> 96 108 <Filename Value="wowpatcher.pas"/> 97 <Caret Line=" 97" Column="1" TopLine="78"/>109 <Caret Line="100" Column="1" TopLine="81"/> 98 110 </Position7> 99 111 <Position8> 100 112 <Filename Value="wowpatcher.pas"/> 101 <Caret Line=" 98" Column="1" TopLine="79"/>113 <Caret Line="85" Column="64" TopLine="84"/> 102 114 </Position8> 103 115 <Position9> 104 116 <Filename Value="wowpatcher.pas"/> 105 <Caret Line=" 99" Column="1" TopLine="80"/>117 <Caret Line="149" Column="1" TopLine="131"/> 106 118 </Position9> 107 119 <Position10> 108 120 <Filename Value="wowpatcher.pas"/> 109 <Caret Line=" 98" Column="1" TopLine="79"/>121 <Caret Line="117" Column="24" TopLine="98"/> 110 122 </Position10> 111 123 <Position11> 112 124 <Filename Value="wowpatcher.pas"/> 113 <Caret Line=" 99" Column="1" TopLine="80"/>125 <Caret Line="157" Column="5" TopLine="125"/> 114 126 </Position11> 115 127 <Position12> 116 128 <Filename Value="wowpatcher.pas"/> 117 <Caret Line="1 00" Column="1" TopLine="81"/>129 <Caret Line="159" Column="65" TopLine="128"/> 118 130 </Position12> 119 131 <Position13> 120 132 <Filename Value="wowpatcher.pas"/> 121 <Caret Line=" 85" Column="64" TopLine="84"/>133 <Caret Line="157" Column="1" TopLine="130"/> 122 134 </Position13> 123 135 <Position14> 124 136 <Filename Value="wowpatcher.pas"/> 125 <Caret Line="1 49" Column="1" TopLine="131"/>137 <Caret Line="158" Column="49" TopLine="121"/> 126 138 </Position14> 127 139 <Position15> 128 140 <Filename Value="wowpatcher.pas"/> 129 <Caret Line=" 117" Column="24" TopLine="98"/>141 <Caret Line="76" Column="60" TopLine="55"/> 130 142 </Position15> 131 143 <Position16> 132 144 <Filename Value="wowpatcher.pas"/> 133 <Caret Line="1 57" Column="5" TopLine="125"/>145 <Caret Line="148" Column="23" TopLine="125"/> 134 146 </Position16> 135 147 <Position17> 136 148 <Filename Value="wowpatcher.pas"/> 137 <Caret Line="1 59" Column="65" TopLine="128"/>149 <Caret Line="118" Column="29" TopLine="99"/> 138 150 </Position17> 139 151 <Position18> 140 152 <Filename Value="wowpatcher.pas"/> 141 <Caret Line="1 57" Column="1" TopLine="130"/>153 <Caret Line="132" Column="42" TopLine="110"/> 142 154 </Position18> 143 155 <Position19> 144 156 <Filename Value="wowpatcher.pas"/> 145 <Caret Line="1 58" Column="49" TopLine="121"/>157 <Caret Line="129" Column="12" TopLine="110"/> 146 158 </Position19> 147 159 <Position20> 148 160 <Filename Value="wowpatcher.pas"/> 149 <Caret Line=" 76" Column="60" TopLine="55"/>161 <Caret Line="21" Column="50" TopLine="2"/> 150 162 </Position20> 151 163 <Position21> 152 164 <Filename Value="wowpatcher.pas"/> 153 <Caret Line="1 48" Column="23" TopLine="125"/>165 <Caret Line="108" Column="40" TopLine="102"/> 154 166 </Position21> 155 167 <Position22> 156 168 <Filename Value="wowpatcher.pas"/> 157 <Caret Line="1 18" Column="29" TopLine="99"/>169 <Caret Line="133" Column="22" TopLine="114"/> 158 170 </Position22> 159 171 <Position23> 160 172 <Filename Value="wowpatcher.pas"/> 161 <Caret Line=" 132" Column="42" TopLine="110"/>173 <Caret Line="20" Column="43" TopLine="2"/> 162 174 </Position23> 163 175 <Position24> 164 176 <Filename Value="wowpatcher.pas"/> 165 <Caret Line=" 129" Column="12" TopLine="110"/>177 <Caret Line="76" Column="55" TopLine="76"/> 166 178 </Position24> 167 179 <Position25> 168 180 <Filename Value="wowpatcher.pas"/> 169 <Caret Line=" 21" Column="50" TopLine="2"/>181 <Caret Line="138" Column="15" TopLine="119"/> 170 182 </Position25> 171 183 <Position26> 172 184 <Filename Value="wowpatcher.pas"/> 173 <Caret Line="1 08" Column="40" TopLine="102"/>185 <Caret Line="164" Column="39" TopLine="154"/> 174 186 </Position26> 175 187 <Position27> 176 188 <Filename Value="wowpatcher.pas"/> 177 <Caret Line="1 33" Column="22" TopLine="114"/>189 <Caret Line="173" Column="54" TopLine="143"/> 178 190 </Position27> 179 191 <Position28> 180 192 <Filename Value="wowpatcher.pas"/> 181 <Caret Line=" 20" Column="43" TopLine="2"/>193 <Caret Line="168" Column="28" TopLine="132"/> 182 194 </Position28> 183 195 <Position29> 184 196 <Filename Value="wowpatcher.pas"/> 185 <Caret Line=" 76" Column="55" TopLine="76"/>197 <Caret Line="131" Column="15" TopLine="123"/> 186 198 </Position29> 187 199 <Position30> 188 200 <Filename Value="wowpatcher.pas"/> 189 <Caret Line=" 138" Column="15" TopLine="119"/>201 <Caret Line="218" Column="1" TopLine="180"/> 190 202 </Position30> 191 203 </JumpHistory> 192 204 </ProjectOptions> 193 205 <CompilerOptions> 194 <Version Value=" 8"/>206 <Version Value="9"/> 195 207 <Target> 196 208 <Filename Value="wowpatcher"/> … … 200 212 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 201 213 </SearchPaths> 202 <Parsing>203 <SyntaxOptions>204 <UseAnsiStrings Value="True"/>205 </SyntaxOptions>206 </Parsing>207 214 <CodeGeneration> 208 215 <Checks> -
tools/wow_patcher/wowpatcher.pas
r474 r489 9 9 Classes, SysUtils, CustApp 10 10 { you can add units after this }; 11 12 const 13 Version = '1.2'; 14 ReleaseDate = '2010-09-08'; 11 15 12 16 type … … 38 42 ErrorMsg: String; 39 43 begin 44 WriteLn('wowpatcher ' + Version + ' ' + ReleaseDate); 40 45 if HasOption('h', 'help') then begin 41 46 WriteHelp; … … 126 131 Position: Integer; 127 132 I: Integer; 133 Shift: Integer; 134 NotValid: Boolean; 128 135 const 129 136 StartSequence: array[0..15] of Integer = ($8D, $4D, $E8, $E8, -1, -1, -1, -1, $5B, $8B, $E5, $5D, $C3, $8D, $49, $00); 130 137 StartSequence2: array[0..15] of Integer = ($88, $1D, -1, -1, -1, -1, $E8, -1, -1, -1, -1, $5B, $8B, $E5, $5D, $C3); 131 138 begin 132 OriginalFile := TFileStream.Create(FileName, fmOpenRead); 133 NewFile := TFileStream.Create(NewFileName, fmCreate); 134 SetLength(Buffer, OriginalFile.Size); 135 OriginalFile.Read(Buffer[0], Length(Buffer)); 136 OriginalFile.Destroy; 137 138 WriteLn; 139 Write('Searching for first sequence '); 140 WriteHexData(StartSequence, 0, Length(StartSequence)); 141 Write('...'); 142 Position := FindSequence(Buffer, StartSequence, 0); 143 if Position <> -1 then begin 144 WriteLn('found at ' + IntToHex(Position, 8)); 145 Inc(Position, Length(StartSequence)); 146 WriteLn('Changing data after sequence'); 147 WriteHexData(Buffer, Position, 16); 148 for I := 0 to 11 do 149 Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)]; 150 WriteLn(' => '); 151 WriteHexData(Buffer, Position, 16); 139 try 140 NewFile := TFileStream.Create(NewFileName, fmCreate); 141 try 142 OriginalFile := TFileStream.Create(FileName, fmOpenRead); 143 SetLength(Buffer, OriginalFile.Size); 144 OriginalFile.Read(Buffer[0], Length(Buffer)); 145 finally 146 OriginalFile.Free; 147 end; 148 152 149 WriteLn; 153 end else WriteLn('not found'); 154 155 WriteLn; 156 Write('Searching for second sequence '); 157 WriteHexData(StartSequence2, 0, Length(StartSequence2)); 158 Write('...'); 159 Position := FindSequence(Buffer, StartSequence2); 160 if Position <> -1 then begin 161 WriteLn('found at ' + IntToHex(Position, 8)); 162 Inc(Position, Length(StartSequence2)); 163 WriteLn('Changing data after sequence'); 164 WriteHexData(Buffer, Position, 16); 165 for I := 0 to 11 do 166 Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)]; 167 WriteLn(' => '); 168 WriteHexData(Buffer, Position, 16); 150 Write('Searching for first sequence '); 151 WriteHexData(StartSequence, 0, Length(StartSequence)); 152 Write('...'); 153 Position := FindSequence(Buffer, StartSequence, 0); 154 if Position <> -1 then begin 155 WriteLn('found at ' + IntToHex(Position, 8)); 156 Inc(Position, Length(StartSequence)); 157 if FindSequence(Buffer, StartSequence, Position) <> -1 then 158 WriteLn('Multiple occurence found - ambiguous') 159 else begin 160 Shift := 0; 161 repeat 162 NotValid := False; 163 for I := 0 to 3 do 164 if Buffer[Position + Shift + 3 + I * 4] <> 0 then NotValid := True; 165 if NotValid then Inc(Shift); 166 if Shift > 100 then begin 167 WriteLn('No valid data found after sequence'); 168 Exit; 169 end; 170 until not NotValid; 171 if Shift > 0 then WriteLn('Data shift after sequence: ' + IntToStr(Shift)); 172 Position := Position + Shift; 173 174 WriteLn('Changing data after sequence'); 175 WriteHexData(Buffer, Position, 16); 176 for I := 0 to 11 do 177 Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)]; 178 WriteLn(' => '); 179 WriteHexData(Buffer, Position, 16); 180 end; 181 WriteLn; 182 end else WriteLn('not found'); 183 169 184 WriteLn; 170 end else WriteLn('not found'); 171 172 NewFile.WriteBuffer(Buffer[0], Length(Buffer)); 173 NewFile.Destroy; 185 Write('Searching for second sequence '); 186 WriteHexData(StartSequence2, 0, Length(StartSequence2)); 187 Write('...'); 188 Position := FindSequence(Buffer, StartSequence2); 189 if Position <> -1 then begin 190 WriteLn('found at ' + IntToHex(Position, 8)); 191 Inc(Position, Length(StartSequence2)); 192 if FindSequence(Buffer, StartSequence2, Position) <> -1 then begin 193 WriteLn('Multiple occurence found - ambiguous') 194 end else begin 195 Shift := 0; 196 repeat 197 NotValid := False; 198 for I := 0 to 3 do 199 if Buffer[Position + Shift + 3 + I * 4] <> 0 then NotValid := True; 200 if NotValid then Inc(Shift); 201 if Shift > 100 then begin 202 WriteLn('No valid data found after sequence'); 203 Exit; 204 end; 205 until not NotValid; 206 if Shift > 0 then WriteLn('Data shift after sequence: ' + IntToStr(Shift)); 207 Position := Position + Shift; 208 209 WriteLn('Changing data after sequence'); 210 WriteHexData(Buffer, Position, 16); 211 for I := 0 to 11 do 212 Buffer[Position + I] := Buffer[Position + 12 + (I mod 4)]; 213 WriteLn(' => '); 214 WriteHexData(Buffer, Position, 16); 215 end; 216 WriteLn; 217 end else WriteLn('not found'); 218 219 NewFile.WriteBuffer(Buffer[0], Length(Buffer)); 220 finally 221 NewFile.Free; 222 end; 174 223 end; 175 224
Note:
See TracChangeset
for help on using the changeset viewer.