unit nocd; interface procedure DoCodeInjections; implementation uses windows, sysutils, Logging, TADemoConsts, TA_MemoryLocations; const NOP_Instruction = $90; CodeInjectionBlock1 : packed array [0..6-1] of Byte = ( NOP_Instruction, NOP_Instruction, NOP_Instruction, NOP_Instruction, NOP_Instruction, NOP_Instruction ); ResStrLen1 = 13; ResourceString1 : string = 'TOTALA.ID'; ResStrLen2 = 52; ResourceString2 : string = 'Totala4.HPI (CD-2) required to play missions'; ResStrLen3 = 55; ResourceString3 : string = 'Totala2.hpi (CD-1) required to play multi-player games'; function PadString( const s : string; len : Integer) : string; begin Result := s; while Length(s) < len do result := result + #0; end; {PadString} procedure DoCodeInjections; var CurrentProcessHandle : THandle; MemAddr : longword; s : string; ByteValue : byte; bytesWritten : Longword; begin CurrentProcessHandle := GetCurrentProcess; try // Do the 1st code injection (Removes the jump which handles when the CD check fails) MemAddr := $41D4CD; bytesWritten := SizeOf(CodeInjectionBlock1); Win32Check( WriteProcessMemory( CurrentProcessHandle, Pointer(MemAddr), @CodeInjectionBlock1, bytesWritten, bytesWritten) ); // Do the 1st code injection (Removes the jump which handles when the CD check fails) MemAddr := $502894; bytesWritten := 1; ByteValue := 1; Win32Check( WriteProcessMemory( CurrentProcessHandle, Pointer(MemAddr), @ByteValue, bytesWritten, bytesWritten) ); // Change 'c%:\TOTALA.ID' -> 'TOTALA.ID'#0#0#0#0 MemAddr := $5028E8; s := PadString(ResourceString1,ResStrLen1); bytesWritten := length(s); Win32Check( WriteProcessMemory( CurrentProcessHandle, Pointer(MemAddr), @s[1], bytesWritten, bytesWritten) ); // Change 'Please insert the Campaign CD (Disc 2) and try again' -> 'Totala4.HPI (CD-2) required to play missions' MemAddr := $502A34; s := PadString(ResourceString2,ResStrLen2); bytesWritten := length(s); Win32Check( WriteProcessMemory( CurrentProcessHandle, Pointer(MemAddr), @s[1], bytesWritten, bytesWritten) ); // Change 'Please insert the Multiplayer CD (Disc 1) and try again' -> 'Totala2.hpi (CD-1) required to play multi-player games' MemAddr := $5030C0; s := PadString(ResourceString3,ResStrLen3); bytesWritten := Length(s); Win32Check( WriteProcessMemory( CurrentProcessHandle, Pointer(MemAddr), @s[1], bytesWritten, bytesWritten) ); except On e : Exception do begin TLog.Add(0,'In memory No-cd check removeal failed'); LogException(e); end; end; end; {DoCodeInjections} end.