| View previous topic :: View next topic |
| Author |
Message |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sun Oct 19, 2008 1:46 pm Post subject: Are delphi IDirect3D8 classes different from C++ IDirect3D8? |
|
|
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 |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sun Oct 19, 2008 3:08 pm Post subject: |
|
|
And you question my sig.
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Sun Oct 19, 2008 3:11 pm Post subject: |
|
|
| smartz993 wrote: | And you question my sig.  |
If you're so smart, help him. (I don't mess with DirectX).
You MUST help him cause you're not on the list.
|
|
| Back to top |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sun Oct 19, 2008 3:16 pm Post subject: |
|
|
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 |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Sun Oct 19, 2008 3:27 pm Post subject: |
|
|
| 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 |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Sun Oct 19, 2008 3:59 pm Post subject: |
|
|
| Rot1 wrote: | | smartz993 wrote: | And you question my sig.  |
If you're so smart, help him. (I don't mess with DirectX).
You MUST help him cause you're not on the list.  |
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 |
|
 |
dnsi0 I post too much
Reputation: 0
Joined: 04 Jan 2007 Posts: 2674
|
Posted: Sun Oct 19, 2008 5:34 pm Post subject: |
|
|
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 |
|
 |
|