| [4774] | 1 | /* $Id: win32k.h,v 1.3 2000-12-11 06:17:20 bird Exp $ | 
|---|
| [4165] | 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 | 
|---|
| [4348] | 30 | #define K32_PROCESSREADWRITE    0x05 | 
|---|
| [4165] | 31 |  | 
|---|
|  | 32 | /* | 
|---|
|  | 33 | * Elf category | 
|---|
|  | 34 | */ | 
|---|
|  | 35 | #define ELF_DUMMY               0x01 | 
|---|
|  | 36 |  | 
|---|
|  | 37 |  | 
|---|
|  | 38 | /******************************************************************************* | 
|---|
|  | 39 | *   Structures and Typedefs                                                    * | 
|---|
|  | 40 | *******************************************************************************/ | 
|---|
|  | 41 | #pragma pack(1) | 
|---|
|  | 42 |  | 
|---|
|  | 43 | /* | 
|---|
|  | 44 | * Object Table Entry buffer. | 
|---|
|  | 45 | */ | 
|---|
|  | 46 | typedef struct _QueryOTE | 
|---|
|  | 47 | { | 
|---|
|  | 48 | ULONG   ote_size;                   /* Object virtual size */ | 
|---|
|  | 49 | ULONG   ote_base;                   /* Object base virtual address */ | 
|---|
|  | 50 | ULONG   ote_flags;                  /* Attribute flags */ | 
|---|
|  | 51 | ULONG   ote_pagemap;                /* Object page map index */ | 
|---|
|  | 52 | ULONG   ote_mapsize;                /* Num of entries in obj page map */ | 
|---|
|  | 53 | /*ULONG   ote_reserved;*/ | 
|---|
|  | 54 | USHORT  ote_sel;                    /* Object Selector */ | 
|---|
|  | 55 | USHORT  ote_hob;                    /* Object Handle */ | 
|---|
|  | 56 | } QOTE, *PQOTE; | 
|---|
|  | 57 |  | 
|---|
|  | 58 | typedef struct _QueryOTEBuffer | 
|---|
|  | 59 | { | 
|---|
|  | 60 | ULONG   cOTEs;                      /* Number of entries in aOTE. */ | 
|---|
|  | 61 | QOTE    aOTE[1];                    /* Array of OTEs. */ | 
|---|
|  | 62 | } QOTEBUFFER, *PQOTEBUFFER; | 
|---|
|  | 63 |  | 
|---|
|  | 64 |  | 
|---|
|  | 65 | /* | 
|---|
|  | 66 | * Options struct. | 
|---|
|  | 67 | * | 
|---|
|  | 68 | * (The function of these members are described in options.h in | 
|---|
|  | 69 | *  the src\win32k\include directory.) | 
|---|
|  | 70 | * All members of this struct (except cb ofcourse) is changable. | 
|---|
|  | 71 | */ | 
|---|
|  | 72 | typedef struct _K32Options | 
|---|
|  | 73 | { | 
|---|
|  | 74 | ULONG   cb; | 
|---|
|  | 75 |  | 
|---|
|  | 76 | /** @cat logging options */ | 
|---|
|  | 77 | USHORT      usCom;                  /* Output port no. */ | 
|---|
|  | 78 | ULONG       fLogging;               /* Logging. */ | 
|---|
|  | 79 |  | 
|---|
|  | 80 | /** @cat Options affecting the generated LX executables */ | 
|---|
|  | 81 | ULONG       fPE;                    /* Flags set the type of conversion. */ | 
|---|
|  | 82 | ULONG       ulInfoLevel;            /* Pe2Lx InfoLevel. */ | 
|---|
|  | 83 |  | 
|---|
|  | 84 | /** @cat Options affecting the generated ELF executables */ | 
|---|
|  | 85 | ULONG       fElf;                   /* Elf flags. */ | 
|---|
|  | 86 |  | 
|---|
|  | 87 | /** @cat Options affecting the UNIX script executables */ | 
|---|
|  | 88 | ULONG       fUNIXScript;            /* UNIX script flags. */ | 
|---|
|  | 89 |  | 
|---|
|  | 90 | /** @cat Options affecting the REXX script executables */ | 
|---|
|  | 91 | ULONG       fREXXScript;            /* REXX script flags. */ | 
|---|
|  | 92 |  | 
|---|
|  | 93 | /** @cat Options affecting the JAVA executables */ | 
|---|
|  | 94 | ULONG       fJava;                  /* Java flags. */ | 
|---|
|  | 95 |  | 
|---|
|  | 96 | /** @cat Options affecting the  executables */ | 
|---|
|  | 97 | ULONG       fNoLoader;              /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */ | 
|---|
|  | 98 |  | 
|---|
| [4774] | 99 | /** @cat Options affecting the behaviour changes in the OS/2 loader */ | 
|---|
|  | 100 | ULONG       fDllFixes;              /* Enables the long DLL name and non .DLL extention fixes. */ | 
|---|
|  | 101 |  | 
|---|
| [4165] | 102 | /** @cat Options affecting the heap. */ | 
|---|
|  | 103 | ULONG       cbSwpHeapMax;           /* Maximum heapsize. */ | 
|---|
|  | 104 | ULONG       cbResHeapMax;           /* Maxiumem residentheapsize. */ | 
|---|
|  | 105 | } K32OPTIONS, *PK32OPTIONS; | 
|---|
|  | 106 |  | 
|---|
|  | 107 |  | 
|---|
|  | 108 | /* | 
|---|
|  | 109 | * Status struct. | 
|---|
|  | 110 | * | 
|---|
|  | 111 | */ | 
|---|
|  | 112 | typedef struct _K32Status | 
|---|
|  | 113 | { | 
|---|
|  | 114 | ULONG   cb; | 
|---|
|  | 115 |  | 
|---|
|  | 116 | /** @cat Options status. */ | 
|---|
|  | 117 | ULONG       fQuiet;                 /* Quiet initialization. */ | 
|---|
|  | 118 |  | 
|---|
|  | 119 | /** @cat Kernel status. */ | 
|---|
|  | 120 | ULONG       fKernel;                /* Smp or uni kernel. */ | 
|---|
|  | 121 | ULONG       ulBuild;                /* Kernel build. */ | 
|---|
|  | 122 | USHORT      usVerMajor;             /* OS/2 major ver - 20 */ | 
|---|
|  | 123 | USHORT      usVerMinor;             /* OS/2 minor ver - 30,40 */ | 
|---|
|  | 124 |  | 
|---|
|  | 125 | /** @cat Heap status. */ | 
|---|
|  | 126 | ULONG       cbSwpHeapInit;          /* Initial heapsize. */ | 
|---|
|  | 127 | ULONG       cbSwpHeapFree;          /* Amount of used space. */ | 
|---|
|  | 128 | ULONG       cbSwpHeapUsed;          /* Amount of free space reserved. */ | 
|---|
|  | 129 | ULONG       cbSwpHeapSize;          /* Amount of memory used by the heap free and used++. */ | 
|---|
|  | 130 | ULONG       cSwpBlocksUsed;         /* Count of used blocks. */ | 
|---|
|  | 131 | ULONG       cSwpBlocksFree;         /* Count of free blocks. */ | 
|---|
|  | 132 |  | 
|---|
|  | 133 | ULONG       cbResHeapInit;          /* Initial heapsize. */ | 
|---|
|  | 134 | ULONG       cbResHeapFree;          /* Amount of free space reserved. */ | 
|---|
|  | 135 | ULONG       cbResHeapUsed;          /* Amount of used space. */ | 
|---|
|  | 136 | ULONG       cbResHeapSize;          /* Amount of memory used by the heap free and used++. */ | 
|---|
|  | 137 | ULONG       cResBlocksUsed;         /* Count of used blocks. */ | 
|---|
|  | 138 | ULONG       cResBlocksFree;         /* Count of free blocks. */ | 
|---|
|  | 139 |  | 
|---|
|  | 140 | /** @cat Win32k build, version and init stuff */ | 
|---|
|  | 141 | CHAR        szBuildDate[12];        /* Date of the win32k build. (Sep 02 2000) */ | 
|---|
|  | 142 | CHAR        szBuildTime[9];         /* Time of the win32k build. (11:44:21) */ | 
|---|
|  | 143 | ULONG       ulVersion;              /* Win32k version */ | 
|---|
|  | 144 | CHAR        szSymFile[CCHMAXPATH];  /* The name of the symbol file or sym database. */ | 
|---|
|  | 145 |  | 
|---|
|  | 146 | /** @cat Statistics */ | 
|---|
|  | 147 | ULONG       cPe2LxModules;          /* Number of Pe2Lx modules currently loaded. */ | 
|---|
|  | 148 | ULONG       cElf2LxModules;         /* Number of Elf2Lx modules currently loaded. */ | 
|---|
|  | 149 | /*...*/ | 
|---|
|  | 150 | } K32STATUS, *PK32STATUS; | 
|---|
|  | 151 |  | 
|---|
|  | 152 |  | 
|---|
|  | 153 |  | 
|---|
|  | 154 | /* | 
|---|
|  | 155 | * K32 category parameter structs | 
|---|
|  | 156 | */ | 
|---|
|  | 157 | typedef struct _k32AllocMemEx | 
|---|
|  | 158 | { | 
|---|
|  | 159 | PVOID   pv;                         /* Pointer to allocated memory block */ | 
|---|
|  | 160 | /* On input this holds the suggested */ | 
|---|
|  | 161 | /* location of the block. */ | 
|---|
|  | 162 | ULONG   cb;                         /* Blocksize (bytes) */ | 
|---|
|  | 163 | ULONG   flFlags;                    /* Flags (equal to DosAllocMem flags) */ | 
|---|
|  | 164 | ULONG   ulCS;                       /* Call CS */ | 
|---|
|  | 165 | ULONG   ulEIP;                      /* Call EIP */ | 
|---|
|  | 166 | ULONG   rc;                         /* Return code. */ | 
|---|
|  | 167 | } K32ALLOCMEMEX, *PK32ALLOCMEMEX; | 
|---|
|  | 168 |  | 
|---|
|  | 169 | typedef struct _k32QueryOTEs | 
|---|
|  | 170 | { | 
|---|
|  | 171 | HMODULE     hMTE;                   /* Module handle. */ | 
|---|
|  | 172 | PQOTEBUFFER pQOte;                  /* Pointer to output buffer. */ | 
|---|
|  | 173 | ULONG       cbQOte;                 /* Size of the buffer pointed to by pQOte  */ | 
|---|
|  | 174 | ULONG       rc;                     /* Return code. */ | 
|---|
|  | 175 | } K32QUERYOTES, *PK32QUERYOTES; | 
|---|
|  | 176 |  | 
|---|
|  | 177 | typedef struct _k32QueryOptionsStatus | 
|---|
|  | 178 | { | 
|---|
|  | 179 | PK32OPTIONS     pOptions;           /* Pointer to option struct. (NULL allowed) */ | 
|---|
|  | 180 | PK32STATUS      pStatus;            /* Pointer to status struct. (NULL allowed) */ | 
|---|
|  | 181 | ULONG           rc;                 /* Return code. */ | 
|---|
|  | 182 | } K32QUERYOPTIONSSTATUS, *PK32QUERYOPTIONSSTATUS; | 
|---|
|  | 183 |  | 
|---|
|  | 184 | typedef struct _k32SetOptions | 
|---|
|  | 185 | { | 
|---|
|  | 186 | PK32OPTIONS     pOptions;           /* Pointer to option struct. (NULL allowed) */ | 
|---|
|  | 187 | ULONG           rc;                 /* Return code. */ | 
|---|
|  | 188 | } K32SETOPTIONS, *PK32SETOPTIONS; | 
|---|
|  | 189 |  | 
|---|
| [4348] | 190 | typedef struct _k32ProcessReadWrite | 
|---|
|  | 191 | { | 
|---|
|  | 192 | PID         pid;                    /* Process ID of the process to access memory in. */ | 
|---|
|  | 193 | ULONG       cb;                     /* Number of bytes to read or write. */ | 
|---|
|  | 194 | PVOID       pvSource;               /* Pointer to source data. */ | 
|---|
|  | 195 | PVOID       pvTarget;               /* Pointer to target area. */ | 
|---|
|  | 196 | BOOL        fRead;                  /* TRUE:   pvSource is within pid while pvTarget is ours. */ | 
|---|
|  | 197 | /* FALSE:  pvTarget is within pid while pvSource is ours. */ | 
|---|
|  | 198 | ULONG       rc;                     /* Return code. */ | 
|---|
|  | 199 | } K32PROCESSREADWRITE, *PK32PROCESSREADWRITE; | 
|---|
| [4165] | 200 |  | 
|---|
| [4348] | 201 |  | 
|---|
|  | 202 |  | 
|---|
| [4165] | 203 | #pragma pack() | 
|---|
|  | 204 |  | 
|---|
|  | 205 | #ifndef NO_WIN32K_LIB_FUNCTIONS | 
|---|
|  | 206 | /******************************************************************************* | 
|---|
|  | 207 | *   External Functions                                                         * | 
|---|
|  | 208 | *******************************************************************************/ | 
|---|
|  | 209 | /* Win32k APIs */ | 
|---|
|  | 210 | APIRET APIENTRY  libWin32kInit(void); | 
|---|
|  | 211 | APIRET APIENTRY  libWin32kTerm(void); | 
|---|
|  | 212 | BOOL   APIENTRY  libWin32kInstalled(void); | 
|---|
|  | 213 | APIRET APIENTRY  libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus); | 
|---|
|  | 214 | APIRET APIENTRY  libWin32kSetOptions(PK32OPTIONS pOptions); | 
|---|
| [4348] | 215 | APIRET APIENTRY  libWin32kSetOption(PK32OPTIONS pOptions); | 
|---|
| [4165] | 216 |  | 
|---|
|  | 217 | /* "Extra OS2 APIs" */ | 
|---|
|  | 218 | APIRET APIENTRY  DosAllocMemEx(PPVOID ppv, ULONG cb, ULONG flag); | 
|---|
|  | 219 | APIRET APIENTRY  W32kQueryOTEs(HMODULE hMTE, PQOTEBUFFER pQOte, ULONG cbQOte); | 
|---|
| [4348] | 220 | APIRET APIENTRY  W32kProcessReadWrite(PID pid, ULONG cb, PVOID pvSource, PVOID pvTarget, BOOL fRead); | 
|---|
| [4165] | 221 |  | 
|---|
|  | 222 | /* Helper function */ | 
|---|
|  | 223 | USHORT APIENTRY  libHelperGetCS(void); | 
|---|
|  | 224 |  | 
|---|
|  | 225 |  | 
|---|
|  | 226 | #endif | 
|---|
|  | 227 |  | 
|---|
|  | 228 | #endif | 
|---|