Skip to content

Micky233/dwm-screen-shot

 
 

Repository files navigation

dwm-screen-shot

Inject shellcode into dwm.exe for DXGI screenshots

The code in the imgui display part is a bit ugly....

Features

  • Compatible with most Windows 10/11 systems
    • Confirmed working on Windows 10 21H2 (LTSC 2021), 22H2, and Windows 11 23H2
    • May not work on recent Windows 11 versions
      • Mirillis Action (paid, watermarked demo available) is also capable of grabbing DWM screenshots, try that if this doesn't work
    • DWM hooking is easier on Windows Vista and 7 so you can use a generic D3D recorder on those OSes. Some of them support DWM hooking by default (e.g. Fraps), and some others only require bypassing the built-in blacklist for dwm.exe. You can also make the hidden DWM Notification Window visible with AHK, WindowDetective, or something like that, then select/activate that as a target game window to record (Bandicam and OBS work with this).
  • Purposes
    • Bypass various anti-screenshot techniques
      • SetWindowDisplayAffinity
      • Function hooks (BitBlt, PrintWindow, etc.)
      • DRM (Widevine, PlayReady)
        • Note that the whole screen will be scrambled/encrypted if HDCP (2.2?) is being used.
    • Understand how multiplane overlay (MPO) and fullscreen optimization (FSO) works
      • Figure out what are being rendered in MPO (they won't appear in this program's screenshot)

Changes from the original repository

  • Translated the whole program into English.
  • Automatically save the taken screenshot to a file.
  • Automatically run as administrator.
  • Automatically take a screenshot on launch.
  • Automatically exit after taking a screenshot.
  • Only download the symbol once - try deleting dxgi.pdb if it's not working after a Windows update.

Build

  • From console (original repo's method):
// Make sure u have installed Visual Studio 2019 or later version
// Open PowerShell and enter a folder prepared for the project, enter the following commands in turn, Enter the following commands in PowerShell

> git clone https://github.com/Ingan121/dwm-screen-shot.git

> cd dwm-screen-shot

> git submodule update --init --recursive

> cd ./build

> devenv dwm-screen-shot.sln /Project dwm-screen-shot

> (Change the build target as VS asks, go to the properties of the DirectXTK solution, and change the runtime library option in `C/C++ -> Code generation` to `/MT`.)

> devenv dwm-screen-shot.sln /build "Release|x64" /Project dwm-screen-shot

> cd ../bin/x64/Release

> .\dwm-screen-shot

Or just build it with the VS GUI. (Used 2022) Debug build is somehow broken currently.

Demo

20220322_232657.2.mp4

Below is just a google translated original readme

Notice

You may find that there is a payload.hpp in the source code, this is the shellcode generated by the main code of the screenshot
  • Please see shellcode-factory
  • in shellcode-factory/shellcode-payload/dwm-screen-shot-demo.cpp you will see how it is written

Dependencies

Knowledge

Direct3D(...Dx9 Dx10 Dx11 Dx12...) and DXGI

DWM

  • Desktop Window Manager (dwm.exe) is an integral part of the window manager. [Later DXGI added some low-level functions to deal with DWM, such as copying mixed screens, device rotation, cross-screen windows](https ://www.zhihu.com/question/36501678/answer/67786884)

VEH hook

  • ...to be continued

Code injection under multi-threading

  • ...to be continued

About

DWM hooking-based screenshot tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.6%
  • Other 1.4%