Changeset 1678 for trunk/src/win32k/dev32/d32init.c
- Timestamp:
- Nov 10, 1999, 2:45:38 AM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/win32k/dev32/d32init.c
r1535 r1678 1 /* $Id: d32init.c,v 1. 3 1999-10-31 23:57:02bird Exp $1 /* $Id: d32init.c,v 1.4 1999-11-10 01:45:30 bird Exp $ 2 2 * 3 3 * d32init.c - 32-bits init routines. 4 4 * 5 5 * Copyright (c) 1998-1999 knut st. osmundsen 6 * 7 * Project Odin Software License can be found in LICENSE.TXT 6 8 * 7 9 */ … … 40 42 * Internal Functions * 41 43 *******************************************************************************/ 42 static int interpretFunctionProlog(char *p); 43 static int procInit(void); 44 static ULONG readnum(const char *pszNum); 45 static int interpretFunctionProlog(char *p); 46 static int procInit(void); 44 47 45 48 … … 70 73 USHORT _loadds _Far32 _Pascal R0Init32(RP32INIT *pRpInit) 71 74 { 72 char *pszTmp2; 73 char *pszTmp; 75 char *pszTmp2; 76 char *pszTmp; 77 ULONG ul; 74 78 75 79 pulTKSSBase32 = (PULONG)_TKSSBase16; … … 114 118 break; 115 119 120 case 'h': 121 case 'H': /* Heap options */ 122 pszTmp2 = strpbrk(pszTmp, ":=/- "); 123 if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 124 && (*pszTmp2 == ':' || *pszTmp2 == '=')) 125 { 126 ul = readnum(pszTmp2 + 1); 127 if (ul > 0x1000UL && ul < 0x2000000UL) /* 4KB < ul < 32MB */ 128 { 129 if (strnicmp(pszTmp, "heapm", 5) == 0) 130 options.cbHeapMax = ul; 131 else 132 options.cbHeap = ul; 133 } 134 } 135 break; 136 116 137 case 'l': 117 138 case 'L': /* -L[..]<:|=| >[<Y..|E..| > | <N..|D..>] */ … … 133 154 case 'P': /* PE */ 134 155 pszTmp2 = strpbrk(pszTmp, ":=/- "); 135 if (pszTmp2 != NULL && (*pszTmp == ':' || *pszTmp == '=')) 156 if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 157 && (*pszTmp2 == ':' || *pszTmp2 == '=')) 136 158 { 137 159 pszTmp++; … … 156 178 break; 157 179 180 case 'r': 181 case 'R': /* ResHeap options */ 182 pszTmp2 = strpbrk(pszTmp, ":=/- "); 183 if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 184 && (*pszTmp2 == ':' || *pszTmp2 == '=')) 185 { 186 ul = readnum(pszTmp2 + 1); 187 if (ul > 0x1000UL && ul < 0x700000UL) /* 4KB < ul < 7MB */ 188 { 189 if (strnicmp(pszTmp, "resheapm", 8) == 0) 190 options.cbHeapMaxResident = ul; 191 else 192 options.cbHeapResident = ul; 193 } 194 } 195 break; 196 158 197 case 's': 159 case 'S': /* SMP kernel */ 160 options.fKernel = KF_SMP; 198 case 'S': /* Sym:<filename> or Script:<Yes|No> or Smp */ 199 /* SMP kernel */ 200 if (pszTmp[1] == 'm' || pszTmp[1] == 'M') 201 options.fKernel = KF_SMP; 202 else 203 { 204 if (pszTmp[1] == 'c' || pszTmp[1] == 'C') 205 { 206 pszTmp2 = strpbrk(pszTmp, ":=/- "); 207 options.fScript = pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 208 && (*pszTmp2 == ':' || *pszTmp2 == '=') 209 && (pszTmp2[1] == 'Y' || pszTmp2[1] == 'y'); 210 } 211 } 212 break; 213 214 case 'u': 215 case 'U': /* UNI kernel */ 216 options.fKernel = KF_UNI; 161 217 break; 162 218 … … 166 222 break; 167 223 168 case 'u': 169 case 'U': /* UNI kernel */ 170 options.fKernel = KF_SMP; 171 break; 224 case 'w': 225 case 'W': 226 if (pszTmp[1] >= '0' && pszTmp[1] <= '4') 227 options.ulInfoLevel = pszTmp[1] - '0'; 228 else 229 { 230 pszTmp2 = strpbrk(pszTmp, ":=/- "); 231 if (pszTmp2 != NULL && (int)(pszTmp2-pszTmp) < cch-1 232 && (*pszTmp2 == ':' || *pszTmp2 == '=') 233 && pszTmp2[1] >= '0' && pszTmp2[1] <= '4' 234 ) 235 options.ulInfoLevel = pszTmp2[1] - '0'; 236 } 237 break; 238 172 239 } 173 240 pszTmp = strpbrk(pszTmp, "-/"); 174 241 } 242 243 /* heap min/max corrections */ 244 if (options.cbHeap > options.cbHeapMax) 245 options.cbHeapMax = options.cbHeap; 246 if (options.cbHeapResident > options.cbHeapMaxResident) 247 options.cbHeapMaxResident = options.cbHeapResident; 175 248 176 249 /* Transfer version and build number from 16-bit probkrnl.c */ … … 179 252 options.usVerMinor = _usVerMinor; 180 253 181 /* log option summary */254 /* log option summary - FIXME */ 182 255 kprintf(("Options - Summary\n")); 183 256 kprintf(("\tKernel: ver%d.%d build %d type %s\n", … … 217 290 218 291 return STATUS_DONE; 292 } 293 294 295 /** 296 * Reads a number (unsigned long integer) for a string. 297 * @returns number read, ~0UL on error / no number read. 298 * @param pszNum Pointer to the string containing the number. 299 * @status competely implemented. 300 * @author knut st. osmundsen 301 */ 302 static ULONG readnum(const char *pszNum) 303 { 304 ULONG ulRet = 0; 305 ULONG ulBase = 10; 306 int i = 0; 307 308 if (*pszNum == '0') 309 if (pszNum[1] == 'x' || pszNum[1] == 'X') 310 { 311 ulBase == 16; 312 pszNum += 2; 313 } 314 else 315 { 316 ulBase == 8; 317 i = 1; 318 } 319 320 /* read digits */ 321 while (ulBase == 16 ? (pszNum[i] >= '0' && pszNum[i] <= '9') || (pszNum[i] >= 'a' && pszNum[i] <= 'f') || (pszNum[i] >= 'A' && pszNum[i] <= 'F') 322 : (pszNum[i] >= '0' && pszNum[i] <= (ulBase == 10 ? '9' : '7')) 323 ) 324 { 325 ulRet *= ulBase; 326 if (ulBase <= 10) 327 ulRet += pszNum[i] - '0'; 328 else 329 ulRet += pszNum[i] - (pszNum[i] >= 'A' ? 'A' - 10 : (pszNum[i] >= 'a' ? 'a' + 9 : '0')); 330 331 i++; 332 } 333 334 return i > 0 ? ulRet : ~0UL; 219 335 } 220 336
Note:
See TracChangeset
for help on using the changeset viewer.