Problem with CInputControl in C# menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    charly's Avatar Established Member
    Reputation
    63
    Join Date
    Jan 2007
    Posts
    72
    Thanks G/R
    15/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with CInputControl in C#

    Hello,

    It's my first post on this forum so I'll begin by thanking all those who share a lot of incredible information about WoW memory :wave:

    This is my problem: I would like to use CInputControl in C#, so I downloaded the BlackMagic library and copy-pasted the example code of Cypher. But my code isn't working..

    Code:
    if (!wow.OpenProcessAndThread(Memory.GetProcessIdByProcessName("Wow.exe")))
                    throw new Exception("Can't open the process");
    
    uint codeCave = wow.AllocateMemory();
    wow.Asm.Clear();
    wow.Asm.AddLine("mov eax, " + 0x00BE10FC); // Randomness Tick
    wow.Asm.AddLine("mov ecx, " + this); // Address of this instance
    wow.Asm.AddLine("push eax");
    wow.Asm.AddLine("push 0"); // Enable
    wow.Asm.AddLine("push 0"); // dwTime
    wow.Asm.AddLine("push " + 0x10); // Movement
    wow.Asm.AddLine("call " + SetFlag); // Address of function SetFlag
    wow.Asm.InjectAndExecute(codeCave);
    wow.FreeMemory(codeCave);
    1) I begin in C# and I don't find the address of this.. I searched on Google but no result.

    2) I don't find the address of SetFlag. I used those 3.0.3 offsets:

    • CInputControl: 0x011779A4
    • CInputControl__SetFlag: 0x005548F0

    My wrong address of SetFlag is Read(clientConnection + 0x005548F0). I know it's a second noob question but I really don't find the explanation saying what's the base to find SetFlag address. Could you tell me what's wrong please?

    Hoping you understand my english
    Merry Christmas
    Last edited by charly; 12-24-2008 at 08:12 AM.


    Problem with CInputControl in C#
  2. #2
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The "this" keyword doesn't return an address in C#. (It does in C++ however.)

    You'll need to figure out the address you need by yourself.

  3. #3
    charly's Avatar Established Member
    Reputation
    63
    Join Date
    Jan 2007
    Posts
    72
    Thanks G/R
    15/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    The "this" keyword doesn't return an address in C#. (It does in C++ however.)

    You'll need to figure out the address you need by yourself.
    Thanks for your answer in this Christmas day You're right.

    Apparently it's easy to get address of primitive types in C# with the unsafe code. But it seems that it's not possible to get the address of an instance...

    Someone else could help me please?


  4. #4
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by charly View Post
    Thanks for your answer in this Christmas day You're right.

    Apparently it's easy to get address of primitive types in C# with the unsafe code. But it seems that it's not possible to get the address of an instance...

    Someone else could help me please?
    You missed what I said. .NET code runs in the CLR, which is like the Java VM. It has its own address space, completely different than what other processes have. You can't reference a "this" or get the address of "this" in memory. (Technically you can, but it's useless)

  5. #5
    charly's Avatar Established Member
    Reputation
    63
    Join Date
    Jan 2007
    Posts
    72
    Thanks G/R
    15/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's what I tried to say in other words

    And..
    - Store this in ecx, is it necessary?
    - How is compute the SetFlag address?


  6. #6
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by charly View Post
    It's what I tried to say in other words

    And..
    - Store this in ecx, is it necessary?
    - How is compute the SetFlag address?
    What are you not understanding? You can't store "this" in a register, as it won't return the base address like you think it will. (In the way you're storing it, it will actually convert the "this" call to "this.ToString()" which is not something you normally want to do in ASM.)

    And read the other threads in this forum for the SetFlag address. (Or learn how to reverse the client, and find it yourself.)

  7. #7
    charly's Avatar Established Member
    Reputation
    63
    Join Date
    Jan 2007
    Posts
    72
    Thanks G/R
    15/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    What are you not understanding? You can't store "this" in a register, as it won't return the base address like you think it will. (In the way you're storing it, it will actually convert the "this" call to "this.ToString()" which is not something you normally want to do in ASM.)

    And read the other threads in this forum for the SetFlag address. (Or learn how to reverse the client, and find it yourself.)
    I repeat the question in other words: Why do we need to store this in ecx (not how)?

    About SetFlag address, I found nothing. I would appreciate if you gave me a link that explains how to compute it.

    Thx.
    Last edited by charly; 12-25-2008 at 06:10 AM.


  8. #8
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by charly View Post
    I repeat the question in other words: Why do we need to store this in ecx (not how)?

    About SetFlag address, I found nothing. I appreciate if you gave me a link that explains how to compute it.

    Thx.
    From the code you copy/pasted (since it's obvious you don't understand what it does...), no you don't need to store anything in the ECX register.

    And again, for SetFlag, read the threads in this forum. Search is your friend. Stop being lazy.

  9. #9
    charly's Avatar Established Member
    Reputation
    63
    Join Date
    Jan 2007
    Posts
    72
    Thanks G/R
    15/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    From the code you copy/pasted (since it's obvious you don't understand what it does...), no you don't need to store anything in the ECX register.
    If I ask why do I need to store this, it's maybe I understand.

    And again, for SetFlag, read the threads in this forum. Search is your friend. Stop being lazy.
    I found threads with:
    only address or pointer of SetFlag.
    or code that isn't working

    On the blog of Shynd, he uses user32. In WoWX, CInputControl isn't used too (It's the LUA function MoveForwardStart()).

    I need your help Apoc


  10. #10
    Apoc's Avatar Angry Penguin
    Reputation
    1387
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/12
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to figure it out yourself.

    We don't spoonfeed here.

  11. #11
    lanman92's Avatar Active Member
    Reputation
    50
    Join Date
    Mar 2007
    Posts
    1,033
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    RTFM, lookup __thiscall calling convention in MSDN.

  12. #12
    Nesox's Avatar ★ Elder ★
    Reputation
    1280
    Join Date
    Mar 2007
    Posts
    1,238
    Thanks G/R
    0/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by charly View Post
    If I ask why do I need to store this, it's maybe I understand.

    I found threads with:
    only address or pointer of SetFlag.
    or code that isn't working

    On the blog of Shynd, he uses user32. In WoWX, CInputControl isn't used too (It's the LUA function MoveForwardStart()).

    I need your help Apoc
    omg just open it in olly or ida write some asm and live happiley ever after.

  13. #13
    charly's Avatar Established Member
    Reputation
    63
    Join Date
    Jan 2007
    Posts
    72
    Thanks G/R
    15/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, it's working. But my character moves only if I nudge him before.

    Example:
    1. I set the flag to 0x100 (turn left).
    2. Nothing happens
    3. I press the key Z (forward) in the game.
    4. Character begins to turn left.

    I forgot something?

    Code:
    mov eax,  GetTickCount
    mov ecx, DWORD PTR SS:[0x011779A4]
    push dwTime
    push eax
    push Enable
    push iFlag
    call 0x005548F0
    retn


  14. #14
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1356
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/4
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    zzzzzz

    "this" is a C++ keyword that holds a pointer to the current class instance. The reason its stored in ECX is because of calling conventions. When compiled code calls a class method it passes the class instance pointer to the function through the ECX register, the calling convention is called 'thiscall'. Its just a standard calling convention for non-vararg member functions (vararg member functions will use __cdecl and pass 'this' as the first param).


  15. #15
    charly's Avatar Established Member
    Reputation
    63
    Join Date
    Jan 2007
    Posts
    72
    Thanks G/R
    15/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for this information

    Have you an idea about my last problem? It's the post just above yours.


Page 1 of 2 12 LastLast

Similar Threads

  1. Problems With Instance Switching
    By SandLOL in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 08-30-2006, 09:22 PM
  2. Problem with WPE
    By weedlord in forum World of Warcraft General
    Replies: 0
    Last Post: 08-14-2006, 03:35 AM
  3. Problem with BWH 1.11.2
    By gwl15 in forum World of Warcraft General
    Replies: 3
    Last Post: 08-11-2006, 05:37 PM
  4. Problem with CE.
    By Eldretch in forum World of Warcraft General
    Replies: 1
    Last Post: 08-08-2006, 06:49 PM
  5. I have problem with BHW 3.0
    By sunrize1 in forum World of Warcraft General
    Replies: 1
    Last Post: 07-17-2006, 08:49 AM
All times are GMT -5. The time now is 08:30 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search