[Injection] EndScene: Memory Protection Attribute menu

User Tag List

Results 1 to 8 of 8
  1. #1
    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)

    [Injection] EndScene: Memory Protection Attribute

    Hi there,

    While finally hooking EndScene, I was constantly getting some kind of uncatchable (from .Net perspective) error, which resulted in the ICLRRuntimeHost::ExecuteInDefaultAppDomain Method to return with E_POINTER, indicating that I accessed an invalid address.

    I tracked down the problem and located it in the actual access in my Memory class while writing the 6 magic bytes to the EndScene address. Regardless if I do the writing with Marshal.Copy or with pure unsafe arithmetic, the managed dll returns immediately without a chance to catch an Exception. I opened OllyDbg and queried the protection attributes for the .text section of d3d9.dll, which suprised me:
    WoW changed them from RWE Copy on Write to RE, explaining my errors.

    Since I'm using Apoc's WhiteMagic (kind of, the Manager<> stuff), I edited the protection attributes for test purposes and my EndScene-handler was called correctly.

    Now my questions are:
    1.) Why does the access violation pass through my .Net Exception handlers?
    2.) The main reason for this post, did you have the same issue? It's not much of a problem because it's easy to fix, but I like to know if I did some kind of n00b mistake and there's an even easier solution.

    [Injection] EndScene: Memory Protection Attribute
  2. #2
    IceFire32's Avatar Active Member
    Reputation
    47
    Join Date
    Feb 2009
    Posts
    33
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had exactly the the same problem, I solved it by hooking the D3D vTable, instead of an easy detour Imo that's a perfect method of DX hooking.

  3. #3
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://msdn.microsoft.com/en-us/library/aa366898(VS.85).aspx

    Just set the memory as PAGE_EXECUTE_READWRITE, do your shit, then set it back to its original state.

    You're both over-complicating things.

  4. #4
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah.. A virtual table hook because you're too lazy to set protections, is silly.


  5. #5
    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 Cypher View Post
    http://msdn.microsoft.com/en-us/library/aa366898(VS.85).aspx

    Just set the memory as PAGE_EXECUTE_READWRITE, do your shit, then set it back to its original state.

    You're both over-complicating things.
    That's exactly how I'm doing it now. I just wondered that nobody talked about it before in here and that the example of WhiteMagic didn't care for that either.

  6. #6
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by suicidity View Post
    Yeah.. A virtual table hook because you're too lazy to set protections, is silly.
    I always hook the vtable, it's a bit easier to use through multiple games. (Go ahead Cypher, bitch about how it doesn't always work.)

  7. #7
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I prefer a virtual table hook because it's simple (In my opinion), but IceFire said he went with it because of protection issues; Doesn't make sense.


  8. #8
    Cypher's Avatar Kynox's Sister's Pimp
    Reputation
    1358
    Join Date
    Apr 2006
    Posts
    5,368
    Thanks G/R
    0/6
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post


    I always hook the vtable, it's a bit easier to use through multiple games. (Go ahead Cypher, bitch about how it doesn't always work.)
    Doesn't always work.

Similar Threads

  1. [Release] [C# DLL] iHook, EndScene ASM Injection!
    By -Ryuk- in forum WoW Memory Editing
    Replies: 142
    Last Post: 09-19-2022, 09:06 PM
  2. Replies: 11
    Last Post: 01-06-2011, 02:59 PM
  3. Replies: 11
    Last Post: 12-23-2010, 09:30 PM
  4. Replies: 5
    Last Post: 04-03-2009, 07:59 PM
  5. Unlock Protected LUA with a Patch? (Without Injecting code?)
    By Zeroi9 in forum WoW Memory Editing
    Replies: 15
    Last Post: 03-30-2009, 05:58 PM
All times are GMT -5. The time now is 03:54 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