Last active
October 26, 2020 18:57
-
-
Save Donpedro13/16e0bf7ad542967158b086fca01d9e41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <windows.h> | |
#include <wingdi.h> | |
int main () | |
{ | |
PRINTDLGW dialogResult = {}; | |
dialogResult.lStructSize = sizeof dialogResult; | |
dialogResult.Flags = PD_RETURNDEFAULT; | |
PrintDlgW (&dialogResult); | |
DEVMODEW* pDefaultDevMode = | |
(DEVMODEW*)GlobalLock (dialogResult.hDevMode); | |
unsigned char* pDriverPrivateData = | |
(unsigned char*)pDefaultDevMode + sizeof (DEVMODEW); | |
// Magic offsets... | |
for (size_t i = 3290; i < 3300; ++i) | |
pDriverPrivateData[i] = 0; | |
HDC hDC = CreateICW (L"winspool", | |
pDefaultDevMode->dmDeviceName, | |
L"LPT1:", | |
pDefaultDevMode); | |
std::cout << "CreateICW " << | |
(hDC ? "succeeded!" : "failed!") << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment