Jump to content

C++ code to autoit


oMBRa
 Share

Recommended Posts

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 ?

Link to comment
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).

Edited by monoceres

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

Link to comment
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

Link to comment
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!

Link to comment
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:

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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

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.

Link to comment
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''

Edited by oMBra
Link to comment
Share on other sites

  • Moderators

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?

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.

Link to comment
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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...