AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Wireframe in OpenGL Spielen

Ein Thema von mr_emre_d · begonnen am 31. Dez 2008
Antwort Antwort
mr_emre_d
(Gast)

n/a Beiträge
 
#1

Wireframe in OpenGL Spielen

  Alt 31. Dez 2008, 20:59
Hiho liebe Leute,
Erst einmal möchte ich euch einen guten Rutsch in das neue Jahr 2009 wünschen
Anschließend mein Problem kurz erläutern :

Ich habe aus Langeweile vor, ein X-beliebiges OpenGL Spiel in den Wireframe Modus
zu bringen !

Folgendes vorweg: Ich habe keine Cheater-Hintergedanke oder wie man das auch
nennen mag --> ich möchte nur rausfinden, ob ich halt schaffe..

Ich habe es bis jetzt soweit geschafft, dass mein Code in das Spiel richtig
"injiziert" und auch ausgeführt wird!

Das Injizierte müsste eigentlich jede paar Ms per glPolygonMode( Param1, Param2 )
das Spiel auf Wireframe schalten -> genau hier scheiterst leider ...

Code:
  TCode = Record
    LoadLib: function( lpLibFileName: PChar): Cardinal; stdcall;
    GetProc: function( hModule: Cardinal; lpProcName: pAnsiChar ): Pointer; stdcall;
    Param1, Param2,              // 1 = opengl.dll  | 2 = glPolygonMode
    Param3,                      // 3 = glClearColor
    Param4, Param5,              // 5 = user32.dll  | 6 = MessageBoxA
    Param6, Param7,              // 7 = kernel32.dll | 8 = Sleep
    Messag: Array[Byte] of Char;
    Poly1, Poly2,           // 1 = gl_Front_and_Back | 2 = gl_Line }
    Sleep: Cardinal;
    ClCol: Single;
  End;

---

function CODE(P: Pointer): Cardinal; stdcall;
var
  Code: TCode;
  hDLL: Cardinal;
  glPolygonMode: procedure(face: Cardinal; mode: Cardinal); stdcall;
  glClearColor: procedure(red: Single; green: Single; blue: Single; alpha: Single); stdcall;
  MessageBox: function (hWnd: Cardinal; lpText, lpCaption: PChar;
    uType: Cardinal): Integer; stdcall;
  Sleep: procedure( ms: Cardinal ); stdcall;
begin
  Code := TCode(P^);

  hDLL := Code.LoadLib( @Code.Param1[0] );
  glPolygonMode := Code.GetProc( hDLL, @Code.Param2[0] );
  glClearColor := Code.GetProc( hDLL, @Code.Param3[0] );

  hDLL := Code.LoadLib( @Code.Param4[0] );
  MessageBox := Code.GetProc( hDLL, @Code.Param5[0] );
  MessageBox( 0, @Code.Messag[0], @Code.Param1[0], 0 );

  hDLL := Code.LoadLib( @Code.Param6[0] );
  Sleep := Code.GetProc( hDLL, @Code.Param7[0] );
  while True do
  begin
    glClearColor( Code.ClCol, Code.ClCol, Code.ClCol, Code.ClCol );
    glPolygonMode( Code.Poly1, Code.Poly2 );
    Sleep(Code.Sleep);
  end;
end;
function CODEEND: Cardinal;
begin
end;

procedure injectCODE(const WindowTitle: String);
var
  hProcess,
  PID, WB : Cardinal;
  Mem: Pointer;

  hDll, cs: Cardinal;
  code: TCode;
begin
  {ermittle code size}
  cs := IntegeR(@CodeEnd)-Integer(@Code);
  ZeroMemory( @code, SizeOf( TCode ) );
  {bereite parameter vor}
  with code do
  begin
    hDll := LoadLibrary( 'kernel32.dll' );
    LoadLib := windows.GetProcAddress( hDLL, 'LoadLibraryA' );
    GetPRoc := windows.GetProcAddress( hDLL, 'GetProcAddress' );

    Move( 'OpenGl32.dll'#0, Param1, 12 );
    Move( 'glPolygonMode'#0, Param2, 14 );
    Move( 'glClearColor'#0, Param3, 13 );
    Poly1 := gl_Front_and_Back;
    Poly2 := gl_Line;

    Move( 'User32.dll'#0, Param4, 11 );
    Move( 'MessageBoxA'#0, Param5, 12 );
    Move( 'Injection was successfull'#0, Messag, 26 );

    Move( 'Kernel32.dll'#0, Param6, 13 );
    Move( 'Sleep'#0, Param7, 6 );
    ClCol := 0.0;
    Sleep := 10;
  end;
  {injecten:}
  GetWindowThreadProcessId( FindWindow(0, pChar(WindowTitle)), PID );
  if PID = 0 then
    Exit;
  hProcess := OpenProcess( PROCESS_ALL_ACCESS, False, PID );
  if hProcess = 0 then
    Exit;
  try
    Mem := VirtualAllocEx( hProcess, nil, SizeOf(TCode) + cs, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
    { MEM: <PARAMETER BLOCK> <CODE BLOCK> }
    WriteProcessMemory( hProcess, Mem, @code, SizeOf( TCode ), WB );
    WriteProcessMemory( hProcess, Pointer(Integer(Mem)+SizeOf( TCode ) ), @Code, cs, WB );
    CreateRemoteThread( hProcess, Nil, 0, Pointer(IntegeR(Mem) + SizeOf( TCode) ), Mem ,0, wb );
  finally
    CloseHandle( hProcess );
  end;
end;
Vielen Danke noch und rutscht nicht zu tief
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:41 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz