Changeset 4164 for trunk/src/win32k/dev16/d16init.c
- Timestamp:
- Sep 2, 2000, 11:08:23 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/dev16/d16init.c
r2898 r4164 1 /* $Id: d16init.c,v 1. 6 2000-02-25 18:15:02bird Exp $1 /* $Id: d16init.c,v 1.7 2000-09-02 21:07:55 bird Exp $ 2 2 * 3 3 * d16init - init routines for both drivers. … … 6 6 * compleated. CodeEnd and DataEnd should not be set here.? 7 7 * 8 * Copyright (c) 1999 knut st. osmundsen8 * Copyright (c) 1999-2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no) 9 9 * 10 10 * Project Odin Software License can be found in LICENSE.TXT … … 36 36 #include <memory.h> 37 37 38 #include "devSegDf.h" 39 #undef DATA16_INIT 40 #define DATA16_INIT 41 #undef CODE16_INIT 42 #define CODE16_INIT 38 43 #include "probkrnl.h" 39 44 #include "dev1632.h" 40 45 #include "dev16.h" 46 #include "vprntf16.h" 47 #include "log.h" 48 #include "options.h" 49 50 41 51 42 52 /** … … 51 61 USHORT NEAR dev0Init(PRPINITIN pRpIn, PRPINITOUT pRpOut) 52 62 { 63 APIRET rc; 53 64 Device_Help = pRpIn->DevHlpEP; 54 65 66 /* 67 * Does this work at Ring-3 (inittime)? 68 * If this work we could be saved from throuble! 69 */ 70 rc = initGetDosTableData(); 71 if (rc != NO_ERROR) 72 printf16("win32k - elf$: initGetDosTableData failed with rc=%d\n", rc); 73 55 74 pRpOut->BPBArray = NULL; 56 pRpOut->CodeEnd = (USHORT)&CODE16END;57 pRpOut->DataEnd = (USHORT)&DATA16END;75 pRpOut->CodeEnd = (USHORT)&CODE16_INITSTART; 76 pRpOut->DataEnd = (USHORT)&DATA16_INITSTART; 58 77 pRpOut->Unit = 0; 59 78 pRpOut->rph.Status = STATUS_DONE; … … 80 99 NPSZ npszErrMsg = NULL; 81 100 101 /* 102 * Probe kernel data. 103 */ 82 104 rc = ProbeKernel(pRpIn); 83 105 if (rc == NO_ERROR) 84 106 { 107 /* 108 * Open and send a Ring-0 init packet to elf$. 109 * If this succeeds win32k$ init succeeds. 110 */ 85 111 rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL, 86 112 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, … … 93 119 if (rc == NO_ERROR) 94 120 { 95 if (data.Status != STATUS_DONE) 96 npszErrMsg = "Ring-0 initiation failed\n\r"; 121 if ((rc = data.Status) == STATUS_DONE) 122 { 123 if (!options.fQuiet) 124 printf16("Win32k.sys succesfully initiated!\n"); 125 pRpOut->Status = pRpOut->rph.Status = data.Status; 126 } 97 127 else 98 { 99 /* FIXME quiet test! */ 100 register NPSZ npsz = "Win32k.sys succesfully initiated!\n\r"; 101 DosPutMessage(1, strlen(npsz)+1, npsz); 102 pRpOut->Status = data.Status; 103 } 128 npszErrMsg = "Ring-0 initiation failed. rc=%d\n"; 104 129 } 105 130 else 106 { 107 APIRET rc2 = rc; 108 NPSZ npsz; 109 /*0123456789012345678901234567890 1*/ 110 npszErrMsg = "DosDevIOCtl failed. rc= \n\r"; 111 112 npsz = &npszErrMsg[29]; 113 do 114 { 115 *npsz-- = (char)((rc2 % 10) + '0'); 116 rc2 = rc2/10; 117 } while (rc2 > 0); 118 } 119 131 npszErrMsg = "Ring-0 init: DosDevIOCtl failed. rc=%d\n"; 120 132 DosClose(hDev0); 121 133 } 122 134 else 123 npszErrMsg = " DosOpen failed.\n\r";135 npszErrMsg = "Ring-0 init: DosOpen failed. rc=%d\n"; 124 136 } 125 137 else 126 npszErrMsg = "ProbeKernel failed.\n\r"; 127 pRpOut->BPBArray = NULL; 128 pRpOut->CodeEnd = (USHORT)&CODE16END; 129 pRpOut->DataEnd = (USHORT)&DATA16END; 138 npszErrMsg = ""; /* ProbeKrnl do its own complaining, but we need something here to indicate failure. */ 139 140 /* 141 * Fill return data. 142 */ 143 pRpOut->CodeEnd = (USHORT)&CODE16_INITSTART; 144 pRpOut->DataEnd = (USHORT)&DATA16_INITSTART; 145 pRpOut->BPBArray= NULL; 130 146 pRpOut->Unit = 0; 131 147 148 /* 149 * Any errors?, if so complain! 150 */ 132 151 if (npszErrMsg) 133 152 { 134 DosPutMessage(1, strlen(npszErrMsg) + 1, npszErrMsg); 135 return pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; 136 } 137 153 printf16(npszErrMsg, rc); 154 pRpOut->Status = pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; 155 } 156 157 /* Init is completed. */ 158 fInitTime = FALSE; 159 160 /* successful return */ 138 161 return pRpOut->rph.Status; 139 162 } … … 142 165 143 166 /** 144 * R0 16-bit initiation function.167 * R0 16-bit initiation. 145 168 * This gets TKSSBase, thunks parameters and calls R0 32-bit initiation function. 146 169 * @returns Status word. 147 170 * @param pRp Generic IO Control request packet. 148 171 */ 149 USHORT NEAR R0Init16(PRP_GENIOCTL pRp)172 USHORT NEAR R0Init16(PRP_GENIOCTL pRp) 150 173 { 151 174 USHORT usRc = STATUS_DONE; … … 162 185 ULONG ulLinData; 163 186 187 /* 188 * Thunk the request packet and lock userdata. 189 */ 164 190 if (!DevHelp_VirtToLin(SELECTOROF(pRp->ParmPacket), OFFSETOF(pRp->ParmPacket), &ulLinParm) 165 191 && … … 175 201 (LIN)~0UL, SSToDS_16(&hLockData[0]), &cPages) 176 202 ) 177 { /* data and param is locked (do we need to lock the request packet too ?). */ 178 /* create new 32-bit packet */ 203 { 204 /* 205 * -data and param is locked (do we need to lock the request packet too ?).- 206 * Create new 32-bit init packet - Parameter pointer is thunked. 207 */ 179 208 RP32INIT rp32init; 180 209 … … 191 220 ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc; 192 221 193 /* finished - unlock data and parm */ 222 /* 223 * finished - unlock data and parm 224 */ 194 225 DevHelp_VMUnLock((LIN)SSToDS_16(&hLockParm[0])); 195 226 DevHelp_VMUnLock((LIN)SSToDS_16(&hLockData[0])); … … 204 235 usRc |= ERROR_I24_GEN_FAILURE; 205 236 206 207 #if 0208 rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_WRITE | VMDHL_VERIFY,209 &DATA32START,210 (ULONG)(&end) - (ULONG)&DATA32START),211 (void*)-1,212 &lock[0],213 &cPages);214 215 rc = DevHelp_VMLock(VMDHL_LONG | VMDHL_VERIFY,216 &CODE32START,217 (ULONG)(&CODE32END) - (ULONG)&CODE32START),218 (void*)-1,219 &lock[0],220 &cPages);221 #endif222 223 237 return usRc; 224 238 } … … 235 249 * After R0Init16 is called TKSSBase16 _is_ set. 236 250 * IMPORTANT! This function must _not_ be called after the initiation of the second device driver!!! 237 */ 238 USHORT NEAR initGetDosTableData(void) 251 * (Since this is init code not present after init...) 252 */ 253 USHORT NEAR initGetDosTableData(void) 239 254 { 240 255 APIRET rc; … … 244 259 if (TKSSBase16 != 0) 245 260 return NO_ERROR; 261 /* 262 _asm { 263 int 3; 264 } 265 */ 246 266 247 267 /* First we're to get the DosTable2 stuff. */
Note:
See TracChangeset
for help on using the changeset viewer.