Visual Studio 2015 __fastcall

08/09/2016 18:49 PainToTheWorld#1
Hii :)
ich bin vor kurzem von c++ Builder zu visual studio gewechselt und hab dabei n kleines Problem.

__fastcall wird scheinbar einfach nicht benutzt
Code:
void __fastcall hkConnect(void* client, char* ip, int port)
Was bei embarcadero c++ Builder problemlos funktioniert.. macht hier Probleme.
Kennt das jemand und kann eventuell weiterhelfen?
08/09/2016 18:52 Pumba98#2
Gehört dann wohl doch eindeutig eher hier hin:
[Only registered and activated users can see links. Click Here To Register...]
08/09/2016 18:54 Bombasticx3#3
Quote:
Originally Posted by PainToTheWorld View Post
Hii :)
ich bin vor kurzem von c++ Builder zu visual studio gewechselt und hab dabei n kleines Problem.

__fastcall wird scheinbar einfach nicht benutzt
Code:
void __fastcall hkConnect(void* client, char* ip, int port)
Was bei embarcadero c++ Builder problemlos funktioniert.. macht hier Probleme.
Kennt das jemand und kann eventuell weiterhelfen?
#edit. Was falsch verstanden

Quote:
Originally Posted by Pumba98 View Post
Gehört dann wohl doch eindeutig eher hier hin:
[Only registered and activated users can see links. Click Here To Register...]

Genau.
08/09/2016 18:56 PainToTheWorld#4
Es geht um eine Funktion in Nostale. Hätte ich dazu schreiben sollen.
Die Argumente werden nicht richtig übergeben.
08/09/2016 18:58 Pumba98#5
Quote:
Originally Posted by PainToTheWorld View Post
Es geht um eine Funktion in Nostale. Hätte ich dazu schreiben sollen.
Die Argumente werden nicht richtig übergeben.
Wenn es erst seit dem Wechsel zu VS probleme gibt hat es trotzdem rein garnichts mit NosTale zu tun :rtfm:
08/09/2016 21:58 nBot-Developer#6
Die __fastcall convention unterscheidet sich von Embarcadero und VS
08/09/2016 22:36 BladeTiger12#7
So viel ich gesehen habe, hat Visual Studio diese Call-Convention gar nicht.
(Habe es selbst schon etliche male Probiert... Ohne Erfolg)
Letztendlich kann mann dann wohl nur auf __asm zurückgreifen.
(Keine Ahnung ob man so eine eigene erstellen kann. Glaube aber eher nicht so einfach.)
08/09/2016 22:42 Pumba98#8
[Only registered and activated users can see links. Click Here To Register...]
08/09/2016 22:50 Bombasticx3#9
Lässt sich ohne Probleme aufrufen, auch mit overloads.
Ob er Fastcall auch richtig nutzt, keinen Plan.

Vielleicht liegt das Problem an ner andren Stelle im Code?

08/09/2016 22:51 BladeTiger12#10
Quote:
Originally Posted by Pumba98 View Post
[Only registered and activated users can see links. Click Here To Register...]
Das unterscheidet sich je nach Compiler.
Sonst würde es bei ihm ja noch gehen.
NosTale nutzt auf jeden Fall eine andere Calling-Convention.
08/09/2016 22:53 Bombasticx3#11
Quote:
Originally Posted by BladeTiger12 View Post
Das unterscheidet sich je nach Compiler.
Sonst würde es bei ihm ja noch gehen.
NosTale nutzt auf jeden Fall eine andere Calling-Convention.
Eventuell __stdcall?
08/09/2016 22:56 BladeTiger12#12
Quote:
Originally Posted by Bombasticx3 View Post
Eventuell __stdcall?
Nope^^ Keine von C++ passt.
NosTale ist doch so weit ich weiß in Delphi, deswegen wahrscheinlich.
Sprich man kommt so schnell nicht rum um __asm.
08/10/2016 00:08 atom0s#13
The game does not use __fastcall for most things, it's a custom calling method used by Delphi. It's similar to __fastcall but does not use the same registers. Fastcall uses ECX and EDX for the first two parameters, where most of Nostale's calls use EAX, EDX, and ECX instead.

You can create custom 'naked' stubs to call the functions instead and just mimic the parameter movements into the proper registers.
08/10/2016 23:01 PainToTheWorld#14
Code:
typedef void(__fastcall *tNTConnect)(unsigned long client, char* ip, int port);
Lässt sich problemlos aufrufen... will man aber hier was abfangen, sind die Register verkehrt.
__asm is zwar nicht so schön, scheint aber nicht anders zu gehen...
Hatte die Hoffnung, das es an den Einstellungen von Visual Studio liegt.
Trotzdem danke an alle :)
08/11/2016 06:00 atom0s#15
If you are looking to alter where the client connects to, you can just hook the 'connect' winsock API. [Only registered and activated users can see links. Click Here To Register...]


Just detour it and alter the connection information in the sockaddr structure.


If you are looking for where the game client currently calls connect, it's located in:
0x526AA4


The current stub is:
Code:
int __usercall sub_526AA4@<eax>(int a1@<eax>, int a2@<edx>, u_short a3@<cx>)

Which you will need to manually call with inline ASM as the calling convention is non-standard.