









<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Drawing on another Direct3D program&#8217;s viewport</title>
	<atom:link href="http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/</link>
	<description>Diary of a programmer, journal of a hacker.</description>
	<lastBuildDate>Sat, 07 Jan 2012 16:21:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Sylar</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-1404</link>
		<dc:creator>Sylar</dc:creator>
		<pubDate>Tue, 23 Feb 2010 06:23:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-1404</guid>
		<description>Hi Greg,
   Thanks for your great work! It looks pretty cool.
   You said this dll could work on nearly all d3d9 games which use present or swapchainpresent to present screen. But how can I get it working? I&#039;m just working on Direct3D and have no idea about dll injection. I wanna use the dll to do this: when any d3d9 game starts, inject this dll into the game and hook the d3d9 api. Any suggestion for me? otherwise, it would be very nice if you could send me a example with source code showing how to using this dll to hook d3d9 games. My email is: chenliangnjbj@tom.com .</description>
		<content:encoded><![CDATA[<p>Hi Greg,<br />
   Thanks for your great work! It looks pretty cool.<br />
   You said this dll could work on nearly all d3d9 games which use present or swapchainpresent to present screen. But how can I get it working? I&#8217;m just working on Direct3D and have no idea about dll injection. I wanna use the dll to do this: when any d3d9 game starts, inject this dll into the game and hook the d3d9 api. Any suggestion for me? otherwise, it would be very nice if you could send me a example with source code showing how to using this dll to hook d3d9 games. My email is: <a href="mailto:chenliangnjbj@tom.com">chenliangnjbj@tom.com</a> .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-213</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Fri, 06 Feb 2009 11:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-213</guid>
		<description>Filip, this is likely due to a service pack or hotfix upgrade. Any new build of the target binary will in all likelihood cause this check to fail.

Indeed, this is the whole purpose of VerifyAddresses - to minimise the fallout in the case of a version mismatch. However, it is probably safe enough to ignore this check altogether if the program is for personal consumption only.

If you need something more scalable, I&#039;d recommend using Microsoft Detours to install equivalent hooks.</description>
		<content:encoded><![CDATA[<p>Filip, this is likely due to a service pack or hotfix upgrade. Any new build of the target binary will in all likelihood cause this check to fail.</p>
<p>Indeed, this is the whole purpose of VerifyAddresses &#8211; to minimise the fallout in the case of a version mismatch. However, it is probably safe enough to ignore this check altogether if the program is for personal consumption only.</p>
<p>If you need something more scalable, I&#8217;d recommend using Microsoft Detours to install equivalent hooks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Filip</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-211</link>
		<dc:creator>Filip</dc:creator>
		<pubDate>Fri, 30 Jan 2009 01:09:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-211</guid>
		<description>When I try to inject into an application I get that the VerifyAddresses function returns false. Any idea why this might be happening?</description>
		<content:encoded><![CDATA[<p>When I try to inject into an application I get that the VerifyAddresses function returns false. Any idea why this might be happening?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ring3 Circus &#187; Blog Archive &#187; Direct3D 9 Hook v1.1</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-131</link>
		<dc:creator>Ring3 Circus &#187; Blog Archive &#187; Direct3D 9 Hook v1.1</dc:creator>
		<pubDate>Fri, 07 Mar 2008 08:46:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-131</guid>
		<description>[...] By popular demand, I&#8217;ve updated the Direct3D 9 Hooking Sample to accommodate Windows Vista. The same binary should work on both Vista and XP. I&#8217;ve only tested it on Vista 64-bit, so it&#8217;d be nice to know if it works with Vista 32 or not. Other than this, most of the same caveats apply as last time. [...]</description>
		<content:encoded><![CDATA[<p>[...] By popular demand, I&#8217;ve updated the Direct3D 9 Hooking Sample to accommodate Windows Vista. The same binary should work on both Vista and XP. I&#8217;ve only tested it on Vista 64-bit, so it&#8217;d be nice to know if it works with Vista 32 or not. Other than this, most of the same caveats apply as last time. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-129</link>
		<dc:creator>matt</dc:creator>
		<pubDate>Fri, 07 Mar 2008 00:18:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-129</guid>
		<description>hook Direct3DCreate9-&gt;CreateDevice-&gt;ppReturnedDeviceInterface

interface are in order in the d3d9.h</description>
		<content:encoded><![CDATA[<p>hook Direct3DCreate9-&gt;CreateDevice-&gt;ppReturnedDeviceInterface</p>
<p>interface are in order in the d3d9.h</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-122</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Tue, 26 Feb 2008 08:47:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-122</guid>
		<description>Austin. Take a look &lt;a href=&quot;http://www.ring3circus.com/gameprogramming/run-time-determination-of-vc-virtual-member-function-addresses-take-ii/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. There&#039;s currently a little doubt surrounding the effectiveness of this method as I&#039;ve received (but not yet investigated) reports of it producing entirely erroneous results. It worked for me though, so it&#039;s certainly worth a try.

If that doesn&#039;t work out for you, it should be simple enough to code up a program with a call to the virtual function in question immediately after something easily identifiable (say, two successive calls to IsDebuggerPresent). Now by throwing the resulting executable at your debugger and setting an appropriate breakpoint you can trace into the call (which will almost certainly be of the form CALL &lt;Register&gt;) and see where you end up. Once you have the absolute address of the function, subtract the base address of the DLL (where the PE header begins in memory) for the relative offset which can be used under all circumstances.

For the record, it&#039;s not generally too easy to find these function locations in a debugger using somebody else&#039;s binary as the compiler trashes all easily processable mappings of function names to addresses. If for some reason you are entirely unable to debug your own Direct3D program then you&#039;ll have to be a little creative and reverse-engineer the target to find the pertinent call, paying attention to stack parameters and comparing the arguments with those specified by the Direct3D docs.</description>
		<content:encoded><![CDATA[<p>Austin. Take a look <a href="http://www.ring3circus.com/gameprogramming/run-time-determination-of-vc-virtual-member-function-addresses-take-ii/" rel="nofollow">here</a>. There&#8217;s currently a little doubt surrounding the effectiveness of this method as I&#8217;ve received (but not yet investigated) reports of it producing entirely erroneous results. It worked for me though, so it&#8217;s certainly worth a try.</p>
<p>If that doesn&#8217;t work out for you, it should be simple enough to code up a program with a call to the virtual function in question immediately after something easily identifiable (say, two successive calls to IsDebuggerPresent). Now by throwing the resulting executable at your debugger and setting an appropriate breakpoint you can trace into the call (which will almost certainly be of the form CALL <register>) and see where you end up. Once you have the absolute address of the function, subtract the base address of the DLL (where the PE header begins in memory) for the relative offset which can be used under all circumstances.</p>
<p>For the record, it&#8217;s not generally too easy to find these function locations in a debugger using somebody else&#8217;s binary as the compiler trashes all easily processable mappings of function names to addresses. If for some reason you are entirely unable to debug your own Direct3D program then you&#8217;ll have to be a little creative and reverse-engineer the target to find the pertinent call, paying attention to stack parameters and comparing the arguments with those specified by the Direct3D docs.</register></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Austin</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-121</link>
		<dc:creator>Austin</dc:creator>
		<pubDate>Mon, 25 Feb 2008 19:48:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-121</guid>
		<description>I am also interested how you got the offsets for the three functions you hooked, in order to hook the other functions using this method.</description>
		<content:encoded><![CDATA[<p>I am also interested how you got the offsets for the three functions you hooked, in order to hook the other functions using this method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-110</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Sat, 09 Feb 2008 17:45:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-110</guid>
		<description>That&#039;s a little worrying. Perhaps there is more than one version of d3d9.dll in the wild for 32-bit Vista. If that&#039;s the case, I&#039;ll have to resort to using the method in &lt;a href=&quot;http://www.ring3circus.com/gameprogramming/run-time-determination-of-vc-virtual-member-function-addresses-take-ii/#comment-109&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt; (which you evidently found and I hope answers your questions). That would involve a compromise somewhere along the line, though, as it requires an initialised IDirect3DDevice9 object in order to function.

So indeed, can anybody confirm that the new offsets are causing problems?</description>
		<content:encoded><![CDATA[<p>That&#8217;s a little worrying. Perhaps there is more than one version of d3d9.dll in the wild for 32-bit Vista. If that&#8217;s the case, I&#8217;ll have to resort to using the method in <a href="http://www.ring3circus.com/gameprogramming/run-time-determination-of-vc-virtual-member-function-addresses-take-ii/#comment-109" rel="nofollow">this post</a> (which you evidently found and I hope answers your questions). That would involve a compromise somewhere along the line, though, as it requires an initialised IDirect3DDevice9 object in order to function.</p>
<p>So indeed, can anybody confirm that the new offsets are causing problems?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexandre</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-107</link>
		<dc:creator>Alexandre</dc:creator>
		<pubDate>Fri, 08 Feb 2008 20:47:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-107</guid>
		<description>I forgot to specify that it does work under XP with the same code. Can anyone else confirm?

Thanks,
Alexandre</description>
		<content:encoded><![CDATA[<p>I forgot to specify that it does work under XP with the same code. Can anyone else confirm?</p>
<p>Thanks,<br />
Alexandre</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexandre</title>
		<link>http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/comment-page-1/#comment-106</link>
		<dc:creator>Alexandre</dc:creator>
		<pubDate>Fri, 08 Feb 2008 20:39:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.ring3circus.com/gameprogramming/drawing-on-another-direct3d-programs-viewport/#comment-106</guid>
		<description>Greg,

The offsets you provided for Vista do not work under Vista x86. I can get a HMODULE of d3d9.dll just fine within the remote process so I add up the offset to it and the memcmp between the opcodes you provided and what is actually there is different. I even tried using your code directly instead of mine and the result is exactly the same. Does this have to do with what matt was saying regarding dynamic offsets? I didn&#039;t quite get it.

Additionally, was it hard for you to get those offsets? I&#039;m not expecting you to show me how but I&#039;m just wondering if it&#039;s within the scope of a guy like me or if it requires quite a bit of reverse engineering experience. The reason I&#039;m asking is because I will most likely need to intercept other methods. I think you mentionned OllyBdg, would that do that?

Thanks,
Alexandre</description>
		<content:encoded><![CDATA[<p>Greg,</p>
<p>The offsets you provided for Vista do not work under Vista x86. I can get a HMODULE of d3d9.dll just fine within the remote process so I add up the offset to it and the memcmp between the opcodes you provided and what is actually there is different. I even tried using your code directly instead of mine and the result is exactly the same. Does this have to do with what matt was saying regarding dynamic offsets? I didn&#8217;t quite get it.</p>
<p>Additionally, was it hard for you to get those offsets? I&#8217;m not expecting you to show me how but I&#8217;m just wondering if it&#8217;s within the scope of a guy like me or if it requires quite a bit of reverse engineering experience. The reason I&#8217;m asking is because I will most likely need to intercept other methods. I think you mentionned OllyBdg, would that do that?</p>
<p>Thanks,<br />
Alexandre</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.452 seconds -->

