Changeset 3834 for branches/GRACE/src/win32k/dev16/d16init.c
- Timestamp:
- Jul 17, 2000, 12:43:41 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GRACE/src/win32k/dev16/d16init.c
r2898 r3834 1 /* $Id: d16init.c,v 1.6 2000-02-25 18:15:02bird Exp $1 /* $Id: d16init.c,v 1.6.4.1 2000-07-16 22:43:21 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 … … 39 39 #include "dev1632.h" 40 40 #include "dev16.h" 41 #include "vprntf16.h" 42 #include "log.h" 43 #include "options.h" 41 44 42 45 /** … … 51 54 USHORT NEAR dev0Init(PRPINITIN pRpIn, PRPINITOUT pRpOut) 52 55 { 56 APIRET rc; 53 57 Device_Help = pRpIn->DevHlpEP; 58 59 /* 60 * Does this work at Ring-3 (inittime)? 61 * If this work we could be saved from throuble! 62 */ 63 rc = initGetDosTableData(); 64 if (rc != NO_ERROR) 65 printf16("win32k - elf$: initGetDosTableData failed with rc=%d\n", rc); 54 66 55 67 pRpOut->BPBArray = NULL; … … 80 92 NPSZ npszErrMsg = NULL; 81 93 94 /* 95 * Probe kernel data. 96 */ 82 97 rc = ProbeKernel(pRpIn); 83 98 if (rc == NO_ERROR) 84 99 { 100 /* 101 * Open and send a Ring-0 init packet to elf$. 102 * If this succeeds win32k$ init succeeds. 103 */ 85 104 rc = DosOpen("\\dev\\elf$", &hDev0, &usAction, 0UL, FILE_NORMAL, 86 105 OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, … … 93 112 if (rc == NO_ERROR) 94 113 { 95 if (data.Status != STATUS_DONE) 96 npszErrMsg = "Ring-0 initiation failed\n\r"; 114 if ((rc = data.Status) == STATUS_DONE) 115 { 116 if (!options.fQuiet) 117 printf16("Win32k.sys succesfully initiated!\n"); 118 pRpOut->Status = pRpOut->rph.Status = data.Status; 119 } 97 120 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 } 121 npszErrMsg = "Ring-0 initiation failed. rc=%d\n"; 104 122 } 105 123 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 124 npszErrMsg = "Ring-0 init: DosDevIOCtl failed. rc=%d\n"; 120 125 DosClose(hDev0); 121 126 } 122 127 else 123 npszErrMsg = " DosOpen failed.\n\r";128 npszErrMsg = "Ring-0 init: DosOpen failed. rc=%d\n"; 124 129 } 125 130 else 126 npszErrMsg = "ProbeKernel failed.\n\r"; 127 pRpOut->BPBArray = NULL; 131 npszErrMsg = ""; /* ProbeKrnl do its own complaining, but we need something here to indicate failure. */ 132 133 /* 134 * Fill return data. 135 */ 128 136 pRpOut->CodeEnd = (USHORT)&CODE16END; 129 137 pRpOut->DataEnd = (USHORT)&DATA16END; 138 pRpOut->BPBArray= NULL; 130 139 pRpOut->Unit = 0; 131 140 141 /* 142 * Any errors?, if so complain! 143 */ 132 144 if (npszErrMsg) 133 145 { 134 DosPutMessage(1, strlen(npszErrMsg) + 1, npszErrMsg); 135 return pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; 136 } 137 146 printf16(npszErrMsg, rc); 147 return pRpOut->Status = pRpOut->rph.Status = STATUS_DONE | STERR | ERROR_I24_QUIET_INIT_FAIL; 148 } 149 150 /* successful return */ 138 151 return pRpOut->rph.Status; 139 152 } … … 142 155 143 156 /** 144 * R0 16-bit initiation function.157 * R0 16-bit initiation. 145 158 * This gets TKSSBase, thunks parameters and calls R0 32-bit initiation function. 146 159 * @returns Status word. … … 162 175 ULONG ulLinData; 163 176 177 /* 178 * Thunk the request packet and lock userdata. 179 */ 164 180 if (!DevHelp_VirtToLin(SELECTOROF(pRp->ParmPacket), OFFSETOF(pRp->ParmPacket), &ulLinParm) 165 181 && … … 175 191 (LIN)~0UL, SSToDS_16(&hLockData[0]), &cPages) 176 192 ) 177 { /* data and param is locked (do we need to lock the request packet too ?). */ 178 /* create new 32-bit packet */ 193 { 194 /* 195 * -data and param is locked (do we need to lock the request packet too ?).- 196 * Create new 32-bit init packet - Parameter pointer is thunked. 197 */ 179 198 RP32INIT rp32init; 180 199 … … 191 210 ((PD16R0INITDATA)pRp->DataPacket)->Status = usRc; 192 211 193 /* finished - unlock data and parm */ 212 /* 213 * finished - unlock data and parm 214 */ 194 215 DevHelp_VMUnLock((LIN)SSToDS_16(&hLockParm[0])); 195 216 DevHelp_VMUnLock((LIN)SSToDS_16(&hLockData[0])); … … 204 225 usRc |= ERROR_I24_GEN_FAILURE; 205 226 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 227 return usRc; 224 228 } … … 235 239 * After R0Init16 is called TKSSBase16 _is_ set. 236 240 * IMPORTANT! This function must _not_ be called after the initiation of the second device driver!!! 241 * (Since this is init code not present after init...) 237 242 */ 238 243 USHORT NEAR initGetDosTableData(void)
Note:
See TracChangeset
for help on using the changeset viewer.