Changeset 9511 for trunk/src


Ignore:
Timestamp:
Dec 16, 2002, 2:53:55 AM (23 years ago)
Author:
bird
Message:

devErrors.c

Location:
trunk/src/win32k/kKrnlLib/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/win32k/kKrnlLib/src/Dev16.mak

    r9124 r9511  
    1 # $Id: Dev16.mak,v 1.9 2002-08-24 22:07:40 bird Exp $
     1# $Id: Dev16.mak,v 1.10 2002-12-16 01:52:23 bird Exp $
    22
    33#
     
    3535$(PATH_TARGET)\d16Init.$(EXT_OBJ)\
    3636$(PATH_TARGET)\d16Globl.$(EXT_OBJ)\
    37 $(PATH_TARGET)\d16crt.$(EXT_OBJ)\
     37$(PATH_TARGET)\devErrors.$(EXT_OBJ)\
     38# $(PATH_TARGET)\d16crt.$(EXT_OBJ)\
    3839$(PATH_TARGET)\d16vprintf.$(EXT_OBJ)\
    39 $(PATH_TARGET)\d16ProbeKrnl.$(EXT_OBJ)\
     40# $(PATH_TARGET)\d16ProbeKrnl.$(EXT_OBJ)\
    4041$(PATH_TARGET)\krnlImportTable.$(EXT_OBJ)\
    4142
  • trunk/src/win32k/kKrnlLib/src/d16Init.c

    r8140 r9511  
    1 /* $Id: d16Init.c,v 1.2 2002-03-31 19:01:13 bird Exp $
     1/* $Id: d16Init.c,v 1.3 2002-12-16 01:53:25 bird Exp $
    22 *
    33 * d16init - init routines for both drivers.
    44 *
    5  * IMPORTANT! Code and data defined here will be discarded after init is
    6  *            completed. CodeEnd and DataEnd should not be set here.?
    7  *
    8  * Copyright (c) 1999-2001 knut st. osmundsen (kosmunds@csc.com)
    9  *
    10  * Project Odin Software License can be found in LICENSE.TXT
    11  *
    12  */
     5 * Copyright (c) 1999-2002 knut st. osmundsen <bird@anduin.net>
     6 *
     7 *
     8 * This file is part of kKrnlLib.
     9 *
     10 * kKrnlLib is free software; you can redistribute it and/or modify
     11 * it under the terms of the GNU General Public License as published by
     12 * the Free Software Foundation; either version 2 of the License, or
     13 * (at your option) any later version.
     14 *
     15 * kKrnlLib is distributed in the hope that it will be useful,
     16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     18 * GNU General Public License for more details.
     19 *
     20 * You should have received a copy of the GNU General Public License
     21 * along with kKrnlLib; if not, write to the Free Software
     22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
     23 *
     24 */
     25
    1326
    1427/*******************************************************************************
     
    3649#include <memory.h>
    3750
    38 #include "devSegDf.h"
    39 #undef  DATA16_INIT
    40 #define DATA16_INIT
    41 #undef  CODE16_INIT
    42 #define CODE16_INIT
    4351#include "kKLInitHlp.h"
    44 #include "probkrnl.h"
     52#include "devErrors.h"
    4553#include "dev1632.h"
    4654#include "dev16.h"
     
    4856#include "kKLlog.h"
    4957#include "options.h"
    50 #include "ProbKrnlErrors.h"
     58
     59
     60
     61/*******************************************************************************
     62*   Internal Functions                                                         *
     63*******************************************************************************/
     64int             DoDevIOCtl(KKLR0INITPARAM  *pParam, KKLR0INITDATA *pData);
     65
     66
     67/**
     68 * Does the dev ioctl call to the helper driver for calling
     69 * a 32-bit Ring-0 worker.
     70 * @returns error code from DosOpen or DosDevIOCtl.
     71 * @param   pParam  Pointer to parameter buffer.
     72 * @param   pData   Pointer to data buffer.
     73 * @author  knut st. osmundsen (kosmunds@csc.com)
     74 */
     75int             DoDevIOCtl(KKLR0INITPARAM  *pParam, KKLR0INITDATA *pData)
     76{
     77    APIRET          rc;
     78    HFILE           hDev0 = 0;
     79    USHORT          usAction = 0;
     80
     81    /* Open the kKrnlHlp device driver. */
     82    rc = DosOpen(KKL_DEVICE_NAME, &hDev0, &usAction, 0UL, FILE_NORMAL,
     83                 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
     84                 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY,
     85                 0UL);
     86    if (rc == NO_ERROR)
     87    {
     88        pData->ulRc = 0;
     89        rc = DosDevIOCtl(pData, pParam, KKL_IOCTL_RING0INIT, KKL_IOCTL_CAT, hDev0);
     90        DosClose(hDev0);
     91        if (rc != NO_ERROR)
     92        {
     93            dprintf(("DosDevIOCtl failed with rc=%d\n", rc));
     94            rc = ERROR_D16_IOCTL_FAILED;
     95        }
     96    }
     97    else
     98    {
     99        dprintf(("DosOpen Failed with rc=%d\n", rc));
     100        rc = ERROR_D16_OPEN_DEV_FAILED;
     101    }
     102
     103    return rc;
     104}
     105
    51106
    52107
     
    74129
    75130    pRpOut->BPBArray = NULL;
    76     pRpOut->CodeEnd = (USHORT)&CODE16_INITSTART;
    77     pRpOut->DataEnd = (USHORT)&DATA16_INITSTART;
     131    pRpOut->CodeEnd = (USHORT)&CODE16END;
     132    pRpOut->DataEnd = (USHORT)&DATA16_ENDEND;
    78133    pRpOut->Unit     = 0;
    79134    pRpOut->rph.Status = STATUS_DONE;
     
    96151    KKLR0INITPARAM  param;
    97152    KKLR0INITDATA   data = {0UL};
    98     HFILE           hDev0 = 0;
    99     USHORT          usAction = 0;
    100 
    101 
    102     /*
    103      * Probe kernel data.
    104      */
    105     rc = ProbeKernel(pRpIn);
    106     if (rc == NO_ERROR)
    107     {
    108         /*
    109          * Create new 32-bit init packet - Parameter pointer is thunked.
    110          */
    111         RP32INIT        rp32init;
    112         RP32INIT FAR *  fprp32init = &rp32init;
    113 
    114         _fmemcpy(fprp32init, pRpIn, sizeof(RPINITIN));
    115         if ((   pRpIn->InitArgs == NULL
    116              || !(rc = DevHelp_VirtToLin(SELECTOROF(rp32init.InitArgs), OFFSETOF(rp32init.InitArgs), (PLIN)&rp32init.InitArgs))
    117              )
    118             &&  !(rc = DevHelp_VirtToLin(SELECTOROF(fprp32init), OFFSETOF(fprp32init), (PLIN)&param.ulParam))
    119            )
    120         {   /* call 32-bit init routine and set 32 bit rc. */
    121             param.pfn = GetR0InitPtr();
    122             rc = DoDevIOCtl(&param, &data);
    123             if (rc == NO_ERROR)
    124                 rc = (USHORT)data.ulRc;
    125         }
    126         else
    127             rc = ERROR_D16_THUNKING_FAILED;
    128     }
     153    RP32INIT        rp32init;
     154    RP32INIT FAR *  fprp32init = &rp32init;
     155
     156    /*
     157     * Create new 32-bit init packet - Parameter pointer is thunked.
     158     */
     159    _fmemcpy(fprp32init, pRpIn, sizeof(RPINITIN));
     160    if ((   pRpIn->InitArgs == NULL
     161         || !(rc = DevHelp_VirtToLin(SELECTOROF(rp32init.InitArgs), OFFSETOF(rp32init.InitArgs), (PLIN)&rp32init.InitArgs))
     162         )
     163        &&  !(rc = DevHelp_VirtToLin(SELECTOROF(fprp32init), OFFSETOF(fprp32init), (PLIN)&param.ulParam))
     164       )
     165    {   /* call 32-bit init routine and set 32 bit rc. */
     166        param.pfn = GetR0InitPtr();
     167        rc = DoDevIOCtl(&param, &data);
     168        if (rc == NO_ERROR)
     169            rc = (USHORT)data.ulRc;
     170    }
     171    else
     172        rc = ERROR_D16_THUNKING_FAILED;
     173
    129174
    130175    /*
    131176     * Fill return data.
    132177     */
    133     pRpOut->CodeEnd = (USHORT)&CODE16_INITSTART;
    134     pRpOut->DataEnd = (USHORT)&DATA16_INITSTART;
     178    pRpOut->CodeEnd = (USHORT)&CODE16_ENDEND;
     179    pRpOut->DataEnd = (USHORT)&DATA16_ENDEND;
    135180    pRpOut->BPBArray= NULL;
    136181    pRpOut->Unit    = 0;
     
    148193    else
    149194    {
    150         char *psz = GetErrorMsg(rc);
     195        char *psz = devGetErrorMsg(rc);
    151196        printf16("kKrnlLib.sys init failed with rc=0x%x (%d)\n", rc, rc);
    152197        if (psz)
     
    169214/**
    170215 * Gets the data we need from the DosTables.
    171  * This data is TKSSBase16, R0FlatCS16 and R0FlatDS16.
     216 * (pulTKSSBase32, R0FlatCS16 and R0FlatDS16)
     217 *
    172218 * @returns   Same as DevHelp_GetDosVar.
    173219 * @status    completely implemented.
    174220 * @author    knut st. osmundsen (knut.stange.osmundsen@mynd.no)
    175  * @remark    If you are not sure if TKSSBase16 is set or not, call this.
    176  *            After R0Init16 is called TKSSBase16 _is_ set.
    177  *            IMPORTANT! This function must _not_ be called after the initiation of the second device driver!!!
    178  *                       (Since this is init code not present after init...)
    179221 */
    180222USHORT NEAR  initGetDosTableData(void)
     
    184226    PDOSTABLE2 pDT2;
    185227
    186     if (TKSSBase16 != 0)
     228    if (pulTKSSBase32 != 0)
    187229        return NO_ERROR;
    188230    /*
     
    197239    {
    198240        pDT2 = (PDOSTABLE2)((char FAR *)pDT + pDT->cul*4 + 1);
    199         TKSSBase16 = (ULONG)pDT2->pTKSSBase;
     241        pulTKSSBase32 = (ULONG)pDT2->pTKSSBase;
    200242        R0FlatCS16 = (USHORT)pDT2->R0FlatCS;
    201243        R0FlatDS16 = (USHORT)pDT2->R0FlatDS;
  • trunk/src/win32k/kKrnlLib/src/devErrors.c

    r9509 r9511  
    1 /* $Id: devErrors.c,v 1.1 2002-12-16 01:50:51 bird Exp $
     1/* $Id: devErrors.c,v 1.2 2002-12-16 01:53:55 bird Exp $
    22 *
    33 * Error message from rc.
    44 *
    5  * Copyright (c) 2002 knut st. osmundsen <bird@anduin.net>
     5 * Copyright (c) 2000-2002 knut st. osmundsen <bird@anduin.net>
    66 *
    77 *
     
    105105 * @param   sErr  Error code id.
    106106 * @status  completely implemented.
    107  * @author  knut st. osmundsen (kosmunds@csc.com)
    108107 */
    109108const char *devGetErrorMsg(int sErr)
Note: See TracChangeset for help on using the changeset viewer.