- Timestamp:
- Dec 16, 2002, 2:53:55 AM (23 years ago)
- 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:40bird Exp $1 # $Id: Dev16.mak,v 1.10 2002-12-16 01:52:23 bird Exp $ 2 2 3 3 # … … 35 35 $(PATH_TARGET)\d16Init.$(EXT_OBJ)\ 36 36 $(PATH_TARGET)\d16Globl.$(EXT_OBJ)\ 37 $(PATH_TARGET)\d16crt.$(EXT_OBJ)\ 37 $(PATH_TARGET)\devErrors.$(EXT_OBJ)\ 38 # $(PATH_TARGET)\d16crt.$(EXT_OBJ)\ 38 39 $(PATH_TARGET)\d16vprintf.$(EXT_OBJ)\ 39 $(PATH_TARGET)\d16ProbeKrnl.$(EXT_OBJ)\40 # $(PATH_TARGET)\d16ProbeKrnl.$(EXT_OBJ)\ 40 41 $(PATH_TARGET)\krnlImportTable.$(EXT_OBJ)\ 41 42 -
trunk/src/win32k/kKrnlLib/src/d16Init.c
r8140 r9511 1 /* $Id: d16Init.c,v 1. 2 2002-03-31 19:01:13bird Exp $1 /* $Id: d16Init.c,v 1.3 2002-12-16 01:53:25 bird Exp $ 2 2 * 3 3 * d16init - init routines for both drivers. 4 4 * 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 13 26 14 27 /******************************************************************************* … … 36 49 #include <memory.h> 37 50 38 #include "devSegDf.h"39 #undef DATA16_INIT40 #define DATA16_INIT41 #undef CODE16_INIT42 #define CODE16_INIT43 51 #include "kKLInitHlp.h" 44 #include " probkrnl.h"52 #include "devErrors.h" 45 53 #include "dev1632.h" 46 54 #include "dev16.h" … … 48 56 #include "kKLlog.h" 49 57 #include "options.h" 50 #include "ProbKrnlErrors.h" 58 59 60 61 /******************************************************************************* 62 * Internal Functions * 63 *******************************************************************************/ 64 int 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 */ 75 int 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 51 106 52 107 … … 74 129 75 130 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; 78 133 pRpOut->Unit = 0; 79 134 pRpOut->rph.Status = STATUS_DONE; … … 96 151 KKLR0INITPARAM param; 97 152 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)¶m.ulParam)) 119 ) 120 { /* call 32-bit init routine and set 32 bit rc. */ 121 param.pfn = GetR0InitPtr(); 122 rc = DoDevIOCtl(¶m, &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)¶m.ulParam)) 164 ) 165 { /* call 32-bit init routine and set 32 bit rc. */ 166 param.pfn = GetR0InitPtr(); 167 rc = DoDevIOCtl(¶m, &data); 168 if (rc == NO_ERROR) 169 rc = (USHORT)data.ulRc; 170 } 171 else 172 rc = ERROR_D16_THUNKING_FAILED; 173 129 174 130 175 /* 131 176 * Fill return data. 132 177 */ 133 pRpOut->CodeEnd = (USHORT)&CODE16_ INITSTART;134 pRpOut->DataEnd = (USHORT)&DATA16_ INITSTART;178 pRpOut->CodeEnd = (USHORT)&CODE16_ENDEND; 179 pRpOut->DataEnd = (USHORT)&DATA16_ENDEND; 135 180 pRpOut->BPBArray= NULL; 136 181 pRpOut->Unit = 0; … … 148 193 else 149 194 { 150 char *psz = GetErrorMsg(rc);195 char *psz = devGetErrorMsg(rc); 151 196 printf16("kKrnlLib.sys init failed with rc=0x%x (%d)\n", rc, rc); 152 197 if (psz) … … 169 214 /** 170 215 * Gets the data we need from the DosTables. 171 * This data is TKSSBase16, R0FlatCS16 and R0FlatDS16. 216 * (pulTKSSBase32, R0FlatCS16 and R0FlatDS16) 217 * 172 218 * @returns Same as DevHelp_GetDosVar. 173 219 * @status completely implemented. 174 220 * @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...)179 221 */ 180 222 USHORT NEAR initGetDosTableData(void) … … 184 226 PDOSTABLE2 pDT2; 185 227 186 if ( TKSSBase16!= 0)228 if (pulTKSSBase32 != 0) 187 229 return NO_ERROR; 188 230 /* … … 197 239 { 198 240 pDT2 = (PDOSTABLE2)((char FAR *)pDT + pDT->cul*4 + 1); 199 TKSSBase16= (ULONG)pDT2->pTKSSBase;241 pulTKSSBase32 = (ULONG)pDT2->pTKSSBase; 200 242 R0FlatCS16 = (USHORT)pDT2->R0FlatCS; 201 243 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:51bird Exp $1 /* $Id: devErrors.c,v 1.2 2002-12-16 01:53:55 bird Exp $ 2 2 * 3 3 * Error message from rc. 4 4 * 5 * Copyright (c) 200 2 knut st. osmundsen <bird@anduin.net>5 * Copyright (c) 2000-2002 knut st. osmundsen <bird@anduin.net> 6 6 * 7 7 * … … 105 105 * @param sErr Error code id. 106 106 * @status completely implemented. 107 * @author knut st. osmundsen (kosmunds@csc.com)108 107 */ 109 108 const char *devGetErrorMsg(int sErr)
Note:
See TracChangeset
for help on using the changeset viewer.