| 1 | /* $Id: libWin32kQueryOptionsStatus.c,v 1.2 2000-09-02 21:08:12 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * libWin32kQueryOptionsStatus - Queries the options and/or the status of | 
|---|
| 4 | *                               Win32k.sys driver. | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no) | 
|---|
| 7 | * | 
|---|
| 8 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 9 | * | 
|---|
| 10 | */ | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 | /******************************************************************************* | 
|---|
| 14 | *   Header Files                                                               * | 
|---|
| 15 | *******************************************************************************/ | 
|---|
| 16 | #define INCL_DOSERRORS | 
|---|
| 17 | #define INCL_DOSFILEMGR | 
|---|
| 18 | #define INCL_DOSDEVICES | 
|---|
| 19 |  | 
|---|
| 20 |  | 
|---|
| 21 | /******************************************************************************* | 
|---|
| 22 | *   Internal Functions                                                         * | 
|---|
| 23 | *******************************************************************************/ | 
|---|
| 24 | #include <os2.h> | 
|---|
| 25 | #include "win32k.h" | 
|---|
| 26 |  | 
|---|
| 27 |  | 
|---|
| 28 | /******************************************************************************* | 
|---|
| 29 | *   Global Variables                                                           * | 
|---|
| 30 | *******************************************************************************/ | 
|---|
| 31 | extern BOOL     fInited; | 
|---|
| 32 | extern HFILE    hWin32k; | 
|---|
| 33 |  | 
|---|
| 34 |  | 
|---|
| 35 | /** | 
|---|
| 36 | * Gets the options settings and/or the status of win32k.sys. | 
|---|
| 37 | * @returns     OS2 returncode. | 
|---|
| 38 | * @param       pOptions    Pointer to an options struct. (NULL is allowed) | 
|---|
| 39 | *                          (cb have to be set to the size of the structure.) | 
|---|
| 40 | * @param       pStatus     Pointer to a status struct. (NULL is allowed) | 
|---|
| 41 | *                          (cb have to be set to the size of the structure.) | 
|---|
| 42 | * @status      completely implelemented. | 
|---|
| 43 | * @author      knut st. osmundsen (knut.stange.osmundsen@mynd.no) | 
|---|
| 44 | * @remark | 
|---|
| 45 | */ | 
|---|
| 46 | APIRET APIENTRY  libWin32kQueryOptionsStatus(PK32OPTIONS pOptions, PK32STATUS pStatus) | 
|---|
| 47 | { | 
|---|
| 48 | APIRET rc; | 
|---|
| 49 |  | 
|---|
| 50 | /* | 
|---|
| 51 | * Simple validation. | 
|---|
| 52 | */ | 
|---|
| 53 | if ((pOptions != NULL && pOptions->cb != sizeof(K32OPTIONS)) | 
|---|
| 54 | || | 
|---|
| 55 | (pStatus  != NULL && pStatus->cb != sizeof(K32STATUS)) | 
|---|
| 56 | || | 
|---|
| 57 | (pOptions == NULL && pStatus == NULL) | 
|---|
| 58 | ) | 
|---|
| 59 | rc = ERROR_INVALID_PARAMETER; | 
|---|
| 60 |  | 
|---|
| 61 | /* | 
|---|
| 62 | * Check that we're initiated. | 
|---|
| 63 | */ | 
|---|
| 64 | else if (fInited) | 
|---|
| 65 | { | 
|---|
| 66 | /* | 
|---|
| 67 | * Build parameters and call win32k. | 
|---|
| 68 | */ | 
|---|
| 69 | K32QUERYOPTIONSSTATUS   Param; | 
|---|
| 70 | ULONG           cbParam = sizeof(Param); | 
|---|
| 71 | ULONG           cbData = 0UL; | 
|---|
| 72 |  | 
|---|
| 73 | Param.pOptions  = pOptions; | 
|---|
| 74 | Param.pStatus   = pStatus; | 
|---|
| 75 | Param.rc = ERROR_INVALID_PARAMETER; | 
|---|
| 76 |  | 
|---|
| 77 | rc = DosDevIOCtl(hWin32k, | 
|---|
| 78 | IOCTL_W32K_K32, | 
|---|
| 79 | K32_QUERYOPTIONSSTATUS, | 
|---|
| 80 | &Param, sizeof(Param), &cbParam, | 
|---|
| 81 | "", 1, &cbData); | 
|---|
| 82 |  | 
|---|
| 83 | if (rc == NO_ERROR) | 
|---|
| 84 | rc = Param.rc; | 
|---|
| 85 | } | 
|---|
| 86 | else | 
|---|
| 87 | rc = ERROR_INIT_ROUTINE_FAILED; | 
|---|
| 88 |  | 
|---|
| 89 | return rc; | 
|---|
| 90 | } | 
|---|
| 91 |  | 
|---|