[Help] How to use ASM in-process menu

Shout-Out

User Tag List

Results 1 to 13 of 13
  1. #1
    teufel123's Avatar Active Member
    Reputation
    30
    Join Date
    Feb 2008
    Posts
    114
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Help] How to use ASM in-process

    Tried searching but found nothing...
    I'm running my C# hack trough CLR hosting and I want to be able to execute ASM like I did with blackmagic.
    Do I still have to use BM if im inprocess or is there an easier way?

    [Help] How to use ASM in-process
  2. #2
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why would you want to use asm injection when you are injected?
    You can just GetDelegateForFunctionPointer Method .

  3. #3
    teufel123's Avatar Active Member
    Reputation
    30
    Join Date
    Feb 2008
    Posts
    114
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you missunderstood me. I want to be able to use asm like in c++ in a C#y way

    Code:
     	_asm {
     		 mov eax, dword ptr ds:[esp+8]
     		 ...
     	}
    I was able to to this in strings and then inject with BM but i want to know if there is an easier method without external libaries if im in-process
    Last edited by teufel123; 12-13-2011 at 03:39 PM.

  4. #4
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    he answered exactly that
    you are IN-Process,in wows adress space,where you can just create a new integer and pass that to a method you got via a pointer with GetDelegateForFunctionPointer

  5. #5
    teufel123's Avatar Active Member
    Reputation
    30
    Join Date
    Feb 2008
    Posts
    114
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aw no... I want to be able to do something like this. I would be able to do this as a string with BM.

    Code:
    	__asm
    	{
    		MOV EDI,iWeaponID;
    		MOV EAX,EDI;
    		AND EAX,0xFF;
    		ADD EAX,EAX;
    		MOV ECX,0xA00D94[EAX+EAX];
    		MOV dwShaderName,ECX;
    	}

  6. #6
    sitnspinlock's Avatar Elite User CoreCoins Purchaser
    Reputation
    398
    Join Date
    Sep 2010
    Posts
    439
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol managed ;p

    use masm unpack the bytes somewhere, unset NX
    Last edited by sitnspinlock; 12-13-2011 at 04:14 PM.

  7. #7
    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)
    If you really need access that fine, you could probably use unsafe pointers from C#. It'll be slightly slower, but you can do the same thing as you would with raw assembly.

  8. #8
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by everdox View Post
    lol managed ;p

    use masm unpack the bytes somewhere, unset NX
    I assume you mean unset NX on the page (ie. give it PAGE_EXECUTE*), not actually disabling DEP?

    Originally Posted by lanman92 View Post
    If you really need access that fine, you could probably use unsafe pointers from C#. It'll be slightly slower, but you can do the same thing as you would with raw assembly.
    I don't think using pointers in C# is any slower than using them from C or ASM? Is there really any overhead (That is, overhead of using them, not other overhead like GC)?
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  9. #9
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by teufel123 View Post
    aw no... I want to be able to do something like this. I would be able to do this as a string with BM.

    Code:
        __asm
        {
            MOV EDI,iWeaponID;
            MOV EAX,EDI;
            AND EAX,0xFF;
            ADD EAX,EAX;
            MOV ECX,0xA00D94[EAX+EAX];
            MOV dwShaderName,ECX;
        }
    Code:
    ...
    int arrayOffset = (iWeaponId & 0xFF) * 4;
    int shaderName = Memory.Read<int>(new IntPtr(0xa00d94) + arrayOffset); // should dwShaderName actually be pszShaderName? Else name it dwShaderId or sth...
    ...
    Often you stuff is already present in an function internal to WoW in which case you use GetDelegateForFunctionPointer.

  10. #10
    teufel123's Avatar Active Member
    Reputation
    30
    Join Date
    Feb 2008
    Posts
    114
    Thanks G/R
    0/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That peace of code wasnt Wow related but I found a solution. I didn't know that fasm had a function ( fasm.Assemble() ) which would return the byte-codeof a sent asm string. I'll call the byte-code after it hase been allocated with a delegate.

  11. #11
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MaiN View Post
    I don't think using pointers in C# is any slower than using them from C or ASM? Is there really any overhead (That is, overhead of using them, not other overhead like GC)?
    I don't think so. IntPtr is a value type. You can't get much simpler than that. As for GC, that is in a separate thread anyways (one which is usually mostly idle), so even that shouldn't add any significant overhead.

  12. #12
    MaiN's Avatar Elite User
    Reputation
    335
    Join Date
    Sep 2006
    Posts
    1,047
    Thanks G/R
    0/10
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by namreeb View Post
    I don't think so. IntPtr is a value type. You can't get much simpler than that. As for GC, that is in a separate thread anyways (one which is usually mostly idle), so even that shouldn't add any significant overhead.
    Yes, but depending on the GC type all other threads are suspended while the GC thread does its work. But yeah, that's what I thought (and I actually checked the ASM generated by the JIT'ter when using IntPtr's once - there are no remnants of the actual usage of IntPtr!).
    [16:15:41] Cypher: caus the CPU is a dick
    [16:16:07] kynox: CPU is mad
    [16:16:15] Cypher: CPU is all like
    [16:16:16] Cypher: whatever, i do what i want

  13. #13
    namreeb's Avatar Legendary

    Reputation
    668
    Join Date
    Sep 2008
    Posts
    1,029
    Thanks G/R
    8/222
    Trade Feedback
    0 (0%)
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    For me I remember that when you export an IntPtr via C++/CLI it'll show up in C# as a ValueType, rather than IntPtr, or some such thing.

Similar Threads

  1. Replies: 1
    Last Post: 07-23-2009, 01:17 PM
  2. [Help] How to create token and how to use it.
    By Ellenor in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 10-04-2008, 10:24 PM
  3. HELP!How Do I Use The C++ Scripts?
    By Lets See2 in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 08-28-2008, 04:57 PM
  4. [HELP!]Dont Know How To Use C++ Scripts...
    By Lets See2 in forum WoW EMU Questions & Requests
    Replies: 3
    Last Post: 08-24-2008, 12:55 AM
  5. [Question] How to use Navicat? :s Help!
    By Gadella in forum World of Warcraft Emulator Servers
    Replies: 11
    Last Post: 12-12-2007, 10:19 AM
All times are GMT -5. The time now is 06:14 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search