5

I ask this question because I probably could research it within a few weeks, but I'm hoping there's someone here who's a lot more knowledgeable and could give me direction.

My question stems from a several year challenge in trying to make a remoting desktop software (just for fun). At first I sent simple PNGs of the entire desktop. Then I finally into a mirror driver capture (DFMirage mirror driver by DemoForge), which was super fast. But it's definitely not fast enough. I'm trying to implement caching by breaking up images into 16 by 16 tiles such that will be a lot of repeats and I only have to send the hash, but it's generally just kind of laggy and dissapointing.

I also have another recent project that involves API hooking. I'm currently hooking Direct3D in this other project. From C#, this means using a hooking library like EasyHook since C# is a managed language. I was wondering if I could apply this to my remote desktop project.

Question: Would it be possible to, and if possible how could I, hook gdi32.dll to redirect all desktop drawing to my application?

But wait, don't jump to answering just yet, because my question itself might be incorrect.

My ultimate goal, of course, is to transfer the screen efficiently from one computer to the other. Now, VNC and most remote desktop products work by transferring the screen as an image. As pixel data. While this is extremely flexible, it's definitely as slow as you can possibly get.

So my guess is that gdi32.dll draws everything that you see on the desktop. Is this correct? I think I'm wrong because DWM aero seems to use something more 'advanced'. So what does draw everything on the desktop? How are windows drawn?

My idea is, that if I can intercept all drawing functions, then I can go beyond the pixel-level and become like Windows Remote Desktop, where I'm sending drawing commands instead of the actual pixels.

If I'm completely amiss, then how does Remote Desktop "know" how to send these primitive drawing commands? The documentation says that Remote Desktop has a "underlying rendering engine" that can "understand" what's on the screen as these primitive drawing commands, but how can I get that too?

I'm looking for an answer that can give me a larger perspective on Windows internals at this graphical level and a direction on how to accomplish my goal (if it's even realistic).

Jason
  • 6,878
  • 5
  • 41
  • 55

0 Answers0