| 1 | /* $Id: win32k.h,v 1.4 2001-02-02 08:42:56 bird Exp $
 | 
|---|
| 2 |  *
 | 
|---|
| 3 |  * Top level make file for the Win32k library.
 | 
|---|
| 4 |  * Contains library and 32-bit IOCtl definition.
 | 
|---|
| 5 |  *
 | 
|---|
| 6 |  * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
 | 
|---|
| 7 |  *
 | 
|---|
| 8 |  * Project Odin Software License can be found in LICENSE.TXT
 | 
|---|
| 9 |  *
 | 
|---|
| 10 |  */
 | 
|---|
| 11 | #ifndef _WIN32K_H_
 | 
|---|
| 12 | #define _WIN32K_H_
 | 
|---|
| 13 | 
 | 
|---|
| 14 | /*******************************************************************************
 | 
|---|
| 15 | *   Defined Constants And Macros                                               *
 | 
|---|
| 16 | *******************************************************************************/
 | 
|---|
| 17 | /*
 | 
|---|
| 18 |  * IOCtls categories.
 | 
|---|
| 19 |  */
 | 
|---|
| 20 | #define IOCTL_W32K_K32          0xC1
 | 
|---|
| 21 | #define IOCTL_W32K_ELF          0xC2
 | 
|---|
| 22 | 
 | 
|---|
| 23 | /*
 | 
|---|
| 24 |  * K32 category - these are the functions found in the k32 directory.
 | 
|---|
| 25 |  */
 | 
|---|
| 26 | #define K32_ALLOCMEMEX          0x01
 | 
|---|
| 27 | #define K32_QUERYOTES           0x02
 | 
|---|
| 28 | #define K32_QUERYOPTIONSSTATUS  0x03
 | 
|---|
| 29 | #define K32_SETOPTIONS          0x04
 | 
|---|
| 30 | #define K32_PROCESSREADWRITE    0x05
 | 
|---|
| 31 | #define K32_HANDLESYSTEMEVENT   0x06
 | 
|---|
| 32 | 
 | 
|---|
| 33 | /*
 | 
|---|
| 34 |  * Elf category
 | 
|---|
| 35 |  */
 | 
|---|
| 36 | #define ELF_DUMMY               0x01
 | 
|---|
| 37 | 
 | 
|---|
| 38 | 
 | 
|---|
| 39 | /*
 | 
|---|
| 40 |  * System event Identifiers.
 | 
|---|
| 41 |  */
 | 
|---|
| 42 | #define K32_SYSEVENT_SM_MOUSE               0x00    /* dh SendEvent - Session Manager (mouse)    */
 | 
|---|
| 43 | #define K32_SYSEVENT_CTRL_BREAK             0x01    /* dh SendEvent - Ctrl-Break                 */
 | 
|---|
| 44 | #define K32_SYSEVENT_CTRL_C                 0x02    /* dh SendEvent - Ctrl-C                     */
 | 
|---|
| 45 | #define K32_SYSEVENT_CTRL_SCREEN_LOCK       0x03    /* dh SendEvent - Ctrl-ScrollLock            */
 | 
|---|
| 46 | #define K32_SYSEVENT_CTRL_PRINT_SCREEN      0x04    /* dh SendEvent - Ctrl-PrtSc                 */
 | 
|---|
| 47 | #define K32_SYSEVENT_SHIFT_PRINT_SCREEN     0x05    /* dh SendEvent - Shift-PrtSc                */
 | 
|---|
| 48 | #define K32_SYSEVENT_SM_KEYBOARD            0x06    /* dh SendEvent - Session Manager (keyboard) */
 | 
|---|
| 49 | #define K32_SYSEVENT_SM_CTRL_ALT_DELETE     0x07    /* dh SendEvent - Ctrl-Alt-Del               */
 | 
|---|
| 50 | #define K32_SYSEVENT_HOT_PLUG               0x08    /* dh SendEvent - Keyboard Hot Plug/Reset    */
 | 
|---|
| 51 | #define K32_SYSEVENT_POWER                  0x09    /* dh SendEvent - Power suspend event        */
 | 
|---|
| 52 | #define K32_SYSEVENT_POWEROFF               0x0a    /* dh SendEvent - Power off event            */
 | 
|---|
| 53 | #define K32_SYSEVENT_CTRL_ALT_2xNUMLOCK     0x0b    /* VectorSDF    - System Dump                */
 | 
|---|
| 54 | #define K32_SYSEVENT_LAST                   K32_SYSEVENT_CTRL_ALT_2xNUMLOCK
 | 
|---|
| 55 | 
 | 
|---|
| 56 | 
 | 
|---|
| 57 | #ifndef INCL_16                         /* We don't need this in 16-bit code. */
 | 
|---|
| 58 | 
 | 
|---|
| 59 | /*******************************************************************************
 | 
|---|
| 60 | *   Structures and Typedefs                                                    *
 | 
|---|
| 61 | *******************************************************************************/
 | 
|---|
| 62 | #pragma pack(1)
 | 
|---|
| 63 | 
 | 
|---|
| 64 | /*
 | 
|---|
| 65 |  * Object Table Entry buffer.
 | 
|---|
| 66 |  */
 | 
|---|
| 67 | typedef struct _QueryOTE
 | 
|---|
| 68 | {
 | 
|---|
| 69 |     ULONG   ote_size;                   /* Object virtual size */
 | 
|---|
| 70 |     ULONG   ote_base;                   /* Object base virtual address */
 | 
|---|
| 71 |     ULONG   ote_flags;                  /* Attribute flags */
 | 
|---|
| 72 |     ULONG   ote_pagemap;                /* Object page map index */
 | 
|---|
| 73 |     ULONG   ote_mapsize;                /* Num of entries in obj page map */
 | 
|---|
| 74 |   /*ULONG   ote_reserved;*/
 | 
|---|
| 75 |     USHORT  ote_sel;                    /* Object Selector */
 | 
|---|
| 76 |     USHORT  ote_hob;                    /* Object Handle */
 | 
|---|
| 77 | } QOTE, *PQOTE;
 | 
|---|
| 78 | 
 | 
|---|
| 79 | typedef struct _QueryOTEBuffer
 | 
|---|
| 80 | {
 | 
|---|
| 81 |     ULONG   cOTEs;                      /* Number of entries in aOTE. */
 | 
|---|
| 82 |     QOTE    aOTE[1];                    /* Array of OTEs. */
 | 
|---|
| 83 | } QOTEBUFFER, *PQOTEBUFFER;
 | 
|---|
| 84 | 
 | 
|---|
| 85 | 
 | 
|---|
| 86 | /*
 | 
|---|
| 87 |  * Options struct.
 | 
|---|
| 88 |  *
 | 
|---|
| 89 |  * (The function of these members are described in options.h in
 | 
|---|
| 90 |  *  the src\win32k\include directory.)
 | 
|---|
| 91 |  * All members of this struct (except cb ofcourse) is changable.
 | 
|---|
| 92 |  */
 | 
|---|
| 93 | typedef struct _K32Options
 | 
|---|
| 94 | {
 | 
|---|
| 95 |     ULONG   cb;
 | 
|---|
| 96 | 
 | 
|---|
| 97 |     /** @cat logging options */
 | 
|---|
| 98 |     USHORT      usCom;                  /* Output port no. */
 | 
|---|
| 99 |     ULONG       fLogging;               /* Logging. */
 | 
|---|
| 100 | 
 | 
|---|
| 101 |     /** @cat Options affecting the generated LX executables */
 | 
|---|
| 102 |     ULONG       fPE;                    /* Flags set the type of conversion. */
 | 
|---|
| 103 |     ULONG       fPEOneObject;           /* All in one object. */
 | 
|---|
| 104 |     ULONG       ulInfoLevel;            /* Pe2Lx InfoLevel. */
 | 
|---|
| 105 | 
 | 
|---|
| 106 |     /** @cat Options affecting the generated ELF executables */
 | 
|---|
| 107 |     ULONG       fElf;                   /* Elf flags. */
 | 
|---|
| 108 | 
 | 
|---|
| 109 |     /** @cat Options affecting the UNIX script executables */
 | 
|---|
| 110 |     ULONG       fUNIXScript;            /* UNIX script flags. */
 | 
|---|
| 111 | 
 | 
|---|
| 112 |     /** @cat Options affecting the REXX script executables */
 | 
|---|
| 113 |     ULONG       fREXXScript;            /* REXX script flags. */
 | 
|---|
| 114 | 
 | 
|---|
| 115 |     /** @cat Options affecting the JAVA executables */
 | 
|---|
| 116 |     ULONG       fJava;                  /* Java flags. */
 | 
|---|
| 117 | 
 | 
|---|
| 118 |     /** @cat Options affecting the  executables */
 | 
|---|
| 119 |     ULONG       fNoLoader;              /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */
 | 
|---|
| 120 | 
 | 
|---|
| 121 |     /** @cat Options affecting the behaviour changes in the OS/2 loader */
 | 
|---|
| 122 |     ULONG       fDllFixes;              /* Enables the long DLL name and non .DLL extention fixes. */
 | 
|---|
| 123 | 
 | 
|---|
| 124 |     /** @cat Options affecting the heap. */
 | 
|---|
| 125 |     ULONG       cbSwpHeapMax;           /* Maximum heapsize. */
 | 
|---|
| 126 |     ULONG       cbResHeapMax;           /* Maxiumem residentheapsize. */
 | 
|---|
| 127 | } K32OPTIONS, *PK32OPTIONS;
 | 
|---|
| 128 | 
 | 
|---|
| 129 | 
 | 
|---|
| 130 | /*
 | 
|---|
| 131 |  * Status struct.
 | 
|---|
| 132 |  *
 | 
|---|
| 133 |  */
 | 
|---|
| 134 | typedef struct _K32Status
 | 
|---|
| 135 | {
 | 
|---|
| 136 |     ULONG   cb;
 | 
|---|
| 137 | 
 | 
|---|
| 138 |     /** @cat Options status. */
 | 
|---|
| 139 |     ULONG       fQuiet;                 /* Quiet initialization. */
 | 
|---|
| 140 | 
 | 
|---|
| 141 |     /** @cat Kernel status. */
 | 
|---|
| 142 |     ULONG       fKernel;                /* Smp or uni kernel. */
 | 
|---|
| 143 |     ULONG       ulBuild;                /* Kernel build. */
 | 
|---|
| 144 |     USHORT      usVerMajor;             /* OS/2 major ver - 20 */
 | 
|---|
| 145 |     USHORT      usVerMinor;             /* OS/2 minor ver - 30,40 */
 | 
|---|
| 146 | 
 | 
|---|
| 147 |     /** @cat Heap status. */
 | 
|---|
| 148 |     ULONG       cbSwpHeapInit;          /* Initial heapsize. */
 | 
|---|
| 149 |     ULONG       cbSwpHeapFree;          /* Amount of used space. */
 | 
|---|
| 150 |     ULONG       cbSwpHeapUsed;          /* Amount of free space reserved. */
 | 
|---|
| 151 |     ULONG       cbSwpHeapSize;          /* Amount of memory used by the heap free and used++. */
 | 
|---|
| 152 |     ULONG       cSwpBlocksUsed;         /* Count of used blocks. */
 | 
|---|
| 153 |     ULONG       cSwpBlocksFree;         /* Count of free blocks. */
 | 
|---|
| 154 | 
 | 
|---|
| 155 |     ULONG       cbResHeapInit;          /* Initial heapsize. */
 | 
|---|
| 156 |     ULONG       cbResHeapFree;          /* Amount of free space reserved. */
 | 
|---|
| 157 |     ULONG       cbResHeapUsed;          /* Amount of used space. */
 | 
|---|
| 158 |     ULONG       cbResHeapSize;          /* Amount of memory used by the heap free and used++. */
 | 
|---|
| 159 |     ULONG       cResBlocksUsed;         /* Count of used blocks. */
 | 
|---|
| 160 |     ULONG       cResBlocksFree;         /* Count of free blocks. */
 | 
|---|
| 161 | 
 | 
|---|
| 162 |     /** @cat Win32k build, version and init stuff */
 | 
|---|
| 163 |     CHAR        szBuildDate[12];        /* Date of the win32k build. (Sep 02 2000) */
 | 
|---|
| 164 |     CHAR        szBuildTime[9];         /* Time of the win32k build. (11:44:21) */
 | 
|---|
| 165 |     ULONG       ulVersion;              /* Win32k version */
 | 
|---|
| 166 |     CHAR        szSymFile[CCHMAXPATH];  /* The name of the symbol file or sym database. */
 | 
|---|
| 167 | 
 | 
|---|
| 168 |     /** @cat Statistics */
 | 
|---|
| 169 |     ULONG       cPe2LxModules;          /* Number of Pe2Lx modules currently loaded. */
 | 
|---|
| 170 |     ULONG       cElf2LxModules;         /* Number of Elf2Lx modules currently loaded. */
 | 
|---|
| 171 |     /*...*/
 | 
|---|
| 172 | } K32STATUS, *PK32STATUS;
 | 
|---|
| 173 | 
 | 
|---|
| 174 | 
 | 
|---|
| 175 | 
 | 
|---|
| 176 | /*
 | 
|---|
| 177 |  * K32 category parameter structs
 | 
|---|
| 178 |  */
 | 
|---|
| 179 | typedef struct _k32AllocMemEx
 | 
|---|
| 180 | {
 | 
|---|
| 181 |     PVOID   pv;                         /* Pointer to allocated memory block */
 | 
|---|
| 182 |                                         /* On input this holds the suggested */
 | 
|---|
| 183 |                                         /* location of the block. */
 | 
|---|
| 184 |     ULONG   cb;                         /* Blocksize (bytes) */
 | 
|---|
| 185 |     ULONG   flFlags;                    /* Flags (equal to DosAllocMem flags) */
 | 
|---|
| 186 |     ULONG   ulCS;                       /* Call CS */
 | 
|---|
| 187 |     ULONG   ulEIP;                      /* Call EIP */
 | 
|---|
| 188 |     ULONG   rc;                         /* Return code. */
 | 
|---|
| 189 | } K32ALLOCMEMEX, *PK32ALLOCMEMEX;
 | 
|---|
| 190 | 
 | 
|---|
| 191 | typedef struct _k32QueryOTEs
 | 
|---|
| 192 | {
 | 
|---|
| 193 |     HMODULE     hMTE;                   /* Module handle. */
 | 
|---|
| 194 |     PQOTEBUFFER pQOte;                  /* Pointer to output buffer. */
 | 
|---|
| 195 |     ULONG       cbQOte;                 /* Size of the buffer pointed to by pQOte  */
 | 
|---|
| 196 |     ULONG       rc;                     /* Return code. */
 | 
|---|
| 197 | } K32QUERYOTES, *PK32QUERYOTES;
 | 
|---|
| 198 | 
 | 
|---|
| 199 | typedef struct _k32QueryOptionsStatus
 | 
|---|
| 200 | {
 | 
|---|
| 201 |     PK32OPTIONS     pOptions;           /* Pointer to option struct. (NULL allowed) */
 | 
|---|
| 202 |     PK32STATUS      pStatus;            /* Pointer to status struct. (NULL allowed) */
 | 
|---|
| 203 |     ULONG           rc;                 /* Return code. */
 | 
|---|
| 204 | } K32QUERYOPTIONSSTATUS, *PK32QUERYOPTIONSSTATUS;
 | 
|---|
| 205 | 
 | 
|---|
| 206 | typedef struct _k32SetOptions
 | 
|---|
| 207 | {
 | 
|---|
| 208 |     PK32OPTIONS     pOptions;           /* Pointer to option struct. (NULL allowed) */
 | 
|---|
| 209 |     ULONG           rc;                 /* Return code. */
 | 
|---|
| 210 | } K32SETOPTIONS, *PK32SETOPTIONS;
 | 
|---|
| 211 | 
 | 
|---|
| 212 | typedef struct _k32ProcessReadWrite
 | 
|---|
| 213 | {
 | 
|---|
| 214 |     PID         pid;                    /* Process ID of the process to access memory in. */
 | 
|---|
| 215 |     ULONG       cb;                     /* Number of bytes to read or write. */
 | 
|---|
| 216 |     PVOID       pvSource;               /* Pointer to source data. */
 | 
|---|
| 217 |     PVOID       pvTarget;               /* Pointer to target area. */
 | 
|---|
| 218 |     BOOL        fRead;                  /* TRUE:   pvSource is within pid while pvTarget is ours. */
 | 
|---|
| 219 |                                         /* FALSE:  pvTarget is within pid while pvSource is ours. */
 | 
|---|
| 220 |     ULONG       rc;                     /* Return code. */
 | 
|---|
| 221 | } K32PROCESSREADWRITE, *PK32PROCESSREADWRITE;
 | 
|---|
| 222 | 
 | 
|---|
| 223 | typedef struct _k32HandleSystemEvent
 | 
|---|
| 224 | {
 | 
|---|
| 225 |     ULONG       ulEvent;                /* Event identifier. One of the K32_SYSEVENT_ defines. */
 | 
|---|
| 226 |     HEV         hev;                    /* Handle of shared event semaphore which should be */
 | 
|---|
| 227 |                                         /* posted when the the requested event occurs.      */
 | 
|---|
| 228 |     BOOL        fHandle;                /* Action flag. */
 | 
|---|
| 229 |                                         /* TRUE:  Take control of the event. */
 | 
|---|
| 230 |                                         /* FALSE: Give control back to the OS of this event. (hev must match the current handle!) */
 | 
|---|
| 231 |     ULONG       rc;                     /* Return code. */
 | 
|---|
| 232 | } K32HANDLESYSTEMEVENT, *PK32HANDLESYSTEMEVENT;
 | 
|---|
| 233 | 
 | 
|---|
| 234 | 
 | 
|---|
| 235 | #pragma pack()
 | 
|---|
| 236 | 
 | 
|---|
| 237 | #ifndef NO_WIN32K_LIB_FUNCTIONS
 | 
|---|
| 238 | /*******************************************************************************
 | 
|---|
| 239 | *   External Functions                                                         *
 | 
|---|
| 240 | *******************************************************************************/
 | 
|---|
| 241 | /* Win32k APIs */
 | 
|---|
| 242 | APIRET APIENTRY  libWin32kInit(void);
 | 
|---|
| 243 | APIRET APIENTRY  libWin32kTerm(void);
 | 
|---|
| 244 | BOOL   APIENTRY  libWin32kInstalled(void);
 | 
|---|
| 245 | APIRET APIENTRY  libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus);
 | 
|---|
| 246 | APIRET APIENTRY  libWin32kSetOptions(PK32OPTIONS pOptions);
 | 
|---|
| 247 | APIRET APIENTRY  libWin32kSetOption(PK32OPTIONS pOptions);
 | 
|---|
| 248 | 
 | 
|---|
| 249 | /* "Extra OS2 APIs" */
 | 
|---|
| 250 | APIRET APIENTRY  DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag);
 | 
|---|
| 251 | APIRET APIENTRY  W32kQueryOTEs(HMODULE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte);
 | 
|---|
| 252 | APIRET APIENTRY  W32kProcessReadWrite(PID pid, ULONG cb, PVOID pvSource, PVOID pvTarget, BOOL fRead);
 | 
|---|
| 253 | APIRET APIENTRY  W32kHandleSystemEvent(ULONG ulEvent, HEV hev, BOOL fHandle);
 | 
|---|
| 254 | 
 | 
|---|
| 255 | /* Helper function */
 | 
|---|
| 256 | USHORT APIENTRY  libHelperGetCS(void);
 | 
|---|
| 257 | 
 | 
|---|
| 258 | 
 | 
|---|
| 259 | #endif
 | 
|---|
| 260 | 
 | 
|---|
| 261 | #endif /* !defined(INCL_16) */
 | 
|---|
| 262 | 
 | 
|---|
| 263 | #endif
 | 
|---|