text: #pragma once
  
  #include <windows.h>
  
  #define TYPE_WINDOW 1
  #define NORMAL_CBWNDEXTRA 0x58
  #define MAGIC_CBWNDEXTRA 0x68
  #define NORMAL_WINDOW_NUMBER 10
  #define GDI_BATCH_BUFFER_SIZE 310
  #define GDI_HANDLE_BUFFER_SIZE64 60
  
  typedef void* (NTAPI* _HMValidateHandle)(
      HWND hwnd,
      int type
      );
  
  typedef void* (WINAPI* _OrigxxxClientAllocWindowClassExtraBytes)(
      ULONG* size
      );
  
  typedef struct _pWND
  {
      HWND        hwnd;           // Window handle
      ULONG       dhOffset;       // Desktop Heap offset
      DWORD       dwStyle;        // dwStyle
      DWORD       dwExStyle;      // dwExStyle
      ULONGLONG   lpImageBase;    // Image base
      CHAR        unknown1[120];  // unknown
      ULONGLONG   spmenuOffset;   // spmenu offset
      CHAR        unknown2[40];   // unknown
      DWORD       cbWndExtra;     // cbWndExtra
      CHAR        unknown3[24];   // unknown
      ULONGLONG   ExtraFlag;      // ExtraFlag
      CHAR        unknown4[56];   // unknown
      ULONGLONG   WndExtra;       // WndExtra
  } pWND, * ppWND;
  
  typedef struct _PEB_LDR_DATA
  {
      ULONG Length;
      BOOLEAN Initialized;
      HANDLE SsHandle;
      LIST_ENTRY InLoadOrderModuleList;
      LIST_ENTRY InMemoryOrderModuleList;
      LIST_ENTRY InInitializationOrderModuleList;
      PVOID EntryInProgress;
      BOOLEAN ShutdownInProgress;
      HANDLE ShutdownThreadId;
  } PEB_LDR_DATA, * PPEB_LDR_DATA;
  
  typedef struct _RTL_USER_PROCESS_PARAMETERS* PRTL_USER_PROCESS_PARAMETERS;
  
  typedef struct _API_SET_NAMESPACE
  {
      ULONG Version;
      ULONG Size;
      ULONG Flags;
      ULONG Count;
      ULONG EntryOffset;
      ULONG HashOffset;
      ULONG HashFactor;
  } API_SET_NAMESPACE, * PAPI_SET_NAMESPACE;
  
  typedef ULONG GDI_HANDLE_BUFFER[GDI_HANDLE_BUFFER_SIZE64];
  
  typedef struct _UNICODE_STRING {
      USHORT Length;
      USHORT MaximumLength;
      PWSTR  Buffer;
  } UNICODE_STRING, * PUNICODE_STRING;
  
  typedef struct _PEB
  {
      BOOLEAN InheritedAddressSpace;
      BOOLEAN ReadImageFileExecOptions;
      BOOLEAN BeingDebugged;
      union
      {
          BOOLEAN BitField;
          struct
          {
              BOOLEAN ImageUsesLargePages : 1;
              BOOLEAN IsProtectedProcess : 1;
              BOOLEAN IsImageDynamicallyRelocated : 1;
              BOOLEAN SkipPatchingUser32Forwarders : 1;
              BOOLEAN IsPackagedProcess : 1;
              BOOLEAN IsAppContainer : 1;
              BOOLEAN IsProtectedProcessLight : 1;
              BOOLEAN IsLongPathAwareProcess : 1;
          };
      };
      HANDLE Mutant;
      PVOID ImageBaseAddress;
      PPEB_LDR_DATA Ldr;
      PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
      PVOID SubSystemData;
      PVOID ProcessHeap;
      PRTL_CRITICAL_SECTION FastPebLock;
      PSLIST_HEADER AtlThunkSListPtr;
      PVOID IFEOKey;
      union
      {
          ULONG CrossProcessFlags;
          struct
          {
              ULONG ProcessInJob : 1;
              ULONG ProcessInitializing : 1;
              ULONG ProcessUsingVEH : 1;
              ULONG ProcessUsingVCH : 1;
              ULONG ProcessUsingFTH : 1;
              ULONG ProcessPreviouslyThrottled : 1;
              ULONG ProcessCurrentlyThrottled : 1;
              ULONG ProcessImagesHotPatched : 1;
              ULONG ReservedBits0 : 24;
          };
      };
      union
      {
          PVOID KernelCallbackTable;
          PVOID UserSharedInfoPtr;
      };
      ULONG SystemReserved;
      ULONG AtlThunkSListPtr32;
      PAPI_SET_NAMESPACE ApiSetMap;
      ULONG TlsExpansionCounter;
      PVOID TlsBitmap;
      ULONG TlsBitmapBits[2];
      PVOID ReadOnlySharedMemoryBase;
      PVOID SharedData;
      PVOID* ReadOnlyStaticServerData;
      PVOID AnsiCodePageData;
      PVOID OemCodePageData;
      PVOID UnicodeCaseTableData;
      ULONG NumberOfProcessors;
      ULONG NtGlobalFlag;
      ULARGE_INTEGER CriticalSectionTimeout;
      SIZE_T HeapSegmentReserve;
      SIZE_T HeapSegmentCommit;
      SIZE_T HeapDeCommitTotalFreeThreshold;
      SIZE_T HeapDeCommitFreeBlockThreshold;
      ULONG NumberOfHeaps;
      ULONG MaximumNumberOfHeaps;
      PVOID* ProcessHeaps;
      PVOID GdiSharedHandleTable;
      PVOID ProcessStarterHelper;
      ULONG GdiDCAttributeList;
      PRTL_CRITICAL_SECTION LoaderLock;
      ULONG OSMajorVersion;
      ULONG OSMinorVersion;
      USHORT OSBuildNumber;
      USHORT OSCSDVersion;
      ULONG OSPlatformId;
      ULONG ImageSubsystem;
      ULONG ImageSubsystemMajorVersion;
      ULONG ImageSubsystemMinorVersion;
      ULONG_PTR ActiveProcessAffinityMask;
      GDI_HANDLE_BUFFER GdiHandleBuffer;
      PVOID PostProcessInitRoutine;
      PVOID TlsExpansionBitmap;
      ULONG TlsExpansionBitmapBits[32];
      ULONG SessionId;
      ULARGE_INTEGER AppCompatFlags;
      ULARGE_INTEGER AppCompatFlagsUser;
      PVOID pShimData;
      PVOID AppCompatInfo;
      UNICODE_STRING CSDVersion;
      PVOID ActivationContextData;
      PVOID ProcessAssemblyStorageMap;
      PVOID SystemDefaultActivationContextData;
      PVOID SystemAssemblyStorageMap;
      SIZE_T MinimumStackCommit;
      PVOID SparePointers[4];
      ULONG SpareUlongs[5];
      PVOID WerRegistrationData;
      PVOID WerShipAssertPtr;
      PVOID pUnused;
      PVOID pImageHeaderHash;
      union
      {
          ULONG TracingFlags;
          struct
          {
              ULONG HeapTracingEnabled : 1;
              ULONG CritSecTracingEnabled : 1;
              ULONG LibLoaderTracingEnabled : 1;
              ULONG SpareTracingBits : 29;
          };
      };
      ULONGLONG CsrServerReadOnlySharedMemoryBase;
      PRTL_CRITICAL_SECTION TppWorkerpListLock;
      LIST_ENTRY TppWorkerpList;
      PVOID WaitOnAddressHashTable[128];
      PVOID TelemetryCoverageHeader;
      ULONG CloudFileFlags;
      ULONG CloudFileDiagFlags;
      CHAR PlaceholderCompatibilityMode;
      CHAR PlaceholderCompatibilityModeReserved[7];
      struct _LEAP_SECOND_DATA* LeapSecondData;
      union
      {
          ULONG LeapSecondFlags;
          struct
          {
              ULONG SixtySecondEnabled : 1;
              ULONG Reserved : 31;
          };
      };
      ULONG NtGlobalFlag2;
  } PEB, * PPEB;
  
  typedef struct _CLIENT_ID {
      HANDLE UniqueProcess;
      HANDLE UniqueThread;
  } CLIENT_ID;
  
  typedef struct _ACTIVATION_CONTEXT_STACK
  {
      struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME* ActiveFrame;
      LIST_ENTRY FrameListCache;
      ULONG Flags;
      ULONG NextCookieSequenceNumber;
      ULONG StackId;
  } ACTIVATION_CONTEXT_STACK, * PACTIVATION_CONTEXT_STACK;
  
  typedef struct _GDI_TEB_BATCH
  {
      ULONG Offset;
      ULONG_PTR HDC;
      ULONG Buffer[GDI_BATCH_BUFFER_SIZE];
  } GDI_TEB_BATCH, * PGDI_TEB_BATCH;
  
  typedef struct _TEB_ACTIVE_FRAME_CONTEXT
  {
      ULONG Flags;
      PSTR FrameName;
  } TEB_ACTIVE_FRAME_CONTEXT, * PTEB_ACTIVE_FRAME_CONTEXT;
  
  typedef struct _TEB_ACTIVE_FRAME
  {
      ULONG Flags;
      struct _TEB_ACTIVE_FRAME* Previous;
      PTEB_ACTIVE_FRAME_CONTEXT Context;
  } TEB_ACTIVE_FRAME, * PTEB_ACTIVE_FRAME;
  
  typedef struct _TEB
  {
      NT_TIB NtTib;
      PVOID EnvironmentPointer;
      CLIENT_ID ClientId;
      PVOID ActiveRpcHandle;
      PVOID ThreadLocalStoragePointer;
      PPEB ProcessEnvironmentBlock;
      ULONG LastErrorValue;
      ULONG CountOfOwnedCriticalSections;
      PVOID CsrClientThread;
      PVOID Win32ThreadInfo;
      ULONG User32Reserved[26];
      ULONG UserReserved[5];
      PVOID WOW32Reserved;
      LCID CurrentLocale;
      ULONG FpSoftwareStatusRegister;
      PVOID ReservedForDebuggerInstrumentation[16];
  #ifdef _WIN64
      PVOID SystemReserved1[30];
  #else
      PVOID SystemReserved1[26];
  #endif
      CHAR PlaceholderCompatibilityMode;
      BOOLEAN PlaceholderHydrationAlwaysExplicit;
      CHAR PlaceholderReserved[10];
      ULONG ProxiedProcessId;
      ACTIVATION_CONTEXT_STACK ActivationStack;
      UCHAR WorkingOnBehalfTicket[8];
      NTSTATUS ExceptionCode;
      PACTIVATION_CONTEXT_STACK ActivationContextStackPointer;
      ULONG_PTR InstrumentationCallbackSp;
      ULONG_PTR InstrumentationCallbackPreviousPc;
      ULONG_PTR InstrumentationCallbackPreviousSp;
  #ifdef _WIN64
      ULONG TxFsContext;
  #endif
      BOOLEAN InstrumentationCallbackDisabled;
  #ifdef _WIN64
      BOOLEAN UnalignedLoadStoreExceptions;
  #endif
  #ifndef _WIN64
      UCHAR SpareBytes[23];
      ULONG TxFsContext;
  #endif
      GDI_TEB_BATCH GdiTebBatch;
      CLIENT_ID RealClientId;
      HANDLE GdiCachedProcessHandle;
      ULONG GdiClientPID;
      ULONG GdiClientTID;
      PVOID GdiThreadLocalInfo;
      ULONG_PTR Win32ClientInfo[62];
      PVOID glDispatchTable[233];
      ULONG_PTR glReserved1[29];
      PVOID glReserved2;
      PVOID glSectionInfo;
      PVOID glSection;
      PVOID glTable;
      PVOID glCurrentRC;
      PVOID glContext;
      NTSTATUS LastStatusValue;
      UNICODE_STRING StaticUnicodeString;
      WCHAR StaticUnicodeBuffer[261];
      PVOID DeallocationStack;
      PVOID TlsSlots[64];
      LIST_ENTRY TlsLinks;
      PVOID Vdm;
      PVOID ReservedForNtRpc;
      PVOID DbgSsReserved[2];
      ULONG HardErrorMode;
  #ifdef _WIN64
      PVOID Instrumentation[11];
  #else
      PVOID Instrumentation[9];
  #endif
      GUID ActivityId;
      PVOID SubProcessTag;
      PVOID PerflibData;
      PVOID EtwTraceData;
      PVOID WinSockData;
      ULONG GdiBatchCount;
      union
      {
          PROCESSOR_NUMBER CurrentIdealProcessor;
          ULONG IdealProcessorValue;
          struct
          {
              UCHAR ReservedPad0;
              UCHAR ReservedPad1;
              UCHAR ReservedPad2;
              UCHAR IdealProcessor;
          };
      };
      ULONG GuaranteedStackBytes;
      PVOID ReservedForPerf;
      PVOID ReservedForOle;
      ULONG WaitingOnLoaderLock;
      PVOID SavedPriorityState;
      ULONG_PTR ReservedForCodeCoverage;
      PVOID ThreadPoolData;
      PVOID* TlsExpansionSlots;
  #ifdef _WIN64
      PVOID DeallocationBStore;
      PVOID BStoreLimit;
  #endif
      ULONG MuiGeneration;
      ULONG IsImpersonating;
      PVOID NlsCache;
      PVOID pShimData;
      ULONG HeapData;
      HANDLE CurrentTransactionHandle;
      PTEB_ACTIVE_FRAME ActiveFrame;
      PVOID FlsData;
      PVOID PreferredLanguages;
      PVOID UserPrefLanguages;
      PVOID MergedPrefLanguages;
      ULONG MuiImpersonation;
      union
      {
          USHORT CrossTebFlags;
          USHORT SpareCrossTebBits : 16;
      };
      union
      {
          USHORT SameTebFlags;
          struct
          {
              USHORT SafeThunkCall : 1;
              USHORT InDebugPrint : 1;
              USHORT HasFiberData : 1;
              USHORT SkipThreadAttach : 1;
              USHORT WerInShipAssertCode : 1;
              USHORT RanProcessInit : 1;
              USHORT ClonedThread : 1;
              USHORT SuppressDebugMsg : 1;
              USHORT DisableUserStackWalk : 1;
              USHORT RtlExceptionAttached : 1;
              USHORT InitialThread : 1;
              USHORT SessionAware : 1;
              USHORT LoadOwner : 1;
              USHORT LoaderWorker : 1;
              USHORT SkipLoaderInit : 1;
              USHORT SpareSameTebBits : 1;
          };
      };
      PVOID TxnScopeEnterCallback;
      PVOID TxnScopeExitCallback;
      PVOID TxnScopeContext;
      ULONG LockCount;
      LONG WowTebOffset;
      PVOID ResourceRetValue;
      PVOID ReservedForWdf;
      ULONGLONG ReservedForCrt;
      GUID EffectiveContainerId;
  } TEB, * PTEB;
  
  typedef struct _KERNELCALLBACKTABLE_T {
      ULONG_PTR __fnCOPYDATA;
      ULONG_PTR __fnCOPYGLOBALDATA;
      ULONG_PTR __fnDWORD;
      ULONG_PTR __fnNCDESTROY;
      ULONG_PTR __fnDWORDOPTINLPMSG;
      ULONG_PTR __fnINOUTDRAG;
      ULONG_PTR __fnGETTEXTLENGTHS;
      ULONG_PTR __fnINCNTOUTSTRING;
      ULONG_PTR __fnPOUTLPINT;
      ULONG_PTR __fnINLPCOMPAREITEMSTRUCT;
      ULONG_PTR __fnINLPCREATESTRUCT;
      ULONG_PTR __fnINLPDELETEITEMSTRUCT;
      ULONG_PTR __fnINLPDRAWITEMSTRUCT;
      ULONG_PTR __fnPOPTINLPUINT;
      ULONG_PTR __fnPOPTINLPUINT2;
      ULONG_PTR __fnINLPMDICREATESTRUCT;
      ULONG_PTR __fnINOUTLPMEASUREITEMSTRUCT;
      ULONG_PTR __fnINLPWINDOWPOS;
      ULONG_PTR __fnINOUTLPPOINT5;
      ULONG_PTR __fnINOUTLPSCROLLINFO;
      ULONG_PTR __fnINOUTLPRECT;
      ULONG_PTR __fnINOUTNCCALCSIZE;
      ULONG_PTR __fnINOUTLPPOINT5_;
      ULONG_PTR __fnINPAINTCLIPBRD;
      ULONG_PTR __fnINSIZECLIPBRD;
      ULONG_PTR __fnINDESTROYCLIPBRD;
      ULONG_PTR __fnINSTRING;
      ULONG_PTR __fnINSTRINGNULL;
      ULONG_PTR __fnINDEVICECHANGE;
      ULONG_PTR __fnPOWERBROADCAST;
      ULONG_PTR __fnINLPUAHDRAWMENU;
      ULONG_PTR __fnOPTOUTLPDWORDOPTOUTLPDWORD;
      ULONG_PTR __fnOPTOUTLPDWORDOPTOUTLPDWORD_;
      ULONG_PTR __fnOUTDWORDINDWORD;
      ULONG_PTR __fnOUTLPRECT;
      ULONG_PTR __fnOUTSTRING;
      ULONG_PTR __fnPOPTINLPUINT3;
      ULONG_PTR __fnPOUTLPINT2;
      ULONG_PTR __fnSENTDDEMSG;
      ULONG_PTR __fnINOUTSTYLECHANGE;
      ULONG_PTR __fnHkINDWORD;
      ULONG_PTR __fnHkINLPCBTACTIVATESTRUCT;
      ULONG_PTR __fnHkINLPCBTCREATESTRUCT;
      ULONG_PTR __fnHkINLPDEBUGHOOKSTRUCT;
      ULONG_PTR __fnHkINLPMOUSEHOOKSTRUCTEX;
      ULONG_PTR __fnHkINLPKBDLLHOOKSTRUCT;
      ULONG_PTR __fnHkINLPMSLLHOOKSTRUCT;
      ULONG_PTR __fnHkINLPMSG;
      ULONG_PTR __fnHkINLPRECT;
      ULONG_PTR __fnHkOPTINLPEVENTMSG;
      ULONG_PTR __xxxClientCallDelegateThread;
      ULONG_PTR __ClientCallDummyCallback;
      ULONG_PTR __fnKEYBOARDCORRECTIONCALLOUT;
      ULONG_PTR __fnOUTLPCOMBOBOXINFO;
      ULONG_PTR __fnINLPCOMPAREITEMSTRUCT2;
      ULONG_PTR __xxxClientCallDevCallbackCapture;
      ULONG_PTR __xxxClientCallDitThread;
      ULONG_PTR __xxxClientEnableMMCSS;
      ULONG_PTR __xxxClientUpdateDpi;
      ULONG_PTR __xxxClientExpandStringW;
      ULONG_PTR __ClientCopyDDEIn1;
      ULONG_PTR __ClientCopyDDEIn2;
      ULONG_PTR __ClientCopyDDEOut1;
      ULONG_PTR __ClientCopyDDEOut2;
      ULONG_PTR __ClientCopyImage;
      ULONG_PTR __ClientEventCallback;
      ULONG_PTR __ClientFindMnemChar;
      ULONG_PTR __ClientFreeDDEHandle;
      ULONG_PTR __ClientFreeLibrary;
      ULONG_PTR __ClientGetCharsetInfo;
      ULONG_PTR __ClientGetDDEFlags;
      ULONG_PTR __ClientGetDDEHookData;
      ULONG_PTR __ClientGetListboxString;
      ULONG_PTR __ClientGetMessageMPH;
      ULONG_PTR __ClientLoadImage;
      ULONG_PTR __ClientLoadLibrary;
      ULONG_PTR __ClientLoadMenu;
      ULONG_PTR __ClientLoadLocalT1Fonts;
      ULONG_PTR __ClientPSMTextOut;
      ULONG_PTR __ClientLpkDrawTextEx;
      ULONG_PTR __ClientExtTextOutW;
      ULONG_PTR __ClientGetTextExtentPointW;
      ULONG_PTR __ClientCharToWchar;
      ULONG_PTR __ClientAddFontResourceW;
      ULONG_PTR __ClientThreadSetup;
      ULONG_PTR __ClientDeliverUserApc;
      ULONG_PTR __ClientNoMemoryPopup;
      ULONG_PTR __ClientMonitorEnumProc;
      ULONG_PTR __ClientCallWinEventProc;
      ULONG_PTR __ClientWaitMessageExMPH;
      ULONG_PTR __ClientWOWGetProcModule;
      ULONG_PTR __ClientWOWTask16SchedNotify;
      ULONG_PTR __ClientImmLoadLayout;
      ULONG_PTR __ClientImmProcessKey;
      ULONG_PTR __fnIMECONTROL;
      ULONG_PTR __fnINWPARAMDBCSCHAR;
      ULONG_PTR __fnGETTEXTLENGTHS2;
      ULONG_PTR __fnINLPKDRAWSWITCHWND;
      ULONG_PTR __ClientLoadStringW;
      ULONG_PTR __ClientLoadOLE;
      ULONG_PTR __ClientRegisterDragDrop;
      ULONG_PTR __ClientRevokeDragDrop;
      ULONG_PTR __fnINOUTMENUGETOBJECT;
      ULONG_PTR __ClientPrinterThunk;
      ULONG_PTR __fnOUTLPCOMBOBOXINFO2;
      ULONG_PTR __fnOUTLPSCROLLBARINFO;
      ULONG_PTR __fnINLPUAHDRAWMENU2;
      ULONG_PTR __fnINLPUAHDRAWMENUITEM;
      ULONG_PTR __fnINLPUAHDRAWMENU3;
      ULONG_PTR __fnINOUTLPUAHMEASUREMENUITEM;
      ULONG_PTR __fnINLPUAHDRAWMENU4;
      ULONG_PTR __fnOUTLPTITLEBARINFOEX;
      ULONG_PTR __fnTOUCH;
      ULONG_PTR __fnGESTURE;
      ULONG_PTR __fnPOPTINLPUINT4;
      ULONG_PTR __fnPOPTINLPUINT5;
      ULONG_PTR __xxxClientCallDefaultInputHandler;
      ULONG_PTR __fnEMPTY;
      ULONG_PTR __ClientRimDevCallback;
      ULONG_PTR __xxxClientCallMinTouchHitTestingCallback;
      ULONG_PTR __ClientCallLocalMouseHooks;
      ULONG_PTR __xxxClientBroadcastThemeChange;
      ULONG_PTR __xxxClientCallDevCallbackSimple;
      ULONG_PTR __xxxClientAllocWindowClassExtraBytes;
      ULONG_PTR __xxxClientFreeWindowClassExtraBytes;
      ULONG_PTR __fnGETWINDOWDATA;
      ULONG_PTR __fnINOUTSTYLECHANGE2;
      ULONG_PTR __fnHkINLPMOUSEHOOKSTRUCTEX2;
  } KERNELCALLBACKTABLE, * PKERNELCALLBACKTABLE;
  
  typedef struct _CONSOLEWINDOWOWNER
  {
      HWND hwnd;
      ULONG ProcessId;
      ULONG ThreadId;
  } CONSOLEWINDOWOWNER, * PCONSOLEWINDOWOWNER;
  
  typedef enum _CONSOLECONTROL
  {
      ConsoleCtrlDesktopConsoleThread = 0,
      GuiConsoleWndClassAtom = 1,
      ConsoleMakePalettePublic = 5,
      ConsoleAcquireDisplayOwnership = 6,
  } CONSOLECONTROL, * PCONSOLECONTROL;
  
  typedef NTSTATUS(WINAPI* _NtUserConsoleControl)(
      IN CONSOLECONTROL ConsoleCtrl,
      IN PVOID ConsoleCtrlInfo,
      IN ULONG ControleStrlInfoLength
      );
  
  typedef NTSTATUS(WINAPI* _NtCallbackReturn)(
      IN PVOID Result,
      IN ULONG ResultLength,
      IN NTSTATUS CallbackStatus
      );