Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Are delphi IDirect3D8 classes different from C++ IDirect3D8?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Oct 19, 2008 1:46 pm    Post subject: Are delphi IDirect3D8 classes different from C++ IDirect3D8? Reply with quote

Cause I you try to hook maplestory's Direct3DCreate8 with a delphi wrapper class, Maple simply crashes. So Any solutions apart from using C++ cause I really suck at C++.


LOL I AM SUCH AN IDIOT!!!!!!!!!!!!!!!!!!!!!!!!
SO STUPID SO STUPID!!!


lol...
before I made the jump I realized that my compiler auomatically pushes
ecx and ebp onto the stack. I didn't pop them from the stack before jumping to the location. So ofcourse it will crash cause the stack is not organized correctly before I called it ... LOL >.> Such an idiot.... >.>
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Sun Oct 19, 2008 3:08 pm    Post subject: Reply with quote

And you question my sig. Sad
Back to top
View user's profile Send private message
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Oct 19, 2008 3:11 pm    Post subject: Reply with quote

smartz993 wrote:
And you question my sig. Sad


If you're so smart, help him. (I don't mess with DirectX).

You MUST help him cause you're not on the list. Smile
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Oct 19, 2008 3:16 pm    Post subject: Reply with quote

Now Im facing a new problem.

If I make maple hook to the Bypassed Function it works but if I create a new function that calls that bypassed functions and then return that value, It crashes. why?
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Sun Oct 19, 2008 3:27 pm    Post subject: Reply with quote

dnsi0 wrote:
Now Im facing a new problem.

If I make maple hook to the Bypassed Function it works but if I create a new function that calls that bypassed functions and then return that value, It crashes. why?


Ok... what?
Post your code with some comments and let that speak... it'll probably make a lot more sense.

_________________
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Sun Oct 19, 2008 3:59 pm    Post subject: Reply with quote

Rot1 wrote:
smartz993 wrote:
And you question my sig. Sad


If you're so smart, help him. (I don't mess with DirectX).

You MUST help him cause you're not on the list. Smile


If you understood English, maybe you would have realized he already solved his problem.

dnsi0 wrote:
Now Im facing a new problem.

If I make maple hook to the Bypassed Function it works but if I create a new function that calls that bypassed functions and then return that value, It crashes. why?


No idea what you said. I think maybe i got part of it..

You're calling one of the DirectX Functions that maple owns in one of your own functions?
Back to top
View user's profile Send private message
dnsi0
I post too much
Reputation: 0

Joined: 04 Jan 2007
Posts: 2674

PostPosted: Sun Oct 19, 2008 5:34 pm    Post subject: Reply with quote

Its in delphi...:
Code:

library DirectXOverlay;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls,psapi,winsvc,DirectXGraphics;

{$R *.res}
var
  orp:cardinal;
  dxHandle:Cardinal;
  dxCreateAddress:Cardinal;
  jumper:pbytearray;
  Direct3DObject:IDirect3D8;
  Direct3DDevice:IDirect3DDevice8;
//See this? THis is the working function that calls Direct3DCreate8.
function hMyDirect3DCreate8(SDKVersion:Cardinal):IDirect3D8;
var
  location:DWORD;
begin
location:=$6DD3E885;
  asm
    pop ecx
    pop ebp
    mov edi,edi
    push ebp
    mov ebp,esp
    jmp [location]
  end;
end;

//This code is supose to hold a DIrect3D8 object and return the other one back.
//I didn't add the hook yet cause im just testing to see if the api hook actucally works... AND... it doesn't work with this function...
function MyDirect3DCreate8(SDKVersion:Cardinal):IDirect3D8;
begin
  Direct3DObject:=hMyDirect3DCreate8(SDKVersion);
  Result:=Direct3DObject;
end;

begin
  loadlibrary('d3d8.dll');
  dxHandle:=GetModuleHandle('d3d8.dll');
  dxCreateAddress:=Dword(GetProcAddress(dxHandle,'Direct3DCreate8'));
  virtualprotect(pointer(dxCreateAddress),6,PAGE_EXECUTE_READWRITE,orp);
  jumper:=pointer(dxCreateAddress);
  jumper[0]:=$E9;
  pdword(@jumper[1])^:=dword(@MyDirect3DCreate8)-dword(dword(@jumper[0])+$5);
end.


DirectXGraphics is a working directX Class.
NOtice the part about the @MyDIrect3DCreate8?
MyDirect3DCreate8 is the function that it is supose to hook. But ...... It doesn't work.
If u hook to hMyDirect3DCreate8 then it works perfectly... WHY>>>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites