| 1 | /* $Id: d32Win32kIOCtl.c,v 1.7 2001-02-21 07:44:57 bird Exp $
 | 
|---|
| 2 |  *
 | 
|---|
| 3 |  * Win32k driver IOCtl handler function.
 | 
|---|
| 4 |  *
 | 
|---|
| 5 |  * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
 | 
|---|
| 6 |  *
 | 
|---|
| 7 |  * Project Odin Software License can be found in LICENSE.TXT
 | 
|---|
| 8 |  *
 | 
|---|
| 9 |  */
 | 
|---|
| 10 | /*******************************************************************************
 | 
|---|
| 11 | *   Defined Constants And Macros                                               *
 | 
|---|
| 12 | *******************************************************************************/
 | 
|---|
| 13 | #define MAX_PARAMSIZE   64              /* Maximum size of a parameter structure. */
 | 
|---|
| 14 | 
 | 
|---|
| 15 | #define INCL_DOSERRORS
 | 
|---|
| 16 | #define INCL_NOPMAPI
 | 
|---|
| 17 | #define INCL_OS2KRNL_TK
 | 
|---|
| 18 | 
 | 
|---|
| 19 | #define NO_WIN32K_LIB_FUNCTIONS
 | 
|---|
| 20 | 
 | 
|---|
| 21 | 
 | 
|---|
| 22 | /*******************************************************************************
 | 
|---|
| 23 | *   Header Files                                                               *
 | 
|---|
| 24 | *******************************************************************************/
 | 
|---|
| 25 | #include <os2.h>
 | 
|---|
| 26 | 
 | 
|---|
| 27 | #include "devSegDf.h"
 | 
|---|
| 28 | #include "dev1632.h"
 | 
|---|
| 29 | #include "dev32.h"
 | 
|---|
| 30 | #include "OS2Krnl.h"
 | 
|---|
| 31 | #include "Win32k.h"
 | 
|---|
| 32 | #include "k32.h"
 | 
|---|
| 33 | #include "log.h"
 | 
|---|
| 34 | #include "asmutils.h"
 | 
|---|
| 35 | 
 | 
|---|
| 36 | 
 | 
|---|
| 37 | /*******************************************************************************
 | 
|---|
| 38 | *   Internal Functions                                                         *
 | 
|---|
| 39 | *******************************************************************************/
 | 
|---|
| 40 | APIRET _Optlink Win32kAPIRouter(ULONG ulFunction, PVOID pvParam);  /* implemented in d32CallGate.asm. */
 | 
|---|
| 41 | 
 | 
|---|
| 42 | 
 | 
|---|
| 43 | /**
 | 
|---|
| 44 |  * IOCtl handler for the Win32k part of the driver.
 | 
|---|
| 45 |  * @returns   Gen IOCtl return code.
 | 
|---|
| 46 |  * @param     pRpIOCtl  Pointer to 32-bit request packet. (not to the original packet)
 | 
|---|
| 47 |  * @author    knut st. osmundsen (knut.stange.osmundsen@mynd.no)
 | 
|---|
| 48 |  */
 | 
|---|
| 49 | USHORT _loadds _Far32 _Pascal Win32kIOCtl(PRP32GENIOCTL pRpIOCtl)
 | 
|---|
| 50 | {
 | 
|---|
| 51 |     /* validate parameter pointer */
 | 
|---|
| 52 |     if (pRpIOCtl == NULL || pRpIOCtl->ParmPacket == NULL
 | 
|---|
| 53 |         || pRpIOCtl->Function == 0 || pRpIOCtl->Function > K32_LASTIOCTLFUNCTION)
 | 
|---|
| 54 |         return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
 | 
|---|
| 55 | 
 | 
|---|
| 56 |     switch (pRpIOCtl->Category)
 | 
|---|
| 57 |     {
 | 
|---|
| 58 |         case IOCTL_W32K_K32:
 | 
|---|
| 59 |             {
 | 
|---|
| 60 |             APIRET rc = Win32kAPIRouter(pRpIOCtl->Function, pRpIOCtl->ParmPacket);
 | 
|---|
| 61 |             if (    rc != 0xdeadbeefUL
 | 
|---|
| 62 |                 &&  TKSuULongNF(&((PK32HDR)pRpIOCtl->ParmPacket)->rc, SSToDS(&rc)) == NO_ERROR)
 | 
|---|
| 63 |                 return STATUS_DONE;     /* Successfull return */
 | 
|---|
| 64 |             break;
 | 
|---|
| 65 |             }
 | 
|---|
| 66 |     }
 | 
|---|
| 67 | 
 | 
|---|
| 68 |     return STATUS_DONE | STERR | ERROR_I24_INVALID_PARAMETER;
 | 
|---|
| 69 | }
 | 
|---|