Sign in to follow this  
Followers 0
oMBRa

C++ code to autoit

16 posts in this topic

Hi, can anyone translate this code to autoit?

void TextOut(char * text,DWORD msgtype,float StayUpTime) // prints text to the chat/ chatlog
{
DWORD TextToScreen = 0x6F2FA900;
DWORD TextToChatLog = 0x6F34E100;
DWORD plNum = GetPlayerNumber();
__asm
{
MOV EAX, DWORD PTR DS:[0x6FAA1988];
PUSH StayUpTime;
PUSH msgtype;
PUSH text;
PUSH plNum;
MOV ECX,EAX;
CALL TextToScreen;
PUSH msgtype;
PUSH text;
PUSH plNum;
MOV EAX, DWORD PTR DS:[0x6FAA1988];
MOV EAX, DWORD PTR SS:[EAX+0x23C];
MOV EAX, DWORD PTR DS:[EAX+0xC];
MOV ECX,EAX;
CALL TextToChatLog;
}
}

if is not possible translate it, can anyone make a dll ?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Not possible in autoit since you can't do assembly in it.

Not possible to compile a dll either since there are unknown identifiers in the code (GetPlayerNumber() etc).

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Not possible in autoit since you can't do assembly in it.

Not possible to compile a dll either since there are unknown identifiers in the code (GetPlayerNumber() etc).

I think that you are wrong about assembly.

If we could get Ward to talk you wuld see that it's very possible to manipulate with that. Ward showed few examples of that.

Who is Ward? This guy.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I think that you are wrong about assembly.

Yeah, I know. I wasn't specific. I was talking about inline assembly which allows you to call functions in your regular language from the assembly code.

What ward does is using compiled machine code and using some trick with CallWindowProc to achieve the result.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

There are several issues. Hard coded addresses such as x6F2FA900 won't be there when you make a dll.

You would have to change the function to include paramaters for any external functions you need. Then

you also have C++ "name mangling" so your public function should be declared with extern C modifier.

Then you'd need to make sure the public function in the dll used the same calling convention as the code

that calls it expects. Probably safest to use the same conventions as WinApi calls.

Then again it would depend on what other functions this function needs to call and where they are.

I'm assuming it's a stand-alone .exe file. If you have the source to the ancillary functions it may

be easier just to code 'em all in assembler and make a .dll that way. :mellow:

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

if u can try to compile this to dll:

void Warcraft_TextOut(char *cText)
{
    static unsigned long WC3FXN_GlobalClass = 0x6F84CC20;
    static unsigned long WC3FXN_Text = 0x6F663740;

    __asm {    
        push 0FFFFFFFFh
        mov eax, WC3FXN_GlobalClass
        mov eax, dword ptr ds:[eax]
        mov eax, dword ptr ds:[eax+0x3E0]
        mov edx, dword ptr ds:[eax]
        push 0
        push 41200000h
        mov ecx, esp
        lea ecx, dword ptr ss:[ecx+0x08]
        push ecx        
        mov ecx, cText
        push ecx
        mov ecx, eax
        call dword ptr [WC3FXN_Text]
    }
}
Edited by oMBra

Share this post


Link to post
Share on other sites

Hmm, well here's the dll (feeling generous).

Since I felt that those hard coded addresses were suspicious I made them into parameters instead.

Here's how to call it:

DllCall("RandomDll.dll","none:cdecl","str","blabla","ulong",0x6F84CC20,"ulong",0x6F663740)

RandomDll.dll


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I get this:

Incorrect number of parameters in function call.

and thx for your help

Edited by oMBra

Share this post


Link to post
Share on other sites

I get this:

Incorrect number of parameters in function call.

Oops, sorry. Forgot the function name :mellow:

DllCall("RandomDll.dll","none:cdecl","Warcraft_TextOut","str","blabla","ulong",0x6F84CC20,"ulong",0x6F663740)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I get this:

Incorrect number of parameters in function call.

and thx for your help

Do you know how to use the DllCall function? He's just giving you a rough example (incorrect format mind you (forgot: Warcraft_TextOut)).

Edit:

See, monoceres to your rescue.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

since the code I posted hooks a function of a game, I think the memory should be opened before or the dll wont work, so if u can modify it adding a memory open, I would be glad.

I think this will help if u have to get the pid: process name = ''war3.exe''

Edited by oMBra

Share this post


Link to post
Share on other sites

since the code I posted hooks a function of a game, I think the memory should be opened before or the dll wont work, so if u can modify it adding a memory open, I would be glad.

I think this will help if u have to get the pid: process name = ''war3.exe''

Gift horse?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

yes I know but, it wont work unless the process is opened, and I dont know how to do it in C++

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I have a strong feeling that that code is meant to be injected into the target process...

Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

basicaly that code should make appear some text on the screen of a game, like if I have wrote it

Share this post


Link to post
Share on other sites

basicaly that code should make appear some text on the screen of a game, like if I have wrote it

Then you must definitely must be in that games address space. Thus this is impossible (at least using that code) in autoit. So this topic is really not relevant anymore.

Maybe try a C++ forum instead.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0